Search in sources :

Example 1 with ListenerIdentifierMap

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

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

the class FramePropertiesPane method createWidgets.

protected void createWidgets(final View view) {
    ListenerIdentifierMap lidMap = view.getLIDMap();
    frameNameLabel = new DisplayLabel(this, SWT.NONE);
    frameNameLabel.setText(NAME_LABEL);
    frameName = new View.PerformActionText(this, SWT.SINGLE | SWT.BORDER) {

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

        @Override
        protected boolean doChangeAction() {
            Frame frame = (Frame) getData();
            DesignEditorUI.FrameRenameParameters evt = new DesignEditorUI.FrameRenameParameters(frame, getText());
            boolean changed = view.performAction(DesignEditorLID.RenameFrame, evt, true);
            if (!changed) {
                setText(frame.getName());
            }
            return changed;
        }
    };
    imagePath = new DisplayLabel(this, SWT.NONE);
    imagePath.setText(IMAGE_PATH);
    imagePathText = new TextWithEnableFix(this, SWT.SINGLE | SWT.READ_ONLY);
    widgetTreeLabel = new DisplayLabel(this, SWT.NONE);
    widgetTreeLabel.setText(WIDGETS);
    widgetTree = new Tree(this, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
    widgetTree.setLinesVisible(true);
    widgetUpdater = new TreeItemUpdater.WidgetItemUpdater(widgetTree);
    if (CogToolPref.RESEARCH.getBoolean()) {
        eltGroupTreeLabel = new DisplayLabel(this, SWT.NONE);
        eltGroupTreeLabel.setText(ELEMENT_GROUPS);
        eltGroupTree = new Tree(this, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
        eltGroupTree.setLinesVisible(true);
        eltGroupUpdater = new TreeItemUpdater.EltGroupItemUpdater(eltGroupTree);
        implicitGroupTreeLabel = new DisplayLabel(this, SWT.NONE);
        implicitGroupTreeLabel.setText(IMPLICIT_GROUPS);
        implicitGroupTree = new Tree(this, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
        implicitGroupTree.setLinesVisible(true);
        implicitGroupUpdater = new TreeItemUpdater.ImplicitGroupItemUpdater(implicitGroupTree);
    }
}
Also used : Frame(edu.cmu.cs.hcii.cogtool.model.Frame) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel) DesignEditorUI(edu.cmu.cs.hcii.cogtool.ui.DesignEditorUI) ListenerIdentifierMap(edu.cmu.cs.hcii.cogtool.util.ListenerIdentifierMap) TextWithEnableFix(edu.cmu.cs.hcii.cogtool.util.TextWithEnableFix) Tree(org.eclipse.swt.widgets.Tree)

Aggregations

DesignEditorUI (edu.cmu.cs.hcii.cogtool.ui.DesignEditorUI)2 DisplayLabel (edu.cmu.cs.hcii.cogtool.util.DisplayLabel)2 ListenerIdentifierMap (edu.cmu.cs.hcii.cogtool.util.ListenerIdentifierMap)2 Tree (org.eclipse.swt.widgets.Tree)2 Design (edu.cmu.cs.hcii.cogtool.model.Design)1 Frame (edu.cmu.cs.hcii.cogtool.model.Frame)1 ComboWithEnableFix (edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix)1 TextWithEnableFix (edu.cmu.cs.hcii.cogtool.util.TextWithEnableFix)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Point (org.eclipse.swt.graphics.Point)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1