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

项目:limpet    文件:ChartFigure.java   
public ChartFigure(final Chart chart, final ActionListener deleteListener)
{
  setPreferredSize(-1, 200);
  setBackgroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
  setOutline(false);
  BorderLayout topLayout = new BorderLayout();
  setLayoutManager(topLayout);
  titleFigure = new DirectionalShape();

  chartNameLabel = new DirectionalIconLabel(StackedchartsImages.getImage(
      StackedchartsImages.DESC_CHART));
  titleFigure.add(chartNameLabel);
  final Button button = new Button(StackedchartsImages.getImage(
      StackedchartsImages.DESC_DELETE));
  button.setToolTip(new Label("Remove this chart from the chart set"));
  button.addActionListener(deleteListener);
  titleFigure.add(button);

  add(titleFigure);

  chartFigure = new JFreeChartFigure(chart);
  add(chartFigure, BorderLayout.CENTER);

}
项目: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);
        }
    });
}
项目:DarwinSPL    文件:DwFeatureFigure.java   
/**
 * Creates the button to show/hide children
 */
private void createExpandButton(){
    expandButton = new DwExpandButton();
    add(expandButton);

    expandButton.setSize(new Dimension( 16, 16 ));
    expandButton.setDirection(Orientable.NORTH);
    expandButton.setVisible(false);

    expandButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            feature.setHideChildren(!feature.isHideChildren(), editor.getCurrentSelectedDate());
        }
    });     
}
项目:ermaster-k    文件:ImageTest.java   
private static Figure createContents() {
    Figure contents = new Figure();
    XYLayout layout = new XYLayout();
    contents.setLayoutManager(layout);

    Button button = new Button("Hello World");
    layout.setConstraint(button, new Rectangle(0, 0, -1, -1));
    contents.add(button);

    button.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionevent) {
            setBrightness();
        }
    });

    String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg";
    image = new Image(Display.getDefault(), path);
    imageFigure = new ImageFigure(image);

    layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1));

    contents.add(imageFigure);

    return contents;
}
项目:scouter    文件:XYGraphToolbar.java   
private void addSnapshotButton() {
    Button snapShotButton = new Button(XYGraphMediaFactory.getInstance().getImage("images/camera.gif"));
    snapShotButton.setToolTip(new Label("Save Snapshot to PNG file"));
    addButton(snapShotButton);
    snapShotButton.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent event) {
             // Have valid name, so get image
               ImageLoader loader = new ImageLoader();
               Image image = xyGraph.getImage();
               loader.data = new ImageData[]{image.getImageData()};
               image.dispose();
            // Prompt for file name
            String path = SingleSourceHelper.getImageSavePath();
            if (path == null || path.length() <= 0)
                return;            
            // Assert *.png at end of file name
            if (! path.toLowerCase().endsWith(".png"))
                path = path + ".png";
            // Save
            loader.save(path, SWT.IMAGE_PNG);
        }
    });
}
项目:limpet    文件:ChartsetFigure.java   
public ChartsetFigure(ActionListener addChartHandler)
{
  add(new Label(StackedchartsImages.getImage(
      StackedchartsImages.DESC_CHARTSET)));
  chartsetHeader = new DirectionalLabel(Activator.FONT_12);
  chartsetHeader.setText("Chart Set");
  chartsetHeader.setTextAlignment(PositionConstants.TOP);
  add(chartsetHeader);

  Button button = new Button(StackedchartsImages.getImage(
      StackedchartsImages.DESC_ADD));
  button.setToolTip(new Label("Add new chart"));
  button.addActionListener(addChartHandler);
  add(button);

}
项目:ermaster-nhit    文件:ImageTest.java   
private static Figure createContents() {
    Figure contents = new Figure();
    XYLayout layout = new XYLayout();
    contents.setLayoutManager(layout);

    Button button = new Button("Hello World");
    layout.setConstraint(button, new Rectangle(0, 0, -1, -1));
    contents.add(button);

    button.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionevent) {
            setBrightness();
        }
    });

    String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg";
    image = new Image(Display.getDefault(), path);
    imageFigure = new ImageFigure(image);

    layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1));

    contents.add(imageFigure);

    return contents;
}
项目:neoscada    文件:RoundDetailsPart.java   
private Figure makeHeader ()
{
    this.button = new CheckBox ( "Active" );

    this.button.getModel ().addActionListener ( new ActionListener () {

        @Override
        public void actionPerformed ( final ActionEvent event )
        {
            setEnabled ( RoundDetailsPart.this.button.getModel ().isSelected () );
        }
    } );

    return this.button;
}
项目:neoscada    文件:BooleanAlarmDetails.java   
private Figure makeHeader ()
{
    this.button = new CheckBox ( Messages.BooleanAlarmDetails_active );

    this.button.getModel ().addActionListener ( new ActionListener () {

        @Override
        public void actionPerformed ( final ActionEvent event )
        {
            setEnabled ( BooleanAlarmDetails.this.button.getModel ().isSelected () );
        }
    } );

    return this.button;
}
项目:neoscada    文件:InputScaleDetails.java   
private Figure makeHeader ()
{
    this.button = new CheckBox ( "Active" );

    this.button.getModel ().addActionListener ( new ActionListener () {

        @Override
        public void actionPerformed ( final ActionEvent event )
        {
            setEnabled ( InputScaleDetails.this.button.getModel ().isSelected () );
        }
    } );

    return this.button;
}
项目:pandionj    文件:TestFigureParser.java   
private static void createDiagram(IFigure root, VarParser parser) {
        VariableInfo sum = parser.locateVariable("sum", 24);
        VariableInfo i = parser.locateVariable("i", 24);

        MockArray array = new MockArray("int", "a", 1,2,3,4);
        MockArrayIndex i1 = new MockArrayIndex(i.getName(), null, 1, IArrayIndexModel.Direction.FORWARD,-4);
//      MockArrayIndex v = new MockArrayIndex(v, null, 0, IArrayIndexModel.Direction.FORWARD, 3); ;
        array.addIndexVariable(i1);
        ArrayPrimitiveFigure fig = new ArrayPrimitiveFigure(array);
        fig.setSize(fig.getPreferredSize());
        fig.setLocation(new Point(100, 100));
        root.add(fig);


        Button but = new Button("test");
        but.setLocation(new Point(5, 5));
        but.setSize(but.getPreferredSize());
        but.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent event) {
                try {
                    array.set(i1.getCurrentIndex(), 9);
                    i1.set(i1.getCurrentIndex() + 1);
                    i1.set(i1.getCurrentIndex() - 1);

                }
                catch(IndexOutOfBoundsException e) {
                    e.printStackTrace();
                }
            }
        });
        root.add(but);
    }
项目:ermasterr    文件:ImageTest.java   
private static Figure createContents() {
    final Figure contents = new Figure();
    final XYLayout layout = new XYLayout();
    contents.setLayoutManager(layout);

    final Button button = new Button("Hello World");
    layout.setConstraint(button, new Rectangle(0, 0, -1, -1));
    contents.add(button);

    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent actionevent) {
            setBrightness();
        }
    });

    final String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg";
    image = new Image(Display.getDefault(), path);
    imageFigure = new ImageFigure(image);

    layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1));

    contents.add(imageFigure);

    return contents;
}
项目:gef-gwt    文件:FlyoutPaletteComposite.java   
private void init() {
    setCursor(SharedCursors.ARROW);
    lws = new LightweightSystem();
    lws.setControl(this);
    final ArrowButton b = new ArrowButton(getArrowDirection());
    b.setRolloverEnabled(true);
    b.setBorder(new ButtonBorder(ButtonBorder.SCHEMES.TOOLBAR));
    b.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            transferFocus = true;
            if (isInState(STATE_COLLAPSED))
                setState(STATE_PINNED_OPEN);
            else
                setState(STATE_COLLAPSED);
        }
    });
    listeners.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(PROPERTY_STATE)) {
                b.setDirection(getArrowDirection());
                setToolTipText(getButtonTooltipText());
            } else if (evt.getPropertyName().equals(
                    PROPERTY_DOCK_LOCATION))
                b.setDirection(getArrowDirection());
        }
    });
    lws.setContents(b);
}
项目: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;
    }
项目:FRaMED    文件:ORMCompartmentEditPart.java   
/**
 * This method does the complets the setup of the
 * {@link ORMCompartmentV2Figure}. That means it adds the collapse image to
 * the button and sets the action listener of this button. The
 * {@link ActionListener} calls on notification the method buttonExpand.
 * */
private ORMCompartmentV2Figure completeORMCompartmentV2Figure(
        final Shape model, final boolean isEditorData, Figure fig) {

    ORMCompartmentV2Figure figure = (ORMCompartmentV2Figure) fig;

    Image imageCollapse = new Image(null, Activator
            .imageDescriptorFromPlugin(Activator.PLUGIN_ID,
                    "icons/collapseArrow3.png").createImage(),
            SWT.IMAGE_COPY);

    figure.getBasicRec().setAntialias(SWT.ON);
    figure.getButton().addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {

            buttonExpand(isEditorData);
        }
    });

    ((Label) figure.getButton().getChildren().get(0))
            .setIcon(imageCollapse);

    return figure;

}
项目:pandionj    文件:TestFigure.java   
private static void createDiagram(IFigure root) {
    // Array com iteradores
    MockArray array = new MockArray("Integer", 1,2,3,4,5);
    //      MockVariable var = new MockVariable("int[]", "v", null, array);
    MockReference ref = new MockReference("int[]", "v", array, false);

    MockValue i1 = new MockValue("int", "i1", null, 0, false);
    MockArrayIndex ii1 = new MockArrayIndex(i1, ref, Direction.NONE);
    MockValue i2 = new MockValue("int", "i2", null, 1, false);
    MockArrayIndex ii2 = new MockArrayIndex(i2, ref, Direction.FORWARD);
    MockValue i3 = new MockValue("int", "i3", null, 5, false);
    MockArrayIndex ii3 = new MockArrayIndex(i3, ref, Direction.FORWARD, new MyBound(-1, BoundType.OPEN, "-1"));

    //      array.addIndexVariable(ii1);
    //      array.addIndexVariable(ii2);
    //      array.addIndexVariable(ii3);

    List<IArrayIndexModel> vars = new ArrayList<>();
    vars.add(ii1);
    vars.add(ii2);

    ArrayReferenceFigure fig = new ArrayReferenceFigure(array);
    fig.setLocation(new Point(100, 100));

    root.add(fig);



    //      IllustrationBorder b = new IllustrationBorder(vars, fig);
    //      MarginBorder b = new MarginBorder(15);
    //      fig.setBorder(b);



    // Array com lenght maior que o tamanho maximo da figura
    MockArray array2 = new MockArray("int", 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25);
    ArrayPrimitiveFigure fig2 = new ArrayPrimitiveFigure(array2);
    fig2.setLocation(new Point(250, 300));
    root.add(fig2);

    // Array vazia
    MockArray array3 = new MockArray("int");
    ArrayPrimitiveFigure fig3 = new ArrayPrimitiveFigure(array3);
    fig3.setLocation(new Point(400, 200));
    root.add(fig3);

    Connection c = new PolylineConnection();
    ChopboxAnchor a = new ChopboxAnchor(fig);
    ChopboxAnchor b = new ChopboxAnchor(fig2);
    c.setSourceAnchor(a);
    c.setTargetAnchor(b);

    root.add(c);

    Button but = new Button("test");
    but.setLocation(new Point(5, 5));
    but.setSize(but.getPreferredSize());
    but.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            i1.set(ii1.getCurrentIndex()+1);
            try {
                if(ii3.getBound().getValue() != ii3.getCurrentIndex()) {
                    i3.set(ii3.getCurrentIndex() - 1);
                }
                array.set(ii3.getCurrentIndex(), 9);
            }
            catch(IndexOutOfBoundsException e) {
                e.printStackTrace();
            }
            fig.repaint();
        }
    });
    root.add(but);
}
项目:limpet    文件:AxisNameFigure.java   
public AxisNameFigure(ActionListener deleteHandler)
{


  add(new Label(StackedchartsImages.getImage(StackedchartsImages.DESC_AXIS)));
  nameLabel = new DirectionalLabel(Activator.FONT_10);
  nameLabel.setTextAlignment(PositionConstants.TOP);

  add(nameLabel);

  Button button = new Button(StackedchartsImages.getImage(StackedchartsImages.DESC_DELETE));
  button.setToolTip(new Label("Remove this axis from the chart"));
  button.addActionListener(deleteHandler);
  add(button);

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