Search in sources :

Example 6 with WidgetType

use of edu.cmu.cs.hcii.cogtool.model.WidgetType in project cogtool by cogtool.

the class FrameEditorController method changeWidgetType.

private void changeWidgetType(ListenerIdentifier lid, final String presentation, final IWidget widget, final WidgetType newWidgetType, IUndoableEditSequence editSequence) {
    final WidgetType oldWidgetType = widget.getWidgetType();
    // Don't make a non-changing edit!
    if (!oldWidgetType.equals(newWidgetType)) {
        // Set the new widget type
        widget.setWidgetType(newWidgetType);
        DemoStateManager.ObsoletingEdit edit = new DemoStateManager.ObsoletingEdit(lid, demoStateMgr) {

            @Override
            public String getPresentationName() {
                return presentation;
            }

            @Override
            public void redo() {
                super.redo();
                widget.setWidgetType(newWidgetType);
                noteEditCheckRegenerate(widget, this);
            }

            @Override
            public void undo() {
                super.undo();
                widget.setWidgetType(oldWidgetType);
                noteEditCheckRegenerate(widget, this);
            }
        };
        noteEditCheckRegenerate(widget, edit);
        editSequence.addEdit(edit);
    }
}
Also used : WidgetType(edu.cmu.cs.hcii.cogtool.model.WidgetType)

Example 7 with WidgetType

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

Example 8 with WidgetType

use of edu.cmu.cs.hcii.cogtool.model.WidgetType in project cogtool by cogtool.

the class ActionProperties method setInitialActionType.

/**
     * Base initial action type on given source
     */
public void setInitialActionType(TransitionSource source, Set<DeviceType> deviceTypes) {
    if (source instanceof InputDevice) {
        InputDevice device = (InputDevice) source;
        DeviceType devType = device.getDeviceType();
        if (devType == DeviceType.Keyboard) {
            useWhichParts = USE_KEYBOARD;
        } else if (devType == DeviceType.Mouse) {
            useWhichParts = USE_MOUSE;
        } else if (devType == DeviceType.Touchscreen) {
            useWhichParts = USE_TOUCHSCREEN;
        } else if (devType == DeviceType.Voice) {
            useWhichParts = USE_VOICE;
        }
    } else if (source instanceof IWidget) {
        IWidget widget = (IWidget) source;
        WidgetType widgetType = widget.getWidgetType();
        if (widgetType == WidgetType.Graffiti) {
            useWhichParts = USE_GRAFFITI_WIDGET;
        } else if (widgetType == WidgetType.TextBox) {
            useWhichParts = USE_KEYBOARD;
        } else {
            setInitialActionType(source, BASE_ACTION_ON_SOURCE, deviceTypes);
        }
    }
}
Also used : DeviceType(edu.cmu.cs.hcii.cogtool.model.DeviceType) InputDevice(edu.cmu.cs.hcii.cogtool.model.InputDevice) WidgetType(edu.cmu.cs.hcii.cogtool.model.WidgetType) IWidget(edu.cmu.cs.hcii.cogtool.model.IWidget)

Example 9 with WidgetType

use of edu.cmu.cs.hcii.cogtool.model.WidgetType in project cogtool by cogtool.

the class WidgetPropertiesPane method showAttributeWidgets.

public void showAttributeWidgets(IWidget widget) {
    WidgetType type = widget.getWidgetType();
    widgetTitle.setText(DISPLAYED_LABEL);
    Object pathObj = widget.getAttribute(WidgetAttributes.IMAGE_PATH_ATTR);
    if (!NullSafe.equals(WidgetAttributes.NO_IMAGE, pathObj)) {
        String imgPath = (String) pathObj;
        imagePath.setVisible(true);
        imagePathText.setVisible(true);
        imagePathText.setText(imgPath);
        imagePathText.setSelection(imgPath.length());
    }
    if ((type == WidgetType.MenuItem) || (type == WidgetType.PullDownItem) || (type == WidgetType.ListBoxItem)) {
        isSeparator.setVisible(true);
        Object value = widget.getAttribute(WidgetAttributes.IS_SEPARATOR_ATTR);
        boolean isSep = NullSafe.equals(WidgetAttributes.IS_SEPARATOR, value);
        isSeparator.setSelection(isSep);
        widgetTitleText.setEnabled(!isSep);
        widgetAuxText.setEnabled(!isSep);
    }
    // Remote label support
    // First check if this is a remote label
    FrameElement remoteLabelOwner = (FrameElement) widget.getAttribute(WidgetAttributes.REMOTE_LABEL_OWNER_ATTR);
    if (remoteLabelOwner != null) {
        String ownerWidgetName = remoteLabelOwner.getName();
        if ((ownerWidgetName == null) || ownerWidgetName.equals("")) {
            if (remoteLabelOwner instanceof RadioButtonGroup) {
                ownerWidgetName = "[ anonymous radio button group ]";
            } else if (remoteLabelOwner instanceof GridButtonGroup) {
                ownerWidgetName = "[ anonymous checkbox group ]";
            } else if (remoteLabelOwner instanceof SimpleWidgetGroup) {
                ownerWidgetName = "[ anonymous widget group ]";
            } else if (remoteLabelOwner instanceof SimpleWidgetGroup) {
                ownerWidgetName = "[ unnamed element group ]";
            } else {
                ownerWidgetName = "[ unnamed widget ]";
            }
        }
        this.remoteLabelOwner.setVisible(true);
        remoteLabelOwnerName.setVisible(true);
        remoteLabelOwnerName.setText("<a>" + ownerWidgetName + "</a>");
        remoteLabelType.setVisible(true);
        remoteLabelTypeCombo.setVisible(true);
        selectCurrentValue(remoteLabelTypeCombo, widgetTypeChoices, widget.getWidgetType());
        imagePath.setLayoutData(isRemoteLabelAlign);
    } else {
        // Otherwise, check if this widget has a remote label
        remoteLabelOwner = widget.getRemoteLabelOwner();
        // reset layout to eliminate space for the remote label
        if (remoteLabelOwner == null) {
            imagePath.setLayoutData(noRemoteLabelAlign);
        } else {
            IWidget remoteLabelWidget = (IWidget) remoteLabelOwner.getAttribute(WidgetAttributes.REMOTE_LABEL_ATTR);
            if (remoteLabelWidget != null) {
                remoteLabelText.setText(remoteLabelWidget.getTitle());
                remoteLabelFind.setVisible(true);
            } else {
                // Display an empty remote label stuff to allow one to be set
                remoteLabelText.setText("");
                remoteLabelFind.setVisible(false);
            }
            remoteLabel.setVisible(true);
            remoteLabelText.setVisible(true);
            imagePath.setLayoutData(hasRemoteLabelAlign);
        }
    }
    if (!widget.isStandard()) {
        layout();
        return;
    }
    if ((type == WidgetType.Menu) || (type == WidgetType.ContextMenu)) {
        submenuActionLabel.setVisible(true);
        submenuAction.setVisible(true);
        submenuDelayLabel.setVisible(true);
        submenuDelay.setVisible(true);
        Integer submenuAction = (Integer) widget.getAttribute(WidgetAttributes.SUBMENU_ACTION_ATTR);
        selectCurrentValue(this.submenuAction, submenuActions, submenuAction);
        Double delay = (Double) widget.getAttribute(WidgetAttributes.SUBMENU_DELAY_ATTR);
        if (NullSafe.equals(WidgetAttributes.NO_SUBMENU_DELAY, delay)) {
            submenuDelay.select(0);
        } else if (NullSafe.equals(WidgetAttributes.PC_SUBMENU_DELAY, delay)) {
            submenuDelay.select(1);
        } else {
            submenuDelay.setText(delay.toString() + " s");
        }
        if (type == WidgetType.ContextMenu) {
            contextMenuActionLabel.setVisible(true);
            contextMenuAction.setVisible(true);
            Integer contextAction = (Integer) widget.getAttribute(WidgetAttributes.CONTEXT_MENU_ACTION_ATTR);
            selectCurrentValue(contextMenuAction, contextMenuActions, contextAction);
        }
    }
    if (type == WidgetType.Check) {
        isInitiallySelected.setVisible(true);
        Boolean selected = (Boolean) widget.getAttribute(WidgetAttributes.IS_SELECTED_ATTR);
        isInitiallySelected.setSelection(selected.booleanValue());
    } else if (type == WidgetType.Button) {
        // TODO: "clicked-on" for Link?
        isToggleable.setVisible(true);
        Boolean selected = (Boolean) widget.getAttribute(WidgetAttributes.IS_TOGGLEABLE_ATTR);
        isToggleable.setSelection(selected.booleanValue());
        isButtonSelected.setEnabled(selected.booleanValue());
        isButtonSelected.setVisible(true);
        selected = (Boolean) widget.getAttribute(WidgetAttributes.IS_SELECTED_ATTR);
        isButtonSelected.setSelection(selected.booleanValue());
    } else if (type == WidgetType.TextBox) {
        //            this.isMultiLine.setVisible(true);
        //
        //            Boolean multi =
        //                (Boolean) widget.getAttribute(WidgetType.IS_MULTILINE_ATTR);
        //
        //            this.isMultiLine.setSelection(multi.booleanValue());
        widgetTitle.setText(TEXT_CONTENTS);
    } else if (type == WidgetType.Radio) {
        selectLabel.setVisible(true);
        initiallySelected.setVisible(true);
        initiallySelected.removeAll();
        initiallySelected.add(SELECT_NONE);
        RadioButtonGroup group = (RadioButtonGroup) widget.getParentGroup();
        if (group != null) {
            Iterator<IWidget> widgets = group.iterator();
            IWidget[] map = new IWidget[group.size()];
            int i = 0;
            while (widgets.hasNext()) {
                IWidget curWidget = widgets.next();
                map[i++] = curWidget;
                String name = curWidget.getNameLabel();
                initiallySelected.add(name);
            }
            // This works because null isn't in the list so indexOf
            // returns -1 if SELECT_NONE is chosen
            int index = group.indexOf(group.getSelection()) + 1;
            initiallySelected.select(index);
            selectionAttrListener.setAttributeHelper(RADIO_HELPER, map);
        }
    } else if (type == WidgetType.PullDownList) {
        selectLabel.setVisible(true);
        initiallySelected.setVisible(true);
        initiallySelected.removeAll();
        initiallySelected.add(SELECT_NONE);
        initiallySelected.select(0);
        SimpleWidgetGroup group = ((AParentWidget) widget).getChildren();
        Iterator<IWidget> widgets = group.iterator();
        IWidget[] map = new IWidget[group.size()];
        int i = 0;
        Widget selected = (Widget) widget.getAttribute(WidgetAttributes.SELECTION_ATTR);
        while (widgets.hasNext()) {
            IWidget curWidget = widgets.next();
            Object isSep = curWidget.getAttribute(WidgetAttributes.IS_SEPARATOR_ATTR);
            if (NullSafe.equals(WidgetAttributes.NON_SEPARATOR, isSep)) {
                String name = curWidget.getNameLabel();
                initiallySelected.add(name);
                if (curWidget == selected) {
                    initiallySelected.select(i + 1);
                }
                map[i++] = curWidget;
            }
        }
        selectionAttrListener.setAttributeHelper(PULLDOWN_HELPER, map);
    }
    // TODO implement list box support
    //        else if (type == WidgetType.ListBoxItem) {
    //            this.selectLabel.setVisible(true);
    //            this.initiallySelected.setVisible(true);
    //            this.initiallySelected.removeAll();
    //            this.initiallySelected.add(SELECT_NONE);
    //            this.visibleLabel.setVisible(true);
    //            this.firstVisible.setVisible(true);
    //            this.firstVisible.removeAll();
    //            this.numVisibleLabel.setVisible(true);
    //            this.numVisible.setVisible(true);
    //
    //            SimpleWidgetGroup group = widget.getParentGroup();
    //
    //            Integer num =
    //                (Integer) group.getAttribute(WidgetType.NUM_VISIBLE_ATTR);
    //            this.numVisible.setSelection(num.intValue());
    //
    //            Iterator<IWidget> widgets = group.getAllWidgets();
    //            while (widgets.hasNext()) {
    //                IWidget curWidget = widgets.next();
    //                String name = curWidget.getDisplayLabel();
    //                this.initiallySelected.add(name);
    //                this.firstVisible.add(name);
    //            }
    //
    //            IWidget init =
    //                (IWidget) group.getAttribute(WidgetType.SELECTION_ATTR);
    //            int ind = group.indexOf(init) + 1;
    //            this.initiallySelected.select(ind);
    //            init = (IWidget) group.getAttribute(WidgetType.FIRST_VISIBLE_ATTR);
    //            ind = group.indexOf(init);
    //            this.firstVisible.select(ind);
    //        }
    layout();
}
Also used : SimpleWidgetGroup(edu.cmu.cs.hcii.cogtool.model.SimpleWidgetGroup) AParentWidget(edu.cmu.cs.hcii.cogtool.model.AParentWidget) IWidget(edu.cmu.cs.hcii.cogtool.model.IWidget) Widget(edu.cmu.cs.hcii.cogtool.model.Widget) RadioButtonGroup(edu.cmu.cs.hcii.cogtool.model.RadioButtonGroup) AParentWidget(edu.cmu.cs.hcii.cogtool.model.AParentWidget) Iterator(java.util.Iterator) FrameElement(edu.cmu.cs.hcii.cogtool.model.FrameElement) WidgetType(edu.cmu.cs.hcii.cogtool.model.WidgetType) IWidget(edu.cmu.cs.hcii.cogtool.model.IWidget) GridButtonGroup(edu.cmu.cs.hcii.cogtool.model.GridButtonGroup)

Example 10 with WidgetType

use of edu.cmu.cs.hcii.cogtool.model.WidgetType in project cogtool by cogtool.

the class WidgetPropertiesPane method createWidgets.

protected void createWidgets() {
    // set up widgets, set disabled for launch
    widgetName = new DisplayLabel(this, SWT.NONE);
    widgetName.setText(L10N.get("FE.WidgetNameCaption", "Widget Name") + ":");
    widgetNameText = new WidgetChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.ChangeNameProperty, view);
    widgetTitle = new DisplayLabel(this, SWT.NONE);
    widgetTitle.setText(DISPLAYED_LABEL);
    widgetTitleText = new WidgetChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.ChangeTitleProperty, view);
    widgetAux = new DisplayLabel(this, SWT.NONE);
    widgetAux.setText(AUX_TEXT_LABEL);
    widgetAuxText = new WidgetChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.ChangeAuxTextProperty, view);
    widgetType = new DisplayLabel(this, SWT.NONE);
    widgetType.setText(L10N.get("FE.WidgetTypeCaption", "Type") + ":");
    widgetTypeLabel = new Label(this, SWT.NONE);
    widgetMode = new DisplayLabel(this, SWT.NONE);
    widgetMode.setText(L10N.get("FE.WidgetModeCaption", "Mode") + ":");
    widgetModeValue = new Label(this, SWT.NONE);
    widgetRender = new Button(this, SWT.CHECK);
    widgetRender.setText(L10N.get("FE.WidgetRenderedCaption", "Render Widget Skin"));
    // Add listener to the rendered widget property
    widgetRender.addSelectionListener(view.createWidgetChgHandler(FrameEditorLID.SetRenderSkin));
    remoteLabel = new DisplayLabel(this, SWT.NONE);
    remoteLabel.setText(L10N.get("FE.RemoteLabelCaption", "Remote Label") + ":");
    remoteLabelFind = new Link(this, SWT.NONE);
    remoteLabelFind.setText(L10N.get("FE.RemoteLabelFind", "<a>Find</a>"));
    remoteLabelFind.setFont(FontUtils.getAdjustedFont(remoteLabelFind.getFont(), 8, SWT.BOLD));
    remoteLabelText = new WidgetChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.SetRemoteLabelText, view);
    remoteLabelOwner = new DisplayLabel(this, SWT.NONE);
    remoteLabelOwner.setText(L10N.get("FE.RemoteLabelOwnerCaption", "Remote Label Owner") + ":");
    remoteLabelOwnerName = new Link(this, SWT.NONE);
    remoteLabelType = new DisplayLabel(this, SWT.NONE);
    remoteLabelType.setText(L10N.get("FE.RemoteLabelTypeCaption", "Remote Label Type") + ":");
    remoteLabelTypeCombo = new View.PerformActionCombo(this, SWT.DROP_DOWN | SWT.READ_ONLY) {

        @Override
        protected boolean doChangeAction() {
            int selectedType = remoteLabelTypeCombo.getSelectionIndex();
            FrameEditorUI.SetRemoteLabelTypeParms setTypeParms = new FrameEditorUI.SetRemoteLabelTypeParms(widgetTypeChoices[selectedType], view.selection.getSelectedIWidgets()[0]);
            return view.performAction(FrameEditorLID.SetRemoteLabelType, setTypeParms, true);
        }
    };
    for (WidgetType widgetTypeChoice : widgetTypeChoices) {
        remoteLabelTypeCombo.add(widgetTypeChoice.toString());
    }
    imagePath = new DisplayLabel(this, SWT.NONE);
    imagePath.setText(IMAGE_PATH);
    imagePathText = new TextWithEnableFix(this, SWT.SINGLE | SWT.READ_ONLY);
    isInitiallySelected = new Button(this, SWT.CHECK);
    isInitiallySelected.setText(L10N.get("FE.InitiallySelected", "Initially Selected"));
    WidgetAttributeListener listener = new WidgetAttributeListener(WidgetAttributes.IS_SELECTED_ATTR) {

        @Override
        public Object getValue() {
            return new Boolean(isInitiallySelected.getSelection());
        }
    };
    isInitiallySelected.addSelectionListener(listener);
    isButtonSelected = new Button(this, SWT.CHECK);
    isButtonSelected.setText(L10N.get("FE.InitiallySelected", "Initially Selected"));
    isButtonSelected.setEnabled(false);
    listener = new WidgetAttributeListener(WidgetAttributes.IS_SELECTED_ATTR) {

        @Override
        public Object getValue() {
            return new Boolean(isButtonSelected.getSelection());
        }
    };
    isButtonSelected.addSelectionListener(listener);
    isToggleable = new Button(this, SWT.CHECK);
    isToggleable.setText(L10N.get("FE.Togglable", "Can be toggled"));
    listener = new WidgetAttributeListener(WidgetAttributes.IS_TOGGLEABLE_ATTR) {

        @Override
        public Object getValue() {
            boolean sel = isToggleable.getSelection();
            isButtonSelected.setEnabled(sel);
            return new Boolean(sel);
        }
    };
    isToggleable.addSelectionListener(listener);
    /*this.isMultiLine = new Button(parent, SWT.CHECK);
        this.isMultiLine.setText(L10N.get("FE.MultiLine", "Multiple Lined"));

        listener = new WidgetAttributeListener(WidgetType.IS_MULTILINE_ATTR) {
            @Override
            public Object getValue() {
                return new Boolean(isMultiLine.getSelection());
            }
        };
        this.isMultiLine.addSelectionListener(listener);*/
    selectLabel = new DisplayLabel(this, SWT.NONE);
    selectLabel.setText(L10N.get("FE.ComboSelectCaption", "Initially Selected Item") + ":");
    initiallySelected = new ComboWithEnableFix(this, SWT.DROP_DOWN | SWT.READ_ONLY);
    initiallySelected.setVisibleItemCount(8);
    initiallySelected.addSelectionListener(selectionAttrListener);
    isSeparator = new Button(this, SWT.CHECK);
    isSeparator.setText(L10N.get("FE.Separator", "Separator"));
    listener = new WidgetAttributeListener(WidgetAttributes.IS_SEPARATOR_ATTR) {

        @Override
        public Object getValue() {
            return (isSeparator.getSelection()) ? WidgetAttributes.IS_SEPARATOR : WidgetAttributes.NON_SEPARATOR;
        }
    };
    isSeparator.addSelectionListener(listener);
    isSeparator.moveAbove(widgetTypeLabel);
    submenuActionLabel = new DisplayLabel(this, SWT.NONE);
    submenuActionLabel.setText(L10N.get("FE.SubmenuActionLabel", "Submenu transition action") + ":");
    submenuAction = new ComboWithEnableFix(this, SWT.DROP_DOWN | SWT.READ_ONLY);
    // Maximize the possible set of values.
    submenuActions = new Integer[] { WidgetAttributes.HOVER_SUBMENU_ACTION, null, null };
    submenuAction.add(L10N.get("FE.HoverSubmenuAction", "Hover"));
    listener = new WidgetAttributeListener(WidgetAttributes.SUBMENU_ACTION_ATTR) {

        @Override
        public Object getValue() {
            Object a = submenuActions[submenuAction.getSelectionIndex()];
            submenuDelay.setEnabled(a == WidgetAttributes.HOVER_SUBMENU_ACTION);
            return a;
        }
    };
    submenuAction.addSelectionListener(listener);
    submenuDelayLabel = new DisplayLabel(this, SWT.NONE);
    submenuDelayLabel.setText(L10N.get("FE.SubmenuDelay", "Submenu transition delay") + ":");
    // TODO: remove READ_ONLY when editing allowed (check exception in setSubmenuDelayAttr)
    submenuDelay = new ComboWithEnableFix(this, SWT.DROP_DOWN | SWT.READ_ONLY);
    submenuDelay.add("0.0 s (" + L10N.get("FE.TypicalForMac", "typical for a Mac") + ")");
    submenuDelay.add("0.5 s (" + L10N.get("FE.TypicalForPC", "typical for a PC") + ")");
    listener = new WidgetAttributeListener(WidgetAttributes.SUBMENU_DELAY_ATTR) {

        @Override
        public Object getValue() {
            switch(submenuDelay.getSelectionIndex()) {
                case 0:
                    {
                        return WidgetAttributes.NO_SUBMENU_DELAY;
                    }
                case 1:
                    {
                        return WidgetAttributes.PC_SUBMENU_DELAY;
                    }
            }
            // should be the current value!
            return null;
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent evt) {
            view.setSubmenuDelayAttr(view.selection.getSelectedIWidgets()[0], submenuDelay.getText());
        }
    };
    submenuDelay.addSelectionListener(listener);
    submenuDelay.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent evt) {
            /*
                     * We can allow certain types of characters here:
                     * Control characters (arrow keys, etc): Character.CONTROL
                     * Numerics: Character.DECIMAL_DIGIT_NUMBER
                     * Decimal Point: keycodes 46 and 16777262
                     *
                     * Disallow anything else
                     */
            int characterType = Character.getType(evt.character);
            if ((characterType == Character.CONTROL) || (characterType == Character.DECIMAL_DIGIT_NUMBER) || (evt.keyCode == 46) || (evt.keyCode == 16777262)) {
                evt.doit = true;
            } else {
                evt.doit = false;
            }
        }

        // listen for the enter key on the number pad for OS X
        public void keyReleased(KeyEvent evt) {
            if (OSUtils.MACOSX) {
                if (evt.keyCode == SWT.KEYPAD_CR) {
                    view.setSubmenuDelayAttr(view.selection.getSelectedIWidgets()[0], submenuDelay.getText());
                }
            }
        }
    });
    contextMenuActionLabel = new DisplayLabel(this, SWT.NONE);
    contextMenuActionLabel.setText(L10N.get("FE.ContextMenuAction", "Context Menu Action") + ":");
    // Maximize the possible set of values.
    contextMenuActions = new Integer[] { null, null, null };
    contextMenuAction = new ComboWithEnableFix(this, SWT.DROP_DOWN | SWT.READ_ONLY);
    //TODO: this.contextMenuAction.add(L10N.get("FE.MenuKeyPress", "Menu Key Press"));
    listener = new WidgetAttributeListener(WidgetAttributes.CONTEXT_MENU_ACTION_ATTR) {

        @Override
        public Object getValue() {
            return contextMenuActions[contextMenuAction.getSelectionIndex()];
        }
    };
    contextMenuAction.addSelectionListener(listener);
    // Set initial selection
    //widgetShapeCombo.select(0);
    widgetTypeLabel.setText(N_A);
    widgetModeValue.setText(N_A);
}
Also used : DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel) Label(org.eclipse.swt.widgets.Label) FrameEditorUI(edu.cmu.cs.hcii.cogtool.ui.FrameEditorUI) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel) KeyEvent(org.eclipse.swt.events.KeyEvent) RadioButton(edu.cmu.cs.hcii.cogtool.model.RadioButton) Button(org.eclipse.swt.widgets.Button) TextWithEnableFix(edu.cmu.cs.hcii.cogtool.util.TextWithEnableFix) SelectionEvent(org.eclipse.swt.events.SelectionEvent) KeyListener(org.eclipse.swt.events.KeyListener) WidgetType(edu.cmu.cs.hcii.cogtool.model.WidgetType) Link(org.eclipse.swt.widgets.Link) ComboWithEnableFix(edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix)

Aggregations

WidgetType (edu.cmu.cs.hcii.cogtool.model.WidgetType)14 IWidget (edu.cmu.cs.hcii.cogtool.model.IWidget)8 SimpleWidgetGroup (edu.cmu.cs.hcii.cogtool.model.SimpleWidgetGroup)4 DoubleRectangle (edu.cmu.cs.hcii.cogtool.model.DoubleRectangle)3 GridButtonGroup (edu.cmu.cs.hcii.cogtool.model.GridButtonGroup)3 Widget (edu.cmu.cs.hcii.cogtool.model.Widget)3 AParentWidget (edu.cmu.cs.hcii.cogtool.model.AParentWidget)2 ActionType (edu.cmu.cs.hcii.cogtool.model.ActionType)2 ContextMenu (edu.cmu.cs.hcii.cogtool.model.ContextMenu)2 DeviceType (edu.cmu.cs.hcii.cogtool.model.DeviceType)2 ListItem (edu.cmu.cs.hcii.cogtool.model.ListItem)2 MenuHeader (edu.cmu.cs.hcii.cogtool.model.MenuHeader)2 PullDownHeader (edu.cmu.cs.hcii.cogtool.model.PullDownHeader)2 PullDownItem (edu.cmu.cs.hcii.cogtool.model.PullDownItem)2 RadioButtonGroup (edu.cmu.cs.hcii.cogtool.model.RadioButtonGroup)2 Iterator (java.util.Iterator)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Button (org.eclipse.swt.widgets.Button)2 Node (org.w3c.dom.Node)2 AAction (edu.cmu.cs.hcii.cogtool.model.AAction)1