Java 类org.eclipse.draw2d.ColorConstants 实例源码

项目:NEXCORE-UML-Modeler    文件:DataTypeFigure.java   
/**
 * @see nexcore.tool.uml.ui.core.diagram.figure.AbstractNotationNodeFigure#paintFigure(org.eclipse.draw2d.Graphics)
 */
@Override
protected void paintFigure(Graphics graphics) {

    super.paintFigure(graphics);
    graphics.drawRectangle(getLocation().x, getLocation().y, getSize().width - 1, getSize().height - 1);

    graphics.setAntialias(SWT.ON);

    Rectangle bounds = getBounds();
    if(isDangling()){
        graphics.setForegroundColor(ColorConstants.red);
        graphics.drawOval(bounds.x, bounds.y, 12, 12);
        graphics.drawLine(bounds.x + 2, bounds.y + 2, bounds.x + 10, bounds.y + 10);
        graphics.drawLine(bounds.x + 10, bounds.y + 2, bounds.x + 2, bounds.y + 10);
    }
}
项目:NEXCORE-UML-Modeler    文件:CollapsedLabel.java   
/**
 * @see Figure#paintFigure(Graphics)
 */
protected void paintFigure(Graphics graphics) {
    if (isOpaque())
        super.paintFigure(graphics);
    Rectangle bounds = getBounds();
    graphics.translate(bounds.x, bounds.y);
    if (icon != null)
        graphics.drawImage(icon, getIconLocation());
    if (!isEnabled()) {
        graphics.translate(1, 1);
        graphics.setForegroundColor(ColorConstants.buttonLightest);
        graphics.drawText(getSubStringText(), getTextLocation());
        graphics.translate(-1, -1);
        graphics.setForegroundColor(ColorConstants.buttonDarker);
    }
    graphics.drawText(getSubStringText(), getTextLocation());
    graphics.translate(-bounds.x, -bounds.y);
}
项目:neoscada    文件:GenericLevelPresets.java   
@Override
protected IFigure createMain ()
{
    final Figure baseFigure = new LayeredPane ();

    final Layer rootFigure = new Layer ();

    this.connLayer = new ConnectionLayer ();
    this.connLayer.setAntialias ( 1 );
    this.connLayer.setConnectionRouter ( ConnectionRouter.NULL );

    baseFigure.add ( this.connLayer );
    baseFigure.add ( rootFigure );

    rootFigure.setLayoutManager ( new BorderLayout () );
    rootFigure.setBackgroundColor ( ColorConstants.white );

    rootFigure.add ( createArrowFigure (), BorderLayout.RIGHT );
    rootFigure.add ( createEntryGrid ( this.connLayer ), BorderLayout.CENTER );

    return baseFigure;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:ServiceFigure.java   
@Override
public void rebuildFigure() {
    getDisplay().setForegroundColor(ColorConstants.black);
    add(getDisplay());
    setConstraint(getDisplay(), new Rectangle(10, 10, -1, -1));
    setOpaque(true);
    setVisible(true);
    setForegroundColor(ServiceNode.FONT_COLOR);
    if (node.getType().equalsIgnoreCase(Enums.ServiceTypes.PROVIDED.name()))
        setBackgroundColor(ColorConstants.green);
    else if (node.getType().equalsIgnoreCase(Enums.ServiceTypes.REQUIRED.name()))
        setBackgroundColor(ColorConstants.orange);
    else
        setBackgroundColor(ServiceNode.DEF_COLOR);
    TooltipFigure tooltip = new TooltipFigure();
    tooltip.setMessage("Service");
    setToolTip(tooltip);
}
项目:gw4e.project    文件:EdgeFigure.java   
public EdgeFigure() {
    tooltipFigure = new TooltipFigure();
    setToolTip(tooltipFigure);

    this.setLineWidth(this.getLineWidth() * 2);

    this.setTargetDecoration(new PolylineDecoration());

    label = new Label("e_"+ID.getId());
    label.setOpaque(true);
    label.setBackgroundColor(ColorConstants.buttonLightest);
    label.setBorder(new LineBorder());
    add(label, new MidpointLocator(this, 0));

    guardedFigure = new GuardFigure();
    blockedFigure = new BlockedFigure();
    actionFigure = new ActionFigure ();
    add (actionFigure, new RelativeLocator(label,0.5,1.5));
}
项目:gemoc-studio    文件:BranchEditPart.java   
@Override
protected IFigure createFigure() {
    final LineLayout layout = new LineLayout();
    layout.setHorizontal(true);
    layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT);
    layout.setMinorAlignment(FlowLayout.ALIGN_BOTTOMRIGHT);
    layout.setMinorSpacing(SPACING);
    layout.setMargin(MARGIN);

    FreeformLayer res = new FreeformLayer();
    final Label toolTip = new Label();
    toolTip.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    toolTip.setBackgroundColor(ColorConstants.tooltipBackground);
    toolTip.setForegroundColor(ColorConstants.tooltipForeground);
    toolTip.setText(getModel().getTimelineWindow().getProvider().getTextAt(getModel().getBranch()));
    res.setToolTip(toolTip);
    res.setLayoutManager(layout);
    return res;
}
项目:Hydrograph    文件:ComponentLabelFigure.java   
/**
 * Creates a new LabelFigure with a MarginBorder that is the given size and
 * a FlowPage containing a TextFlow with the style WORD_WRAP_SOFT.
 * 
 * @param borderSize
 *            the size of the MarginBorder
 */
public ComponentLabelFigure(int borderSize) {
    setBorder(new MarginBorder(borderSize));
    flowPage = new FlowPage();

    textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
            ParagraphTextLayout.WORD_WRAP_SOFT));


    flowPage.add(textFlow);
    flowPage.setHorizontalAligment(PositionConstants.CENTER);

    setLayoutManager(new StackLayout());
    add(flowPage);
    font = new Font( Display.getDefault(), "Arial", 9,
            SWT.NORMAL );
    setFont(font);
    setForegroundColor(ColorConstants.black);

}
项目:Hydrograph    文件:CommentBoxFigure.java   
/**
 * Creates a new CommentBoxFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow
 * with the style WORD_WRAP_SOFT.
 * 
 * @param borderSize
 *            the size of the MarginBorder
 */
public CommentBoxFigure(int borderSize) {
    setBorder(new MarginBorder(5));
    FlowPage flowPage = new FlowPage();

    textFlow = new TextFlow();

    textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT));

    flowPage.add(textFlow);

    setLayoutManager(new StackLayout());
    add(flowPage);
    font = new Font(Display.getDefault(), "Arial", 9, SWT.NORMAL);
    setFont(font);
    setForegroundColor(ColorConstants.black);
    setOpaque(false);

}
项目:bdf2    文件:AbstractNodeFigure.java   
public AbstractNodeFigure(AbstractNodeElement node,Image icon){
    this.node=node;
    BorderLayout layout=new BorderLayout();
    this.setLayoutManager(layout);
    ImageFigure iconFigure=new ImageFigure(icon);
    this.add(iconFigure,BorderLayout.LEFT);
    this.label=new Label(this.node.getLabel());
    this.label.setForegroundColor(ColorConstants.black);
    this.add(this.label,BorderLayout.CENTER);
    this.setAntialias(SWT.ON);
    RGB rgb=Activator.getPreference().getBorderColor();
    this.setForegroundColor(new Color(null,rgb.red,rgb.green,rgb.blue));
    rgb=Activator.getPreference().getBackgroundColor();
    this.setBackgroundColor(new Color(null,rgb.red,rgb.green,rgb.blue));
    this.setLineWidth(2);
}
项目:bdf2    文件:TableFigure.java   
public TableFigure() {
    ToolbarLayout layout = new ToolbarLayout();
    setLayoutManager(layout);
    LineBorder lineBorder = new LineBorder(ColorConstants.lightGray, 2);
    setBorder(lineBorder);
    setOpaque(true);
    setBackgroundColor(ColorConstants.white);

    Font font = new Font(null, "宋体", 11, SWT.NORMAL);
    label.setFont(font);
    label.setBorder(new LineBorder(ColorConstants.lightGray));
    label.setIcon(Activator.getImage(Activator.IMAGE_TABLE_16));
    label.setOpaque(true);
    label.setBackgroundColor(ColorConstants.lightBlue);
    label.setForegroundColor(ColorConstants.black);
    add(label);
    add(columnFigure);
}
项目:bdf2    文件:ColumnFigure.java   
public void refreshFigure(BaseModel model) {
    Image imageBlank = Activator.getImage(Activator.IMAGE_BLANK);
    Column column = (Column) model;
    setForegroundColor(column.isPk() ? ColorConstants.red : ColorConstants.black);
    pkFigure.setImage(column.isPk() ? Activator.getImage(Activator.IMAGE_PK) : imageBlank);
    fkFigure.setImage(column.isFk() ? Activator.getImage(Activator.IMAGE_FK) : imageBlank);
    firstLabel.setText(" " + column.getLabel() + "/" + column.getName() + " ");

    String type = column.getType();
    DbDialect dbDialect = DbDialectManager.getDbDialect(column.getTable().getSchema().getCurrentDbType());
    ColumnType columnType = DbDialectManager.getColumnType(dbDialect, type);
    String length = column.getLength();
    String decimal = column.getDecimalLength();
    if (columnType.isLength() && columnType.isDecimal() && length.length() > 0 && decimal.length() > 0) {
        type += "(" + length + "," + decimal + ")";
    } else if (columnType.isLength() && length.length() > 0 && decimal.length() == 0) {
        type += "(" + length + ")";
    }
    lastLabel.setText(type);
    notNullFigure.setImage(column.isNotNull() ? Activator.getImage(Activator.IMAGE_NOTNULL) : imageBlank);
    uniqueFigure.setImage(column.isUnique() ? Activator.getImage(Activator.IMAGE_UNIQUE) : imageBlank);

}
项目:pandionj    文件:MatrixWidget.java   
private void update() {
    removeAll();
    valid = model.isMatrix();
    if(valid) {
        Object[] array = (Object[]) model.getValues();
        for(Object line : array) {
            int len = Array.getLength(line);
            for(int i = 0; i < len; i++) {
                Object e = Array.get(line, i);
                Label label = new Label(e.toString()); // TODO array deepToString
                label.setForegroundColor(ColorConstants.black);
                add(label);
            }
        }
    }
    getLayoutManager().layout(this);
    repaint();
}
项目:pandionj    文件:MatrixWidget.java   
@Override
protected void paintFigure(Graphics g) {
    super.paintFigure(g);
    final int LEG = 5;
    Rectangle r = getBounds();
    g.setLineWidth(1);
    g.setForegroundColor(valid ? ColorConstants.black : PandionJConstants.Colors.ERROR);

    g.drawLine(r.x, r.y, r.x, r.y+r.height-1);
    g.drawLine(r.x, r.y, r.x+LEG, r.y);
    g.drawLine(r.x, r.y+r.height-1, r.x+LEG, r.y+r.height-1);

    g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1, r.y+r.height);
    g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1-LEG, r.y);
    g.drawLine(r.x+r.width-1, r.y+r.height-1, r.x+r.width-1-LEG, r.y+r.height-1);

    if(!valid) {
        g.setForegroundColor(PandionJConstants.Colors.ERROR);
        String text = "Invalid matrix";
        int textWidth = FigureUtilities.getTextWidth(text, g.getFont());
        Point p = r.getLocation().translate(r.width/2 - textWidth/2, 5);
        g.drawText(text, p);
    }
}
项目:pandionj    文件:ObjectFigure.java   
MethodWidget(IMethod method) {
    setLayoutManager(new FlowLayout());
    button = new Button(shortSig(method));
    button.setToolTip(new Label(longSig(method)));
    button.setForegroundColor(ColorConstants.black);
    FontManager.setFont(button, PandionJConstants.BUTTON_FONT_SIZE);
    button.setEnabled(methodsEnabled);
    add(button);
    resultLabel = new Label();
    resultLabel.setForegroundColor(ColorConstants.black);
    add(resultLabel);
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            invoke(model, method, resultLabel);
        }
    });
}
项目:pandionj    文件:ReferenceLabel.java   
@Override
protected void paintFigure(Graphics g) {
    super.paintFigure(g);

    Rectangle r = getBounds();
    Rectangle square = new Rectangle(r.getLocation().getTranslated(0, r.height/4), new Dimension(r.width/2, r.height/2));
    center = new Point(square.x + square.width/2, square.y + square.height/2);

    g.setBackgroundColor(dirty ? PandionJConstants.Colors.HIGHLIGHT : PandionJConstants.Colors.VARIABLE_BOX);
    g.fillRectangle(square);

    g.setForegroundColor(ref.getRole() == Role.FIXED_VALUE ? PandionJConstants.Colors.CONSTANT : ColorConstants.black);
    g.drawRectangle(square);

    g.setBackgroundColor(error ? PandionJConstants.Colors.ERROR : ColorConstants.black);
    g.fillOval(center.x-3, center.y-3, 7, 7);

    if(isnull) {
        g.setForegroundColor(error ? PandionJConstants.Colors.ERROR : ColorConstants.black);
        Point dest = center.getTranslated(20, 0);
        g.drawLine(center, dest);
        g.drawLine(dest.getTranslated(-3, 5), dest.getTranslated(3, -5));
    }
}
项目:pandionj    文件:ValueLabel.java   
ValueLabel(IValueModel model) {
    this.model = model;
    setOpaque(true);
    FontManager.setFont(this, PandionJConstants.VALUE_FONT_SIZE);
    setSize(model.isDecimal() || model.isBoolean() ? PandionJConstants.POSITION_WIDTH*2 : PandionJConstants.POSITION_WIDTH, PandionJConstants.POSITION_WIDTH);
    setForegroundColor(ColorConstants.black);
    setBackgroundColor(PandionJConstants.Colors.VARIABLE_BOX);
    setBorder(new LineBorder(ColorConstants.black, PandionJConstants.ARRAY_LINE_WIDTH, SWT.LINE_SOLID));
    updateValue();
    model.registerDisplayObserver((a) -> updateValue());
    model.getRuntimeModel().registerDisplayObserver((e) -> {
        if(e.type == IRuntimeModel.Event.Type.STEP || e.type == IRuntimeModel.Event.Type.EVALUATION) {
            updateBackground();
        }
    });
    dirty = false;
}
项目:pandionj    文件:ReferenceFigure.java   
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));
}
项目:pandionj    文件:ColorRGBArrayWidget.java   
void update(int r, int g, int b) {
    boolean valid = 
            r >= 0 && r <= 255 && 
            g >= 0 && g <= 255 && 
            b >= 0 && b <= 255;
    colorFig.setOpaque(valid);
    colorFig.setBackgroundColor(valid ? PandionJUI.getColor(r, g, b) : null);
    colorFig.setBorder(new LineBorder(valid ? ColorConstants.black : PandionJConstants.Colors.ERROR));
    if(valid)
        colorFig.setToolTip(null);
    else {
        Label label = new Label("Invalid RGB values");
        label.setForegroundColor(PandionJConstants.Colors.ERROR);
        colorFig.setToolTip(label);
    }
    text.setText(r + ", " + g + ", " + b);
}
项目: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    文件:NormalColumnEditPart.java   
private void setGroupColumnFigureColor(final TableViewEditPart parentEditPart, final ColumnGroup columnGroup, final boolean selected) {
    for (final NormalColumn column : columnGroup.getColumns()) {
        for (final Object editPart : parentEditPart.getChildren()) {
            final NormalColumnEditPart childEditPart = (NormalColumnEditPart) editPart;
            if (childEditPart.getModel() == column) {
                final NormalColumnFigure columnFigure = (NormalColumnFigure) childEditPart.getFigure();
                if (selected) {
                    columnFigure.setBackgroundColor(ColorConstants.titleBackground);
                    columnFigure.setForegroundColor(ColorConstants.titleForeground);

                } else {
                    columnFigure.setBackgroundColor(null);
                    columnFigure.setForegroundColor(null);
                }

                childEditPart.selected = selected;
                break;
            }
        }
    }
}
项目:ermasterr    文件:GroupColumnEditPart.java   
/**
 * {@inheritDoc}
 */
@Override
public void setSelected(final int value) {
    final GroupColumnFigure figure = (GroupColumnFigure) getFigure();

    if (value != 0 && getParent() != null && getParent().getParent() != null) {
        final List selectedEditParts = getViewer().getSelectedEditParts();

        if (selectedEditParts != null && selectedEditParts.size() == 1) {
            figure.setBackgroundColor(ColorConstants.titleBackground);
            figure.setForegroundColor(ColorConstants.titleForeground);
            selected = true;

            super.setSelected(value);
        }

    } else {
        figure.setBackgroundColor(null);
        figure.setForegroundColor(null);
        selected = false;

        super.setSelected(value);
    }

}
项目: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    文件:SequenceOutlineEditPart.java   
/**
 * {@inheritDoc}
 */
@Override
protected void refreshOutlineVisuals() {
    Sequence sequence = (Sequence) this.getModel();

    if (!DBManagerFactory.getDBManager(this.getDiagram()).isSupported(
            DBManager.SUPPORT_SEQUENCE)) {
        ((TreeItem) getWidget()).setForeground(ColorConstants.lightGray);

    } else {
        ((TreeItem) getWidget()).setForeground(ColorConstants.black);
    }

    this.setWidgetText(this.getDiagram().filter(sequence.getName()));
    this.setWidgetImage(ERDiagramActivator.getImage(ImageKey.SEQUENCE));
}
项目:ermaster-k    文件:SequenceSetOutlineEditPart.java   
/**
 * {@inheritDoc}
 */
@Override
protected void refreshOutlineVisuals() {
    if (!DBManagerFactory.getDBManager(this.getDiagram()).isSupported(
            DBManager.SUPPORT_SEQUENCE)) {
        ((TreeItem) getWidget()).setForeground(ColorConstants.lightGray);

    } else {
        ((TreeItem) getWidget()).setForeground(ColorConstants.black);

    }

    this.setWidgetText(ResourceString.getResourceString("label.sequence")
            + " (" + this.getModelChildren().size() + ")");
    this.setWidgetImage(ERDiagramActivator.getImage(ImageKey.DICTIONARY));
}
项目:ermaster-k    文件:NormalColumnEditPart.java   
private void setGroupColumnFigureColor(TableViewEditPart parentEditPart,
        ColumnGroup columnGroup, boolean selected) {
    for (NormalColumn column : columnGroup.getColumns()) {
        for (Object editPart : parentEditPart.getChildren()) {
            NormalColumnEditPart childEditPart = (NormalColumnEditPart) editPart;
            if (childEditPart.getModel() == column) {
                NormalColumnFigure columnFigure = (NormalColumnFigure) childEditPart
                        .getFigure();
                if (selected) {
                    columnFigure
                            .setBackgroundColor(ColorConstants.titleBackground);
                    columnFigure
                            .setForegroundColor(ColorConstants.titleForeground);

                } else {
                    columnFigure.setBackgroundColor(null);
                    columnFigure.setForegroundColor(null);
                }

                childEditPart.selected = selected;
                break;
            }
        }
    }
}
项目:ermaster-k    文件:GroupColumnEditPart.java   
/**
 * {@inheritDoc}
 */
@Override
public void setSelected(int value) {
    GroupColumnFigure figure = (GroupColumnFigure) this.getFigure();

    if (value != 0 && this.getParent() != null
            && this.getParent().getParent() != null) {
        List selectedEditParts = this.getViewer().getSelectedEditParts();

        if (selectedEditParts != null && selectedEditParts.size() == 1) {
            figure.setBackgroundColor(ColorConstants.titleBackground);
            figure.setForegroundColor(ColorConstants.titleForeground);
            selected = true;

            super.setSelected(value);
        }

    } else {
        figure.setBackgroundColor(null);
        figure.setForegroundColor(null);
        selected = false;

        super.setSelected(value);
    }

}
项目:ForgedUI-Eclipse    文件:ChildElementResizableEditPolicy.java   
@Override
protected void paintFigure(Graphics graphics) {
    IFigure figure = new RectangleFigure();
    ((RectangleFigure) figure).setXOR(true);
    ((RectangleFigure) figure).setFill(true);
    figure.setBackgroundColor(ghostFillColor);
    figure.setForegroundColor(ColorConstants.white);
    figure.setBounds(getBounds());
    figure.paint(graphics);
    /*Image feedbackImage = new Image(Display.getCurrent(),
            ghostImageData);
    graphics.setAlpha(alpha);
    graphics.setClip(getBounds().getCopy());
    graphics.drawImage(feedbackImage, 0, 0, ghostImageData.width,
            ghostImageData.height, getBounds().x, getBounds().y,
            getBounds().width, getBounds().height);
    feedbackImage.dispose();*/
}
项目: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);
}
项目:PDFReporter-Studio    文件:JDRulerRootEditPart.java   
/**
         * @see org.eclipse.draw2d.Figure#paintBorder(org.eclipse.draw2d.Graphics)
         */
        protected void paintBorder(Graphics graphics) {
            super.paintBorder(graphics);
            if (this.getContents() != null && ((JDRulerFigure) this.getContents()).getDrawFocus()) {
                Rectangle focusBounds = getBounds().getCopy();
                if (((JDRulerFigure) this.getContents()).isHorizontal()) {
                    focusBounds.resize(-2, -4);
                    focusBounds.x++;
                } else {
                    focusBounds.resize(-4, -2);
                    focusBounds.y++;
                }
                graphics.setForegroundColor(ColorConstants.black);
                graphics.setBackgroundColor(ColorConstants.white);
//              graphics.drawFocus(focusBounds);
            }
        }
项目: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();
}
项目:PDFReporter-Studio    文件:TemplateBorder.java   
/**
 * Return a border preview for a custom border (not equals to any preset). The image is created only the first time is
 * requested, then it is cached and disposed when the application is closed.
 * 
 * @return an image with the words "Custom" rendereized into it
 */
public static Image getCustomImage() {
    String key = "linePreset_custom";
    Image image = ResourceManager.getImage(key);
    if (image == null) {
        ImageData data = new ImageData(getWidth(), 15, 1, new PaletteData(new RGB[] { ColorConstants.white.getRGB() }));
        // data.transparentPixel = data.getPixel(0, 0);
        image = new Image(null, data);
        GC graphics = new GC(image);
        try {
            graphics.setFont(ResourceManager.getFont("Time New Roman", 10, SWT.NORMAL));
            // graphics.setTextAntialias(SWT.ON);
            graphics.drawString("Custom", 5, 0);
        } finally {
            graphics.dispose();
        }
        ResourceManager.addImage(key, image);
    }
    return image;
}
项目:ForgedUI-Eclipse    文件:SwitchFigure.java   
@Override
protected void paintTitaniumFigure(Graphics graphics) {
    if (isON()){
        graphics.setForegroundColor(ColorConstants.white);
    }
    super.paintTitaniumFigure(graphics);
    Rectangle rect = getBounds().getCopy();
    //rect.shrink((int)getBorder().getBorderWidth(), (int)getBorder().getBorderWidth());
    if (isON()){
        rect.x = rect.right() - rect.height;
    }
    rect.width = rect.height;
    Image image = Drawer.getGradientRectangle(new PrecisionRectangle(rect.getCopy()),
            RECT_B_RGB, RECT_T_RGB, rect.height / 2, rect.height, rect.height);
    graphics.drawImage(image, rect.getLocation());
    image.dispose();
}
项目:erflute    文件:GroupColumnEditPart.java   
@Override
public void refreshTableColumns() {
    final ERDiagram diagram = getDiagram();
    final GroupColumnFigure columnFigure = (GroupColumnFigure) getFigure();
    final TableViewEditPart parent = (TableViewEditPart) getParent();
    parent.getContentPane().add(figure);
    final int notationLevel = diagram.getDiagramContents().getSettings().getNotationLevel();
    final ERColumn column = (ERColumn) getModel();
    if (notationLevel != DiagramSettings.NOTATION_LEVLE_TITLE) {
        final TableFigure tableFigure = (TableFigure) parent.getFigure();
        final boolean isAdded = false;
        final boolean isUpdated = false;
        if ((notationLevel == DiagramSettings.NOTATION_LEVLE_KEY)) {
            columnFigure.clearLabel();
            return;
        }
        addGroupColumnFigure(diagram, tableFigure, columnFigure, column, isAdded, isUpdated, false);
        if (selected) {
            columnFigure.setBackgroundColor(ColorConstants.titleBackground);
            columnFigure.setForegroundColor(ColorConstants.titleForeground);
        }
    } else {
        columnFigure.clearLabel();
        return;
    }
}
项目:erflute    文件:NormalColumnEditPart.java   
private void setGroupColumnFigureColor(TableViewEditPart parentEditPart, ColumnGroup columnGroup, boolean selected) {
    for (final NormalColumn column : columnGroup.getColumns()) {
        for (final Object editPart : parentEditPart.getChildren()) {
            final NormalColumnEditPart childEditPart = (NormalColumnEditPart) editPart;
            if (childEditPart.getModel() == column) {
                final NormalColumnFigure columnFigure = (NormalColumnFigure) childEditPart.getFigure();
                if (selected) {
                    columnFigure.setBackgroundColor(ColorConstants.titleBackground);
                    columnFigure.setForegroundColor(ColorConstants.titleForeground);
                } else {
                    columnFigure.setBackgroundColor(null);
                    columnFigure.setForegroundColor(null);
                }

                childEditPart.selected = selected;
                break;
            }
        }
    }
}
项目:PDFReporter-Studio    文件:BandEditPart.java   
protected IFigure createFigure() {
    JRDesignBand jrBand = getBand();
    BandTypeEnum bandTypeValue = jrBand.getOrigin().getBandTypeValue();
    boolean drawColumns = bandTypeValue.equals(BandTypeEnum.COLUMN_FOOTER)
            || bandTypeValue.equals(BandTypeEnum.COLUMN_HEADER) || bandTypeValue.equals(BandTypeEnum.GROUP_FOOTER)
            || bandTypeValue.equals(BandTypeEnum.GROUP_HEADER) || bandTypeValue.equals(BandTypeEnum.COLUMN_HEADER)
            || bandTypeValue.equals(BandTypeEnum.DETAIL);

    BandFigure rect = new BandFigure(drawColumns, getModel());
    rect.setForegroundColor(ColorConstants.blue);
    setupBandFigure(rect);

    figure = rect;
    setBandNameShowing(rect);
    setMarginColor();
    return rect;
}
项目: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    文件:SimpleSnapFeedbackPolicy.java   
/**
 * @see org.eclipse.gef.EditPolicy#showTargetFeedback(org.eclipse.gef.Request)
 */
public void showTargetFeedback(Request req) {
    if (req.getType().equals(REQ_MOVE) || req.getType().equals(REQ_RESIZE) || req.getType().equals(REQ_CLONE)
            || req.getType().equals(REQ_ADD) || req.getType().equals(REQ_CREATE)) {

        Integer value;
        value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_WEST_ANCHOR);
        highlightGuide(value, ColorConstants.lightBlue, 0);

        value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_NORTH_ANCHOR);
        highlightGuide(value, ColorConstants.lightBlue, 1);

        value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_EAST_ANCHOR);
        highlightGuide(value, ColorConstants.lightBlue, 2);

        value = (Integer) req.getExtendedData().get(SnapToGeometry.KEY_SOUTH_ANCHOR);
        highlightGuide(value, ColorConstants.lightBlue, 3);

        value = (Integer) req.getExtendedData().get(SnapToGuides.KEY_VERTICAL_GUIDE);
        highlightGuide(value, ColorConstants.red, 4);

        value = (Integer) req.getExtendedData().get(SnapToGuides.KEY_HORIZONTAL_GUIDE);
        highlightGuide(value, ColorConstants.red, 5);
    }
}
项目:statecharts    文件:StatechartDiagramEditor.java   
protected void createDefinitionSectionNameLabel(Composite labelComposite) {
    Text statechartNameLabel = new Text(labelComposite, SWT.SINGLE | SWT.NORMAL);
    GridDataFactory.fillDefaults().indent(5, 1).grab(true, false).align(SWT.FILL, SWT.CENTER)
            .applyTo(statechartNameLabel);

    statechartNameLabel.setText(getStatechartName());
    statechartNameLabel.setEditable(getContextObject() instanceof Statechart);
    statechartNameLabel.setBackground(ColorConstants.white);
    statechartNameLabel.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            statechartNameLabel.update();
            statechartNameLabel.redraw();
            statechartNameLabel.getParent().layout();
        }
    });

    observeStatechartName(statechartNameLabel);
}
项目:PDFReporter-Studio    文件:ColorSchemaGenerator.java   
/**
  * Return a a preview image of an embedded color. The image will have size of 
  * 20x10. The image are cached, so it will be generated only the first time that are 
  * requested.
  * 
  * @param colorName the human name of the color
  * @return an SWT image, preview of the color. It can be null if the human name dosen't match 
  * none of the embedded colors.
  */
 public static Image getImagePreview(String colorName){
//The images are cached and disposed at the end
String key = "colorPreview_"+colorName; //$NON-NLS-1$
Image image = ResourceManager.getImage(key);
if (image == null){
    if (colorsMap == null) getColors();
    String colorCode = colorsMap.get(colorName);
    if (colorCode != null){
        Color color = decodeColor("#"+colorCode); //$NON-NLS-1$
        RGB colorRGB = new RGB(color.getRed(), color.getGreen(), color.getBlue());
        ImageData data = new ImageData(20, 10, 1, new PaletteData(new RGB[]{colorRGB}));
        image = new Image(null,data); 
        GC graphics = new GC(image);
        graphics.setForeground(ColorConstants.black);
        graphics.drawRectangle(0,0,19,9);
        graphics.dispose();
        ResourceManager.addImage(key, image);
    } else return null;
}
return image;
}
项目:statecharts    文件:FinalStateFigure.java   
protected void createContents() {
    int size = mapMode.DPtoLP(2);
    this.setBorder(new MarginBorder(size, size, size, size));
    Ellipse whiteCircle = new Ellipse();
    whiteCircle.setOutline(false);
    whiteCircle.setLineWidth(1);
    whiteCircle.setBackgroundColor(ColorConstants.white);
    size = mapMode.DPtoLP(3);
    whiteCircle.setBorder(new MarginBorder(size, size, size, size));
    BorderLayout layout = new BorderLayout();
    whiteCircle.setLayoutManager(layout);
    Object data = BorderLayout.CENTER;
    this.add(whiteCircle, data);
    Ellipse blackCircle = new Ellipse();
    blackCircle.setOutline(false);
    blackCircle.setLineWidth(mapMode.DPtoLP(1));
    blackCircle.setBackgroundColor(ColorConstants.black);
    data = BorderLayout.CENTER;
    whiteCircle.add(blackCircle, data);
}