Search in sources :

Example 26 with ITableEntry

use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.

the class InputDataMapTableView method getCellColor.

/**
     * DOC amaumont Comment method "getCellColor".
     * 
     * @param tableViewerCreator
     * @param element
     * @param columnIndex
     * @param isBackground TODO
     * @return
     */
protected Color getCellColor(TableViewerCreator tableViewerCreator, Object element, int columnIndex, boolean isBackground) {
    ITableEntry entry = (ITableEntry) element;
    TableViewerCreatorColumnNotModifiable column = (TableViewerCreatorColumnNotModifiable) tableViewerCreator.getColumns().get(columnIndex);
    if (column.getId().equals(ID_OPERATOR)) {
        return getExpressionColorProvider().getColor(isBackground, entry.getProblems(), ProblemsManager.KEY_OPERATOR_EMPTY);
    }
    if (column.getId().equals(ID_NAME_COLUMN)) {
        return getExpressionColorProvider().getColor(isBackground, entry.getProblems(), ProblemsManager.KEY_NO_MATCHING);
    }
    return super.getCellColor(tableViewerCreator, element, columnIndex, isBackground);
}
Also used : ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) TableViewerCreatorColumnNotModifiable(org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorColumnNotModifiable)

Example 27 with ITableEntry

use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.

the class OutputDataMapTableView method onOutputTableFiltersModified.

@Override
protected void onOutputTableFiltersModified(ModifiedBeanEvent<FilterTableEntry> event, AbstractExtendedTableViewer<FilterTableEntry> _extendedTableViewerForFilters) {
    super.onOutputTableFiltersModified(event, _extendedTableViewerForFilters);
    TableViewerCreator tableViewerCreator = entendedTableViewerForOtherClauses.getTableViewerCreator();
    ITableEntry tableEntry = event.bean;
    parseExpressionIfNeeded(event, tableViewerCreator, tableEntry);
}
Also used : TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry)

Example 28 with ITableEntry

use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.

the class DataMapTableView method initShowMessageErrorListener.

/**
     * DOC amaumont Comment method "initShowMessageErrorListener".
     * 
     * @param table
     */
protected void initShowMessageErrorListener(final Table table) {
    showErrorMessageListener = new Listener() {

        @Override
        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.MouseMove:
                    // System.out.println("ToolTipText:" + table.getToolTipText());
                    String defaultToolTip = null;
                    if (WindowSystem.isGTK() && table.getToolTipText() != null) {
                        //$NON-NLS-1$
                        defaultToolTip = " ";
                    }
                    Point cursorPositionFromTableOrigin = TableUtils.getCursorPositionFromTableOrigin(table, event);
                    TableColumn tableColumn = TableUtils.getTableColumn(table, cursorPositionFromTableOrigin);
                    if (tableColumn == null) {
                        setTableToolTipText(table, null, null, defaultToolTip);
                        return;
                    }
                    TableItem tableItem = TableUtils.getTableItem(table, cursorPositionFromTableOrigin);
                    if (tableItem == null) {
                        setTableToolTipText(table, tableColumn, null, defaultToolTip);
                        return;
                    }
                    ITableEntry tableEntry = (ITableEntry) tableItem.getData();
                    String toolTip = null;
                    if (tableEntry.getProblems() != null) {
                        List<Problem> problems = tableEntry.getProblems();
                        //$NON-NLS-1$
                        toolTip = "";
                        for (Problem problem : problems) {
                            //$NON-NLS-1$ //$NON-NLS-2$
                            String description = problem.getDescription().replaceAll("[\r\n\t]", "");
                            //$NON-NLS-1$
                            toolTip += description + "\n";
                        }
                    }
                    if (WindowSystem.isGTK() && toolTip == null && table.getToolTipText() != null) {
                        toolTip = defaultToolTip;
                    }
                    setTableToolTipText(table, tableColumn, tableEntry, toolTip);
                    break;
                default:
            }
        }

        /**
             * DOC amaumont Comment method "setTableToolTipText".
             * 
             * @param table
             * @param tableColumn
             * @param text
             */
        private void setTableToolTipText(final Table table, TableColumn tableColumn, ITableEntry tableEntry, String text) {
            table.setToolTipText(text);
        }
    };
    table.addListener(SWT.MouseMove, showErrorMessageListener);
}
Also used : SelectionListener(org.eclipse.swt.events.SelectionListener) ControlListener(org.eclipse.swt.events.ControlListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) DisposeListener(org.eclipse.swt.events.DisposeListener) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) IModifiedBeanListener(org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener) ICellEditorListener(org.eclipse.jface.viewers.ICellEditorListener) MouseListener(org.eclipse.swt.events.MouseListener) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IListenableListListener(org.talend.commons.utils.data.list.IListenableListListener) FocusListener(org.eclipse.swt.events.FocusListener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) KeyListener(org.eclipse.swt.events.KeyListener) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) AbstractInOutTable(org.talend.designer.dbmap.model.table.AbstractInOutTable) OutputTable(org.talend.designer.dbmap.model.table.OutputTable) Table(org.eclipse.swt.widgets.Table) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) TableItem(org.eclipse.swt.widgets.TableItem) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ControlEvent(org.eclipse.swt.events.ControlEvent) ModifiedBeanEvent(org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ListenableListEvent(org.talend.commons.utils.data.list.ListenableListEvent) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) List(java.util.List) Problem(org.talend.core.model.process.Problem) Point(org.eclipse.swt.graphics.Point) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 29 with ITableEntry

use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.

the class DataMapTableView method unselectAllEntriesIfErrorDetected.

/**
     * DOC amaumont Comment method "unselectAllEntriesIfErrorDetected".
     * 
     * @param e
     */
protected void unselectAllEntriesIfErrorDetected(TableCellValueModifiedEvent e) {
    if (e.column.getId().equals(ID_EXPRESSION_COLUMN)) {
        ITableEntry currentEntry = (ITableEntry) e.bean;
        TableViewer tableViewer = null;
        if (currentEntry instanceof IColumnEntry) {
            tableViewer = DataMapTableView.this.getTableViewerCreatorForColumns().getTableViewer();
        } else if (currentEntry instanceof FilterTableEntry) {
            if (FilterTableEntry.OTHER_FILTER.equals(((FilterTableEntry) currentEntry).getFilterKind())) {
                tableViewer = entendedTableViewerForOtherClauses.getTableViewerCreator().getTableViewer();
            } else {
                tableViewer = extendedTableViewerForFilters.getTableViewerCreator().getTableViewer();
            }
        }
        if (currentEntry.getProblems() != null) {
            tableViewer.getTable().deselectAll();
        }
    }
}
Also used : ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) FilterTableEntry(org.talend.designer.dbmap.model.tableentry.FilterTableEntry) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) TableViewer(org.eclipse.jface.viewers.TableViewer) AbstractExtendedTableViewer(org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer)

Example 30 with ITableEntry

use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.

the class DataMapTableView method getCellColor.

/**
     * DOC amaumont Comment method "getCellColor".
     * 
     * @param tableViewerCreator
     * @param element
     * @param columnIndex
     * @param isBackground TODO
     * @return
     */
protected Color getCellColor(TableViewerCreatorNotModifiable tableViewerCreator, Object element, int columnIndex, boolean isBackground) {
    ITableEntry entry = (ITableEntry) element;
    TableViewerCreatorColumnNotModifiable column = (TableViewerCreatorColumnNotModifiable) tableViewerCreator.getColumns().get(columnIndex);
    if (column.getId().equals(ID_EXPRESSION_COLUMN)) {
        return expressionColorProvider.getColor(isBackground, entry.getProblems(), ProblemsManager.KEY_INPUT_EXPRESSION_EMPTY, ProblemsManager.KEY_OUTPUT_EXPRESSION_EMPTY);
    }
    return null;
}
Also used : ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) TableViewerCreatorColumnNotModifiable(org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorColumnNotModifiable)

Aggregations

ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)59 ArrayList (java.util.ArrayList)14 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)14 Point (org.eclipse.swt.graphics.Point)12 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)11 IMapperLink (org.talend.designer.abstractmap.ui.visualmap.link.IMapperLink)11 List (java.util.List)9 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)9 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)9 TableViewer (org.eclipse.jface.viewers.TableViewer)7 FilterTableEntry (org.talend.designer.dbmap.model.tableentry.FilterTableEntry)7 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)7 HashMap (java.util.HashMap)6 MetadataTableEditorView (org.talend.core.ui.metadata.editor.MetadataTableEditorView)6 AbstractUIManager (org.talend.designer.abstractmap.managers.AbstractUIManager)6 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)6 TableEntryLocation (org.talend.designer.dbmap.model.tableentry.TableEntryLocation)6 Zone (org.talend.designer.mapper.ui.visualmap.zone.Zone)6 HashSet (java.util.HashSet)5 Iterator (java.util.Iterator)4