Search in sources :

Example 1 with ActionType

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);
}
Also used : ActionScriptStep(edu.cmu.cs.hcii.cogtool.model.ActionScriptStep) ActionType(edu.cmu.cs.hcii.cogtool.model.ActionType) WidgetType(edu.cmu.cs.hcii.cogtool.model.WidgetType) AScriptStep(edu.cmu.cs.hcii.cogtool.model.AScriptStep) IWidget(edu.cmu.cs.hcii.cogtool.model.IWidget) TextAction(edu.cmu.cs.hcii.cogtool.model.TextAction)

Example 2 with ActionType

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);
}
Also used : DeviceType(edu.cmu.cs.hcii.cogtool.model.DeviceType) ActionType(edu.cmu.cs.hcii.cogtool.model.ActionType)

Example 3 with ActionType

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;
    }
}
Also used : ActionType(edu.cmu.cs.hcii.cogtool.model.ActionType) PullDownItem(edu.cmu.cs.hcii.cogtool.model.PullDownItem) WidgetType(edu.cmu.cs.hcii.cogtool.model.WidgetType)

Aggregations

ActionType (edu.cmu.cs.hcii.cogtool.model.ActionType)3 WidgetType (edu.cmu.cs.hcii.cogtool.model.WidgetType)2 AScriptStep (edu.cmu.cs.hcii.cogtool.model.AScriptStep)1 ActionScriptStep (edu.cmu.cs.hcii.cogtool.model.ActionScriptStep)1 DeviceType (edu.cmu.cs.hcii.cogtool.model.DeviceType)1 IWidget (edu.cmu.cs.hcii.cogtool.model.IWidget)1 PullDownItem (edu.cmu.cs.hcii.cogtool.model.PullDownItem)1 TextAction (edu.cmu.cs.hcii.cogtool.model.TextAction)1