001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: package org.netbeans.modules.soa.mapper.basicmapper.canvas.jgo;
021:
022: import java.util.List;
023: import java.awt.dnd.DropTargetDragEvent;
024: import org.netbeans.modules.soa.mapper.basicmapper.BasicViewController;
025: import org.netbeans.modules.soa.mapper.common.basicmapper.canvas.IMapperCanvasView;
026: import org.netbeans.modules.soa.mapper.common.basicmapper.dnd.IDnDHandler;
027: import org.netbeans.modules.soa.mapper.common.gtk.ICanvas;
028: import org.netbeans.modules.soa.mapper.common.gtk.ICanvasController;
029: import org.netbeans.modules.soa.mapper.common.gtk.ICanvasNode;
030:
031: /**
032: * <p>
033: *
034: * Title: </p> AbstractCanvasController <p>
035: *
036: * Description: </p> AbstractCanvasController provides common implemenation of a
037: * mapper canvas controller.<p>
038: *
039: * Copyright: Copyright (c) 2002 </p> <p>
040: *
041: * Company: </p>
042: *
043: * @author Un Seng Leong
044: * @created December 31, 2002
045: * @version 1.0
046: */
047: public abstract class AbstractCanvasController extends
048: BasicViewController implements ICanvasController {
049:
050: /**
051: * Constructor for the AbstractCanvasController object.
052: */
053: public AbstractCanvasController() {
054: }
055:
056: /**
057: * Return the canvas of this controller handles.
058: *
059: * @return the canvas of this controller handles.
060: */
061: public ICanvas getCanvas() {
062: return ((IMapperCanvasView) getView()).getCanvas();
063: }
064:
065: /**
066: * Return the data model this controller handles. This method calls
067: * getView().getViewModel()
068: *
069: * @return the data model, IMapperViewModel, this controller handles.
070: */
071: public Object getDataModel() {
072: return getView().getViewModel();
073: }
074:
075: /**
076: * Set the canvas of this controller handles. This method is not applicable,
077: * it returns immediately.
078: *
079: * @param canvas the canvas
080: */
081: public void setCanvas(ICanvas canvas) {
082: }
083:
084: /**
085: * Set the data model of this controller handles. This method is not
086: * applicable, it returns immediately.
087: *
088: * @param model the model
089: */
090: public void setDataModel(Object model) {
091: }
092:
093: /**
094: * Set the view manager for the canvas controller. This method is not
095: * applicable, it returns immediately.
096: *
097: * @param viewManager the view Manager
098: */
099: public void setViewManager(Object viewManager) {
100: }
101:
102: /**
103: * Return the view manager for the canvas controller. This method is not
104: * applicable, it always returns null.
105: *
106: * @return always null.
107: */
108: public Object getViewManager() {
109: return null;
110: }
111:
112: /**
113: * Set the dnd handler for this view to hanlder dnd operations. Overrides
114: * IBasicViewController.setDnDHandler(IDnDHanlder).
115: *
116: * @param handler the dnd handler for this mapper to hanlder dnd
117: * operations.
118: */
119: public void setDnDHandler(IDnDHandler handler) {
120: super .setDnDHandler(handler);
121: if (getCanvas() instanceof AbstractCanvasView) {
122: ((AbstractCanvasView) getCanvas()).setDnDHandler(handler);
123: }
124: }
125:
126: /**
127: * Handles node name change. This method is not applicable, it returns
128: * immediately.
129: *
130: * @param dataList the list of data changes
131: */
132: public void handleNodeNameChange(List dataList) {
133: }
134:
135: /**
136: * Return true if the canvas updates with the specified action (id) and
137: * specified data successfully, false otherwise. This method is not
138: * applicable, always returns false.
139: *
140: * @param id the id
141: * @param dataList the data that changed
142: * @return always false.
143: */
144: public boolean handleCanvasUpdates(int id, List dataList) {
145: return false;
146: }
147:
148: /**
149: * Handles update links. Not use, always return false.
150: *
151: * @param fromNode - the from canvas node
152: * @param toNode - the to canvas node
153: * @param isComponentNode - signifies if component is a node
154: * @param isWithBinding - signifies if component is with a binding
155: * @return false
156: */
157: public boolean updateLink(ICanvasNode fromNode, ICanvasNode toNode,
158: ICanvasNode mSourceNode, boolean isWithBinding) {
159: return false;
160: }
161:
162: /**
163: * Overrides the dragOver method to drag and drop the selected
164: * icon to the canvas
165: *
166: * @param event - the drag source drop event
167: * @return boolean
168: */
169: public boolean handleDragOver(DropTargetDragEvent event) {
170: return false;
171: }
172: }
|