use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class MapperManager method addRejectOutput.
public void addRejectOutput() {
String baseName = ERROR_REJECT;
IProcess process = getAbstractMapComponent().getProcess();
String tableName = baseName;
if (!process.checkValidConnectionName(baseName) && process instanceof IProcess2) {
final String uniqueName = ((IProcess2) process).generateUniqueConnectionName("row", baseName);
tableName = uniqueName;
((IProcess2) process).addUniqueConnectionName(uniqueName);
} else if (process instanceof IProcess2) {
tableName = baseName;
((IProcess2) process).addUniqueConnectionName(baseName);
}
IMetadataTable metadataTable = getNewMetadataTable();
metadataTable.setTableName(tableName);
MetadataColumn errorMessageCol = new MetadataColumn();
errorMessageCol.setLabel(ERROR_REJECT_MESSAGE);
errorMessageCol.setTalendType(DesignerPlugin.getDefault().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE));
errorMessageCol.setNullable(true);
errorMessageCol.setOriginalDbColumnName(ERROR_REJECT_MESSAGE);
errorMessageCol.setReadOnly(true);
errorMessageCol.setCustom(true);
errorMessageCol.setCustomId(0);
metadataTable.getListColumns().add(errorMessageCol);
MetadataColumn errorStackTrace = new MetadataColumn();
errorStackTrace.setLabel(ERROR_REJECT_STACK_TRACE);
errorStackTrace.setTalendType(DesignerPlugin.getDefault().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE));
errorStackTrace.setNullable(true);
errorStackTrace.setOriginalDbColumnName(ERROR_REJECT_STACK_TRACE);
errorStackTrace.setReadOnly(true);
errorStackTrace.setCustom(true);
errorStackTrace.setCustomId(1);
metadataTable.getListColumns().add(errorStackTrace);
OutputTable abstractDataMapTable = new OutputTable(this, metadataTable, tableName);
abstractDataMapTable.setErrorRejectTable(true);
abstractDataMapTable.initFromExternalData(null);
TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
DataMapTableView rejectDataMapTableView = uiManager.createNewOutputTableView(null, abstractDataMapTable, tablesZoneViewOutputs);
tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
List<DataMapTableView> outputsTablesView = uiManager.getOutputsTablesView();
int sizeList = outputsTablesView.size();
for (int i = 0; i < sizeList; i++) {
if (i + 1 < sizeList) {
FormData formData = (FormData) outputsTablesView.get(i + 1).getLayoutData();
formData.top = new FormAttachment(outputsTablesView.get(i));
}
}
CustomTableManager.addCustomManagementToTable(uiManager.getOutputMetaEditorView(), true);
tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tablesZoneViewOutputs.layout();
uiManager.moveOutputScrollBarZoneToMax();
uiManager.refreshBackground(true, false);
uiManager.selectDataMapTableView(rejectDataMapTableView, true, false);
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class MapperManager method removeSelectedOutput.
public void removeSelectedOutput() {
DataMapTableView currentSelectedDataMapTableView = uiManager.getCurrentSelectedOutputTableView();
String append = "";
OutputTable outputTable = ((OutputTable) currentSelectedDataMapTableView.getDataMapTable());
List<DataMapTableView> relatedOutputsTableView = null;
if (outputTable.getIsJoinTableOf() == null) {
relatedOutputsTableView = uiManager.getRelatedOutputsTableView(currentSelectedDataMapTableView);
if (relatedOutputsTableView != null && !relatedOutputsTableView.isEmpty()) {
append = " and it's join table ";
for (DataMapTableView tableView : relatedOutputsTableView) {
IDataMapTable retrieveAbstractDataMapTable = this.retrieveAbstractDataMapTable(tableView);
if (retrieveAbstractDataMapTable != null) {
append = append + "'" + retrieveAbstractDataMapTable.getName() + " ' ,";
}
}
append = append.substring(0, append.length() - 1);
}
}
if (currentSelectedDataMapTableView != null) {
String tableName = currentSelectedDataMapTableView.getDataMapTable().getName();
if (MessageDialog.openConfirm(currentSelectedDataMapTableView.getShell(), //$NON-NLS-1$
Messages.getString("MapperManager.removeOutputTableTitle"), Messages.getString("MapperManager.removeOutputTableTitleMessage") + tableName + " '" + append + "?")) {
//$NON-NLS-1$ //$NON-NLS-2$
IProcess process = getAbstractMapComponent().getProcess();
uiManager.removeOutputTableView(currentSelectedDataMapTableView);
// remove join table
if (outputTable.getIsJoinTableOf() == null && relatedOutputsTableView != null) {
for (DataMapTableView view : relatedOutputsTableView) {
uiManager.removeOutputTableView(view);
process.removeUniqueConnectionName(view.getDataMapTable().getName());
}
}
uiManager.updateToolbarButtonsStates(Zone.OUTPUTS);
process.removeUniqueConnectionName(currentSelectedDataMapTableView.getDataMapTable().getName());
}
}
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class MapperManager method addOutput.
/**
* DOC amaumont Comment method "addOutput".
*/
public void addOutput() {
String joinTableName = null;
OutputTable abstractDataMapTable = null;
String name = uiManager.openNewOutputCreationDialog();
if (name == null) {
return;
}
String[] split = name.split(uiManager.NAME_SEPARATOR);
String tableName = split[0];
boolean isCreatingJoinTable = split.length == 2;
if (isCreatingJoinTable) {
joinTableName = split[1];
}
IProcess process = getAbstractMapComponent().getProcess();
OutputTable orignalOutputTable = null;
if (isCreatingJoinTable) {
orignalOutputTable = getOutputTableByName(tableName);
if (orignalOutputTable != null) {
IMetadataTable metadataTable = orignalOutputTable.getMetadataTable();
if (metadataTable != null) {
process.addUniqueConnectionName(joinTableName);
abstractDataMapTable = new OutputTable(this, metadataTable, joinTableName);
abstractDataMapTable.setIsJoinTableOf(tableName);
}
}
} else {
process.addUniqueConnectionName(tableName);
IMetadataTable metadataTable = getNewMetadataTable();
metadataTable.setTableName(tableName);
abstractDataMapTable = new OutputTable(this, metadataTable, tableName);
}
if (abstractDataMapTable == null) {
return;
}
abstractDataMapTable.initFromExternalData(null);
List<DataMapTableView> outputsTablesView = uiManager.getOutputsTablesView();
int sizeOutputsView = outputsTablesView.size();
Control lastChild = null;
if (sizeOutputsView - 1 >= 0) {
lastChild = outputsTablesView.get(sizeOutputsView - 1);
}
TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
DataMapTableView dataMapTableView = uiManager.createNewOutputTableView(lastChild, abstractDataMapTable, tablesZoneViewOutputs);
tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tablesZoneViewOutputs.layout();
uiManager.moveOutputScrollBarZoneToMax();
uiManager.refreshBackground(true, false);
tablesZoneViewOutputs.layout();
uiManager.selectDataMapTableView(dataMapTableView, true, false);
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class MapperManager method changeEntryExpression.
/**
* DOC amaumont Comment method "changeEntryExpression".
*
* @param currentEntry
* @param text
*/
public void changeEntryExpression(final ITableEntry currentEntry, String text) {
currentEntry.setExpression(text);
DataMapTableView dataMapTableView = retrieveDataMapTableView(currentEntry);
TableViewer tableViewer = null;
if (currentEntry instanceof IColumnEntry || currentEntry instanceof FilterTableEntry) {
getProblemsManager().checkProblemsForTableEntryWithDelayLimiter(currentEntry);
if (currentEntry instanceof IColumnEntry) {
tableViewer = dataMapTableView.getTableViewerCreatorForColumns().getTableViewer();
} else if (currentEntry instanceof FilterTableEntry) {
tableViewer = dataMapTableView.getTableViewerCreatorForFilters().getTableViewer();
}
if (currentEntry.getProblems() != null) {
tableViewer.getTable().deselectAll();
}
tableViewer.refresh(currentEntry);
} else if (currentEntry instanceof ExpressionFilterEntry) {
dataMapTableView.getExpressionFilterText().setTextWithoutNotifyListeners(text);
if (!dataMapTableView.getExpressionFilterText().isFocusControl()) {
dataMapTableView.checkProblemsForExpressionFilterWithDelay();
}
}
uiManager.parseNewExpression(text, currentEntry, false);
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView 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);
}
}
}
}
Aggregations