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);
}
}
}
}
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);
}
}
}
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;
}
Aggregations