Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures')
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/BogusLayout.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenterLayout.java117
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenteredIconFigure.java39
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ConnectionFigure.java210
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerFigure.java71
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerLayout.java248
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ExpandableGraphNodeFigure.java133
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FillLayout.java160
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FloatableFigure.java29
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeContainerFigure.java29
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeFigure.java184
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/Interactor.java54
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/LabelFigure.java88
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/PostLayoutManager.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RepeatableGraphNodeFigure.java85
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RoundedLineBorder.java67
16 files changed, 0 insertions, 1594 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/BogusLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/BogusLayout.java
deleted file mode 100644
index cfa8c75b4a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/BogusLayout.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-
-
-/**
- * Figures using the StackLayout as their layout manager have
- * their children placed on top of one another. Order of
- * placement is determined by the order in which the children
- * were added, first child added placed on the bottom.
- */
-public class BogusLayout
- extends AbstractLayout
-{
-
-protected int spacing;
-
-public BogusLayout(){}
-
-protected Dimension calculatePreferredSize(IFigure figure, int w, int h)
-{
- Dimension d = new Dimension();
- return d;
-}
-
-/*
- * Returns the minimum size required by the input container.
- * This is the size of the largest child of the container, as all
- * other children fit into this size.
- */
-/*jvh - final
-public Dimension getMinimumSize(IFigure figure){
- return new Dimension();
-}
-
-public Dimension getPreferredSize(IFigure figure){
- return new Dimension();
-} */
-
-/*
- * Lays out the children on top of each other with
- * their sizes equal to that of the available
- * paintable area of the input container figure.
- */
-public void layout(IFigure figure){
-
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenterLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenterLayout.java
deleted file mode 100644
index a0087abeb5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenterLayout.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-
-/**
- * Figures using the StackLayout as their layout manager have
- * their children placed on top of one another. Order of
- * placement is determined by the order in which the children
- * were added, first child added placed on the bottom.
- */
-public class CenterLayout
- extends AbstractLayout
-{
-
-protected int spacing;
-
-public CenterLayout(){}
-public CenterLayout(int spacing){ this.spacing = spacing; }
-
-/**
- * Calculates and returns the preferred size of the input container.
- * This is the size of the largest child of the container, as all
- * other children fit into this size.
- *
- * @param figure Container figure for which preferred size is required.
- * @return The preferred size of the input figure.
- */
-protected Dimension calculatePreferredSize(IFigure figure, int w, int h){
- Dimension d = calculatePreferredClientAreaSize(figure);
- /*d.expand(figure.getInsets().getWidth(),
- figure.getInsets().getHeight()); */
- d.expand(w,
- h);
- d.union(getBorderPreferredSize(figure));
- return d;
-}
-
-protected Dimension calculatePreferredClientAreaSize(IFigure figure){
- Dimension d = new Dimension();
- List children = figure.getChildren();
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- Dimension childSize = child.getPreferredSize();
- d.height += childSize.height;
- d.width = Math.max(childSize.width, d.width);
- }
- int childrenSize = children.size();
- if (childrenSize > 0)
- {
- d.height += spacing * children.size() - 1;
- }
- return d;
-}
-
-/*
- * Returns the minimum size required by the input container.
- * This is the size of the largest child of the container, as all
- * other children fit into this size.
- */
-public Dimension getMinimumSize(IFigure figure, int wHint, int hHint){
- Dimension d = new Dimension();
- List children = figure.getChildren();
- IFigure child;
- for (int i=0; i < children.size(); i++){
- child = (IFigure)children.get(i);
- d.union(child.getMinimumSize());
- }
- d.expand(figure.getInsets().getWidth(),
- figure.getInsets().getHeight());
- return d;
-}
-
-public Dimension getPreferredSize(IFigure figure, int wHint, int hHint){
- return calculatePreferredSize(figure, wHint, hHint);
-}
-
-
-/*
- * Lays out the children on top of each other with
- * their sizes equal to that of the available
- * paintable area of the input container figure.
- */
-public void layout(IFigure figure){
- Rectangle r = figure.getClientArea();
- List children = figure.getChildren();
-
- Dimension preferredClientAreaSize = calculatePreferredClientAreaSize(figure);
- int x = r.x + (r.width - preferredClientAreaSize.width) / 2;
- int y = r.y + (r.height - preferredClientAreaSize.height) / 2;
-
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- Dimension childSize = child.getPreferredSize();
- child.setBounds(new Rectangle(x, y, childSize.width, childSize.height));
- y += childSize.height + spacing;
- }
-}
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenteredIconFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenteredIconFigure.java
deleted file mode 100644
index 3426bb00d8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenteredIconFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.graphics.Image;
-
-
-public class CenteredIconFigure extends ContainerFigure
-{
- public Image image;
-
- public CenteredIconFigure()
- {
- super();
- setFill(true);
- }
-
- protected void fillShape(Graphics g)
- {
- super.fillShape(g);
- if (image != null)
- {
- Rectangle r = getBounds();
- Dimension imageSize = new Dimension(16, 16);
- g.drawImage(image, r.x + (r.width - imageSize.width)/2, r.y + (r.height - imageSize.height)/2);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ConnectionFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ConnectionFigure.java
deleted file mode 100644
index aaa05f11c2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ConnectionFigure.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.GraphNodeEditPart;
-
-
-
-public class ConnectionFigure extends RectangleFigure
-{
- protected boolean isOutlined = true;
- protected IFigure xsdFigure;
-
- public ConnectionFigure(IFigure xsdFigure)
- {
- setOpaque(false);
- this.xsdFigure = xsdFigure;
- //setFocusTraversable(false);
- //setEnabled(false);
- }
-
- protected boolean isMouseEventTarget()
- {
- return false;
- }
-
- public boolean containsPoint(int x, int y){return false;}
-
- protected void fillShape(Graphics graphics)
- {
- graphics.setForegroundColor(ColorConstants.black);
- drawLines(graphics, xsdFigure);
- }
-
- protected void drawLines(Graphics graphics, IFigure figure)
- {
- if (figure instanceof GraphNodeFigure)
- {
- GraphNodeFigure graphNodeFigure = (GraphNodeFigure)figure;
- if (graphNodeFigure.isConnected() && graphNodeFigure.isExpanded())
- {
- List childList = graphNodeFigure.getChildGraphNodeFigures();
- if (childList.size() > 0)
- {
- Rectangle r = graphNodeFigure.getConnectionRectangle();
-
- int x1 = r.x + r.width;
- int y1 = r.y + r.height/2;
-
- int startOfChildBox = ((GraphNodeFigure)childList.get(0)).getConnectionRectangle().x;
-
- int x2 = x1 + (startOfChildBox - x1) / 3;
- int y2 = y1;
-
- if (childList.size() > 1)
- {
- graphics.drawLine(x1, y1, x2, y2);
-
- int minY = Integer.MAX_VALUE;
- int maxY = -1;
-
- for (Iterator i = childList.iterator(); i.hasNext(); )
- {
- GraphNodeFigure childGraphNodeFigure = (GraphNodeFigure)i.next();
- Rectangle childConnectionRectangle = childGraphNodeFigure.getConnectionRectangle();
- int y = childConnectionRectangle.y + childConnectionRectangle.height / 2;
-
- minY = Math.min(minY, y);
- maxY = Math.max(maxY, y);
- graphics.drawLine(x2, y, childConnectionRectangle.x, y);
- }
- graphics.drawLine(x2, minY, x2, maxY);
- }
- else
- {
- graphics.drawLine(x1, y1, startOfChildBox, y2);
- }
- }
- }
- }
-
- //boolean visitChildren = true;
- List children = figure.getChildren();
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- drawLines(graphics, child);
- }
- }
-
-
- // This method supports the preview connection line function related to drag and drop
- //
- public PointList getConnectionPoints(GraphNodeEditPart parentEditPart, GraphNodeEditPart childRefEditPart, Rectangle draggedFigureBounds)
- {
- PointList pointList = new PointList();
- int[] data = new int[1];
- Point a = getConnectionPoint(parentEditPart, childRefEditPart, data);
- if (a != null)
- {
- int draggedFigureBoundsY = draggedFigureBounds.y + draggedFigureBounds.height/2;
-
- pointList.addPoint(a);
- //pointList.addPoint(new Point(draggedFigureBounds.x, draggedFigureBoundsY));
-
- if (data[0] == 0) // insert between 2 items
- {
- int x = a.x + (draggedFigureBounds.x - a.x)/2;
- pointList.addPoint(new Point(x, a.y));
- pointList.addPoint(new Point(x, draggedFigureBoundsY));
- pointList.addPoint(new Point(draggedFigureBounds.x, draggedFigureBoundsY));
- }
- else // insert at first or last position
- {
- pointList.addPoint(new Point(a.x, draggedFigureBoundsY));
- pointList.addPoint(new Point(draggedFigureBounds.x, draggedFigureBoundsY));
- }
- }
- return pointList;
- }
-
-
- // This method supports the preview connection line function related to drag and drop
- //
- protected Point getConnectionPoint(GraphNodeEditPart parentEditPart, GraphNodeEditPart childRefEditPart, int[] data)
- {
- Point point = null;
- List childList = parentEditPart.getChildren();
-
- //TreeNodeIconFigure icon = ((TreeNodeFigure)parent.getFigure()).treeNodeIconFigure;
-
- if (childList.size() > 0)
- {
- point = new Point();
-
- GraphNodeEditPart prev = null;
- GraphNodeEditPart next = null;
-
- for (Iterator i = childList.iterator(); i.hasNext(); )
- {
- Object o = i.next();
- if (o instanceof GraphNodeEditPart)
- {
- GraphNodeEditPart childEditPart = (GraphNodeEditPart)o;
- if (childEditPart == childRefEditPart)
- {
- next = childEditPart;
- break;
- }
- prev = childEditPart;
- }
- }
-
- if (next != null && prev != null)
- {
- int ya = prev.getConnectionRectangle().getCenter().y;
- int yb = next.getConnectionRectangle().getCenter().y;
- point.y = ya + (yb - ya)/2;
- data[0] = 0;
- }
- else if (prev != null) // add it last
- {
- point.y = prev.getConnectionRectangle().getCenter().y;
- data[0] = 1;
- }
- else if (next != null) // add it first!
- {
- point.y = next.getConnectionRectangle().getCenter().y;
- data[0] = -1;
- }
-
- if (next != null || prev != null)
- {
- GraphNodeEditPart child = prev != null ? prev : next;
- int startOfChildBox = child.getConnectionRectangle().x;
- Rectangle r = parentEditPart.getConnectionRectangle();
- int x1 = r.x + r.width;
- point.x = x1 + (startOfChildBox - x1) / 3;
- }
- }
- return point;
- }
-
-
- protected void outlineShape(Graphics graphics)
- {
- if (isOutlined)
- {
- super.outlineShape(graphics);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerFigure.java
deleted file mode 100644
index 8594005a03..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerFigure.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.LayoutManager;
-import org.eclipse.draw2d.RectangleFigure;
-
-public class ContainerFigure extends RectangleFigure
-{
- protected boolean isOutlined = false;
-
- public ContainerFigure()
- {
- setLayoutManager(new ContainerLayout());
- setFill(false);
- }
-
- public void doLayout()
- {
- layout();
- setValid(true);
- }
-
- public ContainerLayout getContainerLayout()
- {
- return (ContainerLayout)getLayoutManager();
- }
-
- public void setOutlined(boolean isOutlined)
- {
- this.isOutlined = isOutlined;
- }
-
- protected void outlineShape(Graphics graphics)
- {
- if (isOutlined)
- {
- super.outlineShape(graphics);
- }
- }
-
-
- public void validate()
- {
- if (isValid())
- {
- return;
- }
- super.validate();
- postLayout();
- }
-
-
- protected void postLayout()
- {
- LayoutManager layoutManager = getLayoutManager();
- if (layoutManager instanceof PostLayoutManager)
- {
- ((PostLayoutManager)layoutManager).postLayout(this);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerLayout.java
deleted file mode 100644
index a30b6b89f9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerLayout.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.wst.xsd.ui.internal.gef.util.figures.SpacingFigure;
-
-public class ContainerLayout extends AbstractLayout implements PostLayoutManager
-{
- protected boolean isHorizontal;
- protected int spacing = 0;
- protected int border = 0;
-
- public ContainerLayout()
- {
- this(true, 0);
- }
-
- public ContainerLayout(boolean isHorizontal, int spacing)
- {
- this.isHorizontal = isHorizontal;
- this.spacing = spacing;
- }
-
- public void setHorizontal(boolean isHorizontal)
- {
- this.isHorizontal = isHorizontal;
- }
-
- public void setSpacing(int spacing)
- {
- this.spacing = spacing;
- }
-
- public void setBorder(int border)
- {
- this.border = border;
- }
-
- /**
- * Calculates and returns the preferred size of the container
- * given as input.
- *
- * @param figure Figure whose preferred size is required.
- * @return The preferred size of the passed Figure.
- */
- protected Dimension calculatePreferredSize(IFigure parent, int w, int h)
- {
- Dimension preferred = null;
-
- // Here we ensure that an unexpanded container is given a size of (0,0)
- //
- if (parent instanceof GraphNodeContainerFigure)
- {
- GraphNodeContainerFigure graphNodeContainerFigure = (GraphNodeContainerFigure)parent;
- if (!graphNodeContainerFigure.isExpanded())
- {
- preferred = new Dimension();
- }
- }
-
- if (preferred == null)
- {
- preferred = new Dimension();
- List children = parent.getChildren();
-
- for (int i=0; i < children.size(); i++)
- {
- IFigure child = (IFigure)children.get(i);
-
- Dimension childSize = child.getPreferredSize();
- /*
- if (child instanceof Interactor)
- {
- childSize.width = 9;
- childSize.height = 9;
- }*/
-
- if (isHorizontal)
- {
- preferred.width += childSize.width;
- preferred.height = Math.max(preferred.height, childSize.height);
- }
- else
- {
- preferred.height += childSize.height;
- preferred.width = Math.max(preferred.width, childSize.width);
- }
- }
-
- int childrenSize = children.size();
- if (childrenSize > 1)
- {
- if (isHorizontal)
- {
- preferred.width += spacing * (childrenSize - 1);
- }
- else
- {
- preferred.height += spacing * (childrenSize - 1);
- }
- }
-
- preferred.width += border * 2;
- preferred.height += border * 2;
- preferred.width += parent.getInsets().getWidth();
- preferred.height += parent.getInsets().getHeight();
- }
- return preferred;
- }
-
-
- protected int alignFigure(IFigure parent, IFigure child)
- {
- int y = -1;
- return y;
- }
-
- public void layout(IFigure parent)
- {
- List children = parent.getChildren();
- Dimension preferred = new Dimension();
-
- int rx = 0;
- for (int i=0; i < children.size(); i++)
- {
- IFigure child = (IFigure)children.get(i);
- Dimension childSize = child.getPreferredSize();
- if (isHorizontal)
- {
- preferred.height = Math.max(preferred.height, childSize.height);
- rx += childSize.width;
- }
- else
- {
- preferred.width = Math.max(preferred.width, childSize.width);
- }
- }
-
- if (isHorizontal)
- {
- preferred.height += border*2;
- preferred.width += border;
- }
- else
- {
- preferred.width += border*2;
- preferred.height += border;
- }
-
- int childrenSize = children.size();
- for (int i=0; i < childrenSize; i++)
- {
- IFigure child = (IFigure)children.get(i);
- Dimension childSize = child.getPreferredSize();
-
- if (isHorizontal)
- {
- int y = alignFigure(parent, child);
-
-
- if (y == -1)
- {
- y = (preferred.height - childSize.height) / 2;
- }
-
- Rectangle rectangle = new Rectangle(preferred.width, y, childSize.width, childSize.height);
- rectangle.translate(parent.getClientArea().getLocation());
-
- child.setBounds(rectangle);
- preferred.width += childSize.width;
- preferred.width += spacing;
-
- if (child instanceof SpacingFigure)
- {
- int availableHorizontalSpace = parent.getClientArea().width - rx;
- preferred.width += availableHorizontalSpace;
- }
- }
- else
- {
- Rectangle rectangle = new Rectangle(0, preferred.height, childSize.width, childSize.height);
- rectangle.translate(parent.getClientArea().getLocation());
- child.setBounds(rectangle);
- preferred.height += childSize.height;
- preferred.height += spacing;
- }
- }
- }
-
- public void postLayout(IFigure figure)
- {
- // This method attempts to align a 'FloatableFigure' (e.g. an Element node)
- // with any content that it is connected to. This way a chain of connected figures
- // will be vertically aligned (e.g. element -> modelgroup -> element). Any visible clipping of the
- // figures in the graph is probably a result of a bug in this code that results in a 'FloatableFigure' being
- // repositioned beyond the bounds of its parent.
- //
- for (Iterator i = figure.getChildren().iterator(); i.hasNext();)
- {
- IFigure child = (IFigure)i.next();
- if (child instanceof FloatableFigure)
- {
- FloatableFigure floatableFigure = (FloatableFigure)child;
- GraphNodeFigure graphNodeFigure = floatableFigure.getGraphNodeFigure();
- if (graphNodeFigure.isExpanded() && graphNodeFigure.getChildGraphNodeFigures().size() == 1)
- {
- GraphNodeFigure alignedChild = (GraphNodeFigure)graphNodeFigure.getChildGraphNodeFigures().get(0);
- Rectangle alignedChildBounds = alignedChild.getConnectionRectangle();
- Rectangle childBounds = child.getBounds();
-
- int l = childBounds.y + childBounds.height/2;
- int r = alignedChildBounds.y + alignedChildBounds.height/2;
- int delta = r - l;
-
- fixUp(child, delta);
- }
- }
- }
- }
-
- protected void fixUp(IFigure figure, int delta)
- {
- Rectangle bounds = figure.getBounds();
- bounds.y += delta;
- figure.setBounds(bounds);
-
- for (Iterator i = figure.getChildren().iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- fixUp(child, delta);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ExpandableGraphNodeFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ExpandableGraphNodeFigure.java
deleted file mode 100644
index e3391037ba..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ExpandableGraphNodeFigure.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-
-// ------------------------------------------------------------
-// | ExpandableGraphNodeFigure |
-// | |
-// | ---------------------------------- --------------- |
-// | | verticalGroup | | | |
-// | | | | | |
-// | | ----------------------------- | | | |
-// | | | horizontalGroup | | | | |
-// | | | | | | | |
-// | | | --------------------- | | | | |
-// | | | | outlinedArea | | | | | |
-// | | | | ----------------- | | | | outer | |
-// | | | | | iconArea | | | | | Content | |
-// | | | | ----------------- | [+] | | | Area | |
-// | | | | ----------------- | | | | | |
-// | | | | | innerContent | | | | | | |
-// | | | | ----------------- | | | | | |
-// | | | --------------------- | | | | |
-// | | ----------------------------- | | | |
-// | | | | | |
-// | | ------------------ | | | |
-// | | | occurenceArea | | | | |
-// | | ------------------ | | | |
-// | ---------------------------------- --------------- |
-// ------------------------------------------------------------
-
-public class ExpandableGraphNodeFigure extends RepeatableGraphNodeFigure
-{
- protected ContainerFigure horizontalGroup;
- protected Interactor interactor;
- protected ContainerFigure outerContentArea;
-
- public boolean isExpanded()
- {
- return interactor.isExpanded();
- }
-
- public void setExpanded(boolean isExpanded)
- {
- interactor.setExpanded(isExpanded);
- }
-
- public ExpandableGraphNodeFigure()
- {
- super();
- isConnected = true;
- }
-
- protected void createFigure()
- {
- createPreceedingSpace(this);
- createVerticalGroup(this);
- createHorizontalGroup(verticalGroup);
- createOutlinedArea(horizontalGroup);
- createInteractor(horizontalGroup);
- createOccurenceArea(verticalGroup);
- createOuterContentArea(this);
- }
-
- protected void createVerticalGroup(IFigure parent)
- {
- verticalGroup = new FloatableFigure(this);
- verticalGroup.getContainerLayout().setHorizontal(false);
- parent.add(verticalGroup);
- }
-
- protected void createHorizontalGroup(IFigure parent)
- {
- horizontalGroup = new ContainerFigure();
- parent.add(horizontalGroup);
- }
-
- protected void createInteractor(IFigure parent)
- {
- interactor = new Interactor();
- interactor.setForegroundColor(ColorConstants.black);
- interactor.setBackgroundColor(ColorConstants.white);
- parent.add(interactor);
- }
-
- protected void createOuterContentArea(IFigure parent)
- {
- // create a small space between the interactor and the contentArea
- //
- RectangleFigure space = new RectangleFigure();
- space.setVisible(false);
- space.setPreferredSize(new Dimension(5, 10));
- parent.add(space);
-
- outerContentArea = new GraphNodeContainerFigure(this);
- outerContentArea.getContainerLayout().setHorizontal(false);
- parent.add(outerContentArea);
- }
-
- public Interactor getInteractor()
- {
- return interactor;
- }
-
- public ContainerFigure getOuterContentArea()
- {
- return outerContentArea;
- }
-
- public IFigure getConnectionFigure()
- {
- return horizontalGroup;
- }
-
- public Rectangle getConnectionRectangle()
- {
- return horizontalGroup.getBounds();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FillLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FillLayout.java
deleted file mode 100644
index 221c147b24..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FillLayout.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-
-/**
- * Figures using the StackLayout as their layout manager have
- * their children placed on top of one another. Order of
- * placement is determined by the order in which the children
- * were added, first child added placed on the bottom.
- */
-public class FillLayout extends AbstractLayout
-{
-
-protected boolean isHorizontal = false;
-protected int spacing = 0;
-public Dimension min;
-
-public FillLayout(){}
-public FillLayout(boolean dummy){}
-
-public FillLayout(int spacing)
-{
- this.spacing = spacing;
-}
-
-public void setHorizontal(boolean isHorizontal)
-{
- this.isHorizontal = isHorizontal;
-}
-
-/**
- * Calculates and returns the preferred size of the input container.
- * This is the size of the largest child of the container, as all
- * other children fit into this size.
- *
- * @param figure Container figure for which preferred size is required.
- * @return The preferred size of the input figure.
- */
-protected Dimension calculatePreferredSize(IFigure figure, int w, int h)
-{
- Dimension d = calculatePreferredClientAreaSize(figure);
- d.expand(figure.getInsets().getWidth(),
- figure.getInsets().getHeight());
- //d.union(getBorderPreferredSize(figure));
- return d;
-}
-
-protected Dimension calculatePreferredClientAreaSize(IFigure figure)
-{
- Dimension d = new Dimension();
- List children = figure.getChildren();
-
-
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- Dimension childSize = child.getPreferredSize();
-
- if (isHorizontal)
- {
- d.width += childSize.width;
- d.height = Math.max(childSize.height, d.height);
- }
- else
- {
- d.height += childSize.height;
- d.width = Math.max(childSize.width, d.width);
- }
- }
-
-
- int childrenSize = children.size();
- if (childrenSize > 0)
- {
- if (isHorizontal)
- d.width += spacing * (childrenSize - 1);
- else
- d.height += spacing * (childrenSize - 1);
- }
-
- if (min != null)
- {
- d.width = Math.max(d.width, min.width);
- d.height = Math.max(d.height, min.height);
- }
- return d;
-}
-
-/*
- * Returns the minimum size required by the input container.
- * This is the size of the largest child of the container, as all
- * other children fit into this size.
- */
-public Dimension getMinimumSize(IFigure figure, int w, int h)
-{
- Dimension d = new Dimension();
- List children = figure.getChildren();
- IFigure child;
- for (int i=0; i < children.size(); i++){
- child = (IFigure)children.get(i);
- d.union(child.getMinimumSize());
- }
- d.expand(figure.getInsets().getWidth(),
- figure.getInsets().getHeight());
- return d;
-}
-
-public Dimension getPreferredSize(IFigure figure, int w, int h)
-{
- return calculatePreferredSize(figure, w, h);
-}
-
-/*
- * Lays out the children on top of each other with
- * their sizes equal to that of the available
- * paintable area of the input container figure.
- */
-public void layout(IFigure figure){
-
- Dimension preferredSize = calculatePreferredClientAreaSize(figure);
- Rectangle r = figure.getClientArea().getCopy();
-
- List children = figure.getChildren();
-
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- Dimension childSize = child.getPreferredSize();
-
- if (isHorizontal)
- {
- child.setBounds(new Rectangle(r.x, r.y, childSize.width, Math.max(preferredSize.height, r.height)));
- r.x += childSize.width + spacing;
- }
- else
- {
- child.setBounds(new Rectangle(r.x, r.y, Math.max(preferredSize.width, r.width), childSize.height));
- r.y += childSize.height + spacing;
- }
- }
-}
-}
- \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FloatableFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FloatableFigure.java
deleted file mode 100644
index c224145ee0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FloatableFigure.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-
-
-public class FloatableFigure extends ContainerFigure
-{
- public GraphNodeFigure graphNodeFigure;
-
- public FloatableFigure(GraphNodeFigure graphNodeFigure)
- {
- super();
- this.graphNodeFigure = graphNodeFigure;
- }
-
- public GraphNodeFigure getGraphNodeFigure()
- {
- return graphNodeFigure;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeContainerFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeContainerFigure.java
deleted file mode 100644
index c06a6556d3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeContainerFigure.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-
-
-public class GraphNodeContainerFigure extends ContainerFigure
-{
- public ExpandableGraphNodeFigure expandableGraphNodeFigure;
-
- public GraphNodeContainerFigure(ExpandableGraphNodeFigure expandableGraphNodeFigure)
- {
- super();
- this.expandableGraphNodeFigure = expandableGraphNodeFigure;
- }
-
- public boolean isExpanded()
- {
- return expandableGraphNodeFigure.isExpanded();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeFigure.java
deleted file mode 100644
index 3d9706d5a4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeFigure.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-
-// ------------------------------
-// | GraphNodeFigure |
-// | |
-// | ------------------------- |
-// | | vertical group | |
-// | | --------------------- | |
-// | | | outlined area | | |
-// | | | ----------------- | | |
-// | | | | icon area | | | |
-// | | | ----------------- | | |
-// | | | ----------------- | | |
-// | | | | inner content | | | |
-// | | | ----------------- | | |
-// | | --------------------- | |
-// | ------------------------- |
-// ------------------------------
-
-public class GraphNodeFigure extends ContainerFigure
-{
- protected ContainerFigure verticalGroup;
- protected ContainerFigure outlinedArea;
- protected ContainerFigure iconArea;
- protected ContainerFigure innerContentArea;
-
- protected boolean isConnected;
- protected boolean isIsolated;
-
- protected List childGraphNodeFigures = new ArrayList();
- protected GraphNodeFigure parentGraphNodeFigure;
-
- public GraphNodeFigure()
- {
- isIsolated = false;
- createFigure();
- }
-
- public boolean isExpanded()
- {
- return true;
- }
-
- public boolean isConnected()
- {
- return isConnected;
- }
-
- public void setConnected(boolean isConnected)
- {
- this.isConnected = isConnected;
- }
-
- public void setIsIsolated(boolean isIsolated)
- {
- this.isIsolated = isIsolated;
- }
-
- public boolean getIsIsolated()
- {
- return isIsolated;
- }
-
- protected void createFigure()
- {
- createVerticalGroup(this);
- createOutlinedArea(verticalGroup);
- }
-
- protected void createVerticalGroup(IFigure parent)
- {
- verticalGroup = new ContainerFigure();
- verticalGroup.getContainerLayout().setHorizontal(false);
- parent.add(verticalGroup);
- }
-
- protected void createOutlinedArea(IFigure parent)
- {
- outlinedArea = new ContainerFigure();
- outlinedArea.getContainerLayout().setHorizontal(false);
- parent.add(outlinedArea);
-
- iconArea = new ContainerFigure();
- outlinedArea.add(iconArea);
-
- innerContentArea = new ContainerFigure();
- innerContentArea.getContainerLayout().setHorizontal(false);
- outlinedArea.add(innerContentArea);
- }
-
- public ContainerFigure getIconArea()
- {
- return iconArea;
- }
-
- public ContainerFigure getOutlinedArea()
- {
- return outlinedArea;
- }
-
- public ContainerFigure getInnerContentArea()
- {
- return innerContentArea;
- }
-
- public IFigure getConnectionFigure()
- {
- return outlinedArea;
- }
-
- public Rectangle getConnectionRectangle()
- {
- return outlinedArea.getBounds();
- }
-
- public List getChildGraphNodeFigures()
- {
- return childGraphNodeFigures;
- }
-
- public void addNotify()
- {
- super.addNotify();
- if (isConnected())
- {
- parentGraphNodeFigure = computeParentGraphNodeFigure(this);
- if (parentGraphNodeFigure != null)
- {
- parentGraphNodeFigure.getChildGraphNodeFigures().add(this);
- }
- }
- }
-
- public void removeNotify()
- {
- super.removeNotify();
- if (parentGraphNodeFigure != null)
- {
- parentGraphNodeFigure.getChildGraphNodeFigures().remove(this);
- }
- }
-
- public GraphNodeFigure getParentGraphNodeFigure()
- {
- return parentGraphNodeFigure;
- }
-
- public GraphNodeFigure computeParentGraphNodeFigure(IFigure figure)
- {
- GraphNodeFigure result = null;
- IFigure parent = figure != null ? figure.getParent() : null;
- while (parent != null)
- {
- if (parent instanceof GraphNodeFigure)
- {
- GraphNodeFigure parentGraphNodeFigure = (GraphNodeFigure)parent;
- if (parentGraphNodeFigure.isConnected())
- {
- result = (GraphNodeFigure)parent;
- break;
- }
- }
- parent = parent.getParent();
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/Interactor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/Interactor.java
deleted file mode 100644
index 7a64b8fbac..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/Interactor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-/**
- * Interactor the +/- control commonly found in trees
- */
-public class Interactor extends RectangleFigure
-{
- protected boolean isExpanded;
-
- public Interactor()
- {
- super();
- setPreferredSize(new Dimension(9, 9));
- }
-
- public void setExpanded(boolean isExpanded)
- {
- this.isExpanded = isExpanded;
- }
-
- public boolean isExpanded()
- {
- return isExpanded;
- }
-
- protected void fillShape(Graphics g)
- {
- super.fillShape(g);
- Rectangle r = getBounds();
- int mx = r.x + r.width / 2;
- int my = r.y + r.height / 2;
- int s = 2;
- g.drawLine(r.x + s, my, r.x + r.width - s - 1, my);
- if (!isExpanded)
- {
- g.drawLine(mx, r.y + s, mx, r.y + r.height - s -1);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/LabelFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/LabelFigure.java
deleted file mode 100644
index 04c82b8430..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/LabelFigure.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-
-public class LabelFigure extends Figure
-{
- protected String text = "";
- protected boolean isShowEmptyLabel = true;
- protected int left = 4;
- protected int right = 4;
- protected int textHeight;
- protected int textWidth;
-
- public LabelFigure()
- {
- setPreferredSize(new Dimension());
- }
-
- protected void setLeft(int left)
- {
- this.left = left;
- }
-
- protected void setRight(int right)
- {
- this.right = right;
- }
-
- public void setShowEmptyLabel(boolean isShowEmptyLabel)
- {
- this.isShowEmptyLabel = isShowEmptyLabel;
- }
-
-
- public void setText(String s)
- {
- if (s == null)
- s = "";
-
- if (!text.equals(s))
- {
- text = s;
- if (text.length() > 0 || isShowEmptyLabel)
- {
- textHeight = FigureUtilities.getFontMetrics(getFont()).getHeight();
- textWidth = FigureUtilities.getTextWidth(text, getFont());
- textWidth = Math.max(textWidth, FigureUtilities.getTextWidth("abcdefg", getFont()));
- setPreferredSize(new Dimension(textWidth + left + right, textHeight));
- }
- else
- {
- setPreferredSize(new Dimension());
- }
- }
- //revalidate();
- //repaint();
- }
-
-
-
- protected void paintFigure(Graphics graphics)
- //protected void fillShape(Graphics graphics)
- {
- super.paintFigure(graphics);
- //super.fillShape(graphics);
- if (text.length() > 0)
- {
- Rectangle r = getBounds();
- graphics.setForegroundColor(getForegroundColor());
- graphics.drawString(text, left + r.x, r.y);// + (r.width - textWidth)/2, r.y + (r.height - textHeight)/2);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/PostLayoutManager.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/PostLayoutManager.java
deleted file mode 100644
index 21a1f54274..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/PostLayoutManager.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.IFigure;
-
-
-public interface PostLayoutManager
-{
- public void postLayout(IFigure figure);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RepeatableGraphNodeFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RepeatableGraphNodeFigure.java
deleted file mode 100644
index fd8d2496c3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RepeatableGraphNodeFigure.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.wst.xsd.ui.internal.graph.GraphicsConstants;
-
-
-
-
-// ------------------------------
-// | RepeatableGraphNodeFigure |
-// | |
-// | ------------------------- |
-// | | vertical group | |
-// | | --------------------- | |
-// | | | outlined area | | |
-// | | | ----------------- | | |
-// | | | | icon area | | | |
-// | | | ----------------- | | |
-// | | | ----------------- | | |
-// | | | | inner content | | | |
-// | | | ----------------- | | |
-// | | --------------------- | |
-// | | | |
-// | | ------------------ | |
-// | | | occurence area | | |
-// | | ------------------ | |
-// | ------------------------- |
-// ------------------------------
-
-public class RepeatableGraphNodeFigure extends GraphNodeFigure
-{
- protected ContainerFigure occurenceArea;
- protected LabelFigure occurenceLabel;
-
- public RepeatableGraphNodeFigure()
- {
- super();
- }
-
- protected void createFigure()
- {
- createPreceedingSpace(this);
- createVerticalGroup(this);
- createOutlinedArea(verticalGroup);
- createOccurenceArea(verticalGroup);
- }
-
- protected void createOccurenceArea(IFigure parent)
- {
- occurenceArea = new ContainerFigure();
- occurenceLabel = new LabelFigure();
- occurenceLabel.setForegroundColor(ColorConstants.black);
- occurenceLabel.setShowEmptyLabel(false);
- occurenceLabel.setFont(GraphicsConstants.medium);
- occurenceArea.add(occurenceLabel);
- parent.add(occurenceArea);
- }
-
- protected void createPreceedingSpace(IFigure parent)
- {
- // create a small space
- RectangleFigure space = new RectangleFigure();
- space.setVisible(false);
- space.setPreferredSize(new Dimension(10, 10));
- parent.add(space);
- }
-
- public LabelFigure getOccurenceLabel()
- {
- return occurenceLabel;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RoundedLineBorder.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RoundedLineBorder.java
deleted file mode 100644
index 75dbff750c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RoundedLineBorder.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.swt.graphics.Color;
-
-
-public class RoundedLineBorder extends LineBorder
-{
- protected int arcLength;
- protected int lineStyle = Graphics.LINE_SOLID;
-
- public RoundedLineBorder(Color c, int width, int arcLength)
- {
- super(c, width);
- this.arcLength = arcLength;
- }
-
- public RoundedLineBorder(int width, int arcLength)
- {
- super(width);
- this.arcLength = arcLength;
- }
-
- public RoundedLineBorder(Color c, int width, int arcLength, int lineStyle)
- {
- super(c, width);
- this.arcLength = arcLength;
- this.lineStyle = lineStyle;
- }
-
- public RoundedLineBorder(int width, int arcLength, int lineStyle)
- {
- super(width);
- this.arcLength = arcLength;
- this.lineStyle = lineStyle;
- }
-
- public void paint(IFigure figure, Graphics graphics, Insets insets)
- {
- int rlbWidth = getWidth();
- tempRect.setBounds(getPaintRectangle(figure, insets));
- if (rlbWidth%2 == 1)
- {
- tempRect.width--;
- tempRect.height--;
- }
- tempRect.shrink(rlbWidth/2,rlbWidth/2);
- graphics.setLineWidth(rlbWidth);
- graphics.setLineStyle(lineStyle);
- if (getColor() != null)
- graphics.setForegroundColor(getColor());
- graphics.drawRoundRectangle(tempRect, arcLength, arcLength);
- }
-}

Back to the top