Search in sources :

Example 1 with SEDemoSelectionState

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

the class SEDemoController method assignActions.

@Override
public void assignActions() {
    super.assignActions();
    ui.setAction(SEDemoLID.Undo, new UndoController.UndoAction(undoMgr, interaction));
    ui.setAction(SEDemoLID.Redo, new UndoController.RedoAction(undoMgr, interaction));
    ui.setAction(SEDemoLID.SetMouseHand, createSetMouseHandAction());
    ui.setAction(SEDemoLID.SetHandLocation, createSetHandLocationAction());
    ui.setAction(SEDemoLID.PerformTransition, createPerformTransitionAction());
    ui.setAction(SEDemoLID.InsertThink, new IListenerAction() {

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

        public boolean performAction(Object prms) {
            SEDemoSelectionState selection = (SEDemoSelectionState) prms;
            return performInsertThink(selection);
        }
    });
    ui.setAction(SEDemoLID.ChangeThinkProperties, new IListenerAction() {

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

        public boolean performAction(Object prms) {
            SEDemoSelectionState selection = (SEDemoSelectionState) prms;
            return performChangeThink(selection);
        }
    });
    ui.setAction(SEDemoLID.InsertDelay, new IListenerAction() {

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

        public boolean performAction(Object prms) {
            SEDemoSelectionState selection = (SEDemoSelectionState) prms;
            return performInsertDelay(selection);
        }
    });
    ui.setAction(SEDemoLID.ChangeWaitProperties, new IListenerAction() {

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

        public boolean performAction(Object prms) {
            SEDemoSelectionState selection = (SEDemoSelectionState) prms;
            return performChangeDelay(selection);
        }
    });
    ui.setAction(SEDemoLID.Edit, new IListenerAction() {

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

        public boolean performAction(Object prms) {
            SEDemoSelectionState selection = (SEDemoSelectionState) prms;
            DefaultModelGeneratorState selectedState = selection.getSelectedState();
            if (selectedState == null) {
                interaction.protestNoStep();
                return false;
            }
            AScriptStep step = selectedState.getScriptStep();
            if (step instanceof ThinkScriptStep) {
                return performChangeThink(selection);
            }
            if (step instanceof DelayScriptStep) {
                return performChangeDelay(selection);
            }
            if ((step instanceof ActionScriptStep) && step.isDemonstrated() && step.isInsertedByUser()) {
                return performEditSelfTransition((ActionScriptStep) step);
            }
            step = step.getOwner();
            if ((step instanceof ActionScriptStep) && step.isDemonstrated() && step.isInsertedByUser()) {
                return performEditSelfTransition((ActionScriptStep) step);
            }
            interaction.protestNotEditable();
            return false;
        }
    });
    ui.setAction(SEDemoLID.InsertDrive, new IListenerAction() {

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

        public boolean performAction(Object prms) {
            SEDemoSelectionState selection = (SEDemoSelectionState) prms;
            return performInsertDrive(selection);
        }
    });
    ui.setAction(SEDemoLID.InsertLookAt, new IListenerAction() {

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

        public boolean performAction(Object prms) {
            SEDemoUI.LookAtTransition lookAt = (SEDemoUI.LookAtTransition) prms;
            return performInsertLookAt(lookAt.selection, lookAt.target);
        }
    });
    ui.setAction(SEDemoLID.InsertSelfTransition, createInsertSelfTransitionAction());
    ui.setAction(SEDemoLID.Delete, new IListenerAction() {

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

        public boolean performAction(Object prms) {
            // If not the "most recent" step state, warn
            // the user that this will remove all
            // items after as well, unless it's a think,
            // look-at or other non-transitioning item.
            SEDemoSelectionState selection = (SEDemoSelectionState) prms;
            return deleteScriptStep(selection);
        }
    });
    ui.setAction(SEDemoLID.RegenerateScript, createRegenerateScriptAction());
    ui.setAction(SEDemoLID.RecomputeScript, createSaveScriptChangesAction());
    ui.setAction(SEDemoLID.ExportScriptToCSV, createExportScriptToCSVAction());
    ui.setAction(DesignEditorLID.EditFrame, createEditFrameAction());
    ui.setAction(SEDemoLID.ShowModelVisualization, createShowModelVisualizationAction());
}
Also used : DelayScriptStep(edu.cmu.cs.hcii.cogtool.model.DelayScriptStep) ActionScriptStep(edu.cmu.cs.hcii.cogtool.model.ActionScriptStep) AScriptStep(edu.cmu.cs.hcii.cogtool.model.AScriptStep) ThinkScriptStep(edu.cmu.cs.hcii.cogtool.model.ThinkScriptStep) SEDemoUI(edu.cmu.cs.hcii.cogtool.ui.SEDemoUI) IListenerAction(edu.cmu.cs.hcii.cogtool.util.IListenerAction) SEDemoSelectionState(edu.cmu.cs.hcii.cogtool.ui.SEDemoSelectionState) DefaultModelGeneratorState(edu.cmu.cs.hcii.cogtool.model.DefaultModelGeneratorState)

Aggregations

AScriptStep (edu.cmu.cs.hcii.cogtool.model.AScriptStep)1 ActionScriptStep (edu.cmu.cs.hcii.cogtool.model.ActionScriptStep)1 DefaultModelGeneratorState (edu.cmu.cs.hcii.cogtool.model.DefaultModelGeneratorState)1 DelayScriptStep (edu.cmu.cs.hcii.cogtool.model.DelayScriptStep)1 ThinkScriptStep (edu.cmu.cs.hcii.cogtool.model.ThinkScriptStep)1 SEDemoSelectionState (edu.cmu.cs.hcii.cogtool.ui.SEDemoSelectionState)1 SEDemoUI (edu.cmu.cs.hcii.cogtool.ui.SEDemoUI)1 IListenerAction (edu.cmu.cs.hcii.cogtool.util.IListenerAction)1