Search in sources :

Example 6 with VarsTable

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

the class SearchZoneMapper method moveScrollBarZoneAtSelectedTableItem.

public void moveScrollBarZoneAtSelectedTableItem(ITableEntry entry) {
    if (entry != null) {
        DataMapTableView dataMapTableView = mapperManager.retrieveAbstractDataMapTableView(entry.getParent());
        Rectangle tableViewBounds = dataMapTableView.getBounds();
        IDataMapTable table = entry.getParent();
        TableItem tableItem = mapperManager.retrieveTableItem(entry);
        if (table != null && tableItem != null) {
            Rectangle tableItemBounds = tableItem.getBounds();
            int selection = tableViewBounds.y + tableItemBounds.y;
            ScrolledComposite scrollComposite = null;
            if (table instanceof InputTable) {
                scrollComposite = uiManager.getScrolledCompositeViewInputs();
            } else if (table instanceof VarsTable) {
                scrollComposite = uiManager.getScrolledCompositeViewVars();
            } else if (table instanceof OutputTable) {
                scrollComposite = uiManager.getScrolledCompositeViewOutputs();
            }
            if (scrollComposite != null) {
                setPositionOfVerticalScrollBarZone(scrollComposite, selection);
            }
        }
    }
}
Also used : InputTable(org.talend.designer.mapper.model.table.InputTable) VarsTable(org.talend.designer.mapper.model.table.VarsTable) TableItem(org.eclipse.swt.widgets.TableItem) Rectangle(org.eclipse.swt.graphics.Rectangle) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

Example 7 with VarsTable

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

the class SearchZoneMapper method search.

public void search(Map<Integer, Map<Integer, ITableEntry>> searchMaps, String searchValue) {
    if (searchValue.equals("")) {
        uiManager.unselectAllEntriesOfAllTables();
        return;
    }
    // SearchPattern
    matcher.setPattern("*" + searchValue.trim() + "*");
    List<InputTable> inputTables = mapperManager.getInputTables();
    List<VarsTable> varsTables = mapperManager.getVarsTables();
    List<OutputTable> outputTables = mapperManager.getOutputTables();
    int index = -1;
    // for the InputTables
    for (InputTable inputTable : inputTables) {
        for (IColumnEntry column : inputTable.getColumnEntries()) {
            int i = -1;
            Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
            boolean modified = false;
            if (column.getExpression() != null && matcher.matches(column.getExpression())) {
                i++;
                map.put(i, column);
                modified = true;
            }
            if (column.getName() != null && matcher.matches(column.getName())) {
                i++;
                map.put(i, column);
                modified = true;
            }
            if (modified) {
                index++;
                searchMaps.put(index, map);
            }
        }
        // ExpressionFilter
        ExpressionFilterEntry expressionFilterEntry = inputTable.getExpressionFilter();
        if (expressionFilterEntry.getExpression() != null && matcher.matches(expressionFilterEntry.getExpression())) {
            Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
            map.put(0, expressionFilterEntry);
            index++;
            searchMaps.put(index, map);
        }
    }
    // for the VarsTables
    for (VarsTable varsTable : varsTables) {
        for (IColumnEntry column : varsTable.getColumnEntries()) {
            int i = -1;
            Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
            boolean modified = false;
            if (column.getExpression() != null && matcher.matches(column.getExpression())) {
                i++;
                map.put(i, column);
                modified = true;
            }
            if (column.getName() != null && matcher.matches(column.getName())) {
                i++;
                map.put(i, column);
                modified = true;
            }
            if (modified) {
                index++;
                searchMaps.put(index, map);
            }
        }
    }
    // for the OutputTables
    for (OutputTable outputTable : outputTables) {
        for (IColumnEntry column : outputTable.getColumnEntries()) {
            int i = -1;
            Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
            boolean modified = false;
            if (column.getExpression() != null && matcher.matches(column.getExpression())) {
                i++;
                map.put(i, column);
                modified = true;
            }
            if (column.getName() != null && matcher.matches(column.getName())) {
                i++;
                map.put(i, column);
                modified = true;
            }
            if (modified) {
                index++;
                searchMaps.put(index, map);
            }
        }
        // ExpressionFilter
        ExpressionFilterEntry expressionFilterEntry = outputTable.getExpressionFilter();
        if (expressionFilterEntry.getExpression() != null && matcher.matches(expressionFilterEntry.getExpression())) {
            Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
            map.put(0, expressionFilterEntry);
            index++;
            searchMaps.put(index, map);
        }
    }
}
Also used : VarsTable(org.talend.designer.mapper.model.table.VarsTable) HashMap(java.util.HashMap) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) OutputTable(org.talend.designer.mapper.model.table.OutputTable) InputTable(org.talend.designer.mapper.model.table.InputTable) ExpressionFilterEntry(org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry)

Example 8 with VarsTable

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

the class CompleteDropTargetTableListener method insertNewVarEntry.

private int insertNewVarEntry(ILanguage currentLanguage, DataMapTableView dataMapTableViewTarget, int currentIndex, ITableEntry tableEntrySource, String columnName) {
    ITableEntry dataMapTableEntry;
    String type = null;
    if (tableEntrySource.getParent() instanceof InputTable) {
        type = ((InputColumnTableEntry) tableEntrySource).getMetadataColumn().getTalendType();
    } else if (tableEntrySource.getParent() instanceof VarsTable) {
        type = ((VarTableEntry) tableEntrySource).getType();
    }
    dataMapTableEntry = getMapperManager().addNewVarEntry(dataMapTableViewTarget, columnName, currentIndex++, type);
    String location = currentLanguage.getLocation(tableEntrySource.getParentName(), tableEntrySource.getName());
    //$NON-NLS-1$
    dataMapTableEntry.setExpression(location + " ");
    return currentIndex;
}
Also used : InputTable(org.talend.designer.mapper.model.table.InputTable) VarsTable(org.talend.designer.mapper.model.table.VarsTable) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) VarTableEntry(org.talend.designer.mapper.model.tableentry.VarTableEntry) InputColumnTableEntry(org.talend.designer.mapper.model.tableentry.InputColumnTableEntry)

Aggregations

VarsTable (org.talend.designer.mapper.model.table.VarsTable)8 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)4 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)4 InputTable (org.talend.designer.mapper.model.table.InputTable)4 ArrayList (java.util.ArrayList)3 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)2 ExternalMapperTable (org.talend.designer.mapper.external.data.ExternalMapperTable)2 OutputTable (org.talend.designer.mapper.model.table.OutputTable)2 AbstractInOutTableEntry (org.talend.designer.mapper.model.tableentry.AbstractInOutTableEntry)2 VarTableEntry (org.talend.designer.mapper.model.tableentry.VarTableEntry)2 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)2 HashMap (java.util.HashMap)1 List (java.util.List)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 ControlEvent (org.eclipse.swt.events.ControlEvent)1 ControlListener (org.eclipse.swt.events.ControlListener)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1