Search in sources :

Example 1 with Orientable

use of org.eclipse.draw2d.Orientable in project yamcs-studio by yamcs.

the class ScrollbarFigure method setDownClickable.

/**
 * Sets the Clickable that represents the down arrow of the Scrollbar to <i>down</i>.
 *
 * @param down
 *            the down button
 * @since 2.0
 */
public void setDownClickable(Clickable down) {
    hookFocusListener(down);
    if (buttonDown != null) {
        remove(buttonDown);
    }
    buttonDown = down;
    if (buttonDown != null) {
        if (buttonDown instanceof Orientable)
            ((Orientable) buttonDown).setDirection(isHorizontal() ? Orientable.EAST : Orientable.SOUTH);
        buttonDown.setFiringMethod(Clickable.REPEAT_FIRING);
        buttonDown.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                stepDown();
            }
        });
        add(buttonDown, ScrollBarLayout.DOWN_ARROW);
    }
}
Also used : ActionListener(org.eclipse.draw2d.ActionListener) Orientable(org.eclipse.draw2d.Orientable) ActionEvent(org.eclipse.draw2d.ActionEvent)

Example 2 with Orientable

use of org.eclipse.draw2d.Orientable in project yamcs-studio by yamcs.

the class ScrollbarFigure method setUpClickable.

/**
 * Sets the Clickable that represents the up arrow of the Scrollbar to <i>up</i>.
 *
 * @param up
 *            the up button
 * @since 2.0
 */
public void setUpClickable(Clickable up) {
    hookFocusListener(up);
    if (buttonUp != null) {
        remove(buttonUp);
    }
    buttonUp = up;
    if (up != null) {
        if (up instanceof Orientable)
            ((Orientable) up).setDirection(isHorizontal() ? Orientable.WEST : Orientable.NORTH);
        buttonUp.setFiringMethod(Clickable.REPEAT_FIRING);
        buttonUp.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                stepUp();
            }
        });
        add(buttonUp, ScrollBarLayout.UP_ARROW);
    }
}
Also used : ActionListener(org.eclipse.draw2d.ActionListener) Orientable(org.eclipse.draw2d.Orientable) ActionEvent(org.eclipse.draw2d.ActionEvent)

Aggregations

ActionEvent (org.eclipse.draw2d.ActionEvent)2 ActionListener (org.eclipse.draw2d.ActionListener)2 Orientable (org.eclipse.draw2d.Orientable)2