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

项目:gef-gwt    文件:ToolEntryEditPart.java   
ToolEntryToggle(IFigure contents) {
    super(contents);
    setOpaque(false);
    setEnabled(true);
    if (isToolbarItem()) {
        setStyle(Clickable.STYLE_BUTTON | Clickable.STYLE_TOGGLE);
        setBorder(TOOLBAR_ITEM_BORDER);
    }
}
项目:gef-gwt    文件:ToolEntryEditPart.java   
public IFigure createFigure() {

        customLabel = new DetailedLabelFigure();
        Clickable button = new ToolEntryToggle(customLabel);
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                getPaletteViewer().setActiveTool(getToolEntry());
            }
        });

        return button;
    }
项目:scouter    文件:XYGraphToolbar.java   
public void addButton(Clickable button){
    button.setPreferredSize(BUTTON_SIZE, BUTTON_SIZE);
    add(button);
}
项目:scouter    文件:ToolbarArmedXYGraph.java   
/** Add a button to the tool bar.
*  New button will be added to the 'end' of the tool bar.
*  @param button New button
*/
  public void addToolbarButton(final Clickable button)
  {
      toolbar.addButton(button);
  }
项目:gef-gwt    文件:PinnablePaletteStackFigure.java   
public void handleStateChanged(ChangeEvent event) {
    Clickable clickable = (Clickable) event.getSource();
    if (event.getPropertyName() == ButtonModel.MOUSEOVER_PROPERTY
            && getActiveFigure() instanceof ToolEntryToggle) {
        ((ToolEntryToggle) getActiveFigure())
                .setShowHoverFeedback(clickable.getModel()
                        .isMouseOver());
    }
    if (event.getPropertyName() == ButtonModel.SELECTED_PROPERTY) {

        Animation.markBegin();
        handleExpandStateChanged();
        Animation.run(150);

        // Now collapse other stacks when they are not pinned open or in
        // the
        // case of columns and icons layout mode (where only one stack
        // can
        // be expanded at a time for layout reasons).
        if (isExpanded()) {
            boolean collapseOtherStacks = (layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS || layoutMode == PaletteViewerPreferences.LAYOUT_ICONS);

            for (Iterator iterator = getParent().getChildren()
                    .iterator(); iterator.hasNext();) {
                Object childFigure = iterator.next();
                if (childFigure instanceof PinnablePaletteStackFigure
                        && childFigure != PinnablePaletteStackFigure.this) {

                    if (collapseOtherStacks
                            || (((PinnablePaletteStackFigure) childFigure)
                                    .isExpanded() && !((PinnablePaletteStackFigure) childFigure)
                                    .isPinnedOpen())) {

                        ((PinnablePaletteStackFigure) childFigure)
                                .setExpanded(false);
                    }
                }
            }
        }
    }
}
项目:gef-gwt    文件:DrawerFigure.java   
/**
 * @return The Clickable that is used to expand/collapse the drawer.
 */
public Clickable getCollapseToggle() {
    return collapseToggle;
}
项目:gef-gwt    文件:PaletteScrollBar.java   
protected Clickable createDefaultDownButton() {
    return createTransparentArrowButton(true);
}
项目:gef-gwt    文件:PaletteScrollBar.java   
protected Clickable createDefaultUpButton() {
    return createTransparentArrowButton(false);
}
项目:gef-gwt    文件:ToolEntryEditPart.java   
private ButtonModel getButtonModel() {
    Clickable c = (Clickable) getFigure();
    return c.getModel();
}
项目:gef-gwt    文件:DropShadowButtonBorder.java   
public void paint(IFigure figure, Graphics g, Insets insets) {
    ButtonModel model = ((Clickable) figure).getModel();
    Rectangle r = getPaintRectangle(figure, insets);
    g.setLineWidth(1);
    r.width -= 3;
    r.height -= 3;

    if (model.isMouseOver() && !model.isArmed()) {
        g.setForegroundColor(highlight);
        g.drawRectangle(r);

        r.translate(1, 1);
        g.setForegroundColor(dropshadow2);
        g.drawLine(r.x, r.bottom(), r.right(), r.bottom());
        g.drawLine(r.right(), r.y, r.right(), r.bottom());

        r.translate(1, 1);
        g.setForegroundColor(dropshadow3);
        g.drawLine(r.x + 1, r.bottom(), r.right() - 1, r.bottom());
        g.drawLine(r.right(), r.y + 1, r.right(), r.bottom() - 1);
    } else if (model.isPressed()) {
        r.translate(1, 1);

        g.setForegroundColor(highlight);
        g.drawRectangle(r);

        r.translate(1, 1);
        g.setForegroundColor(dropshadow2);
        g.drawLine(r.x, r.bottom(), r.right(), r.bottom());
        g.drawLine(r.right(), r.y, r.right(), r.bottom());
    } else {
        r.translate(1, 1);

        g.setForegroundColor(dropshadow3);
        g.drawRectangle(r);

        r.translate(1, 1);
        g.drawLine(r.x, r.bottom(), r.right(), r.bottom());
        g.drawLine(r.right(), r.y, r.right(), r.bottom());
    }

}