@Override public void add(IFigure figure, Object constraint, int index) { // Add to child to wrapped figure this.wrappedFigure.add(figure, constraint, index); }
/** * Initiate. * * @param figure * {@link Figure} to be wrapped to be put on a * {@link FreeformViewport}. */ public FreeformWrapperFigure(Figure figure) { this.wrappedFigure = figure; this.setLayoutManager(new NoSpacingToolbarLayout(true)); this.setOpaque(false); // Add to this (not wrapped figure) super.add(this.wrappedFigure, null, -1); }
/** * If the child is a <code>FlowFigure</code>, its FlowContext is passed * to it. * * @see org.eclipse.draw2d.IFigure#add(IFigure, Object, int) */ public void add(IFigure child, Object constraint, int index) { super.add(child, constraint, index); if (child instanceof FlowFigure) { FlowFigure ff = (FlowFigure) child; if (getLayoutManager() instanceof FlowContext) { ff.setOriginalFlowContext((FlowContext) getLayoutManager()); } else { PDPlugin.getLogger(this.getClass()).error("layout is not FlowContext", new Throwable("This exception is artificial so we can get a stack trace")); } } }
protected IFigure createFigure() { Figure typeGroup = new Figure(); typeGroup.setLayoutManager(new ToolbarLayout()); labelHolder = new Figure(); FillLayout fillLayout = new FillLayout(); labelHolder.setLayoutManager(fillLayout); typeGroup.add(labelHolder); label = new HyperLinkLabel(); label.setOpaque(true); label.setBorder(new MarginBorder(0, 2, 2, 1)); label.setForegroundColor(ColorConstants.black); labelHolder.add(label); return typeGroup; }
/** * Initiate. * * @param context * {@link OfficeTaskFigureContext}. */ public StandardOfficeTaskFigure(OfficeTaskFigureContext context) { // Create the figure Figure figure = new Figure(); NoSpacingGridLayout figureLayout = new NoSpacingGridLayout(2); figure.setLayoutManager(figureLayout); // Create the task name this.taskName = new Label(context.getOfficeTaskName()); figure.add(this.taskName); // Create the container for child connectors Figure contentPane = new Figure(); NoSpacingGridLayout contentPaneLayout = new NoSpacingGridLayout(1); contentPaneLayout.verticalSpacing = 2; contentPane.setLayoutManager(contentPaneLayout); figure.add(contentPane); // Specify the figure this.setFigure(figure); this.setContentPane(contentPane); }
/** * Initiate. * * @param context * {@link OfficeSectionResponsibilityFigureContext}. */ public StandardOfficeSectionResponsibilityFigure( OfficeSectionResponsibilityFigureContext context) { Figure container = new Figure(); container.setLayoutManager(new NoSpacingGridLayout(2)); // Create connector for managed objects ConnectorFigure moConnector = new ConnectorFigure( ConnectorDirection.WEST, StandardOfficeFloorColours.BLACK()); container.add(moConnector); // Create label and connector for teams LabelConnectorFigure teamConnector = new LabelConnectorFigure(context .getOfficeSectionResponsibilityName(), ConnectorDirection.EAST, StandardOfficeFloorColours.BLACK()); container.add(teamConnector); this.officeSectionResponsibilityName = teamConnector.getLabel(); // Register the anchors ConnectionAnchor teamAnchor = teamConnector.getConnectionAnchor(); this.registerConnectionAnchor( OfficeSectionResponsibilityToOfficeTeamModel.class, teamAnchor); this.setFigure(container); }
/** * Initiate. * * @param context * {@link DutyFigureContext}. */ public StandardDutyFigure(DutyFigureContext context) { // Create the figure Figure figure = new Figure(); figure.setLayoutManager(new NoSpacingGridLayout(1)); // Create the duty figure LabelConnectorFigure duty = new LabelConnectorFigure( context.getDutyName(), ConnectorDirection.WEST, StandardOfficeFloorColours.BLACK()); figure.add(duty); this.dutyName = duty.getLabel(); // Register anchor to office tasks ConnectionAnchor anchor = duty.getConnectionAnchor(); this.registerConnectionAnchor(OfficeTaskToPreDutyModel.class, anchor); this.registerConnectionAnchor(OfficeTaskToPostDutyModel.class, anchor); // Create the content pane Figure contentPane = new Figure(); contentPane.setLayoutManager(new NoSpacingToolbarLayout(false)); figure.add(contentPane); // Specify figure and content pane this.setFigure(figure); this.setContentPane(contentPane); }
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 ); }
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 ); }
/** * Initiate. * * @param context * {@link OfficeSubSectionFigureContext}. */ public StandardOfficeSubSectionFigure(OfficeSubSectionFigureContext context) { Figure figure = new Figure(); figure.setLayoutManager(new NoSpacingToolbarLayout(true)); // Content pane Figure contentPane = new Figure(); contentPane.setLayoutManager(new NoSpacingToolbarLayout(false)); contentPane.setBorder(new MarginBorder(2, 4, 2, 2)); figure.add(contentPane); // Specify the figure and content pane this.setFigure(figure); this.setContentPane(contentPane); }
/** * Initiate. * * @param context * {@link WorkTaskFigureContext}. */ public StandardWorkTaskFigure(WorkTaskFigureContext context) { // Create the figure Figure figure = new Figure(); figure.setLayoutManager(new NoSpacingToolbarLayout(false)); // Task name LabelConnectorFigure nameFigure = new LabelConnectorFigure( context.getWorkTaskName(), ConnectorDirection.EAST, StandardOfficeFloorColours.BLACK()); this.workTaskName = nameFigure.getLabel(); this.registerConnectionAnchor(WorkTaskToTaskModel.class, nameFigure.getConnectionAnchor()); figure.add(nameFigure); // Content Pane Figure contentPane = new Figure(); contentPane.setLayoutManager(new NoSpacingToolbarLayout(false)); contentPane.setBorder(new MarginBorder(new Insets(0, 20, 0, 0))); figure.add(contentPane); // Specify figures this.setFigure(figure); this.setContentPane(contentPane); }
protected IFigure createFigure() { Figure figure = new Figure(); ToolbarLayout tb = new ToolbarLayout(true); tb.setStretchMinorAxis(false); tb.setSpacing(3); figure.setLayoutManager(tb); backToSchema = new ADTToolbarButton(XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif")); backToSchema.setToolTipText(Messages._UI_HOVER_BACK_TO_SCHEMA); backToSchema.setBackgroundColor(ColorConstants.white); // backToSchema.setBounds(new Rectangle(0, 0, 24, 24)); figure.add(backToSchema); figure.setBounds(new Rectangle(0,0,24,24)); addToToolbar(figure); return figure; }
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 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 GridContainerController ( final SymbolController controller, final GridContainer element, final BasicViewElementFactory factory ) throws Exception { this.figure = new Figure (); final GridLayout gridLayout = new GridLayout ( element.getColumns (), element.isEqualWidth () ); gridLayout.horizontalSpacing = element.getHorizontalSpacing (); gridLayout.verticalSpacing = element.getVerticalSpacing (); gridLayout.marginHeight = element.getMarginHeight (); gridLayout.marginWidth = element.getMarginWidth (); this.figure.setLayoutManager ( gridLayout ); for ( final GridChild child : element.getChildren () ) { final Controller elementController = factory.create ( controller, child.getElement () ); final IFigure childFigure = elementController.getFigure (); this.figure.add ( childFigure, convert ( child ) ); } controller.addElement ( element, this ); }
public GridContainerController ( final SymbolController controller, final GridContainer element, final BasicViewElementFactory factory ) throws Exception { this.figure = new Figure (); final GridLayout gridLayout = new GridLayout ( element.getColumns (), element.isEqualWidth () ); gridLayout.horizontalSpacing = element.getHorizontalSpacing (); gridLayout.verticalSpacing = element.getVerticalSpacing (); gridLayout.marginHeight = element.getMarginHeight (); gridLayout.marginWidth = element.getMarginWidth (); this.figure.setLayoutManager ( gridLayout ); for ( final GridChild child : element.getChildren () ) { final Controller elementController = factory.create ( controller, child.getElement () ); final IFigure childFigure = elementController.getFigure (); this.figure.add ( childFigure, convert ( child ) ); } controller.addElement ( element, this ); }
public BorderContainerController ( final SymbolController controller, final BorderContainer element, final BasicViewElementFactory factory ) throws Exception { this.figure = new Layer (); this.figure.setOpaque ( false ); this.figure.setLayoutManager ( this.layout = new BorderLayout () ); this.layout.setHorizontalSpacing ( element.getHorizontalSpacing () ); this.layout.setVerticalSpacing ( element.getVerticalSpacing () ); for ( final BorderChild child : element.getChildren () ) { final Controller elementController = factory.create ( controller, child.getElement () ); final IFigure childFigure = elementController.getFigure (); controller.addRawElement ( child.getName (), new BorderChildController ( childFigure ) ); this.figure.add ( childFigure, convert ( child.getAlignment () ) ); } controller.addElement ( element, this ); }
public BorderContainerController ( final SymbolController controller, final BorderContainer element, final BasicViewElementFactory factory ) throws Exception { this.figure = new Layer (); this.figure.setOpaque ( false ); this.figure.setLayoutManager ( this.layout = new BorderLayout () ); this.layout.setHorizontalSpacing ( element.getHorizontalSpacing () ); this.layout.setVerticalSpacing ( element.getVerticalSpacing () ); for ( final BorderChild child : element.getChildren () ) { final Controller elementController = factory.create ( controller, child.getElement () ); final IFigure childFigure = elementController.getFigure (); controller.addRawElement ( child.getName (), new BorderChildController ( childFigure ) ); this.figure.add ( childFigure, convert ( child.getAlignment () ) ); } controller.addElement ( element, this ); }
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 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 ); }