37 |
|
|
38 |
package nongnu.cashews.eclipse.composer.parts; |
package nongnu.cashews.eclipse.composer.parts; |
39 |
|
|
40 |
|
|
41 |
import java.beans.PropertyChangeListener; |
import java.beans.PropertyChangeListener; |
42 |
import java.util.List; |
import java.util.List; |
43 |
|
|
46 |
import nongnu.cashews.eclipse.composer.tools.RectangleNodeCellEditorLocator; |
import nongnu.cashews.eclipse.composer.tools.RectangleNodeCellEditorLocator; |
47 |
import nongnu.cashews.eclipse.composer.tools.RectangleNodeDirectEditManager; |
import nongnu.cashews.eclipse.composer.tools.RectangleNodeDirectEditManager; |
48 |
|
|
49 |
|
|
50 |
import org.eclipse.draw2d.IFigure; |
import org.eclipse.draw2d.IFigure; |
51 |
import org.eclipse.draw2d.geometry.Dimension; |
import org.eclipse.draw2d.geometry.Dimension; |
52 |
import org.eclipse.draw2d.geometry.Point; |
import org.eclipse.draw2d.geometry.Point; |
60 |
|
|
61 |
public class RectangleNodePart extends NodePart implements |
public class RectangleNodePart extends NodePart implements |
62 |
PropertyChangeListener, NodeEditPart |
PropertyChangeListener, NodeEditPart |
63 |
{ |
{ |
64 |
|
|
65 |
|
|
66 |
// ------------------------------------------------------------------------ |
// ------------------------------------------------------------------------ |
67 |
// Overridden from AbstractGraphicalEditPart |
// Overridden from AbstractGraphicalEditPart |
97 |
{ |
{ |
98 |
return ((RectangleNode) this.getModel()).getIncomingConnections(); |
return ((RectangleNode) this.getModel()).getIncomingConnections(); |
99 |
} |
} |
100 |
|
|
101 |
// ------------------------------------------------------------------------ |
// ------------------------------------------------------------------------ |
102 |
// Overridden from AbstractEditPart |
// Overridden from AbstractEditPart |
103 |
|
|
105 |
{ |
{ |
106 |
RectangleNode node = (RectangleNode) this.getModel(); |
RectangleNode node = (RectangleNode) this.getModel(); |
107 |
Point loc = node.getLocation(); |
Point loc = node.getLocation(); |
108 |
Dimension size = new Dimension(150, 40); |
Dimension size = new Dimension(400, 10); |
109 |
Rectangle rectangle = new Rectangle(loc, size); |
Rectangle rectangle = new Rectangle(loc, size); |
|
|
|
110 |
((RectangleNodeFigure) this.getFigure()).setName(((RectangleNode) this.getModel()).getName()); |
((RectangleNodeFigure) this.getFigure()).setName(((RectangleNode) this.getModel()).getName()); |
|
|
|
111 |
// tells the parent part (in this case DiagramPart) that this part |
// tells the parent part (in this case DiagramPart) that this part |
112 |
// and its figure are to be constrained to the given rectangle |
// and its figure are to be constrained to the given rectangle |
113 |
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), |
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), |
114 |
rectangle); |
rectangle); |
115 |
// //////============================================================ |
// //////============================================================ |
116 |
|
|
117 |
} |
} |
118 |
|
|
119 |
public void performRequest(Request request) |
public void performRequest(Request request) |
120 |
{ |
{ |
121 |
if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) |
if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) |