Search in sources :

Example 16 with AAction

use of edu.cmu.cs.hcii.cogtool.model.AAction in project cogtool by cogtool.

the class BalsamiqButtonAPIConverter method parseTransition.

/** Helper function used by parseWidget
	 * This method is used to parse the href tag that is a link from a widget
	 * to another frame
     * 
     * @param  destinationFrameName the name of the frame that the transition 
     *                               is going to
     * @param  widget               the widget that the transition starts from
     */
protected void parseTransition(String destFrameFileName, Widget widget) {
    String frameName = (destFrameFileName.lastIndexOf(".") == -1) ? destFrameFileName : destFrameFileName.substring(0, destFrameFileName.lastIndexOf('.'));
    /* getFrame() returns the frame for the specified string. If the string is null then
		a null frame is returned. */
    Frame destinationFrame = (frameName != null) ? getFrame(frameName) : null;
    if (destinationFrame != null) {
        //Default Mouse Click Transition
        //TODO: MAKE SURE THE MOUSE IS A DEVICE. check which devices are allowed and then make an action from there
        AAction action = new ButtonAction(MouseButtonState.Left, MousePressType.Click, AAction.NONE);
        //Create the transition and add it to the widget
        Transition t = new Transition(widget, destinationFrame, action);
        if (t != null) {
            widget.addTransition(t);
        }
    }
}
Also used : Frame(edu.cmu.cs.hcii.cogtool.model.Frame) ButtonAction(edu.cmu.cs.hcii.cogtool.model.ButtonAction) Transition(edu.cmu.cs.hcii.cogtool.model.Transition) AAction(edu.cmu.cs.hcii.cogtool.model.AAction)

Example 17 with AAction

use of edu.cmu.cs.hcii.cogtool.model.AAction in project cogtool by cogtool.

the class SEDemoController method performEditSelfTransition.

// performChangeDelay
protected boolean performEditSelfTransition(ActionScriptStep step) {
    TransitionSource source = step.getStepFocus();
    AAction action = step.getAction();
    Design design = source.getFrame().getDesign();
    int deviceTypes = DeviceType.buildDeviceSet(design.getDeviceTypes());
    int limitMode = ActionProperties.determineChangeActionMode(source);
    properties.updateProperties(step, action, source);
    if (!interaction.determineNewAction(properties, deviceTypes, limitMode, EDIT_SELF_TRANSITION)) {
        return false;
    }
    action = EditActionCmd.buildActionFromProperties(properties, deviceTypes, limitMode, interaction);
    if (action == null) {
        return false;
    }
    action = EditActionCmd.ensureActionIsUnique(source, action, properties, deviceTypes, limitMode, null, interaction);
    if (action == null) {
        return false;
    }
    return changeSelfTransition(step, action, properties.delayInSecs, properties.delayLabel);
}
Also used : TransitionSource(edu.cmu.cs.hcii.cogtool.model.TransitionSource) Design(edu.cmu.cs.hcii.cogtool.model.Design) AAction(edu.cmu.cs.hcii.cogtool.model.AAction)

Example 18 with AAction

use of edu.cmu.cs.hcii.cogtool.model.AAction in project cogtool by cogtool.

the class SEDemoController method createInsertSelfTransitionAction.

protected IListenerAction createInsertSelfTransitionAction() {
    return new IListenerAction() {

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

        public boolean performAction(Object actionParms) {
            SEDemoUI.SelfTransition prms = (SEDemoUI.SelfTransition) actionParms;
            if (prms.target != null) {
                TaskApplication taskApp = script.getDemonstration().getTaskApplication();
                Set<DeviceType> deviceTypeSet = taskApp.getDesign().getDeviceTypes();
                int deviceTypes = DeviceType.buildDeviceSet(deviceTypeSet);
                int limitMode = ActionProperties.determineChangeActionMode(prms.target);
                AAction action = prms.action;
                if (prms.action == null) {
                    properties.resetValues();
                    properties.setInitialActionType(prms.target, deviceTypeSet);
                    if (!interaction.determineNewAction(properties, deviceTypes, limitMode, L10N.get("DE.SetActionType", "Set Action Type"))) {
                        return false;
                    }
                    action = EditActionCmd.buildActionFromProperties(properties, deviceTypes, limitMode, interaction);
                    if (action == null) {
                        return false;
                    }
                }
                action = EditActionCmd.ensureActionIsUnique(prms.target, action, properties, deviceTypes, limitMode, null, interaction);
                if (action == null) {
                    return false;
                }
                return performSelfTransition(prms.selection, prms.target, action, properties.delayInSecs, properties.delayLabel);
            }
            return false;
        }
    };
}
Also used : DeviceType(edu.cmu.cs.hcii.cogtool.model.DeviceType) SEDemoUI(edu.cmu.cs.hcii.cogtool.ui.SEDemoUI) IListenerAction(edu.cmu.cs.hcii.cogtool.util.IListenerAction) TaskApplication(edu.cmu.cs.hcii.cogtool.model.TaskApplication) AAction(edu.cmu.cs.hcii.cogtool.model.AAction)

Aggregations

AAction (edu.cmu.cs.hcii.cogtool.model.AAction)18 Transition (edu.cmu.cs.hcii.cogtool.model.Transition)13 ButtonAction (edu.cmu.cs.hcii.cogtool.model.ButtonAction)6 DoublePoint (edu.cmu.cs.hcii.cogtool.model.DoublePoint)5 DeviceType (edu.cmu.cs.hcii.cogtool.model.DeviceType)4 MousePressType (edu.cmu.cs.hcii.cogtool.model.MousePressType)4 TapAction (edu.cmu.cs.hcii.cogtool.model.TapAction)4 TransitionSource (edu.cmu.cs.hcii.cogtool.model.TransitionSource)4 IWidget (edu.cmu.cs.hcii.cogtool.model.IWidget)3 MouseButtonState (edu.cmu.cs.hcii.cogtool.model.MouseButtonState)3 TapPressType (edu.cmu.cs.hcii.cogtool.model.TapPressType)3 IListenerAction (edu.cmu.cs.hcii.cogtool.util.IListenerAction)3 GraffitiAction (edu.cmu.cs.hcii.cogtool.model.GraffitiAction)2 InputDevice (edu.cmu.cs.hcii.cogtool.model.InputDevice)2 DesignEditorUI (edu.cmu.cs.hcii.cogtool.ui.DesignEditorUI)2 IUndoableEdit (edu.cmu.cs.hcii.cogtool.util.IUndoableEdit)2 ComputationUndoRedo (edu.cmu.cs.hcii.cogtool.controller.DemoScriptCmd.ComputationUndoRedo)1 Demonstration (edu.cmu.cs.hcii.cogtool.model.Demonstration)1 Design (edu.cmu.cs.hcii.cogtool.model.Design)1 Frame (edu.cmu.cs.hcii.cogtool.model.Frame)1