Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz')
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/TypeVizEditorMode.java53
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/BoxFigure.java119
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/CompartmentFigure.java188
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/FieldFigure.java312
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/HeadingFigure.java91
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/RoundedLineBorder.java66
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/StructureFigure.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/TypeVizFigureFactory.java64
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/ColumnData.java83
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/RowLayout.java179
10 files changed, 0 insertions, 1216 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/TypeVizEditorMode.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/TypeVizEditorMode.java
deleted file mode 100644
index c48d12bdcc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/TypeVizEditorMode.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.adt.typeviz;
-
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.EditorMode;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlineProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.TypeVizFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDEditPartFactory;
-
-public class TypeVizEditorMode extends EditorMode
-{
- private EditPartFactory editPartFactory;
- public final static String ID = "org.eclipse.wst.xsd.ui.typeviz";
-
- public Object getAdapter(Class adapter)
- {
- return null;
- }
-
- public String getDisplayName()
- {
- return "Advanced";
- }
-
- public EditPartFactory getEditPartFactory()
- {
- if (editPartFactory == null)
- {
- editPartFactory = new XSDEditPartFactory(new TypeVizFigureFactory());
- }
- return editPartFactory;
- }
-
- public String getId()
- {
- return ID;
- }
-
- public IContentProvider getOutlineProvider()
- {
- return new ADTContentOutlineProvider();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/BoxFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/BoxFigure.java
deleted file mode 100644
index 95a904d0ad..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/BoxFigure.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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.adt.typeviz.design.figures;
-
-import java.util.Iterator;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.layouts.ColumnData;
-
-public class BoxFigure extends Figure
-{
- protected ColumnData columnData = new ColumnData();
- public HeadingFigure headingFigure;
- protected Figure contentPane;
-
- public boolean isSelected = false;
-
- public BoxFigure()
- {
- super();
-
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (!highContrast)
- {
- setBackgroundColor(ColorConstants.white);
- }
-
- headingFigure = new HeadingFigure();
- add(headingFigure);
-
- contentPane = new Figure()
- {
- public void paint(Graphics graphics)
- {
- graphics.fillRectangle(getBounds());
- super.paint(graphics);
- boolean isFirst = false;
- for (Iterator i = getChildren().iterator(); i.hasNext();)
- {
- Figure figure = (Figure) i.next();
- if (isFirst)
- {
- isFirst = false;
- }
- else
- {
- Rectangle r = figure.getBounds();
- graphics.drawLine(r.x, r.y + 1, r.x + r.width, r.y + 1);
- }
- }
- }
- };
- contentPane.setLayoutManager(new ToolbarLayout());
- add(contentPane);
- headingFigure.setForegroundColor(ColorConstants.black);
- }
-
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
- /*
- // Fill for the header section
- //
- Rectangle r = getBounds().getCopy();
- graphics.setBackgroundColor(ColorConstants.darkGray);
- Color gradient1 = ColorConstants.lightGray;
- if (isSelected)
- {
- gradient1 = ColorConstants.lightBlue;
- }
- Color gradient2 = ColorConstants.white;
- graphics.setForegroundColor(gradient1);
- graphics.setBackgroundColor(gradient2);
- graphics.fillGradient(r.x + 1, r.y + 1, r.width - 2, nodeNameLabel.getBounds().height - 1, true);
- nodeNameLabel.paint(graphics);
- */
- }
-
- public IFigure getContentPane()
- {
- return contentPane;
- }
-
- public Label getNameLabel()
- {
- return headingFigure.getLabel();
- }
-
- public HeadingFigure getHeadingFigure()
- {
- return headingFigure;
- }
-
- public ColumnData getColumnData()
- {
- return columnData;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/CompartmentFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/CompartmentFigure.java
deleted file mode 100644
index a019ada90e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/CompartmentFigure.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewerGraphicConstants;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.ICompartmentFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.layouts.RowLayout;
-import org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure;
-
-public class CompartmentFigure extends Figure implements ICompartmentFigure
-{
- public Label nodeNameLabel;
- protected Figure contentPane;
- protected Figure annotationArea;
- public Figure rowFigure;
-
- public CompartmentFigure()
- {
- super();
-
- rowFigure = new Figure();
- add(rowFigure);
-
- annotationArea = new Figure() {
-
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
- try
- {
- graphics.pushState();
- graphics.setForegroundColor(ColorConstants.blue);
- graphics.setFont(DesignViewerGraphicConstants.smallFont);
- List children = getChildren();
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- Figure object = (Figure)i.next();
- traverse(object, graphics);
- }
- }
- finally
- {
- graphics.popState();
- }
- }
-
- private void traverse(Figure figure, Graphics graphics)
- {
- List children = figure.getChildren();
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- Figure object = (Figure)i.next();
-
- if (object instanceof GenericGroupFigure)
- {
- GenericGroupFigure fig = (GenericGroupFigure) object;
- if (fig.hasText())
- graphics.drawText(fig.getText(), fig.getTextCoordinates());
- }
- traverse(object, graphics);
- }
-
- }
-
- };
- ToolbarLayout annotationLayout = new ToolbarLayout(false);
- annotationLayout.setStretchMinorAxis(true);
- annotationArea.setLayoutManager(annotationLayout);
-
- // Need this to show content model structure on the left side of the figure
- rowFigure.add(annotationArea);
-
- contentPane = new Figure()
- {
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
- graphics.pushState();
- try
- {
- boolean isFirst = true;
- Color oldColor = graphics.getForegroundColor();
- graphics.setForegroundColor(ColorConstants.lightGray);
- for (Iterator i = getChildren().iterator(); i.hasNext();)
- {
- Figure figure = (Figure) i.next();
- Rectangle r = figure.getBounds();
-// if (figure instanceof FieldFigure)
-// {
-// Rectangle rChild = ((FieldFigure)figure).getNameFigure().getBounds();
-// graphics.drawLine(rChild.right(), rChild.y, rChild.right(), rChild.bottom());
-// graphics.setForegroundColor(ColorConstants.darkGray);
-// }
- if (isFirst)
- {
- isFirst = false;
-// graphics.drawLine(r.x, r.y, r.x, r.y + r.height);
- }
- else
- {
- graphics.setForegroundColor(ColorConstants.white);
- graphics.setBackgroundColor(ColorConstants.lightGray);
- graphics.fillGradient(r.x, r.y, r.width, 1, false);
-// graphics.drawLine(r.x, r.y, r.x + r.width, r.y);
-// graphics.drawLine(r.x, r.y, r.x, r.y + r.height);
- }
- }
- graphics.setForegroundColor(oldColor);
- }
- finally
- {
- graphics.popState();
- }
- }
- };
- contentPane.setLayoutManager(new ToolbarLayout());
- rowFigure.add(contentPane);
-
- RowLayout rowLayout = new RowLayout();
- rowFigure.setLayoutManager(rowLayout);
- rowLayout.setConstraint(annotationArea, "annotation");
- rowLayout.setConstraint(contentPane, "contentPane");
- }
-
- public IFigure getContentPane()
- {
- return contentPane;
- }
-
- public IFigure getAnnotationPane()
- {
- return annotationArea;
- }
-
- public void editPartAttached(EditPart owner)
- {
- StructureEditPart structureEditPart = null;
- for (EditPart parent = owner.getParent(); parent != null; parent = parent.getParent())
- {
- if (parent instanceof StructureEditPart)
- {
- structureEditPart = (StructureEditPart) parent;
- break;
- }
- }
- RowLayout rowLayout = (RowLayout)rowFigure.getLayoutManager();
- IStructureFigure typeFigure = structureEditPart.getStructureFigure();
- Assert.isTrue(typeFigure instanceof StructureFigure, "Expected object of type StructureFigure");
- rowLayout.setColumnData(((StructureFigure)typeFigure).getColumnData());
- }
-
- public void addSelectionFeedback()
- {
- }
-
- public void removeSelectionFeedback()
- {
- }
-
- public void refreshVisuals(Object model)
- {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/FieldFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/FieldFigure.java
deleted file mode 100644
index c1d87cc6a0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/FieldFigure.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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.adt.typeviz.design.figures;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.layouts.RowLayout;
-
-public class FieldFigure extends Figure implements IFieldFigure
-{
- // TODO: put this color is some common class
- public static final Color cellColor = new Color(null, 224, 233, 246);
-
-// For fix to https://bugs.eclipse.org/bugs/show_bug.cgi?id=161940
-// public static final Color leftOuterBorderColor = new Color(null, 253, 196, 88);
-// public static final Color leftInnerBorderColor = new Color(null, 253, 226, 172);
-// public static final Color rightOuterBorderColor = new Color(null, 150, 179, 224);
-// public static final Color rightInnerBorderColor = new Color(null, 49, 106, 197);
-
- // Formatting constraints
- public static final int TOP_MARGIN = 2; // pixels
- public static final int BOTTOM_MARGIN = TOP_MARGIN + 1; // extra pixel for the
- // footer line
- public static final int LEFT_MARGIN = 2;
- public static final int RIGHT_MARGIN = LEFT_MARGIN;
- public static final int RIGHT_SIDE_PADDING = 6;
-
- // States requiring decorators, and their icons
- // protected static final Image errorIcon = ICON_ERROR;
-
- // Labels which handle presentation of name and type
- public Figure rowFigure;
- protected Label nameLabel;
- protected Label nameAnnotationLabel; // for occurrence text, or error icons
- protected Label typeLabel;
- protected Label typeAnnotationLabel; // for occurrence text, or error icons
- protected Label toolTipLabel;
-
- public boolean hasFocus = false;
-
- public FieldFigure()
- {
- super();
- setLayoutManager(new ToolbarLayout());
- rowFigure = new Figure();
- RowLayout rowLayout = new RowLayout();
- rowFigure.setLayoutManager(rowLayout);
-
- add(rowFigure);
-
- nameLabel = new Label();
- nameLabel.setBorder(new MarginBorder(3, 5, 3, 5));
- nameLabel.setLabelAlignment(PositionConstants.LEFT);
- nameLabel.setOpaque(true);
- rowFigure.add(nameLabel);
-
- nameAnnotationLabel = new Label();
- nameAnnotationLabel.setBorder(new MarginBorder(3, 5, 3, 5));
- nameAnnotationLabel.setLabelAlignment(PositionConstants.LEFT);
- nameAnnotationLabel.setOpaque(true);
- rowFigure.add(nameAnnotationLabel);
-
- toolTipLabel = new Label();
-// Don't show tooltip for now. Annoying vertical line shows up. Safe fix.
-// nameLabel.setToolTip(toolTipLabel);
- typeLabel = new Label();
-
- // cs : we need to add some additional padding to the right
- // so that when we edit the field there's room for the combobox's arrow
- // and the type name won't be partially obscured
- //
- typeLabel.setBorder(new MarginBorder(3, 5, 3, 20));
- typeLabel.setLabelAlignment(PositionConstants.LEFT);
- typeLabel.setOpaque(true);
- rowFigure.add(typeLabel);
-
- typeAnnotationLabel = new Label() {
-
- public Dimension getPreferredSize(int wHint, int hHint)
- {
- if (getText() == null || getText().equals(""))
- {
- return new Dimension(0, 0);
- }
- return super.getPreferredSize(wHint, hHint);
- }
- };
- typeAnnotationLabel.setBorder(new MarginBorder(3, 5, 3, 5));
- typeAnnotationLabel.setLabelAlignment(PositionConstants.LEFT);
- typeAnnotationLabel.setOpaque(true);
- rowFigure.add(typeAnnotationLabel);
-// Don't show tooltip for now. Annoying vertical line shows up. Safe fix.
-// typeAnnotationLabel.setToolTip(toolTipLabel);
-
- rowLayout.setConstraint(nameLabel, "name");
- rowLayout.setConstraint(nameAnnotationLabel, "nameAnnotation");
- rowLayout.setConstraint(typeLabel, "type");
- rowLayout.setConstraint(typeAnnotationLabel, "typeAnnotation");
- }
-
- /**
- * @return Returns the "name" string used by this figure.
- */
- public String getName()
- {
- return nameLabel.getText();
- }
-
- /**
- * @return Returns the figure representing the attribute name
- */
- public Label getNameLabel()
- {
- return nameLabel;
- }
-
- /**
- * @return Returns the "type" string used by this figure.
- */
- public String getType()
- {
- return typeLabel.getText();
- }
-
- /**
- * @return Returns the figure representing the attribute's type
- */
- public Label getTypeLabel()
- {
- return typeLabel;
- }
-
- /**
- * @param name
- * Set the "name" string used by this figure.
- */
- public void setName(String name)
- {
- nameLabel.setText(name);
- }
-
- /**
- * @param type
- * Set the "type" string used by this figure.
- */
- public void setType(String type)
- {
- typeLabel.setText(type);
- }
-
- public void setTypeToolTipText(String toolTip)
- {
- setNameToolTipText(toolTip);
- }
-
- public void setNameToolTipText(String toolTip)
- {
- if (toolTip.length() > 0)
- {
- nameLabel.setToolTip(toolTipLabel);
- toolTipLabel.setText(toolTip);
- }
- else
- {
- nameLabel.setToolTip(null);
- }
- }
-
- public void setNameAnnotationLabel(String text)
- {
- nameAnnotationLabel.setText(text);
- }
-
- public void setNameAnnotationLabelIcon(Image icon)
- {
- nameAnnotationLabel.setIcon(icon);
- }
-
- public Label getNameAnnotationLabel()
- {
- return nameAnnotationLabel;
- }
-
- public void setTypeAnnotationLabel(String text)
- {
- typeAnnotationLabel.setText(text);
- }
-
- public void setTypeAnnotationLabelIcon(Image icon)
- {
- typeAnnotationLabel.setIcon(icon);
- }
-
- public Label getTypeAnnotationLabel()
- {
- return typeAnnotationLabel;
- }
-
- public void recomputeLayout()
- {
- RowLayout layout = (RowLayout)rowFigure.getLayoutManager();
- if (layout != null && layout.getColumnData() != null)
- {
- layout.getColumnData().clearColumnWidths();
- }
- }
-
- public void editPartAttached(EditPart owner)
- {
- StructureEditPart structureEditPart = null;
- for (EditPart parent = owner.getParent(); parent != null; parent = parent.getParent())
- {
- if (parent instanceof StructureEditPart)
- {
- structureEditPart = (StructureEditPart) parent;
- break;
- }
- }
- RowLayout rowLayout = (RowLayout)rowFigure.getLayoutManager();
- IStructureFigure typeFigure = structureEditPart.getStructureFigure();
- Assert.isTrue(typeFigure instanceof StructureFigure, "Expected object of type StructureFigure");
- rowLayout.setColumnData(((StructureFigure)typeFigure).getColumnData());
- }
-
- public void addSelectionFeedback()
- {
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (highContrast)
- {
- rowFigure.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- rowFigure.setBackgroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- }
- else
- {
- rowFigure.setBackgroundColor(cellColor);
- }
- }
-
- public void removeSelectionFeedback()
- {
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (highContrast)
- {
- rowFigure.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- rowFigure.setBackgroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- }
- else
- {
- rowFigure.setBackgroundColor(getBackgroundColor());
- }
- }
-
- public void refreshVisuals(Object model)
- {
- }
-
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
- if (hasFocus)
- {
- try
- {
- graphics.pushState();
- Rectangle r = getBounds();
- graphics.setXORMode(true);
- graphics.drawFocus(r.x, r.y + 1, r.width - 1, r.height - 2);
- }
- finally
- {
- graphics.popState();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/HeadingFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/HeadingFigure.java
deleted file mode 100644
index 6c275d68b3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/HeadingFigure.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.graphics.Color;
-
-public class HeadingFigure extends Figure
-{
- public static final Color headerColor = new Color(null, 224, 233, 246);
- Label label;
- Color[] gradientColor = {ColorConstants.white,
- ColorConstants.lightGray,
- ColorConstants.lightBlue,
- ColorConstants.gray};
- boolean isSelected = false;
- boolean isReadOnly = false;
-
- public HeadingFigure()
- {
- label = new Label();
- label.setBorder(new MarginBorder(2));
- ToolbarLayout toolbarLayout = new ToolbarLayout(false);
- toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
- setLayoutManager(toolbarLayout);
- add(label);
- }
-
- public void setGradientColors(Color[] colors)
- {
- this.gradientColor = colors;
- }
-
- public void setSelected(boolean isSelected)
- {
- this.isSelected = isSelected;
- }
-
- public void setIsReadOnly(boolean isReadOnly)
- {
- this.isReadOnly = isReadOnly;
- }
-
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
-
- graphics.pushState();
- try
- {
- // Fill for the header section
- //
- Rectangle r = getBounds().getCopy();
- graphics.setBackgroundColor(ColorConstants.lightGray);
-
- Color gradient1 = isReadOnly ? gradientColor[1] : headerColor;
- if (isSelected && isReadOnly) gradient1 = gradientColor[3];
- else if (isSelected && !isReadOnly) gradient1 = gradientColor[2];
- Color gradient2 = gradientColor[0];
- graphics.setForegroundColor(gradient1);
- graphics.setBackgroundColor(gradient2);
- Rectangle labelBounds = label.getBounds();
- graphics.fillGradient(r.x+1, r.y+1, r.width-2, labelBounds.height - 2, true);
- graphics.setForegroundColor(ColorConstants.darkGray);
- label.paint(graphics);
- }
- finally
- {
- graphics.popState();
- }
- }
-
- public Label getLabel()
- {
- return label;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/RoundedLineBorder.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/RoundedLineBorder.java
deleted file mode 100644
index 93e80f1bee..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/RoundedLineBorder.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.adt.typeviz.design.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);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/StructureFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/StructureFigure.java
deleted file mode 100644
index 990f64b8ea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/StructureFigure.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-
-
-public class StructureFigure extends BoxFigure implements IStructureFigure
-{
- public void editPartAttached(EditPart owner)
- {
- // nothing to do here :-)
- }
-
- public void addSelectionFeedback()
- {
- LineBorder boxFigureLineBorder = (LineBorder)getBorder();
- boxFigureLineBorder.setWidth(2);
- // TODO (cs) need to fix this
- //boxFigureLineBorder.setColor(getComplexType().isReadOnly() ? ColorConstants.darkGray : ColorConstants.darkBlue);
- getHeadingFigure().setSelected(true);
- repaint();
- }
-
- public void removeSelectionFeedback()
- {
- LineBorder boxFigureLineBorder = (LineBorder)getBorder();
- boxFigureLineBorder.setWidth(1);
- getHeadingFigure().setSelected(false);
- repaint();
- }
-
- public boolean hitTestHeader(Point location)
- {
- IFigure target = getHeadingFigure();
- Rectangle b = target.getBounds().getCopy();
- target.translateToAbsolute(b);
- return b.contains(location);
- }
-
- public void refreshVisuals(Object model)
- {
- IStructure structure = (IStructure)model;
- getNameLabel().setText(structure.getName());
- getHeadingFigure().setIsReadOnly(structure.isReadOnly());
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/TypeVizFigureFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/TypeVizFigureFactory.java
deleted file mode 100644
index 08260fb34f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/TypeVizFigureFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
-
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.ICompartmentFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.design.figures.IModelGroupFigure;
-import org.eclipse.wst.xsd.ui.internal.design.figures.ModelGroupFigure;
-
-public class TypeVizFigureFactory implements IExtendedFigureFactory
-{
- public IStructureFigure createStructureFigure(Object model)
- {
- StructureFigure figure = new StructureFigure();
- figure.setBorder(new LineBorder(1));
- ToolbarLayout toolbarLayout = new ToolbarLayout();
- toolbarLayout.setStretchMinorAxis(true);
- figure.setLayoutManager(toolbarLayout);
-
- if (model instanceof ITreeElement)
- {
- figure.getNameLabel().setIcon(((ITreeElement)model).getImage());
- }
- //figure.getHeadingFigure().setIsReadOnly(getComplexType().isReadOnly());
- // we should organize ITreeElement and integrate it with the facade
- return figure;
- }
-
- public IFieldFigure createFieldFigure(Object model)
- {
- // TODO Auto-generated method stub
- return new FieldFigure();
- }
-
- public ICompartmentFigure createCompartmentFigure(Object model)
- {
- CompartmentFigure figure = new CompartmentFigure();
- figure.setBorder(new MarginBorder(1));
- ToolbarLayout toolbarLayout = new ToolbarLayout(false);
- toolbarLayout.setStretchMinorAxis(true);
- figure.setLayoutManager(toolbarLayout);
- return figure;
- }
-
- public IModelGroupFigure createModelGroupFigure(Object model)
- {
- // TODO Auto-generated method stub
- return new ModelGroupFigure();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/ColumnData.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/ColumnData.java
deleted file mode 100644
index 58e9dab1ee..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/ColumnData.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.adt.typeviz.design.layouts;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-public class ColumnData
-{
- HashMap map = new HashMap();
-
- class Entry
- {
- int width = 0;
- int weight = 1;
- }
-
- public void clearColumnWidths()
- {
- for (Iterator i = map.values().iterator(); i.hasNext();)
- {
- Entry entry = (Entry)i.next();
- entry.width = 0;
- }
- }
-
- private Entry lookupOrCreateColumnEntry(String identifier)
- {
- Entry entry = (Entry)map.get(identifier);
- if (entry == null)
- {
- entry = new Entry();
- map.put(identifier, entry);
- }
- return entry;
- }
-
- void stretchColumnWidthIfNeeded(String identifier, int width)
- {
- Entry entry = lookupOrCreateColumnEntry(identifier);
- entry.width = Math.max(entry.width, width);
- }
-
- int getColumnWidth(String identifier)
- {
- Entry entry = (Entry)map.get(identifier);
- if (entry != null)
- {
- return entry.width;
- }
- else
- {
- return 0;//hmm should we return -1 ?
- }
- }
-
- int getColumnWeight(String identifier)
- {
- Entry entry = (Entry)map.get(identifier);
- if (entry != null)
- {
- return entry.weight;
- }
- else
- {
- return 0;
- }
- }
-
- public void setColumnWeight(String identifier, int weight)
- {
- Entry entry = lookupOrCreateColumnEntry(identifier);
- entry.weight = weight;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/RowLayout.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/RowLayout.java
deleted file mode 100644
index fc9067779f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/RowLayout.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.adt.typeviz.design.layouts;
-
-import java.util.HashMap;
-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;
-
-public class RowLayout extends AbstractLayout
-{
- // layout is associated with a parent context
- // any layout manager under the parent context is connected
- // column rows are maintained accross container boundaries
- protected ColumnData columnData;
- protected HashMap figureToContstraintMap = new HashMap();
-
- public RowLayout()
- {
- super();
- }
-
-
- // this method computes the minimum size required to display the figures
- //
- private Dimension calculateChildrenSize(IFigure container, List children, int wHint, int hHint, boolean preferred)
- {
- Dimension childSize;
- IFigure child;
- int height = 0;
- int width = 0;
-
- //IRowFigure figure = (IRowFigure)container;
-
- // for each cell in the row
- //
- for (int i = 0; i < children.size(); i++)
- {
- child = (IFigure) children.get(i);
- String columnIdenifier = (String)getConstraint(child);
-
- // first we compute the child size without regard for columnData
- //
- childSize = child.getPreferredSize(wHint, hHint);// : child.getMinimumSize(wHint, hHint);
-
- // now that the columnData has been populated we can consider if the row needs to be larger
- //
- int effectiveWidth = childSize.width;
- if (columnIdenifier != null)
- {
- columnData.stretchColumnWidthIfNeeded(columnIdenifier, childSize.width);
- effectiveWidth = columnData.getColumnWidth(columnIdenifier);
- }
- height = Math.max(childSize.height, height);
- width += effectiveWidth;
- }
- return new Dimension(width, height);
- }
-
-
-
- protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint)
- {
- List children = container.getChildren();
- Dimension prefSize = calculateChildrenSize(container, children, wHint, hHint, true);
- return prefSize;
- }
-
- public void layout(IFigure parent)
- {
- // layout a table with the columns aligned
- //IRowFigure rowFigure = (IRowFigure)parent;
- Rectangle clientArea = parent.getClientArea();
- List children = parent.getChildren();
- Rectangle r = new Rectangle();
- r.x = clientArea.x;
- r.y = clientArea.y;
- r.height = clientArea.height;
-
- int childrenSize = children.size();
- Rectangle[] bounds = new Rectangle[childrenSize];
-
- // for each cell in the row
- //
- int requiredWidth = 0;
- int totalColumnWeight = 0;
- for (int i = 0; i < childrenSize; i++)
- {
- IFigure child = (IFigure) children.get(i);
- //String columnIdenifier = figure.getColumnIdentifier(child);
- // first we compute the child size without regard for columnData
- //
- Dimension childSize = child.getPreferredSize(-1, -1);
-
- int columnWidth = -1;
- //String columnIdentifier = rowFigure.getColumnIdentifier(child);
- String columnIdentifier = (String)getConstraint(child);
- if (columnIdentifier != null)
- {
- //columnData.stretchColumnWidthIfNeeded(columnIdentifier, childSize.width);
- columnWidth = columnData.getColumnWidth(columnIdentifier);
- totalColumnWeight += columnData.getColumnWeight(columnIdentifier);
- }
- r.width = Math.max(childSize.width, columnWidth);
- requiredWidth += r.width;
- bounds[i] = new Rectangle(r);
- r.x += r.width;
- }
- if (totalColumnWeight < 1)
- {
- totalColumnWeight = 1;
- }
- int extraWidth = Math.max(clientArea.width - requiredWidth, 0);
- int extraWidthAllocated = 0;
- for (int i = 0; i < childrenSize; i++)
- {
- IFigure child = (IFigure) children.get(i);
- Rectangle b = bounds[i];
- if (extraWidth > 0)
- {
- String columnIdentifier = (String)getConstraint(child);
- if (columnIdentifier != null)
- {
- int weight = columnData.getColumnWeight(columnIdentifier);
- float fraction = (float)weight / (float)totalColumnWeight;
- int extraWidthForChild = (int)(extraWidth * fraction);
-
- b.width += extraWidthForChild;
- b.x += extraWidthAllocated;
- extraWidthAllocated += extraWidthForChild;
- }
- else
- {
- b.x += extraWidthAllocated;
- }
- }
- child.setBounds(new Rectangle(b));
- }
- }
-
- public ColumnData getColumnData()
- {
- return columnData;
- }
-
- public void setColumnData(ColumnData columnData)
- {
- this.columnData = columnData;
- }
-
- public Object getConstraint(IFigure child)
- {
- return figureToContstraintMap.get(child);
- }
-
- public void setConstraint(IFigure child, Object constraint)
- {
- figureToContstraintMap.put(child, constraint);
- }
-
- public void invalidate()
- {
- //figureToContstraintMap.clear();
- //this.columnData.clearColumnWidths();
- super.invalidate();
-
- }
-}
-

Back to the top