Search in sources :

Example 1 with ComboWithEnableFix

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

the class DictionaryEditorUIModel method createAlgCombo.

public static Combo createAlgCombo(Composite parent, ITermSimilarity defaultAlg, SelectionListener listener) {
    Combo algCombo = new ComboWithEnableFix(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    for (String element : ALGORITHMS) {
        algCombo.add(element);
    }
    algCombo.select(getAlgIndex(defaultAlg));
    algCombo.addSelectionListener(listener);
    algCombo.setVisibleItemCount(ALGORITHMS.length);
    return algCombo;
}
Also used : Combo(org.eclipse.swt.widgets.Combo) ComboWithEnableFix(edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix)

Example 2 with ComboWithEnableFix

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

the class WebCrawlImportDialog method buildThirdGroup.

public void buildThirdGroup() {
    typeHTMLGroup3 = new Group(useSelectionGroup, SWT.SHADOW_NONE);
    typeHTMLGroup3.setText("Starting URL #3");
    typeHTMLGroup3.setLayout(new FormLayout());
    urlText3 = new TextWithEnableFix(typeHTMLGroup3, SWT.BORDER | SWT.SINGLE);
    urlText3.setText("http://");
    urlText3.addTraverseListener(new TraverseListener() {

        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
                e.detail = SWT.TRAVERSE_NONE;
                questionMarkButtonDomain2.forceFocus();
            }
        }
    });
    plusButton3 = makeToolBarButton(typeHTMLGroup3, addGroupListener, questionImages.PLUS_IMAGE);
    minusButton3 = makeToolBarButton(typeHTMLGroup3, minusGroupListener3, questionImages.MINUS_IMAGE);
    maximumDepthToCrawlLabel3 = new Label(typeHTMLGroup3, SWT.NONE);
    maximumDepthToCrawlLabel3.setText("Maximum Depth To Crawl: ");
    questionMarkButtonDepth3 = makeToolBarButton(typeHTMLGroup3, depthListener, questionImages.QUESTION_SHADOW);
    maxDepthCombo3 = new ComboWithEnableFix(typeHTMLGroup3, SWT.DROP_DOWN | SWT.READ_ONLY);
    maxDepthCombo3.add("Unlimited");
    for (int i = 0; i < 100; i++) {
        maxDepthCombo3.add("" + i);
    }
    maxDepthCombo3.select(2);
    maxDepthCombo3.setVisibleItemCount(21);
    useHTML7 = new Button(typeHTMLGroup3, SWT.RADIO);
    useHTML7.addSelectionListener(domainListener);
    useHTML7.setSelection(true);
    useHTML8 = new Button(typeHTMLGroup3, SWT.RADIO);
    useHTML8.addSelectionListener(domainListener);
    useHTML9 = new Button(typeHTMLGroup3, SWT.RADIO);
    useHTML9.addSelectionListener(domainListener);
    urlPath7 = new Label(typeHTMLGroup3, SWT.NONE);
    urlPath7.setText("Unrestricted");
    urlPath8 = new Label(typeHTMLGroup3, SWT.NONE);
    urlPath8.setText("http://host_name/");
    urlPath9 = new Label(typeHTMLGroup3, SWT.NONE);
    urlPath9.setText("http://host_name/path");
    urlPath9b = new Label(typeHTMLGroup3, SWT.NONE);
    urlPath9b.setText("path");
    urlPath9b.setFont(URL_PATH_FONT);
    urlPath9b.setVisible(false);
    maxDepthCombo3.addSelectionListener(comboListener);
    restrictDomainLabel3 = new Label(typeHTMLGroup3, SWT.NONE);
    restrictDomainLabel3.setText("Restrict Domain: ");
    questionMarkButtonDomain3 = makeToolBarButton(typeHTMLGroup3, domainHelpListener, questionImages.QUESTION_SHADOW);
    urlText3.addFocusListener(new TextFocusListener(urlText3, urlPath8, urlPath9, useHTML7, useHTML8, useHTML9, 3));
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Group(org.eclipse.swt.widgets.Group) TraverseEvent(org.eclipse.swt.events.TraverseEvent) TraverseListener(org.eclipse.swt.events.TraverseListener) Button(org.eclipse.swt.widgets.Button) TextWithEnableFix(edu.cmu.cs.hcii.cogtool.util.TextWithEnableFix) Label(org.eclipse.swt.widgets.Label) ComboWithEnableFix(edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix) Point(org.eclipse.swt.graphics.Point)

Example 3 with ComboWithEnableFix

use of edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix 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 ComboWithEnableFix

use of edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix 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 ComboWithEnableFix

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

the class ActionSet method createTouchComposite.

protected Composite createTouchComposite() {
    Composite touchComp = new Composite(actionSettings, SWT.NONE);
    touchComp.setLayout(new FormLayout());
    touchActionLabel = new DisplayLabel(touchComp, SWT.NONE);
    touchActionLabel.setText(L10N.get("DE.ButtonActionCaption", "Action") + ":");
    // TODO Why is this here rather than in its natural home in the
    //      overridden method in ActionPropertySet?
    transitionSourceLabelTouch = createTransitionSourceLabel(touchComp);
    transitionSourceNameTouch = createTransitionSourceName(touchComp);
    transitionDestinationLabelTouch = createTransitionDestinationLabel(touchComp);
    transitionDestinationNameTouch = createTransitionDestinationName(touchComp);
    touchActionCombo = new ComboWithEnableFix(touchComp, SWT.DROP_DOWN | SWT.READ_ONLY);
    for (TapPressType element : TapPressType.DISPLAY) {
        touchActionCombo.add(element.toString());
    }
    touchActionCombo.select(0);
    touchActionCombo.addSelectionListener(widgetActionChange);
    return touchComp;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) TapPressType(edu.cmu.cs.hcii.cogtool.model.TapPressType) Composite(org.eclipse.swt.widgets.Composite) ComboWithEnableFix(edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel)

Aggregations

ComboWithEnableFix (edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix)11 FormLayout (org.eclipse.swt.layout.FormLayout)7 Label (org.eclipse.swt.widgets.Label)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 Button (org.eclipse.swt.widgets.Button)6 DisplayLabel (edu.cmu.cs.hcii.cogtool.util.DisplayLabel)5 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)5 Point (org.eclipse.swt.graphics.Point)5 Composite (org.eclipse.swt.widgets.Composite)5 TextWithEnableFix (edu.cmu.cs.hcii.cogtool.util.TextWithEnableFix)4 TraverseEvent (org.eclipse.swt.events.TraverseEvent)3 TraverseListener (org.eclipse.swt.events.TraverseListener)3 FormAttachment (org.eclipse.swt.layout.FormAttachment)3 FormData (org.eclipse.swt.layout.FormData)3 Group (org.eclipse.swt.widgets.Group)3 Design (edu.cmu.cs.hcii.cogtool.model.Design)2 ITermSimilarity (edu.cmu.cs.hcii.cogtool.model.ITermSimilarity)1 MouseButtonState (edu.cmu.cs.hcii.cogtool.model.MouseButtonState)1 MousePressType (edu.cmu.cs.hcii.cogtool.model.MousePressType)1 RadioButton (edu.cmu.cs.hcii.cogtool.model.RadioButton)1