Search in sources :

Example 1 with DisplayLabel

use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.

the class ActionSet method createGraffitiComposite.

protected Composite createGraffitiComposite() {
    Composite graffitiComp = new Composite(actionSettings, SWT.NONE);
    graffitiComp.setLayout(new FormLayout());
    graffitiTextLabel = new DisplayLabel(graffitiComp, SWT.NONE);
    graffitiTextLabel.setText(L10N.get("DE.GraffitiTextCaption", "Graffiti® Gestures") + ":");
    // TODO Why is this here rather than in its natural home in the
    //      overridden method in ActionPropertySet?
    transitionSourceLabelGraffiti = createTransitionSourceLabel(graffitiComp);
    transitionSourceNameGraffiti = createTransitionSourceName(graffitiComp);
    transitionDestinationLabelGraffiti = createTransitionDestinationLabel(graffitiComp);
    transitionDestinationNameGraffiti = createTransitionDestinationName(graffitiComp);
    // TODO: set desired width to something somewhat larger
    graffitiText = createGraffitiText(graffitiComp);
    graffitiIsCmd = new Button(graffitiComp, SWT.CHECK);
    graffitiIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
    graffitiIsCmd.addSelectionListener(widgetActionChange);
    return graffitiComp;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel)

Example 2 with DisplayLabel

use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.

the class EltGroupPropertiesPane method createWidgets.

protected void createWidgets() {
    eltGroupNameLabel = new DisplayLabel(this, SWT.NONE);
    eltGroupNameLabel.setText(groupNameLabel);
    eltGroupName = new View.PropertiesChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.SetRemoteLabelText, view) {

        @Override
        protected boolean doChangeAction() {
            FrameElementGroup eltGroup = (FrameElementGroup) getData();
            FrameEditorUI.EltGroupRenameParameters evt = new FrameEditorUI.EltGroupRenameParameters(eltGroup, getText());
            boolean changed = view.performAction(FrameEditorLID.RenameEltGroup, evt, true);
            if (!changed) {
                setText(eltGroup.getName());
            }
            return changed;
        }
    };
    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 View.PropertiesChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.SetRemoteLabelText, view);
    auxTextLabel = new DisplayLabel(this, SWT.NONE);
    auxTextLabel.setText(L10N.get("FE.AuxTextLabelCaption", "Auxiliary Text") + ":");
    auxText = new View.PropertiesChangeText(this, SWT.SINGLE | SWT.BORDER, FrameEditorLID.ChangeAuxTextProperty, view);
    groupEltsTreeLabel = new DisplayLabel(this, SWT.NONE);
    groupEltsTreeLabel.setText(GROUP_ELTS);
    groupEltsTree = new Tree(this, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
    groupEltsTree.setLinesVisible(true);
    groupEltsUpdater = new TreeItemUpdater.FrameEltItemUpdater(groupEltsTree);
}
Also used : FrameElementGroup(edu.cmu.cs.hcii.cogtool.model.FrameElementGroup) Tree(org.eclipse.swt.widgets.Tree) FrameEditorUI(edu.cmu.cs.hcii.cogtool.ui.FrameEditorUI) Link(org.eclipse.swt.widgets.Link) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel)

Example 3 with DisplayLabel

use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.

the class ActionPropertySet method createEmptyComposite.

protected Composite createEmptyComposite() {
    Composite c = new Composite(actionSettings, SWT.NONE);
    c.setLayout(new FormLayout());
    ListenerIdentifierMap lidMap = view.getLIDMap();
    designNameLabel = new DisplayLabel(c, SWT.NONE);
    designNameLabel.setText(nameLabel);
    designName = new View.PerformActionText(c, SWT.SINGLE | SWT.BORDER) {

        @Override
        protected void onFocus() {
            super.onFocus();
            view.getTransmuter().setLIDEnabledState();
        }

        @Override
        protected boolean doChangeAction() {
            Design design = (Design) designName.getData();
            DesignEditorUI.DesignRenameParameters parms = new DesignEditorUI.DesignRenameParameters(design, designName.getText());
            boolean changed = view.performAction(ProjectLID.RenameDesign, parms, true);
            if (!changed) {
                designName.setText(design.getName());
            }
            return changed;
        }
    };
    inputDevicesLabel = new DisplayLabel(c, SWT.NONE);
    inputDevicesLabel.setText(L10N.get("APS.InputDevices", "Input Devices") + ":");
    outputDevicesLabel = new DisplayLabel(c, SWT.NONE);
    outputDevicesLabel.setText(L10N.get("APS.OutputDevices", "Output Devices") + ":");
    for (int i = 0; i < DeviceType.DISPLAY_ORDER.length; i++) {
        deviceButtons[i] = new Button(c, SWT.CHECK);
        deviceButtons[i].setText(DeviceType.DISPLAY_ORDER[i].getName());
        deviceButtons[i].setEnabled(false);
        deviceButtons[i].setSelection(false);
    }
    addDevices = new Button(c, SWT.PUSH);
    addDevices.setText(addDevicesLabel);
    addDevices.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent evt) {
            view.performAction(DesignEditorLID.AddDesignDevices);
        }
    });
    lidMap.addWidget(DesignEditorLID.AddDesignDevices, addDevices, ListenerIdentifierMap.NORMAL);
    skinLabel = new DisplayLabel(c, SWT.NONE);
    skinLabel.setText(DESIGN_SKIN);
    skinCombo = new ComboWithEnableFix(c, SWT.DROP_DOWN | SWT.READ_ONLY);
    for (int i = 1; i < SkinType.DISPLAY.length - 1; i++) {
        // Don't allow None or Palm
        skinCombo.add(SkinType.DISPLAY[i].getName());
    }
    skinCombo.select(0);
    skinCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent evt) {
            switch(skinCombo.getSelectionIndex()) {
                case 0:
                default:
                    {
                        view.performAction(DesignEditorLID.SkinWireFrame);
                        break;
                    }
                case 1:
                    {
                        view.performAction(DesignEditorLID.SkinMacOSX);
                        break;
                    }
                case 2:
                    {
                        view.performAction(DesignEditorLID.SkinWinXP);
                        break;
                    }
            }
        }
    });
    frameTreeLabel = new DisplayLabel(c, SWT.NONE);
    frameTreeLabel.setText(FRAMES);
    frameTree = new Tree(c, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
    frameTree.setLinesVisible(true);
    updater = new TreeItemUpdater.FrameItemUpdater(frameTree);
    return c;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Point(org.eclipse.swt.graphics.Point) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel) Design(edu.cmu.cs.hcii.cogtool.model.Design) DesignEditorUI(edu.cmu.cs.hcii.cogtool.ui.DesignEditorUI) Button(org.eclipse.swt.widgets.Button) ListenerIdentifierMap(edu.cmu.cs.hcii.cogtool.util.ListenerIdentifierMap) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Tree(org.eclipse.swt.widgets.Tree) ComboWithEnableFix(edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix)

Example 4 with DisplayLabel

use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.

the class ActionPropertySet method layoutHelper.

@Override
public void layoutHelper() {
    actionSettings = new Composite(parent, SWT.BORDER);
    actionSettings.setLayout(actionSettingsLayout);
    propLabel = new Label(parent, SWT.CENTER);
    propLabel.setText(designPropertiesLabel);
    Font labelFont = FontUtils.getAdjustedFont(propLabel.getFont(), SWT.BOLD);
    propLabel.setFont(labelFont);
    actionType = new DisplayLabel(parent, SWT.NONE);
    actionType.setText(actionTypeLabel);
    actionChoices = new ComboWithEnableFix(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    actionChoices.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent evt) {
            int currentSelection = actionChoices.getSelectionIndex();
            if (currentSelection != chosenActionType) {
                editTransitionParms.useWhichParts = choiceUseIndexes[currentSelection];
                chosenActionType = currentSelection;
                view.performAction(DesignEditorLID.EditTransition, editTransitionParms, true);
            }
        }
    });
    delayLabelLabel = new DisplayLabel(parent, SWT.NONE);
    delayLabelLabel.setText(DELAY_LABEL_LABEL);
    delayLabel = new View.PerformActionText(parent, SWT.SINGLE | SWT.BORDER) {

        @Override
        protected void onFocus() {
            super.onFocus();
            view.getTransmuter().setLIDEnabledState();
        }

        @Override
        protected boolean doChangeAction() {
            Point labelSelection = getSelection();
            if ("".equals(getText())) {
                setText(TransitionDelay.DEFAULT_DELAY_LABEL);
                labelSelection = null;
            }
            if (view.performAction(DesignEditorLID.ChangeDelay)) {
                if (labelSelection != null) {
                    setSelection(labelSelection);
                }
                return true;
            }
            return false;
        }
    };
    delayInSecsLabel = new DisplayLabel(parent, SWT.NONE);
    delayInSecsLabel.setText(DELAY_DURATION_LABEL + ":");
    secondsUnit = new Label(parent, SWT.NONE);
    secondsUnit.setText(SECONDS);
    delayInSecs = new View.PerformActionDouble(parent, SWT.SINGLE | SWT.BORDER) {

        @Override
        protected void onFocus() {
            super.onFocus();
            view.getTransmuter().setLIDEnabledState();
        }

        @Override
        protected void onModify() {
            super.onModify();
            delayLabel.setEnabled(getDoubleValue() > 0.0);
        }

        @Override
        protected boolean doChangeAction() {
            Point delaySelection = getSelection();
            if (getDoubleValue() == 0.0) {
                setText("");
                delaySelection = null;
            }
            if (view.performAction(DesignEditorLID.ChangeDelay)) {
                if (delaySelection != null) {
                    setSelection(delaySelection);
                }
                return true;
            }
            return false;
        }
    };
    delayInSecs.setAllowNegative(false);
    delayInSecs.setDecimalPlaces(3);
    delayInSecs.moveAbove(delayLabel.getOuter());
    FormData data = new FormData();
    data.left = leftAttachment;
    data.right = new FormAttachment(100, -5);
    propLabel.setLayoutData(data);
    data = new FormData();
    data.left = leftAttachment;
    data.top = new FormAttachment(actionChoices, 0, SWT.CENTER);
    actionType.setLayoutData(data);
    data = new FormData();
    data.left = new FormAttachment(actionType, 5, SWT.RIGHT);
    data.right = new FormAttachment(100, -5);
    data.top = new FormAttachment(propLabel, 5, SWT.BOTTOM);
    actionChoices.setLayoutData(data);
    data = new FormData();
    data.left = leftAttachment;
    data.top = new FormAttachment(actionChoices, 5, SWT.BOTTOM);
    data.right = new FormAttachment(100, -5);
    actionSettings.setLayoutData(data);
    data = new FormData();
    data.left = leftAttachment;
    data.top = new FormAttachment(actionSettings, 5, SWT.BOTTOM);
    delayInSecsLabel.setLayoutData(data);
    data = new FormData();
    data.left = leftAttachment;
    data.top = new FormAttachment(delayInSecsLabel, 5, SWT.BOTTOM);
    data.width = 100;
    delayInSecs.setLayoutData(data);
    data = new FormData();
    data.left = new FormAttachment(delayInSecs.getOuter(), 5, SWT.RIGHT);
    data.top = new FormAttachment(delayInSecs.getOuter(), 0, SWT.CENTER);
    secondsUnit.setLayoutData(data);
    data = new FormData();
    data.left = leftAttachment;
    data.top = new FormAttachment(delayInSecs.getOuter(), 5, SWT.BOTTOM);
    delayLabelLabel.setLayoutData(data);
    data = new FormData();
    data.left = leftAttachment;
    data.top = new FormAttachment(delayLabelLabel, 5, SWT.BOTTOM);
    data.right = new FormAttachment(100, -5);
    delayLabel.setLayoutData(data);
    emptyParms = createEmptyComposite();
    layOutEmptyComposite();
    multTransParms = new Composite(actionSettings, SWT.NONE);
    multTransParms.setLayout(new FormLayout());
    Label multTransLabel = new Label(multTransParms, SWT.WRAP);
    multTransLabel.setText(noActionAvailableText);
    data = new FormData();
    data.left = leftAttachment;
    data.top = new FormAttachment(0, 5);
    data.right = new FormAttachment(100, -5);
    multTransLabel.setLayoutData(data);
    frameParms = createFrameComposite();
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormLayout(org.eclipse.swt.layout.FormLayout) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel) Label(org.eclipse.swt.widgets.Label) Point(org.eclipse.swt.graphics.Point) Font(org.eclipse.swt.graphics.Font) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ComboWithEnableFix(edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 5 with DisplayLabel

use of edu.cmu.cs.hcii.cogtool.util.DisplayLabel in project cogtool by cogtool.

the class ActionSet method createVoiceComposite.

protected Composite createVoiceComposite() {
    Composite voiceComp = new Composite(actionSettings, SWT.NONE);
    voiceComp.setLayout(new FormLayout());
    voiceTextLabel = new DisplayLabel(voiceComp, SWT.NONE);
    voiceTextLabel.setText(L10N.get("DE.VoiceTextCaption", "Spoken Input") + ":");
    // TODO Why is this here rather than in its natural home in the
    //      overridden method in ActionPropertySet?
    transitionDestinationLabelVoice = createTransitionDestinationLabel(voiceComp);
    transitionDestinationNameVoice = createTransitionDestinationName(voiceComp);
    voiceText = createVoiceText(voiceComp);
    voiceIsCmd = new Button(voiceComp, SWT.CHECK);
    voiceIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
    voiceIsCmd.addSelectionListener(deviceActionChange);
    return voiceComp;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel)

Aggregations

DisplayLabel (edu.cmu.cs.hcii.cogtool.util.DisplayLabel)13 Composite (org.eclipse.swt.widgets.Composite)8 FormLayout (org.eclipse.swt.layout.FormLayout)7 ComboWithEnableFix (edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix)5 Button (org.eclipse.swt.widgets.Button)5 Label (org.eclipse.swt.widgets.Label)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 Point (org.eclipse.swt.graphics.Point)3 Tree (org.eclipse.swt.widgets.Tree)3 DesignEditorUI (edu.cmu.cs.hcii.cogtool.ui.DesignEditorUI)2 FrameEditorUI (edu.cmu.cs.hcii.cogtool.ui.FrameEditorUI)2 ListenerIdentifierMap (edu.cmu.cs.hcii.cogtool.util.ListenerIdentifierMap)2 TextWithEnableFix (edu.cmu.cs.hcii.cogtool.util.TextWithEnableFix)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 FormAttachment (org.eclipse.swt.layout.FormAttachment)2 FormData (org.eclipse.swt.layout.FormData)2 Link (org.eclipse.swt.widgets.Link)2 Design (edu.cmu.cs.hcii.cogtool.model.Design)1 Frame (edu.cmu.cs.hcii.cogtool.model.Frame)1 FrameElementGroup (edu.cmu.cs.hcii.cogtool.model.FrameElementGroup)1