use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class CompleteDropTargetListener method updateExpressionsOfInsertedEntries.
/**
* DOC amaumont Comment method "updateExpressionsOfInsertedEntries".
*
* @param uiManager
* @param currentLanguage
* @param metadataEditorView
* @param currentIndex
* @param sourceEntriesOfEntriesBeingAdded
* @param targetTableIsConstraintsTable
* @param tableViewerCreatorTarget
* @param metadataColumnsBeingAdded
* @param metadataEditorEvent
*/
@SuppressWarnings("unchecked")
private void updateExpressionsOfInsertedEntries(IDbLanguage currentLanguage, MetadataTableEditorView metadataEditorView, int currentIndex, ArrayList<ITableEntry> sourceEntriesOfEntriesBeingAdded, boolean targetTableIsConstraintsTable, TableViewerCreator tableViewerCreatorTarget, ArrayList<IMetadataColumn> metadataColumnsBeingAdded) // , MetadataEditorEvent metadataEditorEvent
{
UIManager uiManager = getUiManager();
if (metadataEditorView != null && !targetTableIsConstraintsTable) {
metadataEditorView.getMetadataTableEditor().addAll(currentIndex, metadataColumnsBeingAdded);
// metadataEditorEvent.indexStartInsert = currentIndex;
// IAction action = MetadataEditorActionFactory.getInstance().getAction(metadataEditorView,
// metadataEditorEvent);
// action.run(metadataEditorEvent);
Zone zoneTarget = getMapperManager().retrieveDataMapTableView(tableViewerCreatorTarget.getTable()).getZone();
List<IColumnEntry> lastCreatedTableEntries = uiManager.getLastCreatedInOutColumnEntries();
for (int i = 0; i < lastCreatedTableEntries.size(); i++) {
ITableEntry tableEntrySource = sourceEntriesOfEntriesBeingAdded.get(i);
ITableEntry dataMapTableEntry = lastCreatedTableEntries.get(i);
if (zoneTarget == Zone.INPUTS) {
setDefaultOperator((InputColumnTableEntry) dataMapTableEntry);
}
DataMapTableView dataMapTableView = getMapperManager().retrieveIDataMapTableView(tableEntrySource.getParent());
Zone zoneSource = dataMapTableView.getZone();
String location = null;
if (zoneSource == Zone.OUTPUTS) {
location = tableEntrySource.getExpression();
} else {
location = currentLanguage.getLocation(tableEntrySource.getParentName(), tableEntrySource.getName());
}
if (location != null) {
//$NON-NLS-1$
dataMapTableEntry.setExpression(location + " ");
}
}
}
tableViewerCreatorTarget.getTableViewer().refresh();
List<ITableEntry> refreshedTableEntriesList = tableViewerCreatorTarget.getInputList();
for (ITableEntry tableEntry : refreshedTableEntriesList) {
uiManager.parseExpression(tableEntry.getExpression(), tableEntry, false, true, false);
}
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry 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.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class UIManager method modifySelectionChangedListener.
private void modifySelectionChangedListener(final Zone currentZone, final MetadataTableEditorView metadataTableEditorViewFinal, final TableViewerCreator metadataTVCreator, final MetadataTableEditor metadataTableEditor, final DataMapTableView dataMapTableView, DataMapTableView previousSelectedTableView) {
final TableViewer tableViewer = dataMapTableView.getTableViewerCreatorForColumns().getTableViewer();
IModifiedBeanListener<IMetadataColumn> modifiedBeanListener = new IModifiedBeanListener<IMetadataColumn>() {
public void handleEvent(ModifiedBeanEvent<IMetadataColumn> event) {
if (AbstractMetadataTableEditorView.ID_COLUMN_NAME.equals(event.column.getId()) && !event.previousValue.equals(event.newValue)) {
IMetadataColumn modifiedObject = event.bean;
if (modifiedObject != null) {
TableEntryLocation tableEntryLocation = new TableEntryLocation(dataMapTableView.getDataMapTable().getName(), (String) event.previousValue);
final ITableEntry dataMapTableEntry = mapperManager.retrieveTableEntry(tableEntryLocation);
// see bug 7471,record the modification about the column value
String curConnName = null;
if (dataMapTableEntry != null) {
curConnName = dataMapTableEntry.getParentName();
}
List<? extends IConnection> curInConns = mapperManager.getAbstractMapComponent().getIncomingConnections();
List<? extends IConnection> curOutConns = mapperManager.getAbstractMapComponent().getOutgoingConnections();
for (IConnection curInConn : curInConns) {
if (curConnName.equals(curInConn.getUniqueName())) {
Map<String, String> changedNameInColumns = new HashMap<String, String>();
changedNameInColumns.put((String) event.newValue, (String) event.previousValue);
changedNameColumns.put(curInConn, changedNameInColumns);
}
}
for (IConnection curOutConn : curOutConns) {
if (curConnName.equals(curOutConn.getUniqueName())) {
Map<String, String> changedNameOutColumns = new HashMap<String, String>();
changedNameOutColumns.put((String) event.newValue, (String) event.previousValue);
changedNameColumns.put(curOutConn, changedNameOutColumns);
}
}
processColumnNameChanged((String) event.previousValue, (String) event.newValue, dataMapTableView, dataMapTableEntry);
// related tables
List<DataMapTableView> relatedOutputsTableView = getRelatedOutputsTableView(dataMapTableView);
for (DataMapTableView relatedView : relatedOutputsTableView) {
TableEntryLocation relatedEntryLocation = new TableEntryLocation(relatedView.getDataMapTable().getName(), (String) event.previousValue);
ITableEntry relatedTableEntry = mapperManager.retrieveTableEntry(relatedEntryLocation);
processColumnNameChanged((String) event.previousValue, (String) event.newValue, relatedView, relatedTableEntry);
}
}
// dataMapTableViewer.refresh(event.bean, true);
tableViewer.refresh(true);
} else if (AbstractMetadataTableEditorView.ID_COLUMN_KEY.equals(event.column.getId())) {
tableViewer.refresh(true);
IColumnEntry entry = dataMapTableView.getDataMapTable().getColumnEntries().get(event.index);
parseExpression(entry.getExpression(), entry, false, false, false);
} else if (AbstractMetadataTableEditorView.ID_COLUMN_TYPE.equals(event.column.getId()) || AbstractMetadataTableEditorView.ID_COLUMN_NULLABLE.equals(event.column.getId())) {
mapperManager.getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
}
}
};
ILineSelectionListener metadataEditorViewerSelectionChangedListener = new ILineSelectionListener() {
public void handle(LineSelectionEvent e) {
if (metadataTableEditorViewFinal.getTableViewerCreator() == e.source) {
if (metadataTableEditorViewFinal.getExtendedTableViewer().isExecuteSelectionEvent()) {
mapperManager.getUiManager().selectLinkedTableEntries(metadataTableEditor.getMetadataTable(), metadataTVCreator.getTable().getSelectionIndices());
}
} else {
// if (dataMapTableView.getExtendedTableViewerForColumns().isExecuteSelectionEvent()) {
// int[] selectionIndices =
// dataMapTableView.getTableViewerCreatorForColumns().getTable().getSelectionIndices();
// mapperManager.getUiManager().selectLinkedMetadataEditorEntries(dataMapTableView,
// selectionIndices);
// }
}
}
};
// ISelectionChangedListener previousSelectionChangedListener = null;
ILineSelectionListener previousSelectionChangedListener = null;
IModifiedBeanListener<IMetadataColumn> previousModifiedBeanListener = null;
if (currentZone == Zone.INPUTS) {
previousSelectionChangedListener = inputsSelectionChangedListener;
previousModifiedBeanListener = inputModifiedBeanListener;
} else if (currentZone == Zone.OUTPUTS) {
previousSelectionChangedListener = outputsSelectionChangedListener;
previousModifiedBeanListener = outputModifiedBeanListener;
}
if (previousSelectionChangedListener != null) {
// metadataTVCreator.removeSelectionChangedListener(previousSelectionChangedListener);
metadataTVCreator.getSelectionHelper().removeAfterSelectionListener(previousSelectionChangedListener);
if (previousSelectedTableView != null) {
previousSelectedTableView.getTableViewerCreatorForColumns().getSelectionHelper().removeAfterSelectionListener(previousSelectionChangedListener);
}
}
if (previousModifiedBeanListener != null) {
metadataTableEditor.removeModifiedBeanListener(previousModifiedBeanListener);
}
if (currentZone == Zone.INPUTS) {
inputsSelectionChangedListener = metadataEditorViewerSelectionChangedListener;
inputModifiedBeanListener = modifiedBeanListener;
} else if (currentZone == Zone.OUTPUTS) {
outputsSelectionChangedListener = metadataEditorViewerSelectionChangedListener;
outputModifiedBeanListener = modifiedBeanListener;
}
// metadataTVCreator.addSelectionChangedListener(metadataEditorViewerSelectionChangedListener);
metadataTVCreator.getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
dataMapTableView.getTableViewerCreatorForColumns().getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
metadataTableEditor.addModifiedBeanListener(modifiedBeanListener);
if (this.commonMetadataDisposeListener == null) {
this.commonMetadataDisposeListener = new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (inputsSelectionChangedListener != null) {
getMetadataEditorView(Zone.INPUTS).getTableViewerCreator().getSelectionHelper().removeAfterSelectionListener(inputsSelectionChangedListener);
}
if (outputsSelectionChangedListener != null) {
getMetadataEditorView(Zone.OUTPUTS).getTableViewerCreator().getSelectionHelper().removeAfterSelectionListener(outputsSelectionChangedListener);
}
if (inputModifiedBeanListener != null) {
MetadataTableEditor metadataTableEditor = getMetadataEditorView(Zone.INPUTS).getMetadataTableEditor();
if (metadataTableEditor != null) {
metadataTableEditor.removeModifiedBeanListener(inputModifiedBeanListener);
}
}
if (outputModifiedBeanListener != null) {
MetadataTableEditor metadataTableEditor = getMetadataEditorView(Zone.OUTPUTS).getMetadataTableEditor();
if (metadataTableEditor != null) {
metadataTableEditor.removeModifiedBeanListener(outputModifiedBeanListener);
}
}
}
};
metadataTVCreator.getTable().addDisposeListener(this.commonMetadataDisposeListener);
}
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class MapperManager method replacePreviousLocationInAllExpressions.
/**
* DOC amaumont Comment method "replacePreviousLocationInAllExpressions".
*/
public void replacePreviousLocationInAllExpressions(final TableEntryLocation previousLocation, final TableEntryLocation newLocation) {
DataMapExpressionParser dataMapExpressionParser = new DataMapExpressionParser(LanguageProvider.getCurrentLanguage());
Collection<IDataMapTable> tablesData = getTablesData();
for (IDataMapTable table : tablesData) {
List<IColumnEntry> columnEntries = table.getColumnEntries();
if (table instanceof AbstractInOutTable) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, ((AbstractInOutTable) table).getExpressionFilter());
}
for (IColumnEntry entry : columnEntries) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
}
if (table instanceof OutputTable) {
List<FilterTableEntry> constraintEntries = ((OutputTable) table).getFilterEntries();
for (FilterTableEntry entry : constraintEntries) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
}
}
}
uiManager.refreshBackground(false, false);
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class ProblemsManager method checkProblemsForAllEntries.
/**
*
* DOC amaumont Comment method "checkProblemsForAllEntries".
*
* @param dataMapTableView
* @param forceRefreshData
* @return true if has errors
*/
@SuppressWarnings("unchecked")
public boolean checkProblemsForAllEntries(DataMapTableView dataMapTableView, boolean forceRefreshData) {
if (forceRefreshData) {
mapperManager.getAbstractMapComponent().restoreMapperModelFromInternalData();
checkProblems();
}
boolean hasProblemsWasNull = false;
if (hasProblems == null) {
hasProblems = Boolean.FALSE;
hasProblemsWasNull = true;
}
if (dataMapTableView.getDataMapTable() instanceof AbstractInOutTable) {
AbstractInOutTable table = (AbstractInOutTable) dataMapTableView.getDataMapTable();
if (table.isActivateExpressionFilter()) {
checkProblemsForTableEntry(table.getExpressionFilter(), false);
}
}
List<IColumnEntry> columnsEntriesList = dataMapTableView.getDataMapTable().getColumnEntries();
checkProblemsForAllEntries(columnsEntriesList);
if (refreshTableEntries) {
dataMapTableView.getTableViewerCreatorForColumns().getTableViewer().refresh(true);
}
if (dataMapTableView.getZone() == Zone.OUTPUTS) {
List<ITableEntry> constraintEntriesList = dataMapTableView.getTableViewerCreatorForFilters().getInputList();
checkProblemsForAllEntries(constraintEntriesList);
if (refreshTableEntries) {
dataMapTableView.getTableViewerCreatorForFilters().getTableViewer().refresh(true);
}
}
boolean returnedValue = hasProblems;
if (hasProblemsWasNull) {
hasProblems = null;
}
return returnedValue;
}
Aggregations