Java 类org.eclipse.draw2d.geometry.Insets 实例源码

项目:ermasterr    文件:ERDiagramLineBorder.java   
/**
 * {@inheritDoc}
 */
@Override
public void paint(final IFigure figure, final Graphics graphics, final Insets insets) {
    if (getColor() != null) {
        graphics.setForegroundColor(getColor());
    }

    tempRect.setBounds(getPaintRectangle(figure, insets));
    if (getWidth() % 2 == 1) {
        tempRect.width--;
        tempRect.height--;
    }
    tempRect.shrink(getWidth() / 2, getWidth() / 2);
    graphics.setLineWidth(1);

    int g = 9 * DELTA;
    int b = 9 * DELTA;

    for (int i = 0; i <= 5; i++) {
        final Color color = Resources.getColor(new int[] {b, g, 255});
        paint1(i, color, tempRect, graphics);

        g -= DELTA;
        b -= DELTA;
    }
}
项目:ermasterr    文件:FunnyStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void createColumnArea(final IFigure columns) {
    initColumnArea(columns);

    columns.setBorder(new MarginBorder(0, 0, 0, 0));
    columns.setBackgroundColor(ColorConstants.white);
    columns.setOpaque(true);

    final Figure centerFigure = new Figure();
    centerFigure.setLayoutManager(new BorderLayout());
    centerFigure.setBorder(new MarginBorder(new Insets(0, 2, 0, 2)));

    centerFigure.add(columns, BorderLayout.CENTER);
    getTableFigure().add(centerFigure, BorderLayout.CENTER);
}
项目:ermasterr    文件:FunnyStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void createFooter() {
    final IFigure footer = new Figure();
    final BorderLayout footerLayout = new BorderLayout();
    footer.setLayoutManager(footerLayout);
    footer.setBorder(new MarginBorder(new Insets(0, 2, 0, 2)));

    final IFigure footer1 = new Figure();
    footer1.setSize(-1, 10);
    footer1.setBackgroundColor(Resources.VERY_LIGHT_GRAY);
    footer1.setOpaque(true);

    footer.add(footer1, BorderLayout.TOP);

    final IFigure footer2 = new Figure();
    footer2.setSize(-1, 7);

    footer.add(footer2, BorderLayout.BOTTOM);

    getTableFigure().add(footer, BorderLayout.BOTTOM);
}
项目:ermasterr    文件:SimpleStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(final Figure top) {
    final ToolbarLayout topLayout = new ToolbarLayout();

    topLayout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
    topLayout.setStretchMinorAxis(true);
    top.setLayoutManager(topLayout);

    nameLabel = new Label();
    nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
    top.add(nameLabel);

    final Figure separater = new Figure();
    separater.setSize(-1, 1);
    separater.setBackgroundColor(getTextColor());
    separater.setOpaque(true);

    top.add(separater);
}
项目:ermasterr    文件:PrintERDiagramOperation.java   
/**
 * {@inheritDoc}
 */
@Override
public Rectangle getPrintRegion() {
    final ERDiagram diagram = getDiagram();
    final PageSetting pageSetting = diagram.getPageSetting();

    final org.eclipse.swt.graphics.Rectangle trim = getPrinter().computeTrim(0, 0, 0, 0);
    final org.eclipse.swt.graphics.Point printerDPI = getPrinter().getDPI();

    final Insets notAvailable = new Insets(-trim.y, -trim.x, trim.height + trim.y, trim.width + trim.x);

    final Insets userPreferred = new Insets((pageSetting.getTopMargin() * printerDPI.x) / 72, (pageSetting.getLeftMargin() * printerDPI.x) / 72, (pageSetting.getBottomMargin() * printerDPI.x) / 72, (pageSetting.getRightMargin() * printerDPI.x) / 72);

    final Rectangle paperBounds = new Rectangle(getPrinter().getBounds());
    final Rectangle printRegion = shrink(paperBounds, notAvailable);
    printRegion.intersect(shrink(paperBounds, userPreferred));
    printRegion.translate(trim.x, trim.y);

    return printRegion;
}
项目:ermaster-k    文件:ERDiagramLineBorder.java   
/**
 * {@inheritDoc}
 */
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
    if (getColor() != null) {
        graphics.setForegroundColor(getColor());
    }

    tempRect.setBounds(getPaintRectangle(figure, insets));
    if (getWidth() % 2 == 1) {
        tempRect.width--;
        tempRect.height--;
    }
    tempRect.shrink(getWidth() / 2, getWidth() / 2);
    graphics.setLineWidth(1);

    int g = 9 * DELTA;
    int b = 9 * DELTA;

    for (int i = 0; i <= 5; i++) {
        Color color = Resources.getColor(new int[] { b, g, 255 });
        this.paint1(i, color, tempRect, graphics);

        g -= DELTA;
        b -= DELTA;
    }
}
项目:ermaster-k    文件:FunnyStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void createColumnArea(IFigure columns) {
    this.initColumnArea(columns);

    columns.setBorder(new MarginBorder(0, 0, 0, 0));
    columns.setBackgroundColor(ColorConstants.white);
    columns.setOpaque(true);

    this.centerFigure = new Figure();
    this.centerFigure.setLayoutManager(new BorderLayout());
    this.centerFigure.setBorder(new MarginBorder(new Insets(0, 2, 0, 2)));

    centerFigure.add(columns, BorderLayout.CENTER);
    this.getTableFigure().add(this.centerFigure, BorderLayout.CENTER);
}
项目:ermaster-k    文件:FunnyStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void createFooter() {
    IFigure footer = new Figure();
    BorderLayout footerLayout = new BorderLayout();
    footer.setLayoutManager(footerLayout);
    footer.setBorder(new MarginBorder(new Insets(0, 2, 0, 2)));

    IFigure footer1 = new Figure();
    footer1.setSize(-1, 10);
    footer1.setBackgroundColor(Resources.VERY_LIGHT_GRAY);
    footer1.setOpaque(true);

    footer.add(footer1, BorderLayout.TOP);

    IFigure footer2 = new Figure();
    footer2.setSize(-1, 7);

    footer.add(footer2, BorderLayout.BOTTOM);

    this.getTableFigure().add(footer, BorderLayout.BOTTOM);
}
项目:ermaster-k    文件:SimpleStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(Figure top) {
    ToolbarLayout topLayout = new ToolbarLayout();

    topLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
    topLayout.setStretchMinorAxis(true);
    top.setLayoutManager(topLayout);

    this.nameLabel = new Label();
    this.nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
    top.add(nameLabel);

    Figure separater = new Figure();
    separater.setSize(-1, 1);
    separater.setBackgroundColor(this.getTextColor());
    separater.setOpaque(true);

    top.add(separater);
}
项目:ermaster-k    文件:PrintERDiagramOperation.java   
/**
 * {@inheritDoc}
 */
@Override
public Rectangle getPrintRegion() {
    ERDiagram diagram = this.getDiagram();
    PageSetting pageSetting = diagram.getPageSetting();

    org.eclipse.swt.graphics.Rectangle trim = this.getPrinter()
            .computeTrim(0, 0, 0, 0);
    org.eclipse.swt.graphics.Point printerDPI = this.getPrinter().getDPI();

    Insets notAvailable = new Insets(-trim.y, -trim.x,
            trim.height + trim.y, trim.width + trim.x);

    Insets userPreferred = new Insets(
            (pageSetting.getTopMargin() * printerDPI.x) / 72,
            (pageSetting.getLeftMargin() * printerDPI.x) / 72,
            (pageSetting.getBottomMargin() * printerDPI.x) / 72,
            (pageSetting.getRightMargin() * printerDPI.x) / 72);

    Rectangle paperBounds = new Rectangle(this.getPrinter().getBounds());
    Rectangle printRegion = shrink(paperBounds, notAvailable);
    printRegion.intersect(shrink(paperBounds, userPreferred));
    printRegion.translate(trim.x, trim.y);

    return printRegion;
}
项目:ForgedUI-Eclipse    文件:CreateCommand.java   
public void redo() {
        if (rect != null) {
            Insets expansion = getInsets();
            if (!rect.isEmpty())
                rect.expand(expansion);
            else {
                rect.x -= expansion.left;
                rect.y -= expansion.top;
            }
            child.setLocation(rect.getLocation());
//          if (!rect.isEmpty())
//              child.setSize(rect.getSize());
        }
        ((Container)parent).addChild(child, index);
        child.initDefaults();
    }
项目:ForgedUI-Eclipse    文件:SearchBarFigure.java   
protected void paintCancel(Graphics graphics){
    Rectangle barBounds = getBounds().getCopy();
    barBounds.crop(new Insets(getMargin()));
    if (barBounds.height > getMaxHeight()){
        int dy = (barBounds.height - getMaxHeight())/2;
        barBounds.crop(new Insets(dy,0,dy,0));
    }

    Rectangle cancelBounds = barBounds.getCopy();
    cancelBounds.x = cancelBounds.right() - getCancelButtonWidth();
    cancelBounds.width = getCancelButtonWidth();

    Color cancelColor = new Color(null,
            ColorUtils.darker(
                    ColorUtils.darker(
                            graphics.getBackgroundColor().getRGB())));
    graphics.setBackgroundColor(cancelColor);
    int radius = Math.min(15, cancelBounds.height);
    graphics.fillRoundRectangle(cancelBounds, radius, radius);
    graphics.drawRoundRectangle(cancelBounds, radius, radius);
    graphics.setForegroundColor(ColorConstants.white);
    paintString(graphics, "Cancel", cancelBounds);
    cancelColor.dispose();
}
项目:erflute    文件:SimpleStyleSupport.java   
@Override
public void initTitleBar(Figure top) {
    final ToolbarLayout topLayout = new ToolbarLayout();

    topLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
    topLayout.setStretchMinorAxis(true);
    top.setLayoutManager(topLayout);

    this.nameLabel = new Label();
    nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
    top.add(nameLabel);

    final Figure separater = new Figure();
    separater.setSize(-1, 1);
    separater.setBackgroundColor(getTextColor());
    separater.setOpaque(true);

    top.add(separater);
}
项目:NEXCORE-UML-Modeler    文件:ShadowShape.java   
public void paint(IFigure figure, Graphics graphics, Insets insets) {
    if (!is3D()) {
        return;
    }
    graphics.setBackgroundColor(SHADOW_COLOR);
    Rectangle rec = getProportionalBounds().getTranslated(SHADOW_SIZE, SHADOW_SIZE);
    graphics.pushState();
    graphics.clipRect(rec);
    // graphics.setClip(new Rectangle(rec.x, rec.y + rec.height -
    // getShift(), rec.width, getShift()));
    fillShape(graphics, rec);
    graphics.popState();
    // graphics.setClip(new Rectangle(rec.x + rec.width - getShift(),
    // rec.y, getShift(), rec.height));
    // fillShape(graphics, rec);
}
项目:NEXCORE-UML-Modeler    文件:TitleBarBorder.java   
/**
 * rect는 타이틀 바를 그릴 사각형이다. 여기서는 이 사각형에 타이틀 바를 그린다.
 * 타이틀 바를 가로로 생성한 파티션의 왼쪽에 세로로 그린다.
 * 
 * @param figure
 * @param g
 * @param rect
 *            void
 */
private void drawHorizontalTitleBar(IFigure figure, Graphics g, Rectangle rect) {
    g.setBackgroundColor(getBackgroundColor());
    g.fillRectangle(rect);

    Insets padding = getPadding();
    int x = rect.x + padding.left;
    int y = rect.y + padding.top + (rect.height - getTextExtents(figure).height) / 2;

    int textWidth = getTextExtents(figure).width;
    int freeSpace = rect.width - padding.getWidth() - textWidth;

    if (getTextAlignment() == PositionConstants.CENTER)
        freeSpace /= 2;
    if (getTextAlignment() != PositionConstants.LEFT)
        x += freeSpace;

    Font f = getFont(figure);
    FontData fData = f.getFontData()[0];
    fData.setName(this.getFontName());
    fData.setStyle(this.getTextStyle());
    fData.setHeight(this.getFontSize());
    g.setFont(f);
    g.setForegroundColor(this.getTextColor());
    g.drawString(getLabel(), x, y);
}
项目:NEXCORE-UML-Modeler    文件:TitleBarBorder.java   
/**
 * rect는 타이틀 바를 그릴 사각형이다. 여기서는 이 사각형에 타이틀 바를 그린다.
 * 
 * @param figure
 * @param g
 * @param rect
 *            void
 */
private void drawTitleBar(IFigure figure, Graphics g, Rectangle rect) {
    g.setBackgroundColor(getBackgroundColor());
    g.fillRectangle(rect);

    Insets padding = getPadding();
    int x = rect.x + padding.left;
    int y = rect.y + padding.top + (rect.height - getTextExtents(figure).height) / 2;

    int textWidth = getTextExtents(figure).width;
    int freeSpace = rect.width - padding.getWidth() - textWidth;

    if (getTextAlignment() == PositionConstants.CENTER)
        freeSpace /= 2;
    if (getTextAlignment() != PositionConstants.LEFT)
        x += freeSpace;

    Font f = getFont(figure);
    FontData fData = f.getFontData()[0];
    fData.setName(this.getFontName());
    fData.setStyle(this.getTextStyle());
    fData.setHeight(this.getFontSize());
    g.setFont(f);
    g.setForegroundColor(this.getTextColor());
    g.drawString(getLabel(), x, y);
}
项目:NEXCORE-UML-Modeler    文件:NoteFigure.java   
/**
 * 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;
}
项目:NEXCORE-UML-Modeler    文件:CollapsedLabel.java   
/**
 * calculatePlacement
 *   void
 */
private void calculatePlacement() {
    int gap = getIconTextGap();
    if (icon == null || UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING.equals(text))
        gap = 0;
    Insets insets = getInsets();

    switch (textPlacement) {
        case EAST:
            iconLocation.x = insets.left;
            textLocation.x = getIconSize().width + gap + insets.left;
            break;
        case WEST:
            textLocation.x = insets.left;
            iconLocation.x = getSubStringTextSize().width + gap + insets.left;
            break;
        case NORTH:
            textLocation.y = insets.top;
            iconLocation.y = getTextSize().height + gap + insets.top;
            break;
        case SOUTH:
            textLocation.y = getIconSize().height + gap + insets.top;
            iconLocation.y = insets.top;
    }
}
项目:NEXCORE-UML-Modeler    文件:CollapsedLabel.java   
/**
 * @see IFigure#getPreferredSize(int, int)
 */
public Dimension getPreferredSize(int wHint, int hHint) {
    if (prefSize == null) {
        prefSize = calculateLabelSize(getTextSize());
        Insets insets = getInsets();
        prefSize.expand(insets.getWidth(), insets.getHeight());
        if (getLayoutManager() != null)
            prefSize.union(getLayoutManager().getPreferredSize(this, wHint, hHint));
    }
    if (wHint >= 0 && wHint < prefSize.width) {
        Dimension minSize = getMinimumSize(wHint, hHint);
        Dimension result = prefSize.getCopy();
        result.width = Math.min(result.width, wHint);
        result.width = Math.max(minSize.width, result.width);
        return result;
    }
    return prefSize;
}
项目:statecharts    文件:DirectEditManagerEx.java   
public void paint(IFigure figure, Graphics graphics, Insets insets) {
    Rectangle rect = getPaintRectangle(figure, insets);
    graphics.setForegroundColor(ColorConstants.white);
    graphics.drawLine(rect.x, rect.y, rect.x, rect.bottom());
    rect.x++;
    rect.width--;
    rect.resize(-1, -1);
    graphics.setForegroundColor(ColorConstants.black);
    graphics.drawLine(rect.x + 2, rect.bottom(), rect.right(),
            rect.bottom());
    graphics.drawLine(rect.right(), rect.bottom(), rect.right(),
            rect.y + 2);

    rect.resize(-1, -1);
    graphics.setForegroundColor(BLUE);
    graphics.drawRectangle(rect);
}
项目:statecharts    文件:StateEditPart.java   
@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;
}
项目:statecharts    文件:GroupStatesIntoCompositeRefactoring.java   
/**
 * Iterates through all {@link StateEditPart}s of the current selection and
 * computes layout constraints for the composite node.
 * 
 * @param compositeStateNode
 *            node of the composite state
 */
protected void setCompositeStateLayoutConstraint(Node compositeStateNode) {

    Rectangle newbounds = null;

    for (GraphicalEditPart editPart : getContextObjects()) {
        Rectangle childBounds = editPart.getFigure().getBounds();
        if (newbounds == null)
            newbounds = childBounds.getCopy();

        newbounds.union(childBounds);
    }
    newbounds.expand(new Insets(PADDING, PADDING, PADDING, PADDING));

    Bounds bounds = NotationFactory.eINSTANCE.createBounds();
    bounds.setX(newbounds.x);
    bounds.setY(newbounds.y);
    bounds.setWidth(newbounds.width);
    bounds.setHeight(newbounds.height);
    compositeStateNode.setLayoutConstraint(bounds);
}
项目:PDFReporter-Studio    文件:HighlightBorder.java   
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
    Graphics2D g = ComponentFigure.getG2D(graphics);
    if (g != null) {
        tempRect.setBounds(getPaintRectangle(figure, insets));
        if (getWidth() % 2 == 1) {
            tempRect.width--;
            tempRect.height--;
        }
        tempRect.width = tempRect.width - getWidth();
        tempRect.height = tempRect.height - getWidth();
        tempRect.shrink(getWidth() / 2, getWidth() / 2);
        g.setStroke(new BasicStroke(getWidth()));
        if (getColor() != null) {
            RGB colorRGB = getColor().getRGB();
            g.setColor(new java.awt.Color(colorRGB.red, colorRGB.green, colorRGB.blue, 128));
        }
        g.drawRect(tempRect.x, tempRect.y, tempRect.width, tempRect.height);
    }
}
项目:PDFReporter-Studio    文件:TBLineBorder.java   
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
    Rectangle r = getPaintRectangle(figure, insets);

    graphics.setLineWidth(getWidth());
    graphics.setLineStyle(getStyle());
    if (getColor() != null)
        graphics.setForegroundColor(getColor());
    int y1 = r.y + getWidth() / 2;
    int x2 = r.x + r.width;
    graphics.drawLine(r.x, y1, x2, y1);
    y1 = r.y + r.height - getWidth() / 2;
    graphics.drawLine(r.x, y1, x2, y1);

    graphics.setLineWidth(1);
    graphics.drawLine(r.x - 10, r.y, r.x - 10, r.y + r.height);
    graphics.drawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
}
项目:PDFReporter-Studio    文件:ElementLineBorder.java   
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
    Rectangle tempRect = figure.getBounds();
    if (figure instanceof HandleBounds)
        tempRect = ((HandleBounds) figure).getHandleBounds();
    Graphics2D g = ComponentFigure.getG2D(graphics);
    if (g != null) {
        Stroke oldStroke = g.getStroke();
        g.setStroke(new BasicStroke(0.1f));

        if (getColor() != null)
            g.setColor((J2DGraphics.toAWTColor(getColor())));
        g.drawRect(tempRect.x, tempRect.y, tempRect.width - 1, tempRect.height - 1);

        g.setStroke(oldStroke);
    }
}
项目:erflute    文件:ERDiagramLineBorder.java   
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
    if (getColor() != null) {
        graphics.setForegroundColor(getColor());
    }

    tempRect.setBounds(getPaintRectangle(figure, insets));
    if (getWidth() % 2 == 1) {
        tempRect.width--;
        tempRect.height--;
    }
    tempRect.shrink(getWidth() / 2, getWidth() / 2);
    graphics.setLineWidth(1);

    int g = 9 * DELTA;
    int b = 9 * DELTA;

    for (int i = 0; i <= 5; i++) {
        final Color color = DesignResources.getColor(new int[] { b, g, 255 });
        paint1(i, color, tempRect, graphics);

        g -= DELTA;
        b -= DELTA;
    }
}
项目:erflute    文件:PrintERDiagramOperation.java   
@Override
public Rectangle getPrintRegion() {
    final ERDiagram diagram = getDiagram();
    final PageSettings pageSetting = diagram.getPageSetting();

    final org.eclipse.swt.graphics.Rectangle trim = getPrinter().computeTrim(0, 0, 0, 0);
    final org.eclipse.swt.graphics.Point printerDPI = getPrinter().getDPI();

    final Insets notAvailable = new Insets(-trim.y, -trim.x, trim.height + trim.y, trim.width + trim.x);

    final Insets userPreferred =
            new Insets((pageSetting.getTopMargin() * printerDPI.x) / 72, (pageSetting.getLeftMargin() * printerDPI.x) / 72,
                    (pageSetting.getBottomMargin() * printerDPI.x) / 72, (pageSetting.getRightMargin() * printerDPI.x) / 72);

    final Rectangle paperBounds = new Rectangle(getPrinter().getBounds());
    final Rectangle printRegion = shrink(paperBounds, notAvailable);
    printRegion.intersect(shrink(paperBounds, userPreferred));
    printRegion.translate(trim.x, trim.y);

    return printRegion;
}
项目:erflute    文件:FunnyStyleSupport.java   
@Override
public void addColumnGroup(GroupColumnFigure columnFigure, int viewMode,
        String name, boolean isAdded, boolean isUpdated, boolean isRemoved) {
    columnFigure.setBorder(new MarginBorder(new Insets(1, 0, 1, 0)));

    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(0, 4, 0, 7)));
    image.setImage(Activator.getImage(ImageKey.GROUP));
    columnFigure.add(image);

    final StringBuilder text = new StringBuilder();
    text.append(name);
    text.append(" (GROUP)");

    setColumnFigureColor(columnFigure, false, false, isAdded, isUpdated, isRemoved);

    final Label label = createColumnLabel();

    label.setForegroundColor(ColorConstants.black);
    label.setLabelAlignment(PositionConstants.RIGHT);
    label.setBorder(new MarginBorder(new Insets(1, 3, 0, 4)));

    label.setText(text.toString());

    columnFigure.add(label);
}
项目:erflute    文件:FunnyStyleSupport.java   
@Override
public void addIndex(IndexFigure indexFigure, String name, boolean isFirst) {
    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(0, 0, 0, 19)));
    image.setImage(Activator.getImage(ImageKey.BLANK_WHITE));
    image.setOpaque(true);
    indexFigure.add(image);

    final StringBuilder text = new StringBuilder();
    text.append(name);
    final Label label = createColumnLabel();
    label.setBorder(new MarginBorder(new Insets(1, 0, 0, 4)));
    label.setForegroundColor(ColorConstants.black);
    label.setText(text.toString());

    indexFigure.add(label);
}
项目:pandionj    文件:ValueFigure.java   
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
    graphics.setForegroundColor(PandionJConstants.Colors.ROLE_ANNOTATIONS);
    Rectangle r = figure.getBounds();
    int startY = direction == Direction.FORWARD ? 2 : 1 + (PandionJConstants.POSITION_WIDTH/3)*2;
    Point from = r.getLocation().getTranslated(r.width-6, startY);
    Point to = from.getTranslated(0, PandionJConstants.POSITION_WIDTH / 4);
    if(direction == Direction.FORWARD) {
        Point t = from;
        from = to;
        to = t;
    }
    drawArrow(graphics, from, to); 
}
项目:DarwinSPL    文件:DwEnumContainerFigure.java   
public DwEnumContainerFigure(DwGraphicalFeatureModelViewer editor) {
    super(editor);

    DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme();

    ToolbarLayout layout = new ToolbarLayout();
    layout.setHorizontal(false);
    layout.setSpacing(theme.getPrimaryMargin());        
    setLayoutManager(layout);   

    this.setBorder(new DwMarginLineBorder(new Insets(10, 10, 10, 10), theme.getLineColor(), theme.getLineWidth()));
}
项目:DarwinSPL    文件:DwExpandButton.java   
protected void createTriangle() {
    DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme();        

    Triangle tri = new Triangle();
    tri.setOutline(true);
    tri.setBackgroundColor(theme.getFeatureFontColor());
    tri.setForegroundColor(theme.getFeatureFontColor());
    tri.setBorder(new MarginBorder(new Insets(2)));
    setContents(tri);
}
项目:ermasterr    文件:DropShadowRectangle.java   
/**
 * {@inheritDoc}
 */
@Override
protected void fillShape(final Graphics graphics) {
    Rectangle f = Rectangle.SINGLETON.setBounds(getBounds());
    final Insets shadowInset = new Insets(0, 0, SHADOW_INSET, SHADOW_INSET);
    f = shrink(f, shadowInset);
    drawShadow(f, graphics);
    final Dimension cornerDimensions = getCornerDimensions();
    graphics.fillRoundRectangle(f, cornerDimensions.width, cornerDimensions.height);
}
项目:ermasterr    文件:DropShadowRectangle.java   
private Rectangle shrink(final Rectangle bounds, final Insets insets) {
    final Rectangle shrinked = bounds.getCopy();

    shrinked.x += insets.left;
    shrinked.y += insets.top;
    shrinked.width -= insets.getWidth();
    shrinked.height -= insets.getHeight();

    return shrinked;
}
项目:ermasterr    文件:DropShadowRectangle.java   
/**
 * {@inheritDoc}
 */
@Override
protected void outlineShape(final Graphics graphics) {
    final Rectangle f = Rectangle.SINGLETON.setBounds(getBounds());
    final Insets shadowInset = new Insets(getLineWidth() / 2, getLineWidth() / 2, getLineWidth() + SHADOW_INSET, getLineWidth() + SHADOW_INSET);
    shrink(f, shadowInset);
    final Dimension cornerDimensions = getCornerDimensions();
    graphics.drawRoundRectangle(f, cornerDimensions.width, cornerDimensions.height);
}
项目:ermasterr    文件:NormalColumnFigure.java   
public NormalColumnFigure() {
    final FlowLayout layout = new FlowLayout();
    layout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
    setLayoutManager(layout);

    setBorder(new MarginBorder(new Insets(0, 5, 0, 0)));
}
项目:ermasterr    文件:FunnyStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(final Figure top) {
    top.setLayoutManager(new BorderLayout());

    final Figure title = new Figure();
    top.add(title, BorderLayout.TOP);
    final FlowLayout titleLayout = new FlowLayout();
    titleLayout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
    title.setLayoutManager(titleLayout);

    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(5, 10, 5, 2)));
    image.setImage(ERDiagramActivator.getImage(getTableFigure().getImageKey()));
    title.add(image);

    nameLabel = new Label();
    nameLabel.setBorder(new MarginBorder(new Insets(5, 0, 5, 20)));
    title.add(nameLabel);

    final Figure separater = new Figure();
    separater.setSize(-1, 1);
    separater.setBackgroundColor(ColorConstants.black);
    separater.setOpaque(true);

    top.add(separater, BorderLayout.BOTTOM);
}
项目:ermasterr    文件:AbstractStyleSupport.java   
protected Label createColumnLabel() {
    final Label label = new Label();
    label.setBorder(new MarginBorder(new Insets(3, 5, 3, 5)));
    label.setLabelAlignment(PositionConstants.LEFT);

    return label;
}
项目:ermasterr    文件:FrameStyleSupport.java   
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(final Figure top) {
    titleBarBorder = (TitleBarBorder) border.getInnerBorder();
    titleBarBorder.setTextAlignment(PositionConstants.CENTER);
    titleBarBorder.setPadding(new Insets(5, 20, 5, 20));
}
项目:ermasterr    文件:PrintERDiagramOperation.java   
private Rectangle shrink(final Rectangle bounds, final Insets insets) {
    final Rectangle shrinked = bounds.getCopy();

    shrinked.x += insets.left;
    shrinked.y += insets.top;
    shrinked.width -= insets.getWidth();
    shrinked.height -= insets.getHeight();

    return shrinked;
}