Search in sources :

Example 6 with ButtonAction

use of edu.cmu.cs.hcii.cogtool.model.ButtonAction 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)

Aggregations

AAction (edu.cmu.cs.hcii.cogtool.model.AAction)6 ButtonAction (edu.cmu.cs.hcii.cogtool.model.ButtonAction)6 Transition (edu.cmu.cs.hcii.cogtool.model.Transition)6 MousePressType (edu.cmu.cs.hcii.cogtool.model.MousePressType)4 TapAction (edu.cmu.cs.hcii.cogtool.model.TapAction)4 MouseButtonState (edu.cmu.cs.hcii.cogtool.model.MouseButtonState)3 TapPressType (edu.cmu.cs.hcii.cogtool.model.TapPressType)3 DeviceType (edu.cmu.cs.hcii.cogtool.model.DeviceType)2 DoublePoint (edu.cmu.cs.hcii.cogtool.model.DoublePoint)2 IWidget (edu.cmu.cs.hcii.cogtool.model.IWidget)2 Frame (edu.cmu.cs.hcii.cogtool.model.Frame)1 GraffitiAction (edu.cmu.cs.hcii.cogtool.model.GraffitiAction)1 InputDevice (edu.cmu.cs.hcii.cogtool.model.InputDevice)1 KeyAction (edu.cmu.cs.hcii.cogtool.model.KeyAction)1 VoiceAction (edu.cmu.cs.hcii.cogtool.model.VoiceAction)1 WidgetType (edu.cmu.cs.hcii.cogtool.model.WidgetType)1