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

项目: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    文件: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);
                }
            }
        }
    });
}