use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class Link method calculate.
public void calculate() {
point1 = this.uiManager.getTableEntryPosition(pointLinkDescriptor1.getTableEntry(), true);
point2 = this.uiManager.getTableEntryPosition(pointLinkDescriptor2.getTableEntry(), true);
DataMapTableView viewTable1 = this.mapperManager.retrieveDataMapTableView(pointLinkDescriptor1.getTableEntry());
DataMapTableView viewTable2 = this.mapperManager.retrieveDataMapTableView(pointLinkDescriptor2.getTableEntry());
widthTable1 = viewTable1.getBounds().width + 2 * viewTable1.getBorderWidth();
widthTable2 = viewTable2.getBounds().width + 2 * viewTable2.getBorderWidth();
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView 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.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class UIManager method processColumnNameChanged.
/**
* DOC amaumont Comment method "processNewProcessColumnName".
*
* @param previousColumnName TODO
* @param dataMapTableView
* @param text
* @param entry
*/
public void processColumnNameChanged(final String previousColumnName, final String newColumnName, final DataMapTableView dataMapTableView, final ITableEntry currentModifiedITableEntry) {
mapperManager.changeColumnName(currentModifiedITableEntry, previousColumnName, newColumnName);
Collection<DataMapTableView> tableViews = mapperManager.getTablesView();
boolean atLeastOneLinkHasBeenRemoved = false;
for (DataMapTableView view : tableViews) {
IDataMapTable dataMapTable = view.getDataMapTable();
List<IColumnEntry> metadataTableEntries = dataMapTable.getColumnEntries();
for (IColumnEntry entry : metadataTableEntries) {
if (parseExpression(entry.getExpression(), entry, true, true, false).isAtLeastOneLinkRemoved()) {
atLeastOneLinkHasBeenRemoved = true;
}
}
// for the input/output table expression filter
if (dataMapTable instanceof AbstractInOutTable) {
ExpressionFilterEntry expressionFilterEntry = ((AbstractInOutTable) dataMapTable).getExpressionFilter();
if (expressionFilterEntry != null && expressionFilterEntry.getExpression() != null) {
if (parseExpression(expressionFilterEntry.getExpression(), expressionFilterEntry, true, true, false).isAtLeastOneLinkRemoved()) {
atLeastOneLinkHasBeenRemoved = true;
}
}
}
}
mapperManager.getUiManager().refreshBackground(false, false);
dataMapTableView.getTableViewerCreatorForColumns().getTableViewer().refresh(currentModifiedITableEntry);
if (atLeastOneLinkHasBeenRemoved) {
new AsynchronousThreading(20, false, dataMapTableView.getDisplay(), new Runnable() {
public void run() {
TableViewerCreator tableViewerCreatorForColumns = dataMapTableView.getTableViewerCreatorForColumns();
boolean propagate = MessageDialog.openQuestion(tableViewerCreatorForColumns.getTable().getShell(), //$NON-NLS-1$
Messages.getString("UIManager.propagateTitle"), //$NON-NLS-1$
Messages.getString("UIManager.propagateMessage"));
if (propagate) {
TableEntryLocation previousLocation = new TableEntryLocation(currentModifiedITableEntry.getParentName(), previousColumnName);
TableEntryLocation newLocation = new TableEntryLocation(currentModifiedITableEntry.getParentName(), newColumnName);
mapperManager.replacePreviousLocationInAllExpressions(previousLocation, newLocation);
}
}
}).start();
}
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView 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.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class UIManager method removeOutputTableView.
/**
* Call mapperManager.removeSelectedOutput() to remove a table view.
*
* @param dataMapTableViewToRemove
*/
public void removeOutputTableView(DataMapTableView dataMapTableViewToRemove) {
List<DataMapTableView> outputsTablesView = mapperManager.getUiManager().getOutputsTablesView();
int sizeList = outputsTablesView.size();
for (int i = 0; i < sizeList; i++) {
Control control = outputsTablesView.get(i);
if (control == dataMapTableViewToRemove && i < sizeList - 1 && i > 0) {
FormData formData = (FormData) outputsTablesView.get(i + 1).getLayoutData();
formData.top = new FormAttachment(outputsTablesView.get(i - 1));
break;
}
}
mapperManager.removeTablePair(dataMapTableViewToRemove);
MetadataTableEditorView outputMetaEditorView = getOutputMetaEditorView();
if (outputMetaEditorView.getMetadataTableEditor() != null && outputMetaEditorView.getMetadataTableEditor().getMetadataTable() == ((OutputTable) dataMapTableViewToRemove.getDataMapTable()).getMetadataTable()) {
getOutputMetaEditorView().setMetadataTableEditor(null);
}
dataMapTableViewToRemove.dispose();
dataMapTableViewToRemove = null;
getTablesZoneViewOutputs().layout();
refreshBackground(true, false);
this.currentSelectedOutputTableView = null;
}
Aggregations