Search in sources :

Example 1 with ZoomableUI

use of edu.cmu.cs.hcii.cogtool.ui.ZoomableUI in project cogtool by cogtool.

the class ZoomableController method assignActions.

/**
     * Registers the set of <code>IListenerAction</code> instances
     * that implement the semantic actions that are possible.
     * <p>
     * For this class, this consists of the actions that all CogTool
     * model editing windows support.
     *
     * @author mlh
     */
@Override
protected void assignActions() {
    super.assignActions();
    final ZoomableUI ui = getZoomableUI();
    if (ui != null) {
        ui.setAction(CogToolLID.SetZoom, new IListenerAction() {

            public Class<?> getParameterClass() {
                return Double.class;
            }

            public boolean performAction(Object prm) {
                double zoom = ((Double) prm).doubleValue();
                ui.setZoom(zoom);
                return true;
            }
        });
        ui.setAction(CogToolLID.ZoomToFit, new AListenerAction() {

            public boolean performAction(Object prms) {
                ui.zoomToFit();
                return true;
            }
        });
        ui.setAction(CogToolLID.ZoomNormal, new AListenerAction() {

            public boolean performAction(Object prms) {
                ui.zoomToActual();
                return true;
            }
        });
        ui.setAction(CogToolLID.ZoomIn, new AListenerAction() {

            public boolean performAction(Object prms) {
                ui.zoomIn();
                return true;
            }
        });
        ui.setAction(CogToolLID.ZoomOut, new AListenerAction() {

            public boolean performAction(Object prms) {
                ui.zoomOut();
                return true;
            }
        });
    }
}
Also used : ZoomableUI(edu.cmu.cs.hcii.cogtool.ui.ZoomableUI) IListenerAction(edu.cmu.cs.hcii.cogtool.util.IListenerAction) AListenerAction(edu.cmu.cs.hcii.cogtool.util.AListenerAction)

Aggregations

ZoomableUI (edu.cmu.cs.hcii.cogtool.ui.ZoomableUI)1 AListenerAction (edu.cmu.cs.hcii.cogtool.util.AListenerAction)1 IListenerAction (edu.cmu.cs.hcii.cogtool.util.IListenerAction)1