use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class TableEntriesManager method remove.
public void remove(ITableEntry dataMapTableEntry) {
if (dataMapTableEntry != null) {
mapperManager.removeLinksOf(dataMapTableEntry);
tableEntries.remove(TableEntriesManager.buildLocation(dataMapTableEntry));
dataMapTableEntryToProperties.remove(dataMapTableEntry);
IDataMapTable dataMapTable = dataMapTableEntry.getParent();
if (dataMapTableEntry instanceof IColumnEntry) {
dataMapTableEntry.getParent().removeColumnEntry((IColumnEntry) dataMapTableEntry);
} else if (dataMapTableEntry instanceof GlobalMapEntry) {
if (dataMapTable instanceof OutputTable) {
((InputTable) dataMapTable).removeGlobalMapEntry((GlobalMapEntry) dataMapTableEntry);
}
} else if (dataMapTableEntry instanceof FilterTableEntry) {
if (dataMapTable instanceof OutputTable) {
((OutputTable) dataMapTable).removeFilterEntry((FilterTableEntry) dataMapTableEntry);
}
} else if (dataMapTableEntry instanceof ExpressionFilterEntry) {
// nothing
} else {
String exceptionMessage = //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"TableEntriesManager.exceptionMessage.typeIsNotValid", dataMapTableEntry.getClass().toString());
throw new IllegalArgumentException(exceptionMessage);
}
}
}
use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class UIManager method removeUnsavedOutputsFromProcess.
private void removeUnsavedOutputsFromProcess() {
AbstractMapComponent abstractMapComponent = getAbstractMapperManager().getAbstractMapComponent();
IProcess process = abstractMapComponent.getProcess();
List<OutputTable> currentOutputTablesList = mapperManager.getOutputTables();
HashSet<String> currentTables = new HashSet<String>(currentOutputTablesList.size());
for (OutputTable outputTable : currentOutputTablesList) {
currentTables.add(outputTable.getName());
}
ExternalMapperData originalExternalData = (ExternalMapperData) mapperManager.getOriginalExternalData();
HashSet<String> originalTableNames = new HashSet<String>();
if (originalExternalData != null) {
List<ExternalMapperTable> originalOutputTables = originalExternalData.getOutputTables();
for (ExternalMapperTable outputTable : originalOutputTables) {
originalTableNames.add(outputTable.getName());
}
}
for (String currentTable : currentTables) {
if (!originalTableNames.contains(currentTable)) {
process.removeUniqueConnectionName(currentTable);
}
}
}
use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class OutputDataMapTableView method createMapSettingTable.
@Override
protected void createMapSettingTable() {
ExtendedTableModel<GlobalMapEntry> tableMapSettingEntriesModel = ((OutputTable) abstractDataMapTable).getTableMapSettingEntriesModel();
extendedTableViewerForMapSetting = new AbstractExtendedTableViewer<GlobalMapEntry>(tableMapSettingEntriesModel, centerComposite) {
@Override
protected void createColumns(TableViewerCreator<GlobalMapEntry> tableViewerCreator, Table table) {
initMapSettingColumns(tableViewerCreator);
}
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<GlobalMapEntry> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setBorderVisible(false);
}
};
if (tableMapSettingEntriesModel != null) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, OUTPUT_REJECT, null));
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, LOOK_UP_INNER_JOIN_REJECT, null));
if (getOutputTable().getIsJoinTableOf() == null) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, SCHEMA_TYPE, null));
if (getOutputTable().isRepository()) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, SCHEMA_ID, null));
}
}
}
mapSettingViewerCreator = extendedTableViewerForMapSetting.getTableViewerCreator();
mapSettingTable = extendedTableViewerForMapSetting.getTable();
tableForMapSettingGridData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
mapSettingTable.setLayoutData(tableForMapSettingGridData);
mapSettingTable.setHeaderVisible(true);
mapSettingTable.setLinesVisible(true);
boolean mappingSettingVisible = false;
if (abstractDataMapTable instanceof AbstractInOutTable) {
mappingSettingVisible = ((AbstractInOutTable) abstractDataMapTable).isActivateCondensedTool();
}
tableForMapSettingGridData.exclude = !mappingSettingVisible;
mapSettingTable.setVisible(mappingSettingVisible);
mapSettingViewerCreator.getTableViewer().setSelection(null);
mapSettingTable.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
mapSettingViewerCreator.getTableViewer().setSelection(null);
}
public void focusGained(FocusEvent e) {
}
});
final TableViewer mapSettingTableViewer = mapSettingViewerCreator.getTableViewer();
mapSettingTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
selectThisDataMapTableView();
}
});
}
use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class OutputDataMapTableView method initColumnsOfTableColumns.
@Override
public void initColumnsOfTableColumns(final TableViewerCreator tableViewerCreatorForColumns) {
IOConnection connection = ((OutputTable) getDataMapTable()).getConnection();
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
//$NON-NLS-1$
column.setTitle(Messages.getString("OutputDataMapTableView.columnTitle.expression"));
column.setId(DataMapTableView.ID_EXPRESSION_COLUMN);
expressionCellEditor = createExpressionCellEditor(tableViewerCreatorForColumns, column, new Zone[] { Zone.INPUTS, Zone.VARS }, false);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<OutputColumnTableEntry, String>() {
public String get(OutputColumnTableEntry bean) {
return bean.getExpression();
}
public void set(OutputColumnTableEntry bean, String value) {
bean.setExpression(value);
mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true);
tableViewerCreatorForColumns.getTableViewer().refresh(bean);
}
});
column.setModifiable(!mapperManager.componentIsReadOnly());
//$NON-NLS-1$
column.setDefaultInternalValue("");
column.setWeight(COLUMN_EXPRESSION_SIZE_WEIGHT);
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle(DataMapTableView.COLUMN_NAME);
column.setId(DataMapTableView.ID_NAME_COLUMN);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<OutputColumnTableEntry, String>() {
public String get(OutputColumnTableEntry bean) {
return bean.getMetadataColumn().getLabel();
}
public void set(OutputColumnTableEntry bean, String value) {
bean.getMetadataColumn().setLabel(value);
}
});
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
if (PluginChecker.isTraceDebugPluginLoaded() && mapperManager.isTracesActive() && connection != null) {
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle("Preview");
column.setId(DataMapTableView.PREVIEW_COLUMN);
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<OutputColumnTableEntry, String>() {
public String get(OutputColumnTableEntry bean) {
IMetadataColumn metadataColumn = bean.getMetadataColumn();
if (metadataColumn != null) {
String label = metadataColumn.getLabel();
TraceData preview = bean.getPreviewValue();
if (preview != null && preview.getData() != null) {
return preview.getData().get(label);
}
}
return "";
}
public void set(OutputColumnTableEntry bean, String value) {
// do nothing
}
});
}
configureCellModifier(tableViewerCreatorForColumns);
}
use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class OutputDataMapTableView method getMapSettingValueAccess.
@Override
protected IBeanPropertyAccessors<GlobalMapEntry, Object> getMapSettingValueAccess(final CellEditor cellEditor) {
return new IBeanPropertyAccessors<GlobalMapEntry, Object>() {
public Object get(GlobalMapEntry bean) {
IDataMapTable parent = bean.getParent();
OutputTable outputTable = (OutputTable) parent;
if (cellEditor instanceof ComboBoxCellEditor) {
ComboBoxCellEditor functComboBox = (ComboBoxCellEditor) cellEditor;
functComboBox.setItems(new String[] { "true", "false" });
if (OUTPUT_REJECT.equals(bean.getName())) {
return String.valueOf(outputTable.isReject());
} else if (LOOK_UP_INNER_JOIN_REJECT.equals(bean.getName())) {
return String.valueOf(outputTable.isRejectInnerJoin());
} else if (SCHEMA_TYPE.equals(bean.getName())) {
functComboBox.setItems(new String[] { BUILT_IN, REPOSITORY });
return outputTable.isRepository() ? REPOSITORY : BUILT_IN;
}
} else if (cellEditor instanceof CustomDialogCellEditor) {
CustomDialogCellEditor customDialogCellEditor = (CustomDialogCellEditor) cellEditor;
if (OUTPUT_REJECT.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.BOOL);
return String.valueOf(outputTable.isReject());
} else if (LOOK_UP_INNER_JOIN_REJECT.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.BOOL);
return String.valueOf(outputTable.isRejectInnerJoin());
} else if (SCHEMA_TYPE.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.SCHEMA_TYPE);
enableDiaplayViewer(outputTable.isRepository());
return outputTable.isRepository() ? REPOSITORY : BUILT_IN;
} else if (SCHEMA_ID.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.SCHEMA_ID);
return getSchemaDisplayName(outputTable.getId());
}
}
return "";
}
public void set(GlobalMapEntry bean, Object value) {
if (value == null) {
return;
}
IDataMapTable parent = bean.getParent();
OutputTable outputTable = (OutputTable) parent;
if (OUTPUT_REJECT.equals(bean.getName())) {
outputTable.setReject(Boolean.valueOf(value.toString()));
} else if (LOOK_UP_INNER_JOIN_REJECT.equals(bean.getName())) {
outputTable.setRejectInnerJoin(Boolean.valueOf(value.toString()));
} else if (SCHEMA_TYPE.equals(bean.getName())) {
outputTable.setRepository(REPOSITORY.equals(value));
showSchemaIDSetting(REPOSITORY.equals(value));
enableDiaplayViewer(REPOSITORY.equals(value));
} else if (SCHEMA_ID.equals(bean.getName())) {
outputTable.setId(String.valueOf(value));
}
refreshCondensedImage(outputTable, bean.getName());
}
};
}
Aggregations