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