public StackContainerController ( final SymbolController controller, final StackContainer element, final BasicViewElementFactory factory ) throws Exception { this.figure = new Layer (); this.figure.setOpaque ( false ); this.figure.setLayoutManager ( this.layout = new StackLayout () ); this.layout.setObserveVisibility ( true ); for ( final Primitive child : element.getChildren () ) { final Controller elementController = factory.create ( controller, child ); final IFigure childFigure = elementController.getFigure (); controller.addRawElement ( child.getName (), elementController ); this.figure.add ( childFigure ); } controller.addElement ( element, this ); }
/** * Creates a new LabelFigure with a MarginBorder that is the given size and * a FlowPage containing a TextFlow with the style WORD_WRAP_SOFT. * * @param borderSize * the size of the MarginBorder */ public ComponentLabelFigure(int borderSize) { setBorder(new MarginBorder(borderSize)); flowPage = new FlowPage(); textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT)); flowPage.add(textFlow); flowPage.setHorizontalAligment(PositionConstants.CENTER); setLayoutManager(new StackLayout()); add(flowPage); font = new Font( Display.getDefault(), "Arial", 9, SWT.NORMAL ); setFont(font); setForegroundColor(ColorConstants.black); }
/** * Creates a new CommentBoxFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow * with the style WORD_WRAP_SOFT. * * @param borderSize * the size of the MarginBorder */ public CommentBoxFigure(int borderSize) { setBorder(new MarginBorder(5)); FlowPage flowPage = new FlowPage(); textFlow = new TextFlow(); textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT)); flowPage.add(textFlow); setLayoutManager(new StackLayout()); add(flowPage); font = new Font(Display.getDefault(), "Arial", 9, SWT.NORMAL); setFont(font); setForegroundColor(ColorConstants.black); setOpaque(false); }
/** * createTextFlow * * @return TextFlow */ public TextFlow createTextFlow() { // FlowPage flowPage = new FlowPage(); // TextFlow flow = new TextFlow(); flow.setLayoutManager(new ParagraphTextLayout(flow, ParagraphTextLayout.WORD_WRAP_SOFT)); flow.setForegroundColor(new Color(null, 0, 0, 0)); if (getName() != null) flow.setText(getName()); else flow.setText(""); //$NON-NLS-1$ flowPage.add(flow); flowPage.setHorizontalAligment(PositionConstants.LEFT); setLayoutManager(new StackLayout()); add(flowPage); return flow; }
/** * createTextFlow * * @return TextFlow */ public TextFlow createTextFlow() { flowPage = new FlowPage(); flow = new TextFlow(); flow.setLayoutManager(new ParagraphTextLayout(flow, ParagraphTextLayout.WORD_WRAP_SOFT)); flow.setForegroundColor(new Color(null, 0, 0, 0)); if (getName() != null) flow.setText(getName()); else flow.setText(""); //$NON-NLS-1$ flowPage.add(flow); flowPage.setHorizontalAligment(PositionConstants.LEFT); flowPage.setBorder(new MarginBorder(new Insets(15, 7, 7, 7))); setLayoutManager(new StackLayout()); add(flowPage); return flow; }
@Override protected NodeFigure createNodeFigure() { NodeFigure figure = new DefaultSizeNodeFigure(getDefaultSize()) { @Override // StateFigure is drawed smaller (Blurshadow size) public Rectangle getHandleBounds() { Insets insets = new Insets(0, 0, StateFigure.BLUR_SHADOW_WIDTH, StateFigure.BLUR_SHADOW_WIDTH); return new Rectangle(getBounds().x + insets.left, getBounds().y + insets.top, getBounds().width - (insets.right + insets.left), getBounds().height - (insets.bottom + insets.top)); } }; figure.setLayoutManager(new StackLayout()); figure.setMinimumSize(getDefaultSize()); figure.add(createPrimaryShape()); return figure; }
@Override protected NodeFigure createNodeFigure() { final NodeFigure figure = new NodeFigure() { @Override public PointList getPolygonPoints() { PointList points = new PointList(5); Rectangle handleBounds = getHandleBounds(); points.addPoint(handleBounds.x + (handleBounds.width / 2), handleBounds.y); points.addPoint(handleBounds.x + handleBounds.width, handleBounds.y + (handleBounds.height / 2)); points.addPoint(handleBounds.x + (handleBounds.width / 2), handleBounds.y + handleBounds.height); points.addPoint(handleBounds.x, handleBounds.y + handleBounds.height / 2); points.addPoint(handleBounds.x + (handleBounds.width / 2), handleBounds.y); return points; } }; figure.setLayoutManager(new StackLayout()); figure.add(createPrimaryShape()); figure.setBackgroundColor(org.eclipse.draw2d.ColorConstants.white); figure.setForegroundColor(org.eclipse.draw2d.ColorConstants.black); figure.setMinimumSize(getDefaultSize()); return figure; }
protected void createContents() { // Name Label nameFigure = new SyntaxColoringLabel(); nameFigure.setAlignment(PositionConstants.CENTER); this.add(nameFigure, GridDataFactory.fillDefaults().grab(true, false) .getData()); // Text compartment textCompartmentPane = new Figure(); textCompartmentPane.setLayoutManager(new StackLayout()); this.add(textCompartmentPane, GridDataFactory.fillDefaults().grab(true, true).getData()); figureCompartmentPane = new Figure(); figureCompartmentPane.setLayoutManager(new StackLayout()); this.add(figureCompartmentPane, GridDataFactory.fillDefaults().grab(true, true).getData()); }
public ChartController ( final SymbolController symbolController, final ResourceManager resourceManager, final ChartView view, final SymbolLoader symbolLoader, final FactoryContext context ) { super ( symbolController, resourceManager ); this.context = context; this.symbolLoader = symbolLoader; this.wrapperFigure = new Figure () { @Override public void addNotify () { super.addNotify (); start (); } @Override public void removeNotify () { stop (); super.removeNotify (); } }; this.wrapperFigure.setOpaque ( false ); this.figure = new ChartFigure ( Display.getCurrent (), resourceManager ); this.wrapperFigure.setLayoutManager ( new StackLayout () ); this.wrapperFigure.add ( this.figure ); this.errorFigure = new ErrorFigure (); symbolController.addElement ( view, this ); applyCommon ( view ); }
public FigureContainerController ( final SymbolController controller, final FigureContainer element, final ResourceManager manager, final BasicViewElementFactory viewElementFactory ) throws Exception { super ( controller, manager ); this.figure = new Figure () { @Override public void addNotify () { super.addNotify (); start (); } @Override public void removeNotify () { stop (); super.removeNotify (); } }; if ( element.getSize () != null ) { final PrecisionRectangle rect = new PrecisionRectangle (); rect.setPreciseSize ( element.getSize ().getWidth (), element.getSize ().getHeight () ); this.figure.setBounds ( rect ); } controller.addElement ( element, this ); this.figure.setLayoutManager ( new StackLayout () ); this.figure.add ( viewElementFactory.create ( controller, element.getContent () ).getFigure () ); applyCommon ( element ); }
public PickerColumnFigure() { pane = new FreeformLayer(); pane.setLayoutManager(new FreeformLayout()); setLayoutManager(new StackLayout()); container = new TitaniumFigure(); container.setLayoutManager(new FreeformLayout()); pane.add(container); scrollpane = new ScrollPane(); scrollpane.setHorizontalScrollBarVisibility(ScrollPane.NEVER); scrollpane.setVerticalScrollBarVisibility(ScrollPane.NEVER); scrollpane.setViewport(new FreeformViewport()); scrollpane.setContents(pane); add(scrollpane); }
public ScrollViewFigure() { pane = new FreeformLayer(); pane.setLayoutManager(new FreeformLayout()); setLayoutManager(new StackLayout()); container = new TitaniumFigure(); container.setLayoutManager(new FreeformLayout()); pane.add(container); scrollpane = new ScrollPane(); scrollpane.setScrollBarVisibility(ScrollPane.AUTOMATIC); scrollpane.setViewport(new FreeformViewport()); scrollpane.setContents(pane); add(scrollpane); }
/** * PackageFigure * @param isDangling */ public PackageFigure(boolean isDangling) { setDangling(isDangling); setLayoutManager(new StackLayout() { @SuppressWarnings("unchecked") public void layout(IFigure figure) { Rectangle rectangle = figure.getClientArea(); List children = figure.getChildren(); IFigure child; org.eclipse.draw2d.geometry.Dimension dimension; int sizeValue = children.size(); for (int i = 0; i < children.size(); i++) { if (!(children.get(i) instanceof RectangleFigure)) { child = (IFigure) children.get(i); dimension = child.getPreferredSize(rectangle.width, rectangle.height); dimension.width = Math.min(dimension.width, rectangle.width); dimension.height = Math.min(dimension.height, rectangle.height); Rectangle childRect = new Rectangle(rectangle.x + (rectangle.width - dimension.width) / 2, rectangle.y + (rectangle.height - dimension.height) / 2 + (int) (i * dimension.height) - (sizeValue * 3), dimension.width, dimension.height); child.setBounds(childRect); } } } }); setOpaque(true); }
/** * StickMan * @param is3D * @param backgroundColor * @param foregroundColor */ public StickMan(boolean is3D, Color backgroundColor, Color foregroundColor) { super(is3D, backgroundColor, foregroundColor); setKeepingProportions(true); setW2HRatio(BASE_W / BASE_H); setLayoutManager(new StackLayout()); }
/** * CollaborationFigure * * @param isDangling */ public CollaborationFigure(boolean isDangling) { this.isDangling = isDangling; this.setLineStyle(SWT.BORDER_DASH); setLayoutManager(new StackLayout() { @SuppressWarnings("unchecked") public void layout(IFigure figure) { Rectangle rectangle = figure.getClientArea(); List children = figure.getChildren(); IFigure child; org.eclipse.draw2d.geometry.Dimension dimension; for (int i = 0; i < children.size(); i++) { child = (IFigure) children.get(i); dimension = child.getPreferredSize(rectangle.width, rectangle.height); dimension.width = Math.min(dimension.width, rectangle.width); dimension.height = Math.min(dimension.height, rectangle.height); Rectangle childRect = new Rectangle(rectangle.x + (rectangle.width - dimension.width) / 2, rectangle.y + (rectangle.height - dimension.height) / 2 + (int) (i * dimension.height) - (10 * (children.size() - 1)), dimension.width, dimension.height); child.setBounds(childRect); } } }); setOpaque(true); }
/** * DeleteSignFigure * @param string */ public DeleteSignFigure(String string) { setBorder(new LineBorder(ColorConstants.black)); setLayoutManager(new StackLayout() { @SuppressWarnings("unchecked") public void layout(IFigure figure) { Rectangle rectangle = figure.getClientArea(); List children = figure.getChildren(); IFigure child; org.eclipse.draw2d.geometry.Dimension dimension; int sizeValue = children.size(); for (int i = 0; i < children.size(); i++) { if (!(children.get(i) instanceof RectangleFigure)) { child = (IFigure) children.get(i); dimension = child.getPreferredSize(rectangle.width, rectangle.height); dimension.width = Math.min(dimension.width, rectangle.width); dimension.height = Math.min(dimension.height, rectangle.height); Rectangle childRect = new Rectangle(rectangle.x + (rectangle.width - dimension.width) / 2, rectangle.y + (rectangle.height - dimension.height) / 2 + (int) (i * dimension.height) - (sizeValue * 3), dimension.width, dimension.height); child.setBounds(childRect); } } } }); Label nameLabel = new Label(string); add(nameLabel); }
/** * UseCaseFigure * * @param isDangling */ public UseCaseFigure(boolean isDangling) { this.isDangling = isDangling; setLayoutManager(new StackLayout() { @SuppressWarnings("unchecked") public void layout(IFigure figure) { Rectangle rectangle = figure.getClientArea(); List children = figure.getChildren(); IFigure child; org.eclipse.draw2d.geometry.Dimension dimension; for (int i = 0; i < children.size(); i++) { child = (IFigure) children.get(i); dimension = child.getPreferredSize(rectangle.width, rectangle.height); dimension.width = Math.min(dimension.width, rectangle.width); dimension.height = Math.min(dimension.height, rectangle.height); Rectangle childRect = new Rectangle(rectangle.x + (rectangle.width - dimension.width) / 2, rectangle.y + (rectangle.height - dimension.height) / 2 + (int) (i * dimension.height) - (10 * (children.size() - 1)), dimension.width, dimension.height); child.setBounds(childRect); } } }); setOpaque(true); }
/** * Creates figure for this edit part. * * Body of this method does not depend on settings in generation model * so you may safely remove <i>generated</i> tag and modify it. * * @generated */ protected NodeFigure createNodeFigure() { NodeFigure figure = createNodePlate(); figure.setLayoutManager(new StackLayout()); IFigure shape = createNodeShape(); figure.add(shape); contentPane = setupContentPane(shape); return figure; }
@Override protected NodeFigure createMainFigure() { final NodeFigure figure = new EllipseAnchorDefaultSizeNodeFigure(MapModeUtils.DEFAULT_SMALL_NODE_DIMENSION); figure.setLayoutManager(new StackLayout()); figure.add(createPrimaryShape()); figure.setBackgroundColor(ColorConstants.black); figure.setForegroundColor(ColorConstants.white); return figure; }
@Override protected NodeFigure createNodeFigure() { final NodeFigure figure = new NodeFigure(); figure.setLayoutManager(new StackLayout()); figure.add(new StatechartTextFigure(getMapMode())); figure.setMinimumSize(new Dimension(0, 0)); return figure; }
@Override protected void addChildVisual(EditPart childEditPart, int index) { if (childEditPart instanceof StatechartNameEditPart) { ((StatechartNameEditPart) childEditPart).setLabel(getPrimaryShape().getName()); } else if (childEditPart instanceof StatechartTextExpressionEditPart) { IFigure pane = getPrimaryShape().getCompartment(); pane.setLayoutManager(new StackLayout()); IFigure compartmentFigure = ((StatechartTextExpressionEditPart) childEditPart).getFigure(); pane.add(compartmentFigure); } else super.addChildVisual(childEditPart, index); }
@Override protected NodeFigure createNodeFigure() { final NodeFigure figure = new NodeFigure(); figure.setLayoutManager(new StackLayout()); figure.setMinimumSize(new Dimension(0, 0)); figure.add(new RegionFigure(getMapMode())); return figure; }
@Override protected void addChildVisual(EditPart childEditPart, int index) { if (childEditPart instanceof RegionCompartmentEditPart) { IFigure pane = getPrimaryShape().getCompartmentPane(); pane.setLayoutManager(new StackLayout()); IFigure figure2 = ((RegionCompartmentEditPart) childEditPart).getFigure(); pane.add(figure2); } else if (childEditPart instanceof RegionNameEditPart) { ((RegionNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); } else super.addChildVisual(childEditPart, index); }
@Override protected NodeFigure createNodeFigure() { final DefaultSizeNodeFigure nodeFigure = new DefaultSizeNodeFigure(getMapMode().DPtoLP(DEFAULT_WIDTH), getMapMode().DPtoLP(DEFAULT_HEIGHT)); nodeFigure.setLayoutManager(new StackLayout()); nodeFigure.add(new SynchronizationFigure(getMapMode())); nodeFigure.setForegroundColor(ColorConstants.black); nodeFigure.setBackgroundColor(ColorConstants.black); return nodeFigure; }
@Override protected NodeFigure createMainFigure() { final NodeFigure figure = new EllipseAnchorDefaultSizeNodeFigure(MapModeUtils.DEFAULT_SMALL_NODE_DIMENSION); figure.setLayoutManager(new StackLayout()); figure.add(new ExitFigure(getMapMode())); figure.setForegroundColor(ColorConstants.black); figure.setBackgroundColor(ColorConstants.white); return figure; }
public PriorityFigure(IMapMode mapMode, int priority) { this.setLayoutManager(new StackLayout()); setForegroundColor(ColorConstants.black); setBackgroundColor(ColorConstants.white); this.setOutline(false); setOpaque(false); setFill(true); this.setLineWidth(-1); Label label = new Label(String.valueOf(priority)); label.setFont(priority > 9 ? SMALL_FONT : NORMAL_FONT); add(label); }
private void createContents() { nameLabel = new SyntaxColoringLabel(); GridData data = GridDataFactory.fillDefaults().grab(true, false).getData(); data.horizontalIndent = 5; nameLabel.setTextPlacement(PositionConstants.WEST); this.add(nameLabel, data); /** Compartment container **/ compartmentPane = new RectangleFigure(); compartmentPane.setOutline(false); compartmentPane.setLayoutManager(new StackLayout()); compartmentPane.setFill(false); this.add(compartmentPane, GridDataFactory.fillDefaults().grab(true, true).getData()); }
private void createContents() { name = new SyntaxColoringLabel(); name.setLayoutManager(new StackLayout()); GridData data = GridDataFactory.fillDefaults() .align(GridData.CENTER, GridData.CENTER).grab(true, false) .getData(); this.add(name, data); // Text compartment compartment = new Figure(); this.add(compartment, GridDataFactory.fillDefaults().grab(true, true) .getData()); }
/** * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure() */ public IFigure createFigure() { Figure figure = new Figure() { public Dimension getPreferredSize(int wHint, int hHint) { if (PaletteStackEditPart.this.getChildren().isEmpty()) return EMPTY_DIMENSION; return super.getPreferredSize(wHint, hHint); } }; figure.setLayoutManager(new BorderLayout()); contentsFigure = new Figure(); StackLayout stackLayout = new StackLayout(); // make it so the stack layout does not allow the invisible figures to // contribute // to its bounds stackLayout.setObserveVisibility(true); contentsFigure.setLayoutManager(stackLayout); figure.add(contentsFigure, BorderLayout.CENTER); arrowFigure = new RolloverArrow(); arrowFigure.addChangeListener(clickableArrowListener); arrowFigure.addActionListener(actionListener); figure.add(arrowFigure, BorderLayout.RIGHT); return figure; }
/** * Creates figure for this edit part. * * Body of this method does not depend on settings in generation model * so you may safely remove <i>generated</i> tag and modify it. * * @generated */ protected NodeFigure createMainFigure() { NodeFigure figure = createNodePlate(); figure.setLayoutManager(new StackLayout()); IFigure shape = createNodeShape(); figure.add(shape); contentPane = setupContentPane(shape); return figure; }
@Override public void createPartControl(final Composite parent) { canvas = new FigureCanvas(parent, SWT.V_SCROLL | SWT.H_SCROLL); rootFigure = new Figure(); rootFigure.addMouseListener(selectionProvider); rootFigure.setLayoutManager(new StackLayout()); rootFigure.setVisible(true); canvas.setContents(rootFigure); getSite().setSelectionProvider(selectionProvider); createActions(); }
protected IFigure createFigure( ) { LabelFigure label = new LabelFigure( ); label.setLayoutManager( new StackLayout( ) ); return label; }