Search in sources :

Example 36 with TableEditor

use of org.eclipse.swt.custom.TableEditor in project tdi-studio-se by Talend.

the class MultipleSurrogateSection method creationComplement.

/**
     * DOC hcw Comment method "onCreationChange".
     * 
     * @param value
     * @param key
     * @param item
     */
protected void creationComplement(Integer value, final SurrogateKey key, final TableItem item) {
    // dispose editor
    TableEditor editor = editorManager.getEditor(item, COMPLEMENT_INDEX);
    editorManager.disposeEditor(editor);
    if (value == SurrogateCreationType.ROUTINE.getIndex()) {
        // create routine editor
        editor = editorManager.createTextEditor(editor, table, key.getComplement(), item, COMPLEMENT_INDEX, new IPropertySetter<String>() {

            public void set(String value) {
                key.setComplement(value);
            }
        });
        // add content proposal
        TalendProposalUtils.installOn(editor.getEditor(), null);
    } else if (value == SurrogateCreationType.DB_SEQUENCE.getIndex()) {
        editor = editorManager.createTextEditor(editor, table, key.getComplement(), item, COMPLEMENT_INDEX, new IPropertySetter<String>() {

            public void set(String value) {
                key.setComplement(value);
            }
        });
        // add content proposal
        TalendProposalUtils.installOn(editor.getEditor(), null);
    } else if (value == SurrogateCreationType.INPUT_FIELD.getIndex()) {
        // combo editor
        // final List<String> inputColumns = scdManager.getInputColumnNames();
        // inputColumns.add(0, "");
        // int index = editorManager.getComboIndex(inputColumns, key.getComplement());
        // editor = editorManager.createComboEditor(table, inputColumns.toArray(new String[inputColumns.size()]),
        // item,
        // COMPLEMENT_INDEX, index, new IPropertySetter<Integer>() {
        //
        // public void set(Integer value) {
        // key.setComplement(inputColumns.get(value));
        // Color color = value == 0 ? ERROR_COLOR : null;
        // editorManager.setComboColor(item, COMPLEMENT_INDEX, color);
        // scdManager.fireFieldChange();
        // }
        // });
        //
        // if (StringUtils.isEmpty(key.getComplement())) {
        // // display as error status, this field must not be null
        // editorManager.setComboColor(item, COMPLEMENT_INDEX, ERROR_COLOR);
        // }
        // label editor
        editor = editorManager.createLabelEditor(editor, table, key.getComplement(), item, COMPLEMENT_INDEX);
        final Label text = (Label) editor.getEditor();
        if (StringUtils.isEmpty(key.getComplement())) {
            // display as error status, this field must not be null
            text.setBackground(ERROR_COLOR);
        }
    // add drag and drop support
    // IDragDropDelegate delegate = createDragDropDelegate(key, text);
    // dragDropManager.addDragSupport(text, delegate);
    // dragDropManager.addDropSupport(text, delegate);
    }
}
Also used : Label(org.eclipse.swt.widgets.Label) TableEditor(org.eclipse.swt.custom.TableEditor) IPropertySetter(org.talend.designer.scd.util.IPropertySetter)

Example 37 with TableEditor

use of org.eclipse.swt.custom.TableEditor in project tdi-studio-se by Talend.

the class Type2Section method onStartCreationChange.

/**
     * DOC hcw Comment method "onStartCreationChange".
     * 
     * @param value
     * @param versioning
     * @param startItem
     */
protected void onStartCreationChange(Integer value, final Versioning versioning, TableItem item) {
    //$NON-NLS-1$
    versioning.setStartComplement("");
    scdManager.fireFieldChange();
    // dispose editor
    TableEditor editor = editorManager.getEditor(item, COMPLEMENT_INDEX);
    editorManager.disposeEditor(editor);
    if (value == VersionStartType.INPUT_FIELD.getIndex()) {
        createStartComplement(versioning, item, editor);
    }
}
Also used : TableEditor(org.eclipse.swt.custom.TableEditor)

Example 38 with TableEditor

use of org.eclipse.swt.custom.TableEditor in project tdi-studio-se by Talend.

the class Type2Section method onEndCreationChange.

/**
     * DOC hcw Comment method "onEndCreationChange".
     * 
     * @param value
     * @param versioning
     * @param endItem
     */
protected void onEndCreationChange(Integer value, final Versioning versioning, TableItem item) {
    //$NON-NLS-1$
    versioning.setEndComplement("");
    // dispose editor
    TableEditor editor = editorManager.getEditor(item, COMPLEMENT_INDEX);
    editorManager.disposeEditor(editor);
    if (value == VersionEndType.FIXED_YEAR.getIndex()) {
        createEndComplement(versioning, item, editor);
    }
}
Also used : TableEditor(org.eclipse.swt.custom.TableEditor)

Example 39 with TableEditor

use of org.eclipse.swt.custom.TableEditor in project tdi-studio-se by Talend.

the class AbstractVersionManagementProjectSettingPage method removeTableItem.

protected void removeTableItem(TableItem item) {
    if (item == null) {
        return;
    }
    TableEditor[] editors = (TableEditor[]) item.getData(ITEM_EDITOR_KEY);
    if (editors != null) {
        for (TableEditor editor : editors) {
            editor.getEditor().dispose();
            editor.dispose();
        }
    }
    item.dispose();
}
Also used : TableEditor(org.eclipse.swt.custom.TableEditor)

Aggregations

TableEditor (org.eclipse.swt.custom.TableEditor)39 TableItem (org.eclipse.swt.widgets.TableItem)16 SelectionEvent (org.eclipse.swt.events.SelectionEvent)15 GridData (org.eclipse.swt.layout.GridData)11 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)10 Point (org.eclipse.swt.graphics.Point)10 GridLayout (org.eclipse.swt.layout.GridLayout)7 Button (org.eclipse.swt.widgets.Button)7 CCombo (org.eclipse.swt.custom.CCombo)6 MouseEvent (org.eclipse.swt.events.MouseEvent)6 Event (org.eclipse.swt.widgets.Event)6 Listener (org.eclipse.swt.widgets.Listener)6 TraverseEvent (org.eclipse.swt.events.TraverseEvent)5 TraverseListener (org.eclipse.swt.events.TraverseListener)5 Rectangle (org.eclipse.swt.graphics.Rectangle)5 Composite (org.eclipse.swt.widgets.Composite)5 Label (org.eclipse.swt.widgets.Label)5 Table (org.eclipse.swt.widgets.Table)5 Text (org.eclipse.swt.widgets.Text)5 TableLayout (org.eclipse.jface.viewers.TableLayout)4