use of edu.cmu.cs.hcii.cogtool.model.ActionType in project cogtool by cogtool.
the class SEDemoController method performSelfTransition.
protected boolean performSelfTransition(SEDemoSelectionState selection, TransitionSource source, AAction action, double delayInSecs, String delayLabel) {
AScriptStep beforeStep = getDemoStep(selection);
ActionScriptStep selfTransitionStep = new ActionScriptStep(action, source);
selfTransitionStep.setDelay(delayInSecs, delayLabel);
if (source instanceof IWidget) {
IWidget widget = (IWidget) source;
ActionType actionType = action.getType();
WidgetType widgetType = widget.getWidgetType();
if (toggleIfGermane(widget, selfTransitionStep, action)) {
// Do nothing further
} else if ((actionType == ActionType.KeyPress) || (actionType == ActionType.GraffitiStroke)) {
TextAction text = (TextAction) action;
if (widgetType == WidgetType.TextBox) {
selfTransitionStep.overrideAttribute(widget, WidgetAttributes.APPENDED_TEXT_ATTR, text.getText());
}
}
}
return insertStep(selfTransitionStep, beforeStep, SEDemoLID.InsertSelfTransition, INSERT_SELF_TRANSITION);
}
use of edu.cmu.cs.hcii.cogtool.model.ActionType in project cogtool by cogtool.
the class DesignEditorUI method getDefaultProperties.
public void getDefaultProperties(TransitionSource source, ActionProperties properties) {
view.getDefaultProperties(properties);
ActionType transitionType = getCurrentActionType();
Set<DeviceType> deviceTypes = uiModel.getDesign().getDeviceTypes();
properties.setInitialActionType(source, transitionType, deviceTypes);
}
use of edu.cmu.cs.hcii.cogtool.model.ActionType in project cogtool by cogtool.
the class SEDemoController method toggleIfGermane.
private boolean toggleIfGermane(IWidget widget, AScriptStep selfTransitionStep, AAction action) {
WidgetType widgetType = widget.getWidgetType();
ActionType actionType = action.getType();
if (widget.isStandard() && ((actionType == ActionType.Tap) || ((actionType == ActionType.ButtonPress) && (((ButtonAction) action).getButton() == MouseButtonState.Left)))) {
if (widgetType == WidgetType.Check) {
selfTransitionStep.overrideAttribute(widget, WidgetAttributes.IS_SELECTED_ATTR, WidgetAttributes.TOGGLE_SELECTION);
} else if (widgetType == WidgetType.Radio) {
selfTransitionStep.overrideAttribute(widget.getParentGroup(), WidgetAttributes.SELECTION_ATTR, widget);
} else if (widgetType == WidgetType.Button) {
// Override regardless of the button's "toggleability"
// because the user can always change this attribute in the
// frame
selfTransitionStep.overrideAttribute(widget, WidgetAttributes.IS_SELECTED_ATTR, WidgetAttributes.TOGGLE_SELECTION);
} else if (widgetType == WidgetType.PullDownItem) {
PullDownItem pdi = (PullDownItem) widget;
Object value = pdi.getAttribute(WidgetAttributes.IS_SEPARATOR_ATTR);
if (NullSafe.equals(WidgetAttributes.NON_SEPARATOR, value)) {
selfTransitionStep.overrideAttribute(pdi.getParent(), WidgetAttributes.SELECTION_ATTR, widget);
}
}
return true;
} else {
return false;
}
}
Aggregations