public XYContainerController ( final SymbolController controller, final XYContainer element, final BasicViewElementFactory factory ) throws Exception { this.figure = new Layer (); this.figure.setOpaque ( false ); this.figure.setLayoutManager ( new XYLayout () ); for ( final XYChild child : element.getChildren () ) { final Controller elementController = factory.create ( controller, child.getElement () ); final IFigure childFigure = elementController.getFigure (); final Rectangle rect = factory.create ( child.getPosition (), child.getDimension () ); controller.addRawElement ( child.getName (), new XYChildController ( childFigure, rect ) ); this.figure.add ( childFigure, rect ); } controller.addElement ( element, this ); }
public DwHiddenChildrenIndicatorFigure(DwFeatureWrapped feature, DwFeatureModelWrapped featureModel) { DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme(); outlineWidth = theme.getLineWidth(); outlineColor = theme.getLineColor(); primaryColor = theme.getFeatureNameAreaSecondaryColor(); secondaryColor = theme.getFeatureNameAreaPrimaryColor(); this.feature = feature; this.featureModel = featureModel; setLayoutManager(new XYLayout()); label = new Label(); label.setForegroundColor(theme.getLineColor()); label.setFont(theme.getFeatureFont()); label.setLocation(new Point(0, (int)(HIDDEN_CHILDREN_INDICATOR_SIZE * 0.5))); label.setSize(new Dimension(HIDDEN_CHILDREN_INDICATOR_SIZE, HIDDEN_CHILDREN_INDICATOR_SIZE)); add(label); }
private static Figure createContents() { Figure contents = new Figure(); XYLayout layout = new XYLayout(); contents.setLayoutManager(layout); Button button = new Button("Hello World"); layout.setConstraint(button, new Rectangle(0, 0, -1, -1)); contents.add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionevent) { setBrightness(); } }); String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg"; image = new Image(Display.getDefault(), path); imageFigure = new ImageFigure(image); layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1)); contents.add(imageFigure); return contents; }
/** * The constructor of this class, where the constructor {@link ORMShapeFigure#ORMShapeFigure()} * is called, the basic {@link ShadowRectangle} is initialized and the child figures for the name( * {@link Label}) is added to the basic rectangle. * * */ public ORMNaturalTypeFigure() { super(); rectangle = new ShadowRectangle(); ToolbarLayout layout = new ToolbarLayout(); layout.setSpacing(8); // set the initial heigth of the child figures setLayoutManager(new XYLayout()); setBackgroundColor(ColorConstants.white); rectangle.setAntialias(SWT.ON); rectangle.setLayoutManager(layout); rectangle.setOpaque(true); setOpaque(true); // add name figure rectangle.add(getLabel()); add(rectangle); }
/** * The constructor of this class, where the constructor {@link ORMShapeFigure#ORMShapeFigure()} * is called, the basic {@link ShadowRoundedRectangle} is initialized * and the child figure for the name( {@link Label}) is added to the basic rectangle. * */ public ORMGroupV1Figure() { super(); rectangle = new ShadowRoundedRectangle(); ToolbarLayout layout = new ToolbarLayout(); layout.setSpacing(4); // set initial heigth of child figures setLayoutManager(new XYLayout()); setBackgroundColor(ColorConstants.white); rectangle.setAntialias(SWT.ON); rectangle.setLayoutManager(layout); rectangle.setOpaque(true); // add name figure rectangle.add(getLabel()); setOpaque(true); add(rectangle); }
public LifelineFigure(final IContourAttributes attributes) { isGutter = (attributes == null); if (isGutter) { head = new Label(""); head.setOpaque(false); head.setBorder(new MarginBorder(5)); } else { head = new Label(attributes.getText(), attributes.getIcon()); final Label tooltip = new Label(attributes.getToolTipText(), attributes.getToolTipIcon()); head.setToolTip(tooltip); head.setToolTip(tooltip); head.setOpaque(true); head.setBorder(LifelineFigure.HEAD_BORDER); head.setIconAlignment(PositionConstants.BOTTOM); head.setLabelAlignment(PositionConstants.LEFT); head.setBackgroundColor(attributes.getLabelBackgroundColor()); } setOpaque(false); setLayoutManager(new XYLayout()); add(head, new Rectangle(0, 0, -1, -1)); }
public ExecutionOccurrenceFigure(final IInitiatorEvent execution, final Color color) { super(); this.isGutter = execution instanceof ISystemStartEvent; final int width = isGutter ? 0 : PreferencesPlugin.getDefault().getActivationWidth(); final int height = (int) execution.duration() * PreferencesPlugin.getDefault().eventHeight(); if (!isGutter) { final IContourAttributes attributes = createAttributes(execution, color); setToolTip(new Label(attributes.getToolTipText(), attributes.getToolTipIcon())); setBackgroundColor(color); } setBounds(new Rectangle(-1, -1, width, height)); setOpaque(false); setOutline(false); setLayoutManager(new XYLayout()); final Rectangle constraint = new Rectangle(width, height, -1, -1); add(new Figure(), constraint); // Ensures the figure has the correct dimensions }
protected void createEditPolicies( ) { installEditPolicy( EditPolicy.COMPONENT_ROLE, new ReportComponentEditPolicy( ) { public boolean understandsRequest( Request request ) { if ( RequestConstants.REQ_DIRECT_EDIT.equals( request.getType( ) ) || RequestConstants.REQ_OPEN.equals( request.getType( ) ) || ReportRequest.CREATE_ELEMENT.equals( request.getType( ) ) ) return true; return super.understandsRequest( request ); } } ); installEditPolicy( EditPolicy.CONTAINER_ROLE, new ReportContainerEditPolicy( ) ); installEditPolicy( EditPolicy.LAYOUT_ROLE, new CrosstabXYLayoutEditPolicy( (XYLayout) getContentPane( ).getLayoutManager( ) ) ); }
protected void createEditPolicies( ) { installEditPolicy( EditPolicy.COMPONENT_ROLE, new ReportComponentEditPolicy( ) { public boolean understandsRequest( Request request ) { if ( RequestConstants.REQ_DIRECT_EDIT.equals( request.getType( ) ) || RequestConstants.REQ_OPEN.equals( request.getType( ) ) || ReportRequest.CREATE_ELEMENT.equals( request.getType( ) ) ) return true; return super.understandsRequest( request ); } } ); installEditPolicy( EditPolicy.CONTAINER_ROLE, new ReportContainerEditPolicy( ) ); // should add highlight policy // installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new // ContainerHighlightEditPolicy()); installEditPolicy( EditPolicy.LAYOUT_ROLE, new TableXYLayoutEditPolicy( (XYLayout) getContentPane( ).getLayoutManager( ) ) ); }
public DepartmentNodeFigure() { ToolbarLayout layout= new ToolbarLayout(); setLayoutManager(layout); label = new Label(); label.setLabelAlignment(PositionConstants.LEFT); label.setForegroundColor(ColorConstants.blue); label.setIcon(Activator.getDefault().getImageRegistry().get(Activator.STATE_MACHINE)); label.setPreferredSize(700, 50); label.setBorder(new MarginBorder(TOP_LEVEL_SPACE)); add(label); Figure line = new RectangleFigure(); line.setBackgroundColor(ColorConstants.lightGray); line.setForegroundColor(ColorConstants.lightGray); line.setPreferredSize(700, 1); add(line); figure = new Figure(); figure.setLayoutManager(new XYLayout()); add(figure); setBorder(new LineBorder(ColorConstants.lightGray, 1)); }
/** * Constructor of the node figure. Set the layout manager and the line width */ public GrlNodeFigure() { super(); autoResize = true; setAntialias(GeneralPreferencePage.getAntialiasingPref()); xylayout = new XYLayout(); this.setLayoutManager(xylayout); setLineWidth(3); initAnchor(); flowPage = new FlowPage(); // Center text in GRL nodes. Vertical centering not available... flowPage.setHorizontalAligment(PositionConstants.CENTER); textFlow = new TextFlow(); // Slightly larger font here used for GRL node labels. textFlow.setFont(new Font(Display.getDefault(), new FontData("Tahoma", 9, SWT.NONE))); //$NON-NLS-1$ textFlow.setVisible(!shouldHideInnerText()); textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_HARD)); flowPage.add(textFlow); add(flowPage); }
private Label createFigure(final String inTitle) { setOpaque(true); setLayoutManager(new XYLayout()); setBorder(new LineBorder(ColorConstants.black)); setBackgroundColor(GraphicalViewerCreator.BG_COLOR); setSize(RelationsConstants.ITEM_WIDTH, RelationsConstants.ITEM_HEIGHT); final Label outLabel = new Label(inTitle); outLabel.setOpaque(true); outLabel.setBackgroundColor(GraphicalViewerCreator.BG_COLOR); outLabel.setLabelAlignment(PositionConstants.LEFT); add(outLabel); setConstraint(outLabel, new Rectangle(ICON_WIDTH, 0, LABEL_WIDTH, RelationsConstants.ITEM_HEIGHT)); final ImageFigure lImage = new ImageFigure(image); add(lImage); setConstraint(lImage, new Rectangle(-1, -1, ICON_WIDTH, ICON_WIDTH)); return outLabel; }
protected void setUpContents() { contents = new ScalableFrameFigure(GraphicsUtil.defaultWidgetColor); contents.setScale(1.0); contents.setLayoutManager(new XYLayout()); installFrames(); // Resize to preferred size. DoubleSize s = getPreferredSize(); contents.setSize(PrecisionUtilities.round(s.width), PrecisionUtilities.round(s.height)); }
protected void createLayout () { setLayoutManager(new XYLayout()); setBackgroundColor(Activator.getStartVertexImageColor()); setOpaque(true); this.setBorder(null); ellipse = new Ellipse(); add(ellipse); name = new Label(""); add(name); }
protected void createLayout() { setLayoutManager(new XYLayout()); setBackgroundColor(Activator.getVertexImageColor()); setOpaque(true); setBorder(null); rectangle = new RoundedRectangle(); add(rectangle); name = new Label(""); add(name); }
public GraphFigure() { layout = new XYLayout(); setLayoutManager(layout); name.setForegroundColor(ColorConstants.red); add(name); setConstraint(name, new Rectangle(5, 5, -1, -1)); setForegroundColor(ColorConstants.black); setBorder(new LineBorder(2)); }
protected void createLayout () { setLayoutManager(new XYLayout()); setBackgroundColor(Activator.getSharedVertexImageColor()); setOpaque(true); this.setBorder(null); rectangle = new RoundedRectangle(); add(rectangle); name = new Label(""); add(name); }
/** * 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. * @not-generated */ @Override protected NodeFigure createNodeFigure() { NodeFigure node = createNodePlate(); node.setLayoutManager(new XYLayout()); IFigure shape = createNodeShape(); node.add(shape); contentPane = setupContentPane(shape); return node; }
public static void main(String[] args) { Shell shell = new Shell(new Display()); shell.setSize(365, 280); shell.setLayout(new GridLayout()); Figure root = new Figure(); root.setFont(shell.getFont()); XYLayout layout = new XYLayout(); root.setLayoutManager(layout); Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED); canvas.setBackground(ColorConstants.white); canvas.setLayoutData(new GridData(GridData.FILL_BOTH)); VarParser parser = new VarParser("src/pt/iscte/pandionj/tests/Test.java"); parser.run(); System.out.println(parser.toText()); createDiagram(root, parser); LightweightSystem lws = new LightweightSystem(canvas); lws.setContents(root); Display display = shell.getDisplay(); shell.open(); while (!shell.isDisposed()) { while (!display.readAndDispatch()) { display.sleep(); } } }
public DwVersionFigure(HyVersion version){ this.version = version; setLayoutManager(new XYLayout()); createChildFigures(); update(); }
protected IFigure createFigure() { Figure f = new Figure(); f.setBackgroundColor(ColorConstants.white); f.setOpaque(true); XYLayout layout = new XYLayout(); f.setLayoutManager(layout); Branch branch = (Branch)getModel(); Rectangle rect = new Rectangle(10+branch.getIndex()*BRANCH_OFFSET, 10, BRANCH_WIDTH, -1); ((AbstractGraphicalEditPart)getParent()).getFigure().getLayoutManager().setConstraint(f, rect); return f; }
protected IFigure createFigure() { Figure f = new Figure(); f.setBackgroundColor(ColorConstants.white); f.setOpaque(true); XYLayout layout = new XYLayout(); f.setLayoutManager(layout); return f; }
private static Figure createContents() { final Figure contents = new Figure(); final XYLayout layout = new XYLayout(); contents.setLayoutManager(layout); final Button button = new Button("Hello World"); layout.setConstraint(button, new Rectangle(0, 0, -1, -1)); contents.add(button); button.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent actionevent) { setBrightness(); } }); final String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg"; image = new Image(Display.getDefault(), path); imageFigure = new ImageFigure(image); layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1)); contents.add(imageFigure); return contents; }
@Override protected Point getLayoutOrigin() { IFigure container = getLayoutContainer(); if (!(container.getLayoutManager() instanceof XYLayout)) return container.getParent().getClientArea().getLocation(); return super.getLayoutOrigin(); }
protected IFigure createFigure() { APageFigure figure = newPageFigure(); setPrefsBorder(figure); setupPageFigure(figure); // get current display... figure.setOpaque(false); figure.setBackgroundColor(ColorConstants.white); figure.setLayoutManager(new XYLayout()); updateRullers(); return figure; }
/** * Creates a new Figure object. * * @param node * the node * @return the i figure */ public static IFigure createFigure(final ANode node) { ExtensionManager m = JaspersoftStudioPlugin.getExtensionManager(); IFigure f = m.createFigure(node); if (f != null) return f; if (node instanceof MEllipse) return new EllipseFigure((MEllipse)node); if (node instanceof MRectangle) return new RectangleFigure((MRectangle)node); if (node instanceof MStaticText) return new StaticTextFigure((MStaticText)node); if (node instanceof MTextField) return new TextFieldFigure((MTextField)node); if (node instanceof MLine) return new LineFigure((MLine)node); if (node instanceof MFrame) return new FrameFigure((MFrame)node); if (node instanceof MImage) return new ImageFigure((MImage)node); if (node instanceof MSubreport) return new SubreportFigure((MSubreport)node); if (node instanceof MGenericElement) return new GenericElementFigure((MGenericElement)node); if (node.getValue() instanceof JRComponentElement) return new ComponentFigure(); if (node instanceof MCallout) return new CalloutFigure(); else { org.eclipse.draw2d.RectangleFigure rfig = new org.eclipse.draw2d.RectangleFigure(); rfig.setLayoutManager(new XYLayout()); return rfig; } }
@Override protected void createLayers(LayeredPane layeredPane) { Layer rowsLayer = new Layer(); rowsLayer.setLayoutManager(new XYLayout()); rowsLayer.setOpaque(false); layeredPane.add(rowsLayer, LAYER_DATA_ROWS_LAYER); getViewer().registerLayer(LAYER_DATA_ROWS_LAYER, rowsLayer); super.createLayers(layeredPane); }
@Override protected IFigure createFigure() { BarFigure f = new BarFigure(); f.setLayoutManager(new XYLayout()); f.setRound(TIMELINE_PREFERENCES.getBoolean(TimelinePreferencePage.P_ROW_ELEMENT_ROUNDED)); f.setPaintBorder(TIMELINE_PREFERENCES.getBoolean(TimelinePreferencePage.P_ROW_ELEMENT_BORDER)); return f; }
@Override protected IFigure createPrimaryFigure() { ScaleFigure figure = new ScaleFigure(); figure.setLayoutManager(new XYLayout()); figure.setPreferredSize(computeFigureBounds()); figure.setFont(TimelineUtils.deriveScaleHeightFont(figure.getFont())); return figure; }
/** * The constructor of this class, where the layout for the white area is set. * */ public ORMRootModelFigure() { setLayoutManager(new XYLayout()); //setBorder(new LineBorder(1)); setAntialias(SWT.ON); }
@PostConstruct public void postConstruct(Composite parent, IEclipseContext ctx) { // Create the canvas and the related LightweightSystem for Draw2D canvas = new Canvas(parent, SWT.NONE); final LightweightSystem lws = new LightweightSystem(canvas); // Create a main figure to contain the 2 counters and the 2 labels IFigure root = new Figure(); root.setLayoutManager(new XYLayout()); root.setBackgroundColor(ColorConstants.lightBlue); rpmCounter = createRpmCounter(); rpmCounter.setBounds(new Rectangle(COUNTER_MARGIN,COUNTER_MARGIN,COUNTER_SIZE, COUNTER_SIZE)); root.add(rpmCounter); speedCounter = createSpeedCounter(); speedCounter.setBounds(new Rectangle(COUNTER_MARGIN*2 + COUNTER_SIZE, COUNTER_MARGIN,COUNTER_SIZE, COUNTER_SIZE)); root.add(speedCounter); // Add two titles under the counters. Label rpmTitle = new Label(); rpmTitle.setText("Rpm"); rpmTitle.setLabelAlignment(PositionConstants.CENTER); rpmTitle.setBounds(new Rectangle(COUNTER_MARGIN, COUNTER_SIZE + COUNTER_MARGIN,COUNTER_SIZE, 20)); root.add(rpmTitle); Label speedTitle = new Label(); speedTitle.setText("Speed"); speedTitle.setLabelAlignment(PositionConstants.CENTER); speedTitle.setBounds(new Rectangle(COUNTER_SIZE + 2*COUNTER_MARGIN, COUNTER_SIZE + COUNTER_MARGIN,COUNTER_SIZE, 20)); root.add(speedTitle); // Set the root figure. lws.setContents(root); }
public XYBlockModelFigure() { VerticalFillLayout vertical = new VerticalFillLayout(); vertical.setSpacing(5); setLayoutManager(new XYLayout()); setOpaque(true); setBackgroundColor(ColorConstants.white); border = new LineBorder(); border.setColor(orange); border.setWidth(1); setBorder(border); }
public XYBlockModelFigure() { setLayoutManager(new XYLayout()); setOpaque(true); setBackgroundColor(ColorConstants.white); border = new LineBorder(); border.setColor(ColorConstants.darkBlue); border.setWidth(1); setBorder(border); }
/** * Creates the figure and initializes anchors. * */ public PathNodeFigure() { super(); xylayout = new XYLayout(); this.setLayoutManager(xylayout); createFigure(); initAnchor(); }
public HumanCircleFigure() { setLayoutManager(new XYLayout()); rectangle = new RectangleFigure(); add(rectangle); label = new Label(); add(label); }
public HumanPolylineConnectionAnchorFigure() { setLayoutManager(new XYLayout()); label = new Label(); LineBorder borderL1 = new LineBorder(); label.setBorder(borderL1); add(label); }
public InteractionFigure(IEnterExitListener enterExitL, MouseMotionListener motionL, MouseListener clickL, Cursor figureCursor) { enterExitListener = enterExitL; motionListener = motionL; clickListener = clickL; setLayoutManager(new XYLayout()); setCursor(figureCursor); }