Search in sources :

Example 26 with TableViewerCreatorColumn

use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.

the class AbstractHL7MetadataTableEditorView method configureDbColumnName.

/**
     * DOC amaumont Comment method "configureNameColumn".
     * 
     * @param tableViewerCreator
     */
protected void configureDbColumnName(TableViewerCreator<B> tableViewerCreator) {
    TableViewerCreatorColumn column;
    column = new TableViewerCreatorColumn(tableViewerCreator);
    column.setId(ID_COLUMN_DBCOLUMNNAME);
    //$NON-NLS-1$ 
    column.setTitle("Mapping Column");
    //$NON-NLS-1$
    column.setToolTipHeader(Messages.getString("MetadataTableEditorView.ColumnTitle"));
    column.setBeanPropertyAccessors(getDbColumnNameAccessor());
    column.setWeight(25);
    column.setModifiable(!isReadOnly());
    column.setMinimumWidth(45);
    final TextCellEditor cellEditor = new TextCellEditor(tableViewerCreator.getTable());
    column.setCellEditor(cellEditor);
    column.setColumnCellModifier(new ColumnCellModifier(column) {

        @Override
        public boolean canModify(Object bean) {
            return super.canModify(bean) && canModifyDBColumn(bean);
        }
    });
    column.setCellEditorAppliedListener(new ITableCellValueModifiedListener() {

        public void cellValueModified(TableCellValueModifiedEvent e) {
            linker.getMainui().redrawLinkers();
            linker.getBackgroundRefresher().refreshBackground();
        }
    });
    if (!dbColumnNameWritable) {
        column.setColorProvider(new IColumnColorProvider() {

            public Color getBackgroundColor(Object bean) {
                return READONLY_CELL_BG_COLOR;
            }

            public Color getForegroundColor(Object bean) {
                return null;
            }
        });
    }
}
Also used : Color(org.eclipse.swt.graphics.Color) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) IColumnColorProvider(org.talend.commons.ui.runtime.swt.tableviewer.behavior.IColumnColorProvider) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) ColumnCellModifier(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ColumnCellModifier)

Example 27 with TableViewerCreatorColumn

use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.

the class AbstractHL7MetadataTableEditorView method configureNameColumn.

/**
     * DOC amaumont Comment method "configureNameColumn".
     * 
     * @param tableViewerCreator
     */
protected void configureNameColumn(TableViewerCreator<B> tableViewerCreator) {
    TableViewerCreatorColumn column;
    column = new TableViewerCreatorColumn(tableViewerCreator);
    column.setId(ID_COLUMN_NAME);
    //$NON-NLS-1$
    column.setTitle("User Column(Click to edit)");
    //$NON-NLS-1$
    column.setToolTipHeader(Messages.getString("MetadataTableEditorView.ColumnTitle"));
    column.setBeanPropertyAccessors(getLabelAccessor());
    final Image imageKey = ImageProvider.getImage(EImage.KEY_ICON);
    final Image imageEmpty = org.talend.commons.ui.runtime.image.ImageProvider.getImage(EImage.EMPTY);
    final TextCellEditor cellEditor = new TextCellEditor(tableViewerCreator.getTable());
    column.setCellEditor(cellEditor);
    cellEditor.addListener(new DialogErrorForCellEditorListener(cellEditor, column) {

        @Override
        public void newValidValueTyped(int itemIndex, Object previousValue, Object newValue, CELL_EDITOR_STATE state) {
        }

        @Override
        public String validateValue(String newValue, int beanPosition) {
            return validateColumnName(newValue, beanPosition);
        }
    });
    column.setImageProvider(new IColumnImageProvider() {

        public Image getImage(Object element) {
            if (getKeyAccesor().get((B) element)) {
                return imageKey;
            } else {
                return imageEmpty;
            }
        }
    });
    column.setWeight(25);
    column.setModifiable(!isReadOnly());
    column.setMinimumWidth(45);
    // final TextCellEditor cellEditor = new TextCellEditor(tableViewerCreator.getTable());
    // cellEditor.addListener(new DialogErrorForCellEditorListener(cellEditor, column) {
    //
    // @Override
    // public void newValidValueTyped(int itemIndex, Object previousValue, Object newValue, CELL_EDITOR_STATE state)
    // {
    // }
    //
    // @Override
    // public String validateValue(String newValue, int beanPosition) {
    // return validateColumnName(newValue, beanPosition);
    // }
    //
    // });
    // column.setCellEditor(cellEditor);
    nameColumn = column;
}
Also used : IColumnImageProvider(org.talend.commons.ui.runtime.swt.tableviewer.behavior.IColumnImageProvider) CELL_EDITOR_STATE(org.talend.commons.ui.swt.tableviewer.TableViewerCreator.CELL_EDITOR_STATE) DialogErrorForCellEditorListener(org.talend.commons.ui.swt.tableviewer.celleditor.DialogErrorForCellEditorListener) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn) Image(org.eclipse.swt.graphics.Image) EImage(org.talend.commons.ui.runtime.image.EImage)

Example 28 with TableViewerCreatorColumn

use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.

the class AbstractHL7MetadataTableEditorView method configurePrecisionColumn.

/**
     * DOC amaumont Comment method "configurePrecisionColumn".
     * 
     * @param tableViewerCreator
     */
protected void configurePrecisionColumn(TableViewerCreator<B> tableViewerCreator) {
    TableViewerCreatorColumn column;
    column = new TableViewerCreatorColumn(tableViewerCreator);
    //$NON-NLS-1$
    column.setTitle(Messages.getString("MetadataTableEditorView.PrecisionTitle"));
    //$NON-NLS-1$
    column.setToolTipHeader(Messages.getString("MetadataTableEditorView.PrecisionTitle"));
    column.setId(ID_COLUMN_PRECISION);
    column.setBeanPropertyAccessors(getPrecisionAccessor());
    column.setModifiable(!isReadOnly());
    column.setWeight(10);
    column.setMinimumWidth(10);
    column.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()), CellEditorValueAdapterFactory.getPositiveIntAdapter());
}
Also used : TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)

Example 29 with TableViewerCreatorColumn

use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.

the class AbstractHL7MetadataTableEditorView method configureCommentColumn.

/**
     * DOC amaumont Comment method "configureCommentColumn".
     * 
     * @param tableViewerCreator
     */
protected void configureCommentColumn(TableViewerCreator<B> tableViewerCreator) {
    TableViewerCreatorColumn column;
    column = new TableViewerCreatorColumn(tableViewerCreator);
    //$NON-NLS-1$
    column.setTitle(Messages.getString("MetadataTableEditorView.CommentTitle"));
    //$NON-NLS-1$
    column.setToolTipHeader(Messages.getString("MetadataTableEditorView.CommentTitle"));
    column.setId(ID_COLUMN_COMMENT);
    column.setBeanPropertyAccessors(getCommentAccessor());
    column.setWeight(10);
    column.setModifiable(!isReadOnly());
    column.setMinimumWidth(20);
    column.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
}
Also used : TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)

Example 30 with TableViewerCreatorColumn

use of org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn in project tdi-studio-se by Talend.

the class AbstractHL7MetadataTableEditorView method configureLengthColumn.

/**
     * DOC amaumont Comment method "configureLengthColumn".
     * 
     * @param tableViewerCreator
     * @param positiveIntValueAdapter
     */
protected void configureLengthColumn(TableViewerCreator<B> tableViewerCreator) {
    TableViewerCreatorColumn column;
    column = new TableViewerCreatorColumn(tableViewerCreator);
    //$NON-NLS-1$
    column.setTitle(Messages.getString("MetadataTableEditorView.LengthTitle"));
    //$NON-NLS-1$
    column.setToolTipHeader(Messages.getString("MetadataTableEditorView.LengthTitle"));
    column.setId(ID_COLUMN_LENGHT);
    column.setBeanPropertyAccessors(getLengthAccessor());
    column.setModifiable(!isReadOnly());
    column.setWeight(10);
    column.setMinimumWidth(10);
    column.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()), CellEditorValueAdapterFactory.getPositiveIntAdapter(true));
}
Also used : TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)

Aggregations

TableViewerCreatorColumn (org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)38 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)14 CellEditorValueAdapter (org.talend.commons.ui.runtime.swt.tableviewer.behavior.CellEditorValueAdapter)9 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)8 CCombo (org.eclipse.swt.custom.CCombo)6 Color (org.eclipse.swt.graphics.Color)6 IColumnColorProvider (org.talend.commons.ui.runtime.swt.tableviewer.behavior.IColumnColorProvider)6 TextCellEditorWithProposal (org.talend.commons.ui.swt.proposal.TextCellEditorWithProposal)6 CheckboxTableEditorContent (org.talend.commons.ui.swt.tableviewer.tableeditor.CheckboxTableEditorContent)6 List (java.util.List)5 ColumnCellModifier (org.talend.commons.ui.runtime.swt.tableviewer.behavior.ColumnCellModifier)5 CELL_EDITOR_STATE (org.talend.commons.ui.swt.tableviewer.TableViewerCreator.CELL_EDITOR_STATE)5 DialogErrorForCellEditorListener (org.talend.commons.ui.swt.tableviewer.celleditor.DialogErrorForCellEditorListener)5 CellEditor (org.eclipse.jface.viewers.CellEditor)4 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 Image (org.eclipse.swt.graphics.Image)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3