@Override protected IFigure createFigure() { RectangleFigure figure = new RectangleFigure(); figure.setBackgroundColor(BACKGROUND_COLOR); Color borderCol = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY); Border figureBorder = new LineBorder(borderCol, 2); figure.setBorder(figureBorder); figure.setOutline(false); GridLayout layoutManager = new GridLayout(); // zero margin, in order to connect the dependent axes to the shared one layoutManager.marginHeight = 0; layoutManager.marginWidth = 0; figure.setLayoutManager(layoutManager); datasetsPane = new RectangleFigure(); datasetsPane.setOutline(false); final SimpleLoweredBorder datasetBorder = new SimpleLoweredBorder(3); datasetsPane.setBorder(datasetBorder); GridLayout datasetsPaneLayout = new GridLayout(); datasetsPane.setLayoutManager(datasetsPaneLayout); figure.add(datasetsPane); arrowFigure = new ArrowFigure(false); figure.add(arrowFigure); axisNameLabel = new AxisNameFigure(this); figure.add(axisNameLabel); return figure; }
@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; }
private void addRow(String name, String value, String tableStyle) { final Border border = new MarginBorder(5); final ToolbarLayout layout = new ToolbarLayout(); layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); layout.setStretchMinorAxis(true); final Label nameLabel = new Label(); final Label valueLabel = new Label(); nameLabel.setBorder(border); nameLabel.setText(name); nameLabel.setLabelAlignment(PositionConstants.LEFT); nameLabel.setForegroundColor(foregroundColor); add(nameLabel); if (!DisplayMessages.getMessage("action.title.change.design.simple").equals(tableStyle) && !DisplayMessages.getMessage("action.title.change.design.frame").equals(tableStyle)) { valueLabel.setBackgroundColor(ColorConstants.white); valueLabel.setOpaque(true); valueLabel.setForegroundColor(ColorConstants.black); } else { valueLabel.setOpaque(false); valueLabel.setForegroundColor(foregroundColor); } valueLabel.setBorder(border); valueLabel.setText(value); valueLabel.setLabelAlignment(PositionConstants.LEFT); add(valueLabel); }
/** * Generates a draw2d constraint object derived from the specified child * EditPart using the provided Request. The returned constraint will be * translated to the application's model later using * {@link #translateToModelConstraint(Object)}. * * @param request * the ChangeBoundsRequest * @param child * the child EditPart for which the constraint should be * generated * @return the draw2d constraint */ protected Object getConstraintFor( ChangeBoundsRequest request, GraphicalEditPart child ) { IFigure figure = child.getFigure( ); Rectangle rect = new PrecisionRectangle(figure.getBounds()); figure.translateToAbsolute(rect); rect = request.getTransformedRectangle( rect ); figure.translateToRelative(rect); rect.translate( getLayoutOrigin( ).getNegated( ) ); if (figure instanceof IOutsideBorder) { Border border = ((IOutsideBorder)figure).getOutsideBorder( ); if (border != null) { Insets insets = border.getInsets( figure ); rect.shrink( insets.right, insets.bottom ); } } return getConstraintFor( rect ); }
private Dimension getFigureSize() { IFigure figure = getOwner( ).getFigure( ); Dimension dim = figure.getSize( ); if (figure instanceof IOutsideBorder) { Border border = ((IOutsideBorder)figure).getOutsideBorder( ); Insets insets = border.getInsets( figure ); if (PositionConstants.EAST == getResizeDirection()) { dim.width = dim.width - insets.right - insets.left; } else if (PositionConstants.SOUTH == getResizeDirection()) { dim.height = dim.height - insets.bottom - insets.top; } } return dim; }
private void addRow(final String name, final String value, final String tableStyle) { final Border border = new MarginBorder(5); final ToolbarLayout layout = new ToolbarLayout(); layout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT); layout.setStretchMinorAxis(true); final Label nameLabel = new Label(); final Label valueLabel = new Label(); nameLabel.setBorder(border); nameLabel.setText(name); nameLabel.setLabelAlignment(PositionConstants.LEFT); nameLabel.setForegroundColor(foregroundColor); this.add(nameLabel); if (!ResourceString.getResourceString("action.title.change.design.simple").equals(tableStyle) && !ResourceString.getResourceString("action.title.change.design.frame").equals(tableStyle)) { valueLabel.setBackgroundColor(ColorConstants.white); valueLabel.setOpaque(true); valueLabel.setForegroundColor(ColorConstants.black); } else { valueLabel.setOpaque(false); valueLabel.setForegroundColor(foregroundColor); } valueLabel.setBorder(border); valueLabel.setText(value); valueLabel.setLabelAlignment(PositionConstants.LEFT); this.add(valueLabel); }
private void addRow(String name, String value, String tableStyle) { Border border = new MarginBorder(5); ToolbarLayout layout = new ToolbarLayout(); layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); layout.setStretchMinorAxis(true); Label nameLabel = new Label(); Label valueLabel = new Label(); nameLabel.setBorder(border); nameLabel.setText(name); nameLabel.setLabelAlignment(PositionConstants.LEFT); nameLabel.setForegroundColor(this.foregroundColor); this.add(nameLabel); if (!ResourceString.getResourceString( "action.title.change.design.simple").equals(tableStyle) && !ResourceString.getResourceString( "action.title.change.design.frame").equals(tableStyle)) { valueLabel.setBackgroundColor(ColorConstants.white); valueLabel.setOpaque(true); valueLabel.setForegroundColor(ColorConstants.black); } else { valueLabel.setOpaque(false); valueLabel.setForegroundColor(this.foregroundColor); } valueLabel.setBorder(border); valueLabel.setText(value); valueLabel.setLabelAlignment(PositionConstants.LEFT); this.add(valueLabel); }
@Override public void setBorder(Border border) { if (border != null){ Assert.isTrue(border instanceof TitaniumBackgroundBorder, "Only TitaniumBackgroundBorder can be set in TitaniumFigure!"); } super.setBorder(border); }
/** * Overridden to assert that only {@link FlowBorder} is used. * <code>null</code> is still a valid value as well. * * @param border * <code>null</code> or a FlowBorder */ public void setBorder(Border border) { if (border == null || border instanceof FlowBorder) super.setBorder(border); else throw new RuntimeException( "Border must be an instance of FlowBorder"); //$NON-NLS-1$ }
@Override protected Border createBorder() { MarginBorder marginBorder = new MarginBorder(PADDING - 1); LineBorder lineBorder = new LineBorder(1); lineBorder.setColor(ColorConstants.black); return new CompoundBorder(lineBorder, marginBorder); }
protected void fillShape( Graphics graphics ) { Rectangle bounds = getBounds( ).getCopy( ); Border border = getBorder( ); if ( border != null ) { bounds = bounds.crop( border.getInsets( null ) ); } if ( isOpaque( ) ) graphics.fillRectangle( bounds ); }
protected void outlineShape( Graphics graphics ) { Rectangle bounds = getBounds( ).getCopy( ); Border border = getBorder( ); if ( border != null ) { bounds = bounds.crop( border.getInsets( null ) ); } graphics.drawRectangle( bounds.x, bounds.y, bounds.width - 1, bounds.height - 1 ); }
@Override public void setBorder(Border border) { super.setBorder(border); if(border != null) setSize(border.getPreferredSize(this)); }
@Override public void setBorder(Border border) { getContentsPane().setBorder(border); }
/** * @see org.eclipse.draw2d.Figure#setBorder(org.eclipse.draw2d.Border) */ @Override public void setBorder(Border border) { }
public Border getOutsideBorder( ) { return getBorder( ); }
@Override public void setBorder( final Border border ) { delegate.setBorder( border ); }
/**Gets the outside border * @return */ Border getOutsideBorder();