Search in sources :

Example 6 with GlobalMapEntry

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

the class InputDataMapTableView method createGlobalMapColumns.

public void createGlobalMapColumns(final TableViewerCreator<GlobalMapEntry> tableViewerCreatorForGlobalMap) {
    TableViewerCreatorColumn<GlobalMapEntry, String> column = new TableViewerCreatorColumn<GlobalMapEntry, String>(tableViewerCreatorForGlobalMap);
    //        column.setTitle(Messages.getString("InputDataMapTableView.columnTitle.globalMapVar")); //$NON-NLS-1$
    //$NON-NLS-1$
    column.setTitle("Expr.");
    column.setId(DataMapTableView.ID_EXPRESSION_COLUMN);
    final ExtendedTextCellEditor expressionCellEditor = createExpressionCellEditor(tableViewerCreatorForGlobalMap, column, new Zone[] { Zone.INPUTS }, false);
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<GlobalMapEntry, String>() {

        public String get(GlobalMapEntry bean) {
            return bean.getExpression();
        }

        public void set(GlobalMapEntry bean, String value) {
            bean.setExpression(value);
            mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true);
        }
    });
    column.setModifiable(true);
    //$NON-NLS-1$
    column.setDefaultInternalValue("");
    column.setWeight(COLUMN_EXPRESSION_SIZE_WEIGHT);
    column.setMoveable(false);
    column.setResizable(true);
    column = new TableViewerCreatorColumn<GlobalMapEntry, String>(tableViewerCreatorForGlobalMap);
    //$NON-NLS-1$
    column.setTitle(Messages.getString("InputDataMapTableView.globalMapKey"));
    column.setId(DataMapTableView.ID_NAME_COLUMN);
    column.setModifiable(true);
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<GlobalMapEntry, String>() {

        public String get(GlobalMapEntry bean) {
            return bean.getName();
        }

        public void set(GlobalMapEntry bean, String value) {
            bean.setName(value);
        }
    });
    column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
    final TextCellEditor cellEditor = new TextCellEditor(tableViewerCreatorForGlobalMap.getTable());
    column.setCellEditor(cellEditor);
    // Column with remove button
    column = new TableViewerCreatorColumn(tableViewerCreatorForGlobalMap);
    //$NON-NLS-1$
    column.setTitle("");
    //$NON-NLS-1$
    column.setDefaultDisplayedValue("");
    //$NON-NLS-1$
    column.setToolTipHeader(Messages.getString("InputDataMapTableView.addNewGlobalMapVar.tooltip"));
    column.setWeight(10);
    column.setWidth(25);
    column.setMoveable(false);
    column.setResizable(true);
    column.setImageHeader(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.ADD_ICON)));
    column.setTableColumnSelectionListener(new DefaultHeaderColumnSelectionListener(column, tableViewerCreatorForGlobalMap) {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
        @Override
        public void widgetSelected(SelectionEvent arg0) {
            if (!mapperManager.componentIsReadOnly()) {
                getInputTable().addGlobalMapEntry(//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
                new GlobalMapEntry(getInputTable(), "\"" + findUniqueName("myKey") + "\"", ""));
                updateGridDataHeightForTableGlobalMap();
                resizeAtExpandedSize();
            }
        }
    });
    ButtonPushImageTableEditorContent buttonImage = new ButtonPushImageTableEditorContent() {

        /*
             * (non-Javadoc)
             * 
             * @see
             * org.talend.commons.ui.swt.tableviewer.tableeditor.ButtonImageTableEditorContent#selectionEvent(org.talend
             * .commons.ui.swt.tableviewer.TableViewerCreatorColumn, java.lang.Object)
             */
        @Override
        protected void selectionEvent(TableViewerCreatorColumnNotModifiable column, Object bean) {
            ITableEntry tableEntry = (ITableEntry) bean;
            if (!mapperManager.componentIsReadOnly()) {
                boolean removeEntry = MessageDialog.openConfirm(getShell(), //$NON-NLS-1$
                Messages.getString("InputDataMapTableView.removeGlobalMapVar.Title"), //$NON-NLS-1$
                Messages.getString("InputDataMapTableView.removeGlobalMapVar.Message", tableEntry.getName()));
                if (removeEntry) {
                    ExtendedTableRemoveCommand removeCommand = new ExtendedTableRemoveCommand(bean, extendedTableViewerForGlobalMap.getExtendedTableModel());
                    mapperManager.removeTableEntry((ITableEntry) bean);
                    mapperManager.executeCommand(removeCommand);
                    tableViewerCreatorForGlobalMap.getTableViewer().refresh();
                    List list = tableViewerCreatorForGlobalMap.getInputList();
                    updateGridDataHeightForTableGlobalMap();
                    resizeAtExpandedSize();
                }
            }
        }
    };
    buttonImage.setImage(ImageProvider.getImage(EImage.MINUS_ICON));
    column.setTableEditorContent(buttonImage);
}
Also used : ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) TableViewerCreatorColumnNotModifiable(org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorColumnNotModifiable) ButtonPushImageTableEditorContent(org.talend.commons.ui.runtime.swt.tableviewer.tableeditor.ButtonPushImageTableEditorContent) ExtendedTextCellEditor(org.talend.commons.ui.runtime.swt.tableviewer.celleditor.ExtendedTextCellEditor) DefaultHeaderColumnSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.DefaultHeaderColumnSelectionListener) ExtendedTableRemoveCommand(org.talend.commons.ui.swt.advanced.dataeditor.commands.ExtendedTableRemoveCommand) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(java.util.List) ArrayList(java.util.ArrayList) ExtendedTextCellEditor(org.talend.commons.ui.runtime.swt.tableviewer.celleditor.ExtendedTextCellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry)

Example 7 with GlobalMapEntry

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

the class UIManager method getTableEntryPosition.

/**
     * DOC amaumont Comment method "getTableEntryPosition".
     * 
     * @param manager TODO
     * @param tableEntry
     * @param forceRecalculate TODO
     * @return
     */
public Point getTableEntryPosition(ITableEntry tableEntry, boolean forceRecalculate) {
    DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(tableEntry);
    int entriesSize = 0;
    int minHeight = dataMapTableView.getTableViewerCreatorForColumns().getTable().getHeaderHeight() + dataMapTableView.getTableViewerCreatorForColumns().getTable().getItemHeight();
    TableItem[] tableItems = new TableItem[0];
    if (tableEntry instanceof InputColumnTableEntry || tableEntry instanceof OutputColumnTableEntry) {
        tableItems = dataMapTableView.getTableViewerCreatorForColumns().getTable().getItems();
        AbstractInOutTable abstractInOutTable = (AbstractInOutTable) dataMapTableView.getDataMapTable();
        if (dataMapTableView.getZone() == Zone.OUTPUTS) {
            OutputTable outputTable = (OutputTable) abstractInOutTable;
            List<IColumnEntry> oldOuputEntries = outputTable.getDataMapTableEntries();
            entriesSize = oldOuputEntries.size();
        }
        if (dataMapTableView.getZone() == Zone.INPUTS) {
            InputTable inputTable = (InputTable) abstractInOutTable;
            List<IColumnEntry> oldOuputEntries = inputTable.getDataMapTableEntries();
            entriesSize = oldOuputEntries.size();
        }
    }
    Rectangle tableViewBounds = dataMapTableView.getBounds();
    Point pointFromTableViewOrigin = null;
    Display display = dataMapTableView.getDisplay();
    Point returnedPoint = new Point(0, 0);
    TableEntryProperties tableEntryProperties = null;
    int itemIndex = 0;
    if (tableEntry instanceof IColumnEntry || tableEntry instanceof FilterTableEntry || tableEntry instanceof GlobalMapEntry) {
        tableEntryProperties = mapperManager.getTableEntryProperties(tableEntry);
        returnedPoint = tableEntryProperties.position;
        if (forceRecalculate || returnedPoint == null) {
            int y;
            TableItem tableItem = mapperManager.retrieveTableItem(tableEntry);
            boolean isOutputEntry = tableEntry instanceof OutputColumnTableEntry;
            boolean isIntputEntry = tableEntry instanceof InputColumnTableEntry;
            boolean checked = false;
            for (int i = 0; i < tableItems.length; i++) {
                if (tableItems[i].getData() == tableEntry) {
                    itemIndex = i;
                    break;
                }
            }
            boolean allIsNull = false;
            if (tableItem == null && (isIntputEntry || isOutputEntry)) {
                if (tableItems.length > 0) {
                    tableItem = tableItems[0];
                    checked = true;
                } else {
                    allIsNull = true;
                }
            }
            if (!allIsNull) {
                Table table = tableItem.getParent();
                // FIX for issue 1225 ("1" parameter added)
                Rectangle boundsTableItem = tableItem.getBounds(1);
                y = boundsTableItem.y + table.getItemHeight() / 2 + dataMapTableView.getBorderWidth();
                if (isOutputEntry || isIntputEntry) {
                    if (entriesSize != tableItems.length) {
                        y = boundsTableItem.y + table.getItemHeight() / 2 + dataMapTableView.getBorderWidth();
                    }
                }
                if (checked) {
                    y = boundsTableItem.y + dataMapTableView.getBorderWidth();
                    checked = false;
                }
                int x = 0;
                if (y < 0) {
                    y = 0;
                }
                Point point = new Point(x, y);
                pointFromTableViewOrigin = display.map(tableItem.getParent(), dataMapTableView, point);
            } else {
                Text columnFilterText = dataMapTableView.getColumnNameFilterText();
                Point point = new Point(-dataMapTableView.getBorderWidth() - 19, minHeight);
                pointFromTableViewOrigin = display.map(columnFilterText, dataMapTableView, point);
            }
        }
    } else if (tableEntry instanceof ExpressionFilterEntry) {
        StyledText expressionFilterText = dataMapTableView.getExpressionFilterText();
        //            dataMapTableView.getex
        Point point = new Point(-dataMapTableView.getBorderWidth() - 19, 16);
        pointFromTableViewOrigin = display.map(expressionFilterText, dataMapTableView, point);
    } else {
        //$NON-NLS-1$
        throw new IllegalStateException("Case not found");
    }
    if (pointFromTableViewOrigin.y > tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION) {
        pointFromTableViewOrigin.y = tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION;
    }
    returnedPoint = convertPointToReferenceOrigin(getReferenceComposite(), pointFromTableViewOrigin, dataMapTableView);
    if (tableEntryProperties != null) {
        tableEntryProperties.position = returnedPoint;
    }
    return returnedPoint;
}
Also used : IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) InputTable(org.talend.designer.mapper.model.table.InputTable) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) OutputTable(org.talend.designer.mapper.model.table.OutputTable) ExternalMapperTable(org.talend.designer.mapper.external.data.ExternalMapperTable) Table(org.eclipse.swt.widgets.Table) AbstractDataMapTable(org.talend.designer.mapper.model.table.AbstractDataMapTable) StyledText(org.eclipse.swt.custom.StyledText) TableItem(org.eclipse.swt.widgets.TableItem) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) Rectangle(org.eclipse.swt.graphics.Rectangle) FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry) InputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.OutputDataMapTableView) VarsDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.VarsDataMapTableView) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) OutputColumnTableEntry(org.talend.designer.mapper.model.tableentry.OutputColumnTableEntry) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) Point(org.eclipse.swt.graphics.Point) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) TableEntryProperties(org.talend.designer.mapper.ui.visualmap.TableEntryProperties) Point(org.eclipse.swt.graphics.Point) OutputTable(org.talend.designer.mapper.model.table.OutputTable) InputTable(org.talend.designer.mapper.model.table.InputTable) InputColumnTableEntry(org.talend.designer.mapper.model.tableentry.InputColumnTableEntry) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry) ExpressionFilterEntry(org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry) Display(org.eclipse.swt.widgets.Display)

Example 8 with GlobalMapEntry

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

the class TableEntriesManager method remove.

public void remove(ITableEntry dataMapTableEntry) {
    if (dataMapTableEntry != null) {
        mapperManager.removeLinksOf(dataMapTableEntry);
        tableEntries.remove(TableEntriesManager.buildLocation(dataMapTableEntry));
        dataMapTableEntryToProperties.remove(dataMapTableEntry);
        IDataMapTable dataMapTable = dataMapTableEntry.getParent();
        if (dataMapTableEntry instanceof IColumnEntry) {
            dataMapTableEntry.getParent().removeColumnEntry((IColumnEntry) dataMapTableEntry);
        } else if (dataMapTableEntry instanceof GlobalMapEntry) {
            if (dataMapTable instanceof OutputTable) {
                ((InputTable) dataMapTable).removeGlobalMapEntry((GlobalMapEntry) dataMapTableEntry);
            }
        } else if (dataMapTableEntry instanceof FilterTableEntry) {
            if (dataMapTable instanceof OutputTable) {
                ((OutputTable) dataMapTable).removeFilterEntry((FilterTableEntry) dataMapTableEntry);
            }
        } else if (dataMapTableEntry instanceof ExpressionFilterEntry) {
        // nothing
        } else {
            String exceptionMessage = //$NON-NLS-1$
            Messages.getString(//$NON-NLS-1$
            "TableEntriesManager.exceptionMessage.typeIsNotValid", dataMapTableEntry.getClass().toString());
            throw new IllegalArgumentException(exceptionMessage);
        }
    }
}
Also used : FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry) ExpressionFilterEntry(org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

Example 9 with GlobalMapEntry

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

the class UIManager method selectLinks.

/**
     * Highlight links and linked cells which have are referenced by the selected items.
     * 
     * @param dataMapTableView
     * @param forceResetHighlightLinksForOtherTables TODO
     * @param selectAllTableLinks TODO
     * @param selectedMetadataTableEntries, source or targets entries which must be highlighted, can be null to select
     * all links of a same DataMapTableView
     */
@SuppressWarnings("unchecked")
public void selectLinks(DataMapTableView dataMapTableView, List<ITableEntry> selectedTableEntries, boolean forceResetHighlightLinksForOtherTables, boolean selectAllTableLinks) {
    if (!selectAllTableLinks && selectedTableEntries == null || selectedTableEntries != null && selectedTableEntries.size() == 0) {
        return;
    }
    UIManager uiManager = mapperManager.getUiManager();
    TableViewerCreator<ITableEntry> currentTableViewer = null;
    boolean isFilterTableSelected = false;
    boolean isGlobalMapTableSelected = false;
    if (!selectAllTableLinks) {
        ITableEntry firstEntry = selectedTableEntries.get(0);
        if (firstEntry.isTableEntry()) {
            if (firstEntry instanceof FilterTableEntry) {
                isFilterTableSelected = true;
                currentTableViewer = dataMapTableView.getTableViewerCreatorForFilters();
            } else if (firstEntry instanceof GlobalMapEntry) {
                isGlobalMapTableSelected = true;
                currentTableViewer = dataMapTableView.getTableViewerCreatorForGlobalMap();
            } else {
                currentTableViewer = dataMapTableView.getTableViewerCreatorForColumns();
            }
        }
    }
    // Color selectedColor = dataMapTableView.getDisplay().getSystemColor(SWT.COLOR_YELLOW);
    Color unselectedColor = dataMapTableView.getDisplay().getSystemColor(SWT.COLOR_WHITE);
    Zone currentZone = dataMapTableView.getZone();
    Set<ITableEntry> hashSelectedMetadataTableEntries = new HashSet<ITableEntry>();
    if (selectAllTableLinks) {
        if (currentZone == Zone.INPUTS || currentZone == Zone.OUTPUTS) {
            hashSelectedMetadataTableEntries.add(((AbstractInOutTable) dataMapTableView.getDataMapTable()).getExpressionFilter());
        }
        hashSelectedMetadataTableEntries.addAll(dataMapTableView.getTableViewerCreatorForColumns().getInputList());
        if (currentZone == Zone.INPUTS) {
            hashSelectedMetadataTableEntries.addAll(dataMapTableView.getTableViewerCreatorForGlobalMap().getInputList());
        }
        if (currentZone == Zone.OUTPUTS) {
            hashSelectedMetadataTableEntries.addAll(dataMapTableView.getTableViewerCreatorForFilters().getInputList());
        }
    } else {
        hashSelectedMetadataTableEntries.addAll(selectedTableEntries);
    }
    // ////////////////////////////////////////////////////////////////////////
    // Unselect all links and tableEntries if Ctrl or Shift keys are not pressed or if zone different of last
    // selection
    boolean zoneHasChanged = (previousSelectedZone == Zone.INPUTS || previousSelectedZone == Zone.VARS) && currentZone == Zone.OUTPUTS || (currentZone == Zone.INPUTS || currentZone == Zone.VARS) && previousSelectedZone == Zone.OUTPUTS;
    boolean tableTypeHasChanged = previousSelectedTableIsConstraint != isFilterTableSelected && currentZone == Zone.OUTPUTS || previousSelectedTableIsGlobalMap != isGlobalMapTableSelected && currentZone == Zone.INPUTS;
    boolean resetHighlightObjectsForOtherTables = !uiManager.isDragging() && (!uiManager.isCtrlPressed() && !uiManager.isShiftPressed() || zoneHasChanged);
    if (resetHighlightObjectsForOtherTables || forceResetHighlightLinksForOtherTables) {
        for (IMapperLink link : mapperManager.getLinks()) {
            if (!hashSelectedMetadataTableEntries.contains(link.getPointLinkDescriptor1().getTableEntry()) && !hashSelectedMetadataTableEntries.contains(link.getPointLinkDescriptor2().getTableEntry())) {
                link.setState(LinkState.UNSELECTED);
                ITableEntry sourceITableEntry = link.getPointLinkDescriptor1().getTableEntry();
                TableItem tableItem = mapperManager.retrieveTableItem(sourceITableEntry);
                if (tableItem != null) {
                    tableItem.setBackground(unselectedColor);
                }
                ITableEntry targetITableEntry = link.getPointLinkDescriptor2().getTableEntry();
                if (tableItem != null) {
                    tableItem = mapperManager.retrieveTableItem(targetITableEntry);
                }
                if (tableItem != null) {
                    tableItem.setBackground(unselectedColor);
                }
            }
        }
        if (currentZone == Zone.INPUTS || currentZone == Zone.VARS) {
            unselectAllOutputMetaDataEntries();
        } else if (currentZone == Zone.OUTPUTS) {
            unselectAllInputMetaDataEntries();
        }
        Collection<DataMapTableView> tablesToDeselectEntries = mapperManager.getTablesView();
        for (DataMapTableView viewToDeselectEntries : tablesToDeselectEntries) {
            if (viewToDeselectEntries != dataMapTableView) {
                viewToDeselectEntries.unselectAllEntries();
            } else if (viewToDeselectEntries == dataMapTableView && tableTypeHasChanged) {
                if (isFilterTableSelected) {
                    viewToDeselectEntries.unselectAllColumnEntries();
                    viewToDeselectEntries.unselectAllGlobalMapEntries();
                } else if (isGlobalMapTableSelected) {
                    viewToDeselectEntries.unselectAllColumnEntries();
                    viewToDeselectEntries.unselectAllConstraintEntries();
                } else {
                    viewToDeselectEntries.unselectAllGlobalMapEntries();
                    viewToDeselectEntries.unselectAllConstraintEntries();
                }
            }
        }
    }
    // ////////////////////////////////////////////////////////////////////////
    // ////////////////////////////////////////////////////////////////////////
    // Select or unselect links and tableEntries
    List<ITableEntry> allEntriesOfCurrentTableView = new ArrayList<ITableEntry>();
    if (currentZone == Zone.INPUTS || currentZone == Zone.OUTPUTS) {
        allEntriesOfCurrentTableView.add(((AbstractInOutTable) dataMapTableView.getDataMapTable()).getExpressionFilter());
    }
    if (selectAllTableLinks || currentTableViewer != null) {
        allEntriesOfCurrentTableView.addAll(dataMapTableView.getTableViewerCreatorForColumns().getInputList());
        if (selectAllTableLinks && currentZone == Zone.OUTPUTS) {
            allEntriesOfCurrentTableView.addAll(dataMapTableView.getTableViewerCreatorForFilters().getInputList());
        }
        // if (selectAllTableLinks && currentZone == Zone.INPUTS) {
        if (currentZone == Zone.INPUTS) {
            allEntriesOfCurrentTableView.addAll(dataMapTableView.getTableViewerCreatorForGlobalMap().getInputList());
        }
    }
    int lstSize = allEntriesOfCurrentTableView.size();
    Set<IMapperLink> linksAlreadySelected = new HashSet<IMapperLink>();
    for (int i = 0; i < lstSize; i++) {
        ITableEntry entry = allEntriesOfCurrentTableView.get(i);
        Set<IMapperLink> linksFromSource = mapperManager.getGraphicalLinksFromSource(entry);
        Set<IMapperLink> linksFromTarget = mapperManager.getGraphicalLinksFromTarget(entry);
        LinkState linkState = null;
        if (hashSelectedMetadataTableEntries.contains(entry)) {
            linkState = LinkState.SELECTED;
        } else {
            linkState = LinkState.UNSELECTED;
        }
        for (IMapperLink link : linksFromSource) {
            ITableEntry targetITableEntry = link.getPointLinkDescriptor2().getTableEntry();
            if (linkState == LinkState.SELECTED || !linksAlreadySelected.contains(link) && linkState == LinkState.UNSELECTED) {
                link.setState(linkState);
                if (linkState == LinkState.SELECTED) {
                    linksAlreadySelected.add(link);
                }
            }
            EntryState entryState = (link.getState() == LinkState.SELECTED ? EntryState.HIGHLIGHT : EntryState.NONE);
            setEntryState(mapperManager, entryState, targetITableEntry);
        }
        for (IMapperLink link : linksFromTarget) {
            ITableEntry sourceITableEntry = link.getPointLinkDescriptor1().getTableEntry();
            if (linkState == LinkState.SELECTED || !linksAlreadySelected.contains(link) && linkState == LinkState.UNSELECTED) {
                link.setState(linkState);
                if (linkState == LinkState.SELECTED) {
                    linksAlreadySelected.add(link);
                }
            }
            EntryState entryState = (link.getState() == LinkState.SELECTED ? EntryState.HIGHLIGHT : EntryState.NONE);
            setEntryState(mapperManager, entryState, sourceITableEntry);
        }
    }
    // ////////////////////////////////////////////////////////////////////////
    // order links to place selected links at last position (last drawn)
    mapperManager.orderLinks();
    uiManager.refreshBackground(false, false);
    previousSelectedZone = dataMapTableView.getZone();
    previousSelectedTableIsConstraint = isFilterTableSelected;
    previousSelectedTableIsGlobalMap = isGlobalMapTableSelected;
}
Also used : ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) Zone(org.talend.designer.mapper.ui.visualmap.zone.Zone) InputsZone(org.talend.designer.mapper.ui.visualmap.zone.InputsZone) ToolbarOutputZone(org.talend.designer.mapper.ui.visualmap.zone.toolbar.ToolbarOutputZone) ToolbarZone(org.talend.designer.mapper.ui.visualmap.zone.toolbar.ToolbarZone) OutputsZone(org.talend.designer.mapper.ui.visualmap.zone.OutputsZone) Color(org.eclipse.swt.graphics.Color) TableItem(org.eclipse.swt.widgets.TableItem) FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry) ArrayList(java.util.ArrayList) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) InputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.OutputDataMapTableView) VarsDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.VarsDataMapTableView) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) Point(org.eclipse.swt.graphics.Point) LinkState(org.talend.designer.abstractmap.ui.visualmap.link.LinkState) IMapperLink(org.talend.designer.abstractmap.ui.visualmap.link.IMapperLink) EntryState(org.talend.designer.mapper.ui.visualmap.table.EntryState) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry) HashSet(java.util.HashSet)

Example 10 with GlobalMapEntry

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

the class UIManager method parseAllExpressions.

/**
     * DOC amaumont Comment method "processAllExpressions".
     * 
     * @param newLinksMustHaveSelectedState TODO
     */
@SuppressWarnings("unchecked")
public void parseAllExpressions(DataMapTableView dataMapTableView, boolean newLinksMustHaveSelectedState) {
    List<IColumnEntry> columnsEntriesList = dataMapTableView.getDataMapTable().getColumnEntries();
    parseAllExpressions(columnsEntriesList, newLinksMustHaveSelectedState);
    if (mapperManager.isAdvancedMap() && (dataMapTableView.getZone() == Zone.INPUTS || dataMapTableView.getZone() == Zone.OUTPUTS)) {
        AbstractInOutTable table = (AbstractInOutTable) dataMapTableView.getDataMapTable();
        if (dataMapTableView.getZone() == Zone.INPUTS) {
            InputTable inputTable = (InputTable) table;
            List<GlobalMapEntry> globalMapEntries = inputTable.getGlobalMapEntries();
            if (globalMapEntries != null && !inputTable.isMainConnection()) {
                parseAllExpressions(globalMapEntries, newLinksMustHaveSelectedState);
            }
        }
        if (table.isActivateExpressionFilter()) {
            ExpressionFilterEntry expressionFilter = table.getExpressionFilter();
            parseExpression(expressionFilter.getExpression(), expressionFilter, newLinksMustHaveSelectedState, false, false);
        }
    } else if (dataMapTableView.getZone() == Zone.OUTPUTS) {
        List<ITableEntry> constraintEntriesList = dataMapTableView.getTableViewerCreatorForFilters().getInputList();
        parseAllExpressions(constraintEntriesList, newLinksMustHaveSelectedState);
    }
}
Also used : InputTable(org.talend.designer.mapper.model.table.InputTable) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) ArrayList(java.util.ArrayList) List(java.util.List) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry) ExpressionFilterEntry(org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry)

Aggregations

GlobalMapEntry (org.talend.designer.mapper.model.tableentry.GlobalMapEntry)20 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)10 ArrayList (java.util.ArrayList)8 InputTable (org.talend.designer.mapper.model.table.InputTable)8 ExpressionFilterEntry (org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry)7 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)6 FilterTableEntry (org.talend.designer.mapper.model.tableentry.FilterTableEntry)6 List (java.util.List)4 Table (org.eclipse.swt.widgets.Table)4 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)4 AbstractInOutTable (org.talend.designer.mapper.model.table.AbstractInOutTable)4 OutputTable (org.talend.designer.mapper.model.table.OutputTable)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 TableViewer (org.eclipse.jface.viewers.TableViewer)3 FocusEvent (org.eclipse.swt.events.FocusEvent)3 FocusListener (org.eclipse.swt.events.FocusListener)3 Point (org.eclipse.swt.graphics.Point)3 GridData (org.eclipse.swt.layout.GridData)3 TableItem (org.eclipse.swt.widgets.TableItem)3