Search in sources :

Example 1 with Control

use of org.eclipse.swt.widgets.Control in project cogtool by cogtool.

the class ActionSet method createKeyComposite.

protected Composite createKeyComposite() {
    Composite keyComp = new Composite(actionSettings, SWT.NONE);
    keyComp.setLayout(new FormLayout());
    keyboardTextLabel = new DisplayLabel(keyComp, SWT.NONE);
    keyboardTextLabel.setText(L10N.get("DE.KeyboardTextCaption", "Text") + ":");
    keyboardText = createKeyboardText(keyComp);
    keyboardText.setFont(FontUtils.SYMBOL_FONT);
    keyboardIsCmd = new Button(keyComp, SWT.CHECK);
    keyboardIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
    keyboardIsCmd.addSelectionListener(deviceActionChange);
    // TODO Why is this here rather than in its natural home in the
    //      overridden method in ActionPropertySet?
    transitionDestinationLabelKeyboard = createTransitionDestinationLabel(keyComp);
    transitionDestinationNameKeyboard = createTransitionDestinationName(keyComp);
    /* TODO: add back in when single character stuff is straightened out
        this.keyboardActionLabel = new DisplayLabel(keyComp, SWT.NONE);
        this.keyboardActionLabel.setText(L10N.get("DE.KeyActionCaption",
                                                  "Action")
                                            + ":");

        this.keyboardActionCombo =
            new ComboWithEnableFix(keyComp,
                                   SWT.DROP_DOWN | SWT.READ_ONLY);

        for (int i = 0; i < KeyPressType.DISPLAY.length; i++) {
            this.keyboardActionCombo.add(KeyPressType.DISPLAY[i].toString());
        }

        this.keyboardActionCombo.select(0);
        this.keyboardActionCombo.addSelectionListener(this.deviceActionChange);
*/
    SelectionListener insertSpecial = new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            Control source = (Control) e.getSource();
            keyboardText.insert((String) source.getData());
            Point selection = keyboardText.getSelection();
            keyboardText.setFocus();
            keyboardText.setSelection(selection);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    };
    // TODO: replace alignTo with this.keyboardActionCombo when the above TODO is done!
    // can't assign using ?: because Java is stupid
    Control alignTo;
    if (vertical) {
        alignTo = transitionDestinationNameKeyboard;
    } else {
        alignTo = keyboardText.getOuter();
    }
    keyboardSpecials = new KeyboardSpecialChars(alignTo, insertSpecial, vertical);
    return keyComp;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with Control

use of org.eclipse.swt.widgets.Control in project cogtool by cogtool.

the class ProjectUI method cleanupTaskEditor.

/**
     * Removes stale Text control and selection listener.
     */
protected void cleanupTaskEditor() {
    // Remove and dispose the text box
    Control oldEditor = editor.getEditor();
    if (oldEditor != null) {
        // We defer this disposal until the main event loop as otherwise
        // we crash mysteriously in Leopard (OS X 10.5). The oldEditor
        // is actually a subclass (suspect for SWT controls!), and my
        // conjecture is that some method in the superclass is still
        // depending upon the object not having been disposed at it is
        // unwinding the stack. Anyway, this appears to fix the problem,
        // and certainly should make the patient no worse.
        WindowUtil.deferDisposal(oldEditor);
        editor.setEditor(null);
        setViewEnabledState(selection, ListenerIdentifierMap.NORMAL);
    }
}
Also used : Control(org.eclipse.swt.widgets.Control)

Example 3 with Control

use of org.eclipse.swt.widgets.Control in project cogtool by cogtool.

the class DefaultSEUIModel method updateDeviceDisplay.

public void updateDeviceDisplay() {
    if ((currentFrame != null) && (devicesFooter != null)) {
        Control[] deviceLabels = devicesFooter.getChildren();
        double midIndex = 0.5 * (deviceLabels.length - 1);
        for (int i = 0; i < deviceLabels.length; i++) {
            DeviceType deviceType = (DeviceType) deviceLabels[i].getData(DEVICE_TYPE_KEY);
            if (deviceType != null) {
                Frame currentFrameModel = currentFrame.getFrame();
                InputDevice inputDevice = currentFrameModel.getInputDevice(deviceType);
                String text = AbstractGraphicalSource.buildToolTipText(inputDevice, deviceType.toString());
                text = KeyDisplayUtil.convertActionToMenuText(text);
                deviceLabels[i].setToolTipText(" " + text + " ");
                deviceLabels[i].setData(inputDevice);
                FormData formData = new FormData();
                formData.top = new FormAttachment(0, 0);
                formData.bottom = new FormAttachment(100, 0);
                formData.width = DesignUtil.DEVICE_WIDTH;
                double ii = i;
                if (ii == (midIndex - 0.5)) {
                    formData.right = new FormAttachment(50, -(DEVICE_MARGIN / 2));
                } else if (ii < midIndex) {
                    formData.right = new FormAttachment(deviceLabels[i + 1], -DEVICE_MARGIN, SWT.LEFT);
                } else if (ii == midIndex) {
                    formData.left = new FormAttachment(50, -(DesignUtil.DEVICE_WIDTH / 2));
                } else if (ii == (midIndex + 0.5)) {
                    formData.left = new FormAttachment(50, DEVICE_MARGIN / 2);
                } else {
                    // ii > midIndex
                    formData.left = new FormAttachment(deviceLabels[i - 1], DEVICE_MARGIN, SWT.RIGHT);
                }
                deviceLabels[i].setLayoutData(formData);
            }
        }
        devicesFooter.layout();
    }
}
Also used : FormData(org.eclipse.swt.layout.FormData) DeviceType(edu.cmu.cs.hcii.cogtool.model.DeviceType) Control(org.eclipse.swt.widgets.Control) Frame(edu.cmu.cs.hcii.cogtool.model.Frame) InputDevice(edu.cmu.cs.hcii.cogtool.model.InputDevice) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 4 with Control

use of org.eclipse.swt.widgets.Control in project cogtool by cogtool.

the class DictionaryEditorUI method cleanupEditor.

/**
     * Removes stale Text control and selection listener.
     */
protected void cleanupEditor() {
    // Remove and dispose the text box
    Control oldEditor = editor.getEditor();
    if (oldEditor != null) {
        oldEditor.dispose();
        editor.setEditor(null);
    }
}
Also used : Control(org.eclipse.swt.widgets.Control)

Example 5 with Control

use of org.eclipse.swt.widgets.Control in project tdi-studio-se by Talend.

the class MapperManager method addOutput.

/**
     * DOC amaumont Comment method "addOutput".
     */
public void addOutput() {
    String tableName = uiManager.openNewOutputCreationDialog();
    if (tableName == null) {
        return;
    }
    IProcess process = mapperComponent.getProcess();
    //$NON-NLS-1$
    String uniqueName = process.generateUniqueConnectionName("table");
    process.addUniqueConnectionName(uniqueName);
    MetadataTable metadataTable = new MetadataTable();
    metadataTable.setTableName(uniqueName);
    // metadataTable.setId(uniqueName);
    metadataTable.setLabel(tableName);
    List<DataMapTableView> outputsTablesView = getUiManager().getOutputsTablesView();
    int sizeOutputsView = outputsTablesView.size();
    Control lastChild = null;
    if (sizeOutputsView - 1 >= 0) {
        lastChild = outputsTablesView.get(sizeOutputsView - 1);
    }
    IDataMapTable abstractDataMapTable = new OutputTable(this, metadataTable, uniqueName, tableName);
    TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
    DataMapTableView dataMapTableView = uiManager.createNewOutputTableView(lastChild, abstractDataMapTable, tablesZoneViewOutputs);
    tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    tablesZoneViewOutputs.layout();
    uiManager.moveOutputScrollBarZoneToMax();
    uiManager.refreshBackground(true, false);
    tablesZoneViewOutputs.layout();
    uiManager.selectDataMapTableView(dataMapTableView, true, false);
}
Also used : Control(org.eclipse.swt.widgets.Control) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) InputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) TablesZoneView(org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView) IProcess(org.talend.core.model.process.IProcess) OutputTable(org.talend.designer.dbmap.model.table.OutputTable)

Aggregations

Control (org.eclipse.swt.widgets.Control)1298 Composite (org.eclipse.swt.widgets.Composite)412 GridData (org.eclipse.swt.layout.GridData)297 Point (org.eclipse.swt.graphics.Point)231 Label (org.eclipse.swt.widgets.Label)218 Button (org.eclipse.swt.widgets.Button)211 GridLayout (org.eclipse.swt.layout.GridLayout)193 Text (org.eclipse.swt.widgets.Text)162 SelectionEvent (org.eclipse.swt.events.SelectionEvent)144 FormData (org.eclipse.swt.layout.FormData)127 FormAttachment (org.eclipse.swt.layout.FormAttachment)124 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)113 Shell (org.eclipse.swt.widgets.Shell)89 ArrayList (java.util.ArrayList)78 Display (org.eclipse.swt.widgets.Display)70 Event (org.eclipse.swt.widgets.Event)70 Group (org.eclipse.swt.widgets.Group)67 Combo (org.eclipse.swt.widgets.Combo)66 StyledText (org.eclipse.swt.custom.StyledText)62 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)58