Author: dazarov
Date: 2008-05-30 09:17:40 -0400 (Fri, 30 May 2008)
New Revision: 8461
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageEditPart.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1189
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageEditPart.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageEditPart.java 2008-05-30
12:21:18 UTC (rev 8460)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageEditPart.java 2008-05-30
13:17:40 UTC (rev 8461)
@@ -7,12 +7,11 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor.edit;
-import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.*;
+import java.util.List;
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.IFigure;
@@ -22,21 +21,25 @@
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
-import org.jboss.tools.common.model.ui.dnd.DnDUtil;
-import org.eclipse.gef.*;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartListener;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.requests.DropRequest;
+import org.eclipse.gef.requests.SelectionRequest;
import org.eclipse.swt.accessibility.AccessibleControlEvent;
import org.eclipse.swt.accessibility.AccessibleEvent;
-
-import org.jboss.tools.common.meta.action.XAction;
-import org.jboss.tools.common.model.XModelException;
-import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
import org.jboss.tools.seam.ui.pages.editor.figures.NodeFigure;
import org.jboss.tools.seam.ui.pages.editor.figures.PageFigure;
-public class PageEditPart extends PagesEditPart implements PropertyChangeListener,
EditPartListener, Adapter {
+public class PageEditPart extends PagesEditPart implements
+ PropertyChangeListener, EditPartListener, Adapter {
private PageFigure fig = null;
public void doControlUp() {
@@ -72,8 +75,6 @@
return true;
}
-
-
private void refreshTargetLink(Link link) {
if (link == null)
return;
@@ -84,7 +85,6 @@
gep.refreshTargetConnections();
}
-
protected AccessibleEditPart createAccessible() {
return new AccessibleGraphicalEditPart() {
@@ -106,14 +106,28 @@
return getPageModel().getOutputLinks();
}
+ public void performRequest(Request req) {
+ if (RequestConstants.REQ_OPEN.equals(req.getType())) {
+ SelectionRequest request = (SelectionRequest) req;
+ Point mouseLocation = request.getLocation()
+ .translate(-getGroupFigure().getLocation().x,
+ -getGroupFigure().getLocation().y);
+ if (mouseLocation.x < 16 && mouseLocation.y >
getGroupFigure().getSize().height-16) {
+ getPageModel().setParamsVisible(!getPageModel().isParamsVisible());
+ refresh();
+ fig.repaint();
+ }
+ }
+ }
+
protected void createEditPolicies() {
super.createEditPolicies();
installEditPolicy(EditPolicy.NODE_ROLE, null);
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null);
- //installEditPolicy(EditPolicy.COMPONENT_ROLE, new PageEditPolicy());
- //installEditPolicy(EditPolicy.LAYOUT_ROLE, new JSFFlowEditPolicy());
- //installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,
- // new PageEditPolicy());
+ // installEditPolicy(EditPolicy.COMPONENT_ROLE, new PageEditPolicy());
+ // installEditPolicy(EditPolicy.LAYOUT_ROLE, new JSFFlowEditPolicy());
+ // installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,
+ // new PageEditPolicy());
}
/**
@@ -143,15 +157,14 @@
Dimension size;
-
-
protected void refreshVisuals() {
Point loc = getPageModel().getLocation();
- int height = 23 + getPageModel().getOutputLinks().size()*NodeFigure.LINK_HEIGHT;
-
- if(getPageModel().getOutputLinks().size() == 0)
- height = 23+NodeFigure.LINK_HEIGHT;
-
+ int height = 23 + getPageModel().getOutputLinks().size()
+ * NodeFigure.LINK_HEIGHT;
+
+ if (getPageModel().getOutputLinks().size() == 0)
+ height = 23 + NodeFigure.LINK_HEIGHT;
+
size = new Dimension(50, height);
loc.x -= loc.x % 8;
loc.y -= loc.y % 8;
@@ -175,19 +188,19 @@
public ConnectionAnchor getSourceConnectionAnchor(
ConnectionEditPart connEditPart) {
- Link link = (Link) connEditPart.getModel();
- int index = getPageModel().getOutputLinks().indexOf(link);
- return getNodeFigure().getConnectionAnchor((index + 1) + "_OUT");
+ Link link = (Link) connEditPart.getModel();
+ int index = getPageModel().getOutputLinks().indexOf(link);
+ return getNodeFigure().getConnectionAnchor((index + 1) + "_OUT");
}
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
- Point pt = new Point(((DropRequest) request).getLocation());
- return getNodeFigure().getSourceConnectionAnchorAt(pt);
+ Point pt = new Point(((DropRequest) request).getLocation());
+ return getNodeFigure().getSourceConnectionAnchorAt(pt);
}
-// protected List getModelChildren() {
-// return getPageModel().getChildren();
-// }
+ // protected List getModelChildren() {
+ // return getPageModel().getChildren();
+ // }
protected void refreshChildren() {
super.refreshChildren();
@@ -196,7 +209,7 @@
}
}
-
+
/**
* @see org.eclipse.gef.EditPart#activate()
*/
@@ -206,14 +219,14 @@
((Notifier) getModel()).eAdapters().add(this);
super.activate();
}
-
- public void deactivate(){
+
+ public void deactivate() {
if (!isActive())
return;
((Notifier) getModel()).eAdapters().remove(this);
super.deactivate();
}
-
+
/**
* @see
org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
*/
@@ -221,6 +234,7 @@
refresh();
refreshVisuals();
}
+
/**
* )
*
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java 2008-05-30
12:21:18 UTC (rev 8460)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java 2008-05-30
13:17:40 UTC (rev 8461)
@@ -58,6 +58,11 @@
public static final Color exceptionForegroundColor = new Color(null, 0x99, 0x07, 0x02);
+ public static final Color button1Color = new Color(null, 0xff, 0xf6, 0xc8);
+ public static final Color button2Color = new Color(null, 0x98, 0x99, 0x98);
+ public static final Color button3Color = new Color(null, 0xff, 0xe8, 0x79);
+ public static final Color button4Color = new Color(null, 0xdb, 0xc7, 0x68);
+
public static final Font exceptionFont = new Font(null, "default", 8,
SWT.BOLD);
public static final Image errorIcon = ModelUIImages
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java 2008-05-30
12:21:18 UTC (rev 8460)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java 2008-05-30
13:17:40 UTC (rev 8461)
@@ -268,7 +268,54 @@
g.fillPolygon(shadowPointlist);
g.fillPolygon(shadow2Pointlist);
-
+ if(page.getChildren().size() != 0){
+ if(page.isParamsVisible()){
+ g.setForegroundColor(blackColor);
+ g.drawLine(4, height-13, 11, height-13);
+ g.drawLine(4, height-13, 4, height-6);
+
+ g.drawLine(6, height-9, 10, height-9);
+
+ g.setForegroundColor(button2Color);
+ g.drawLine(12, height-13, 12, height-5);
+ g.drawLine(4, height-5, 12, height-5);
+
+ g.setForegroundColor(button3Color);
+ g.setBackgroundColor(button3Color);
+ g.drawLine(5, height-4, 13, height-4);
+ g.drawLine(13, height-4, 13, height-12);
+ g.fillRectangle(6, height-11, 5, 2);
+ g.fillRectangle(6, height-8, 5, 2);
+
+ g.setForegroundColor(button4Color);
+ g.drawLine(5, height-7, 5, height-12);
+ g.drawLine(5, height-12, 10, height-12);
+ }else{
+
+ g.setForegroundColor(button2Color);
+ g.drawLine(4, height-13, 11, height-13);
+ g.drawLine(4, height-13, 4, height-6);
+
+ g.setForegroundColor(blackColor);
+
+ g.drawLine(6, height-9, 10, height-9);
+ g.drawLine(8, height-11, 8, height-7);
+
+ g.drawLine(12, height-13, 12, height-5);
+ g.drawLine(4, height-5, 12, height-5);
+
+ g.setForegroundColor(button3Color);
+ g.drawLine(5, height-4, 13, height-4);
+ g.drawLine(13, height-4, 13, height-12);
+
+ g.drawLine(6, height-6, 11, height-6);
+ g.drawLine(11, height-6, 11, height-12);
+
+ g.setForegroundColor(whiteColor);
+ g.drawLine(5, height-6, 5, height-12);
+ g.drawLine(5, height-12, 11, height-12);
+ }
+ }
}
class GroupBorder extends LineBorder {
@@ -279,7 +326,6 @@
public void paint(IFigure figure, Graphics graphics, Insets insets) {
Rectangle r = getPaintRectangle(figure, insets).getCopy();
graphics.translate(r.getLocation());
- int start = 0;
int width = r.width - 1;
int height = r.height - 1;
@@ -288,14 +334,14 @@
else
graphics.setForegroundColor(darkGrayColor);
- graphics.drawLine(start + 1, 0, width - 15, 0);
- graphics.drawLine(start, 1, start, height - 2);
- graphics.drawLine(start + 1, height - 1, width - 2, height - 1);
+ graphics.drawLine(1, 0, width - 15, 0);
+ graphics.drawLine(0, 1, 0, height - 2);
+ graphics.drawLine(1, height - 1, width - 2, height - 1);
graphics.drawLine(width - 1, 14, width - 1, height - 2);
graphics.drawLine(width - 15, 0, width - 1, 14);
- graphics.drawLine(start, 1, start + 1, 0);
- graphics.drawLine(start, height - 2, start + 1, height - 1);
+ graphics.drawLine(0, 1, 1, 0);
+ graphics.drawLine(0, height - 2, 1, height - 1);
graphics.drawLine(width - 2, height - 1, width - 1, height - 2);
graphics.drawLine(width - 15, 0, width - 14, 4);
@@ -304,16 +350,9 @@
graphics.drawLine(width - 18, 10, width - 1, 14);
- graphics.drawLine(start + 23, 0, start + 23, 19);
- graphics.drawLine(start, 20, start + 22, 20);
- graphics.drawLine(start + 22, 20, start + 23, 19);
-
-
- if (page != null /*&& group.isConfirmed()*/)
- graphics.setForegroundColor(borderColor);
- else
- graphics.setForegroundColor(darkGrayColor);
-
+ graphics.drawLine(23, 0, 23, 19);
+ graphics.drawLine(0, 20, 22, 20);
+ graphics.drawLine(22, 20, 23, 19);
}
public void mouseDoubleClicked(MouseEvent me) {