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);
}
}
}
Aggregations