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

项目: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);
}
项目:gef-gwt    文件:FlyoutPaletteComposite.java   
/**
 * Creates a new instance
 * 
 * @param direction
 *            the direction the arrow should face
 *            (PositionConstants.RIGHT or PositionConstants.LEFT)
 */
public ArrowButton(int direction) {
    super();
    setDirection(direction);

    triangle = new Triangle();
    triangle.setOutline(true);
    triangle.setBackgroundColor(PaletteColorUtil.WIDGET_LIST_BACKGROUND);
    triangle.setForegroundColor(PaletteColorUtil.WIDGET_DARK_SHADOW);
    setContents(triangle);
}
项目:OpenSPIFe    文件:TreeTimelineHeaderRowEditPart.java   
protected void addTitle(IFigure figure) {
    Object model = getModel();

    final int rowHeight = TimelineUtils.getRowElementHeight(TreeTimelineHeaderRowEditPart.this);
    Figure title = new Figure();
    ToolbarLayout layout = new ToolbarLayout(true);
    layout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
    title.setLayoutManager(layout);
    layout.setSpacing(6);

    int depth = getDepth();
    TreeTimelineContentProvider cp = getTimelineTreeContentProvider();
    ILabelProvider lp = getLabelProvider();
    String labelText = lp != null ? lp.getText(model) : model + "";
    Image labelImage = lp != null ? lp.getImage(model) : null;

    {   
        levelFigure = new RectangleFigure(); 
        levelFigure.setOutline(false);
        levelFigure.setSize(depth*LEVEL_PADDING, rowHeight);
        levelFigure.setOpaque(true);
        title.add(levelFigure);
    }

    {
        expansionButton = new ArrowButton(PositionConstants.EAST) {

            @Override
            protected void createTriangle() {
                Triangle tri = new Triangle();
                tri.setOutline(true);
                tri.setBackgroundColor(ColorConstants.listForeground);
                tri.setForegroundColor(ColorConstants.listForeground);
                setContents(tri);
            }

        };
        expansionButton.setBorder(null);
        expansionButton.setOpaque(true);
        expansionButton.setPreferredSize(rowHeight,rowHeight);
        expansionButton.setForegroundColor(ColorConstants.black);
        expansionButton.setVisible(cp != null && cp.hasChildren(model));
        expansionButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent event) {
                toggleExpanded();
            }
        });
        title.add(expansionButton);
    }

    {
        titleLabel = new Label();
        titleLabel.setTextAlignment(PositionConstants.CENTER);
        titleLabel.setText(labelText);
        if (labelImage != null) {
            titleLabel.setIcon(labelImage);
        }
        titleLabel.setOpaque(true);
        title.add(titleLabel);
        refreshTitleLabelFont();
    }

    figure.add(title);
}