use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class SearchZoneMapper method hightlightAll.
public void hightlightAll(Map<Integer, Map<Integer, ITableEntry>> searchMaps, boolean isHightlight) {
Iterator iter = searchMaps.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Map<Integer, ITableEntry> map = (Map<Integer, ITableEntry>) entry.getValue();
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry e = (Map.Entry) it.next();
if (isHightlight) {
setEntryState(mapperManager, EntryState.HIGHLIGHTALL, (ITableEntry) e.getValue());
} else {
setEntryState(mapperManager, EntryState.NONE, (ITableEntry) e.getValue());
}
}
}
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class SearchZoneMapper method getSelectedKeyAtSelectedTableItem.
public Integer getSelectedKeyAtSelectedTableItem(Map<Integer, Map<Integer, ITableEntry>> searchMaps) {
Integer selectKey = 0;
TableViewerCreator tableViewerCreator = null;
if (uiManager.getCurrentSelectedInputTableView() != null) {
tableViewerCreator = uiManager.getCurrentSelectedInputTableView().getTableViewerCreatorForColumns();
if (tableViewerCreator != null && tableViewerCreator.getTableViewer() != null) {
ISelection selection = tableViewerCreator.getTableViewer().getSelection();
if (selection == null || selection.isEmpty()) {
if (uiManager.getCurrentSelectedOutputTableView() != null) {
tableViewerCreator = uiManager.getCurrentSelectedOutputTableView().getTableViewerCreatorForColumns();
}
}
}
} else if (uiManager.getCurrentSelectedOutputTableView() != null) {
tableViewerCreator = uiManager.getCurrentSelectedOutputTableView().getTableViewerCreatorForColumns();
}
if (tableViewerCreator != null && tableViewerCreator.getTableViewer() != null) {
ISelection selection = tableViewerCreator.getTableViewer().getSelection();
if (selection != null && !selection.isEmpty()) {
List<ITableEntry> list = uiManager.extractSelectedTableEntries(selection);
if (list != null && !list.isEmpty()) {
ITableEntry tableEntry = list.get(0);
if (tableEntry != null) {
Iterator iter = searchMaps.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Map<Integer, ITableEntry> map = (Map<Integer, ITableEntry>) entry.getValue();
if (map.containsValue(tableEntry)) {
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry e = (Map.Entry) it.next();
if (e.getValue() != null && e.getValue() instanceof ITableEntry) {
ITableEntry tableEntryTemp = (ITableEntry) e.getValue();
if (tableEntry.equals(tableEntryTemp)) {
tableViewerCreator.getTableViewer().getTable().deselectAll();
return (Integer) entry.getKey();
}
}
}
}
}
}
}
}
}
return selectKey;
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class UIManager method parseFilterColumn.
public ParseExpressionResult parseFilterColumn(String expression, ITableEntry currentModifiedITableEntry, boolean linkMustHaveSelectedState, boolean checkInputKeyAutomatically, boolean inputExpressionAppliedOrCanceled) {
if (currentModifiedITableEntry instanceof InputColumnTableEntry) {
InputColumnTableEntry entry = (InputColumnTableEntry) currentModifiedITableEntry;
if (StringUtils.trimToNull(expression) == null) {
entry.setOperator(null);
}
}
DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(currentModifiedITableEntry);
boolean linkHasBeenAdded = false;
boolean linkHasBeenRemoved = false;
DataMapExpressionParser dataMapExpressionParser = new DataMapExpressionParser(LanguageProvider.getCurrentLanguage());
TableEntryLocation[] tableEntriesLocationsSources = dataMapExpressionParser.parseTableEntryLocations(expression);
Set<TableEntryLocation> alreadyProcessed = new HashSet<TableEntryLocation>();
Set<ITableEntry> sourcesForTarget = mapperManager.getSourcesForTarget(currentModifiedITableEntry);
Set<ITableEntry> sourcesForTargetToDelete = new HashSet<ITableEntry>(sourcesForTarget);
boolean isInputEntry = currentModifiedITableEntry instanceof InputColumnTableEntry;
ECodeLanguage codeLanguage = LanguageProvider.getCurrentLanguage().getCodeLanguage();
for (TableEntryLocation tableEntriesLocationsSource : tableEntriesLocationsSources) {
TableEntryLocation location = tableEntriesLocationsSource;
// tests to know if link must be removed if key is unchecked
boolean dontRemoveLink = (!isInputEntry || isInputEntry && (inputExpressionAppliedOrCanceled || !inputExpressionAppliedOrCanceled && !mapperManager.checkEntryHasInvalidUncheckedKey((InputColumnTableEntry) currentModifiedITableEntry)));
if (!alreadyProcessed.contains(location) && checkSourceLocationIsValid(location, currentModifiedITableEntry) && (mapperManager.isAdvancedMap() || !mapperManager.isAdvancedMap() && dontRemoveLink)) {
ITableEntry sourceTableEntry = mapperManager.retrieveTableEntry(location);
if (sourceTableEntry != null && sourcesForTarget.contains(sourceTableEntry)) {
Set<IMapperLink> targets = mapperManager.getGraphicalLinksFromTarget(currentModifiedITableEntry);
Set<IMapperLink> linksFromTarget = new HashSet<IMapperLink>(targets);
for (IMapperLink link : linksFromTarget) {
link.calculate();
}
}
}
}
mapperManager.orderLinks();
if (!mapperManager.isAdvancedMap()) {
if (dataMapTableView.getZone() == Zone.INPUTS) {
if (linkHasBeenAdded || linkHasBeenRemoved) {
checkTargetInputKey(currentModifiedITableEntry, checkInputKeyAutomatically, inputExpressionAppliedOrCanceled);
}
if (inputExpressionAppliedOrCanceled) {
openChangeKeysDialog((InputDataMapTableView) dataMapTableView);
}
}
}
return new ParseExpressionResult(linkHasBeenAdded, linkHasBeenRemoved);
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class UIManager method selectLinkedTableEntries.
/**
* DOC amaumont Comment method "selectTableEntries".
*
* @param metadataTable
* @param selectedTableEntries
* @param selectionIndices
*/
public void selectLinkedTableEntries(IMetadataTable metadataTable, int[] selectionIndices) {
DataMapTableView dataMapTableView = tableManager.getView(metadataTable);
if (dataMapTableView == null) {
return;
}
dataMapTableView.setTableSelection(selectionIndices);
List<ITableEntry> list = extractSelectedTableEntries(dataMapTableView.getTableViewerCreatorForColumns().getTableViewer().getSelection());
selectLinks(dataMapTableView, list, false, false);
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class UIManager method selectLinkedMetadataEditorEntries.
/**
* DOC amaumont Comment method "selectTableEntries".
*
* @param view
* @param selectedTableEntries
* @param selectionIndices
*/
public void selectLinkedMetadataEditorEntries(DataMapTableView view, int[] selectionIndices) {
MetadataTableEditorView metadataTableEditorView = null;
MetadataTableEditorView otherMetadataTableEditorView = null;
if (view.getZone() == Zone.INPUTS) {
metadataTableEditorView = getInputMetaEditorView();
otherMetadataTableEditorView = getOutputMetaEditorView();
} else if (view.getZone() == Zone.OUTPUTS) {
metadataTableEditorView = getOutputMetaEditorView();
otherMetadataTableEditorView = getInputMetaEditorView();
}
if (metadataTableEditorView != null) {
metadataTableEditorView.getTableViewerCreator().getSelectionHelper().setActiveFireSelectionChanged(false);
metadataTableEditorView.getExtendedTableViewer().getTableViewerCreator().getSelectionHelper().setSelection(selectionIndices);
metadataTableEditorView.getTableViewerCreator().getSelectionHelper().setActiveFireSelectionChanged(true);
metadataTableEditorView.getExtendedToolbar().updateEnabledStateOfButtons();
}
if (otherMetadataTableEditorView != null) {
otherMetadataTableEditorView.getExtendedToolbar().updateEnabledStateOfButtons();
}
TableViewerCreator tableViewerCreatorForColumns = view.getTableViewerCreatorForColumns();
if (tableViewerCreatorForColumns != null) {
final TableViewer tableViewerForEntries = tableViewerCreatorForColumns.getTableViewer();
if (tableViewerForEntries.getSelection() != null) {
List<ITableEntry> extractSelectedTableEntries = extractSelectedTableEntries(tableViewerForEntries.getSelection());
for (ITableEntry entry : extractSelectedTableEntries) {
if (entry instanceof OutputColumnTableEntry) {
if (((OutputColumnTableEntry) entry).getMetadataColumn().isCustom() && view.getZone() == Zone.OUTPUTS) {
metadataTableEditorView.getExtendedToolbar().getRemoveButton().getButton().setEnabled(false);
break;
}
}
}
}
}
}
Aggregations