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

项目:PDFReporter-Studio    文件:ColumnFigure.java   
/**
 * Constructs a CheckBox with the passed text in its label.
 * 
 * @param text
 *          The label text
 * @since 2.0
 */
public ColumnFigure(String text, Image image) {
    setLayoutManager(new FlowLayout(true));
    checkbox = new CheckBox();
    checkbox.addChangeListener(new ChangeListener() {

        @Override
        public void handleStateChanged(ChangeEvent event) {
            if (event.getPropertyName().equals(ButtonModel.SELECTED_PROPERTY))
                handleSelectionChanged();
        }
    });
    add(checkbox);
    Label lbl = new Label(ConvertUtil.cleanDbNameFull(text), image);
    lbl.setTextPlacement(PositionConstants.WEST);
    add(lbl);
}
项目:gef-gwt    文件:DrawerFigure.java   
public CollapseToggle(IFigure contents) {
    super(contents);
    setSelected(true);
    setRequestFocusEnabled(true);
    addChangeListener(new ChangeListener() {

        public void handleStateChanged(ChangeEvent e) {
            if (e.getPropertyName().equals(
                    ButtonModel.SELECTED_PROPERTY)) {
                Animation.markBegin();
                handleExpandStateChanged();
                Animation.run(150);
            } else if (e.getPropertyName().equals(
                    ButtonModel.MOUSEOVER_PROPERTY)) {
                repaint();
            }
        }
    });
}
项目:scouter    文件:XYGraphToolbar.java   
/** Create buttons enumerated in <code>ZoomType</code>
    *  @param flags Bitwise 'or' of flags
    *  @see XYGraphFlags#COMBINED_ZOOM
    *  @see XYGraphFlags#SEPARATE_ZOOM
 */
private void createZoomButtons(final int flags) {
    for(final ZoomType zoomType : ZoomType.values()){
        if (! zoomType.useWithFlags(flags))
            continue;
        final ImageFigure imageFigure =  new ImageFigure(zoomType.getIconImage());
        final Label tip = new Label(zoomType.getDescription());
        final ToggleButton button = new ToggleButton(imageFigure);
        button.setBackgroundColor(ColorConstants.button);
        button.setOpaque(true);
        final ToggleModel model = new ToggleModel();
        model.addChangeListener(new ChangeListener(){
            public void handleStateChanged(ChangeEvent event) {
                if(event.getPropertyName().equals("selected") && 
                        button.isSelected()){
                    xyGraph.setZoomType(zoomType);
                }               
            }
        });

        button.setModel(model);
        button.setToolTip(tip);
        addButton(button);
        zoomGroup.add(model);

        if(zoomType == ZoomType.NONE)
            zoomGroup.setDefault(model);
    }
}
项目:gef-gwt    文件:PaletteStackEditPart.java   
public void handleStateChanged(ChangeEvent event) {
    if (event.getPropertyName().equals(ButtonModel.MOUSEOVER_PROPERTY))
        arrowFigure.getModel().setMouseOver(
                activeFigure.getModel().isMouseOver());
    else if (event.getPropertyName().equals(ButtonModel.ARMED_PROPERTY))
        arrowFigure.getModel().setArmed(
                activeFigure.getModel().isArmed());
}
项目:gef-gwt    文件:PaletteStackEditPart.java   
public void handleStateChanged(ChangeEvent event) {
    if (event.getPropertyName().equals(ButtonModel.MOUSEOVER_PROPERTY))
        activeFigure.getModel().setMouseOver(
                arrowFigure.getModel().isMouseOver());
    if (event.getPropertyName().equals(ButtonModel.ARMED_PROPERTY))
        activeFigure.getModel().setArmed(
                arrowFigure.getModel().isArmed());
}
项目:gef-gwt    文件:PinFigure.java   
public PinFigure() {
    super(new ImageFigure(InternalImages.get(InternalImages.IMG_UNPINNED)));
    setRolloverEnabled(true);
    setRequestFocusEnabled(false);
    Label tooltip = new Label(PaletteMessages.TOOLTIP_PIN_FIGURE);
    tooltip.setBorder(TOOLTIP_BORDER);
    setToolTip(tooltip);
    setOpaque(false);

    addChangeListener(new ChangeListener() {

        public void handleStateChanged(ChangeEvent e) {
            if (e.getPropertyName().equals(ButtonModel.SELECTED_PROPERTY)) {
                if (isSelected()) {
                    ((ImageFigure) (getChildren().get(0)))
                            .setImage(InternalImages
                                    .get(InternalImages.IMG_PINNED));
                    ((Label) getToolTip())
                            .setText(PaletteMessages.TOOLTIP_UNPIN_FIGURE);
                } else {
                    ((ImageFigure) (getChildren().get(0)))
                            .setImage(InternalImages
                                    .get(InternalImages.IMG_UNPINNED));
                    ((Label) getToolTip())
                            .setText(PaletteMessages.TOOLTIP_PIN_FIGURE);
                }
            }
        }
    });
}
项目: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);
                    }
                }
            }
        }
    }
}