@Override protected IFigure createMain () { final Figure rootFigure = new Figure (); rootFigure.setLayoutManager ( new GridLayout ( 3, true ) ); rootFigure.add ( makeHeader (), new GridData ( GridData.BEGINNING, GridData.CENTER, true, false, 3, 1 ) ); rootFigure.add ( createSourceValue (), new GridData ( GridData.CENTER, GridData.CENTER, true, true ) ); rootFigure.add ( new Figure () ); rootFigure.add ( createTargetValue (), new GridData ( GridData.CENTER, GridData.CENTER, true, true ) ); rootFigure.add ( new Figure () ); rootFigure.add ( createCommandPanel (), new GridData ( GridData.CENTER, GridData.CENTER, true, true ) ); createRoundArrow ( rootFigure ); return rootFigure; }
private Object convert ( final GridChild child ) { final GridData gd = new GridData (); gd.horizontalAlignment = convert ( child.getHorizontalAlignment () ); gd.verticalAlignment = convert ( child.getVerticalAlignment () ); gd.grabExcessHorizontalSpace = child.isGrabHorizontalSpace (); gd.grabExcessVerticalSpace = child.isGrabVerticalSpace (); gd.horizontalSpan = child.getSpanCols (); gd.verticalSpan = child.getSpanRows (); if ( child.getWidthHint () != null ) { gd.widthHint = child.getWidthHint (); } if ( child.getHeightHint () != null ) { gd.heightHint = child.getHeightHint (); } return gd; }
private int convert ( final GridAlignment alignment ) { switch ( alignment ) { case BEGINNING: return GridData.BEGINNING; case END: return GridData.END; case CENTER: return GridData.CENTER; case FILL: return GridData.FILL; default: return GridData.BEGINNING; } }
void showPrivateFields() { if(hiddenFields == null || visibilityOpen) return; visibilityOpen = true; getLayoutManager().setConstraint(hiddenFields, new GridData(SWT.FILL, SWT.DEFAULT, true, true)); hiddenFields.setToolTip(new Label("hidden fields")); for (IVariableModel<?> var : model.getFields()) { if(!var.isVisible()) { PandionJFigure<?> fieldFig = figureProvider.getFigure(var, false); hiddenFields.add(fieldFig); hiddenFields.getLayoutManager().setConstraint(fieldFig, new GridData(SWT.RIGHT, SWT.FILL, true, false)); setObjectContainerVisible(); if(var instanceof IReferenceModel) objectContainer.addObjectAndPointer((IReferenceModel) var, ((ReferenceFigure) fieldFig).getAnchor()); } } fig.getLayoutManager().layout(fig); runtimeViewer.updateLayout(); }
public ReferenceFigure(IReferenceModel model) { super(model, false); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = 3; layout.verticalSpacing = 0; setLayoutManager(layout); label = new Label(model.getName()); label.setForegroundColor(ColorConstants.black); FontManager.setFont(label, PandionJConstants.VAR_FONT_SIZE); String tooltip = Utils.getTooltip(model); Collection<String> tags = model.getTags(); if(!tags.isEmpty()) tooltip += "\ntags: " + String.join(", ", tags); label.setToolTip(new Label(tooltip)); add(label); refLabel = new ReferenceLabel(model); add(refLabel); layout.setConstraint(refLabel, new GridData(PandionJConstants.POSITION_WIDTH, PandionJConstants.POSITION_WIDTH)); }
/** * performDirectEdit void */ protected void performDirectEdit(Request req) { if (getParent() != null && getParent() instanceof ScrollableEditPart) { AbstractNode node = (AbstractNode) getParent().getModel(); Label label = (Label) getFigure(); if (((AbstractNode) node).getNodeType().equals(NodeType.PROVIDED_INTERFACES)) { return; } else if (((AbstractNode) node).getNodeType().equals(NodeType.REQUIRED_INTERFACES)) { return; } setFigureLayout(label, GridData.BEGINNING); } else if (getParent() != null && getParent() instanceof AbstractChildCompartmentEditPart) { return; } if (directManager == null) { directManager = new DirectEditorManager(this, TextCellEditor.class, new DirectEditCellEditorLocator(getFigure())); } directManager.show(); }
@Override protected void refreshVisuals() { contentPane.setName(getDataset().getName()); ChartSet parent = ((Chart) getParent().getParent().getParent().getModel()).getParent(); boolean horizontal = parent.getOrientation() == Orientation.HORIZONTAL; ((DirectionalShape) getFigure()).setVertical(!horizontal); if (horizontal) { contentPane.setVertical(false); setLayoutConstraint(this, getFigure(), new GridData(GridData.FILL, GridData.FILL, true, false)); } else { contentPane.setVertical(true); setLayoutConstraint(this, getFigure(), new GridData(GridData.CENTER, GridData.FILL, false, true)); } }
@Override protected void refreshVisuals() { String name = getModel().getName(); ChartFigure chartFigure = (ChartFigure) getFigure(); chartFigure.setName(name); chartFigure .setVertical(getModel().getParent().getOrientation() == Orientation.VERTICAL); GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalAlignment = SWT.FILL; gridData.verticalAlignment = SWT.FILL; ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, gridData); }
@Override protected IFigure createFigure() { final RectangleFigure figure = new RectangleFigure(); figure.setOutline(false); final Color borderCol = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY); final Border figureBorder = new LineBorder(borderCol, 2); figure.setBorder(figureBorder); figure.setLayoutManager(new GridLayout()); nameLabel = new DirectionalLabel(Activator.FONT_8); final ChartPaneEditPart.AxisLandingPad pad = (ChartPaneEditPart.AxisLandingPad) getModel(); nameLabel.setText(pad.pos == ChartPanePosition.MIN ? "Min Axis" : "Max Axis"); figure.add(nameLabel); figure.getLayoutManager().setConstraint(nameLabel, new GridData( GridData.FILL, GridData.FILL, true, true)); return figure; }
@Override protected void refreshVisuals() { boolean horizontal = ((AxisLandingPad) getModel()).chart.getParent() .getOrientation() == Orientation.HORIZONTAL; nameLabel.setVertical(!horizontal); if (horizontal) { ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, new GridData(GridData.FILL, GridData.CENTER, true, false)); } else { ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, new GridData(GridData.CENTER, GridData.FILL, false, true)); } figure.invalidate(); }
@Override protected void refreshVisuals() { GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalAlignment = SWT.FILL; gridData.verticalAlignment = SWT.FILL; GraphicalEditPart parent = (GraphicalEditPart) getParent(); parent.setLayoutConstraint(this, figure, gridData); GridLayout layoutManager = (GridLayout) getFigure().getLayoutManager(); layoutManager.numColumns = ((ChartSet) parent.getModel()).getOrientation() == Orientation.HORIZONTAL ? getModelChildren().size() : 1; layoutManager.invalidate(); }
/** * @generated */ private void createContents() { fFigureRoleNameLabel = new WrappingLabel(); fFigureRoleNameLabel.setText(""); GridData constraintFFigureRoleNameLabel = new GridData(); constraintFFigureRoleNameLabel.verticalAlignment = GridData.CENTER; constraintFFigureRoleNameLabel.horizontalAlignment = GridData.CENTER; constraintFFigureRoleNameLabel.horizontalIndent = 0; constraintFFigureRoleNameLabel.horizontalSpan = 1; constraintFFigureRoleNameLabel.verticalSpan = 1; constraintFFigureRoleNameLabel.grabExcessHorizontalSpace = true; constraintFFigureRoleNameLabel.grabExcessVerticalSpace = true; this.add(fFigureRoleNameLabel, constraintFFigureRoleNameLabel); }
void hideIconView( final Column column ) { iconViewColumn = null; column.cellColumn.setBorder( null ); focusLine.setVisible( true ); for ( final Column col : focusTree.columns ) { col.cellColumn.setVisible( true ); } setCellColumnLayoutManager( column ); for ( final Object child : column.cellColumn.getChildren() ) { final Cell cell = ( Cell ) child; cell.setPreferredSize( null ); cell.icon.setImage( focusTree.viewModel.icon( cell.item ) ); final GridData gridData = new GridData( SWT.FILL, SWT.DEFAULT, false, false ); gridData.widthHint = column.cellWidthBeforeIconView; column.cellColumn.setConstraint( cell, gridData ); } column.cellColumn.setLocation( new Point( column.bounds.x + columnMargins.width, 0 ) ); column.cellColumn.setSize( column.cellColumn.getPreferredSize() ); focusCell( column, column.focusCell ); }
void showIconView( final Column column ) { iconViewColumn = column; focusLine.setVisible( false ); for ( final Column col : focusTree.columns ) { if ( col != column ) col.cellColumn.setVisible( false ); } column.cellWidthBeforeIconView = 0; for ( final Object figure : column.cellColumn.getChildren() ) { final Cell cell = ( Cell ) figure; if ( column.cellWidthBeforeIconView == 0 ) column.cellWidthBeforeIconView = ( ( GridData ) column.cellColumn.getLayoutManager().getConstraint( cell ) ).widthHint; cell.icon.setImage( focusTree.viewModel.iconViewIcon( cell.item ) ); final Dimension size = cell.getPreferredSize( iconViewCellWidth, SWT.DEFAULT ); cell.setPreferredSize( size ); } final FlowLayout layout = new FlowLayout(); layout.setMinorAlignment( OrderedLayout.ALIGN_BOTTOMRIGHT ); layout.setMajorSpacing( columnMargins.width ); layout.setMinorSpacing( columnMargins.height ); column.cellColumn.setLayoutManager( layout ); column.cellColumn.setBorder( new MarginBorder( columnMargins.height, columnMargins.width, columnMargins.height, columnMargins.width ) ); updateIconViewBounds(); }
void updateColumnWidth( final Column column, final int width, final boolean visible ) { final int delta = width - column.bounds.width; column.bounds.width = width; final Dimension cellColumnSize = column.cellColumn.getSize(); column.cellColumn.setSize( cellColumnSize.width + delta, cellColumnSize.height ); for ( final Object cell : column.cellColumn.getChildren() ) ( ( GridData ) column.cellColumn.getLayoutManager().getConstraint( ( IFigure ) cell ) ).widthHint += delta; column.cellColumn.setVisible( visible ); boolean afterColumn = false; for ( final Column col : focusTree.columns ) if ( col == column ) afterColumn = true; else if ( afterColumn ) { final Point cellColumnLocation = col.cellColumn.getLocation(); cellColumnLocation.x += delta; col.cellColumn.setLocation( cellColumnLocation ); col.cellColumn.revalidate(); col.bounds.x += delta; } final Dimension canvasSize = canvas.getSize(); canvas.setSize( canvasSize.width + delta, canvasSize.height ); canvas.revalidate(); }
private void createHeader() { Figure top = new Figure(); GridLayout topLayout = new GridLayout(3, false); topLayout.horizontalSpacing = 0; topLayout.verticalSpacing = 0; topLayout.marginHeight = 0; topLayout.marginWidth = 0; top.setLayoutManager(topLayout); leftExpander = new ProcessExpander(node, Side.INPUT); rightExpander = new ProcessExpander(node, Side.OUTPUT); top.add(leftExpander, new GridData(SWT.LEFT, SWT.CENTER, false, false)); top.add(new Label(node.getName()), new GridData(SWT.FILL, SWT.FILL, true, false)); top.add(rightExpander, new GridData(SWT.RIGHT, SWT.CENTER, false, false)); add(top, new GridData(SWT.FILL, SWT.FILL, true, false)); GridData dummyGridData = new GridData(SWT.FILL, SWT.FILL, true, false); dummyGridData.heightHint = TEXT_HEIGHT + 3 * MARGIN_HEIGHT; add(new Figure(), dummyGridData); }
private IFigure createEntryGrid ( final Figure connLayer ) { final Figure figure = new Figure (); figure.setLayoutManager ( new GridLayout ( 1, false ) ); figure.add ( this.presetCeil = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetHH = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetH = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.currentLabel = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetL = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetLL = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ figure.add ( this.presetFloor = new Label ( "" ), new GridData ( GridData.CENTER, GridData.FILL, true, true ) ); //$NON-NLS-1$ createConnection ( connLayer, this.presetCeil, this.rectCeil ); createConnection ( connLayer, this.presetHH, this.triHH ); createConnection ( connLayer, this.presetH, this.triH ); createConnection ( connLayer, this.presetL, this.triL ); createConnection ( connLayer, this.presetLL, this.triLL ); createConnection ( connLayer, this.presetFloor, this.rectFloor ); this.blinkerCeil = new LevelBlinker ( this.rectCeil ); this.blinkerHH = new LevelBlinker ( this.triHH ); this.blinkerH = new LevelBlinker ( this.triH ); this.blinkerL = new LevelBlinker ( this.triL ); this.blinkerLL = new LevelBlinker ( this.triLL ); this.blinkerFloor = new LevelBlinker ( this.rectFloor ); this.stylerCeil = new StateStyler ( this.blinkerCeil ); this.stylerHH = new StateStyler ( this.blinkerHH ); this.stylerH = new StateStyler ( this.blinkerH ); this.stylerL = new StateStyler ( this.blinkerL ); this.stylerLL = new StateStyler ( this.blinkerLL ); this.stylerFloor = new StateStyler ( this.blinkerFloor ); return figure; }
public AbstractArrayFigure(IArrayModel<E> model, boolean horizontal) { super(model, true); this.horizontal = horizontal; N = Math.min(model.getLength(), PandionJView.getMaxArrayLength()); positions = new ArrayList<>(N); positionsFig = createPositionsFig(); getLayoutManager().setConstraint(positionsFig, new GridData(SWT.DEFAULT, SWT.BEGINNING, false, false)); add(positionsFig); model.getRuntimeModel().registerDisplayObserver((e) -> { if(e.type == IRuntimeModel.Event.Type.STEP || e.type == IRuntimeModel.Event.Type.EVALUATION) { positionsFig.setBackgroundColor(PandionJConstants.Colors.OBJECT); } }); }
private RoundedRectangle createPositionsFig() { RoundedRectangle fig = new RoundedRectangle(); fig.setOpaque(false); fig.setCornerDimensions(PandionJConstants.OBJECT_CORNER); fig.setBackgroundColor(PandionJConstants.Colors.OBJECT); GridLayout layout = new GridLayout(horizontal ? (model.getLength() > PandionJView.getMaxArrayLength() ? N + 1 : Math.max(1, N)) : 1, false); layout.verticalSpacing = 0; layout.horizontalSpacing = PandionJConstants.ARRAY_POSITION_SPACING; layout.marginWidth = PandionJConstants.ARRAY_MARGIN; layout.marginHeight = PandionJConstants.ARRAY_MARGIN; fig.setLayoutManager(layout); fig.setToolTip(new Label("length = " + model.getLength())); if(N == 0) { Label empty = new Label(""); GridData layoutData = new GridData(POSITION_WIDTH/2, POSITION_WIDTH); layout.setConstraint(empty, layoutData); fig.add(empty); } else { Iterator<Integer> it = model.getValidModelIndexes(); while(it.hasNext()) { Integer i = it.next(); if(!it.hasNext() && model.getLength() > PandionJView.getMaxArrayLength()) { Position emptyPosition = new Position(null); fig.add(emptyPosition); } Position p = new Position(i); fig.add(p); positions.add(p); } } return fig; }
private void addVariable(IVariableModel<?> v, ExceptionType exception) { if(v.isInstance() == instance) { // && !(v instanceof IReferenceModel && !((IReferenceModel) v).getTags().isEmpty())) { PandionJFigure<?> figure = figProvider.getFigure(v, true); add(figure); layout.setConstraint(figure, new GridData(SWT.RIGHT, SWT.DEFAULT, true, false)); if(v instanceof IReferenceModel) objectContainer.addObjectAndPointer((IReferenceModel) v, ((ReferenceFigure) figure).getAnchor()); } }
public ValueExtensionFigure(IValueModel model, IFigure figure) { super(model, false); layout = new GridLayout(1, false); layout.verticalSpacing = 0; layout.horizontalSpacing = 0; layout.marginHeight = 0; layout.marginWidth = 0; setLayoutManager(layout); Figure comp = new Figure(); GridLayout compLayout = new GridLayout(2,false); compLayout.marginHeight = 0; compLayout.marginWidth = 0; compLayout.horizontalSpacing = 3; compLayout.verticalSpacing = 0; comp.setLayoutManager(compLayout); String tooltip = Utils.getTooltip(model); Label nameLabel = new Label(model.getName()); nameLabel.setForegroundColor(ColorConstants.black); FontManager.setFont(nameLabel, PandionJConstants.VAR_FONT_SIZE); nameLabel.setToolTip(new Label(tooltip)); comp.add(nameLabel); comp.add(figure); add(comp); layout.setConstraint(comp, new GridData(SWT.RIGHT, SWT.DEFAULT, true, false)); }
public void addFrame(IStackFrameModel frame, RuntimeViewer runtimeViewer, ObjectContainer objectContainer, boolean invisible) { if(frame.getLineNumber() != -1) { StackFrameFigure sv = new StackFrameFigure(runtimeViewer, frame, objectContainer, invisible, false); add(sv); getLayoutManager().setConstraint(sv, new GridData(SWT.FILL, SWT.DEFAULT, true, false)); } }
public ArrayPrimitiveFigure(IArrayModel<IValueModel> model) { super(model); this.model = model; model.registerDisplayObserver((o, indexes) -> observerAction(o, indexes)); N = Math.min(model.getLength(), Constants.ARRAY_LENGTH_LIMIT); // limit size positions = new ArrayList<>(N); setBackgroundColor(Constants.Colors.OBJECT); outerLayout = new GridLayout(3, false); setLayoutManager(outerLayout); leftBound = new PositionOutBounds(); rightBound = new PositionOutBounds(); positionsFig = createPositionsFig(); GridData boundConstraints = new GridData(SWT.CENTER, SWT.TOP, false, false); add(leftBound, boundConstraints); add(positionsFig); add(rightBound, boundConstraints); vars = new HashMap<>(); // for(IArrayIndexModel v : model.getIndexModels()) // addVariable(v); updateOutOfBoundsPositions(); setSize(getPreferredSize()); }
public Position(Integer index) { int width = POSITION_WIDTH; if(model.isDecimal()) width *= 2; GridData layoutData = new GridData(width, POSITION_WIDTH+20); arrayLayout.setConstraint(this, layoutData); GridLayout layout = Constants.getOneColGridLayout(); setLayoutManager(layout); if(index != null) { IValueModel m = model.getElementModel(index); valueLabel = new ValueLabel(m); layout.setConstraint(valueLabel, new GridData(width, POSITION_WIDTH)); add(valueLabel); }else { Label emptyLabel = new Label("..."); FontManager.setFont(this, Constants.VALUE_FONT_SIZE); IValueModel measure = model.getElementModel(model.getLength() - 1); setSize(measure.isDecimal() || measure.isBoolean() ? Constants.POSITION_WIDTH*2 : Constants.POSITION_WIDTH, Constants.POSITION_WIDTH); layout.setConstraint(emptyLabel, new GridData(width, POSITION_WIDTH)); add(emptyLabel); } indexLabel = new Label(index == null ? "..." : Integer.toString(index)); FontManager.setFont(indexLabel, INDEX_FONT_SIZE); indexLabel.setLabelAlignment(SWT.CENTER); indexLabel.setForegroundColor(ColorConstants.gray); layout.setConstraint(indexLabel, layoutCenter); add(indexLabel); }
private void refreshCompartmentLayout() { if (getTextCompartment().isCollapsed()) { getPrimaryShape().setConstraint(getPrimaryShape().getTextCompartmentPane(), getCollapsedData()); } else { GridData expandedData = getExpandedData(); if (figureCompartmentVisible()) expandedData.grabExcessVerticalSpace = false; getPrimaryShape().setConstraint(getPrimaryShape().getTextCompartmentPane(), expandedData); } if (!figureCompartmentVisible()) { getPrimaryShape().setConstraint(getPrimaryShape().getFigureCompartmentPane(), getCollapsedData()); } else { getPrimaryShape().setConstraint(getPrimaryShape().getFigureCompartmentPane(), getExpandedData()); } }
@Override protected void addChildVisual(EditPart childEditPart, int index) { if (childEditPart instanceof StateTextCompartmentExpressionEditPart) { GridData data = GridDataFactory.fillDefaults().grab(true, true).getData(); getContentPane().add(((StateTextCompartmentExpressionEditPart) childEditPart).getFigure(), data); } else super.addChildVisual(childEditPart, index); }
private GridDataFactory fillDefaultsInternal() { align(GridData.FILL, GridData.FILL); grab(false, false); span(1, 1); data.horizontalIndent = 1; return this; }
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()); }
@Override protected void refreshVisuals() { final GridData gridData = new GridData(); gridData.horizontalAlignment = SWT.CENTER; gridData.verticalAlignment = SWT.CENTER; ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, gridData); ((ChartsetFigure) getFigure()).setVertical(getModel() .getOrientation() == Orientation.HORIZONTAL); }
public ChartBlockModelFigure() { setLayoutManager(new GridLayout()); setOpaque(true); setBackgroundColor(ColorConstants.white); border = new FrameBorder(); border.setLabel("Block"); this.setBorder(border); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = GridData.BEGINNING; gridData.verticalAlignment = GridData.CENTER; }
public FrameBlockModelFigure() { setLayoutManager(new GridLayout()); setOpaque(true); setBackgroundColor(ColorConstants.white); border = new FrameBorder(); border.setLabel("Block"); this.setBorder(border); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = GridData.BEGINNING; gridData.verticalAlignment = GridData.CENTER; getContainer(); }
public ParamModelFigure() { setLayoutManager(new GridLayout(2, false)); paramDescriptionLabel = new Label(""); add(paramDescriptionLabel); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = GridData.BEGINNING; gridData.verticalAlignment = GridData.CENTER; }
Cell( final IFigure delegate ) { this.delegate = delegate; final org.eclipse.draw2d.GridLayout layout = new org.eclipse.draw2d.GridLayout(); layout.marginHeight = layout.marginWidth = 0; super.setLayoutManager( layout ); super.add( delegate, null, 0 ); super.setConstraint( delegate, new org.eclipse.draw2d.GridData( SWT.FILL, SWT.FILL, true, true ) ); }
private Button createButton(Icon icon, String tooltipText) { Button button = new Button(this, SWT.FLAT | SWT.NO_FOCUS | SWT.HIDE_SELECTION); button.setImage(icon.get()); button.setToolTipText(tooltipText); button.setData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); return button; }
@Override protected void refreshVisuals() { if (getModel().isDummy()) return; int hAlign = getModel().exchange.isInput ? SWT.LEFT : SWT.RIGHT; getFigure().getParent().setConstraint(getFigure(), new GridData(hAlign, SWT.TOP, true, false)); }
@Override public IFigure createMain () { final LayeredPane root = new LayeredPane (); final Layer figureLayer = new Layer (); figureLayer.setLayoutManager ( new FlowLayout () ); final ConnectionLayer connectionLayer = new ConnectionLayer (); connectionLayer.setAntialias ( SWT.ON ); final Figure figure = new Figure (); figureLayer.add ( figure ); final GridLayout gridLayout = new GridLayout ( 3, true ); gridLayout.horizontalSpacing = 50; gridLayout.verticalSpacing = 50; figure.setLayoutManager ( gridLayout ); final Figure rpvFigure = createRPV (); final Figure pvFigure = createPV (); final Figure rmvFigure = createRMV (); final Figure mvFigure = createMV (); final Figure rvFigure = createRV (); figure.add ( rpvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 1 ) ); figure.add ( pvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 2 ) ); figure.add ( rvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 3 ) ); figure.add ( rmvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 1 ) ); figure.add ( mvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 1 ) ); figure.add ( new Figure (), new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 1 ) ); // placeholder connectionLayer.add ( this.p2rConnection = createConnection ( this.pvRect, this.rvRect ) ); connectionLayer.add ( this.m2rConnection = createConnection ( this.mvRect, this.rvRect ) ); connectionLayer.add ( this.rp2pConnection = createConnection ( this.rpvRect, this.pvRect ) ); connectionLayer.add ( this.rm2pConnection = createConnection ( this.rmvRect, this.pvRect ) ); root.add ( figureLayer ); root.add ( connectionLayer ); return root; }
@Override GridData createValueLabelGridData(boolean hole) { return new GridData(POSITION_WIDTH, POSITION_WIDTH); }
@Override GridData createIndexLabelGridData() { return new GridData(SWT.CENTER, SWT.BEGINNING, false, false); }
@Override GridData createValueLabelGridData(boolean hole) { int w = hole ? POSITION_WIDTH/2 : POSITION_WIDTH; return new GridData(w, w); }