use of org.talend.designer.abstractmap.model.table.IDataMapTable 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);
}
}
}
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class InputDataMapTableView 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();
InputTable inputTable = (InputTable) parent;
if (cellEditor instanceof ComboBoxCellEditor) {
ComboBoxCellEditor functComboBox = (ComboBoxCellEditor) cellEditor;
if (LOOKUP_MODEL_SETTING.equals(bean.getName())) {
IUILookupMode[] availableJoins = { TMAP_LOOKUP_MODE.LOAD_ONCE, TMAP_LOOKUP_MODE.RELOAD, TMAP_LOOKUP_MODE.CACHE_OR_RELOAD };
List<String> names = new ArrayList<String>();
for (IUILookupMode availableJoin : availableJoins) {
names.add(availableJoin.getLabel());
}
functComboBox.setItems(names.toArray(new String[names.size()]));
final IUILookupMode lookupMode = ((InputTable) parent).getLookupMode();
if (lookupMode != null) {
return lookupMode.getLabel();
}
} else if (MATCH_MODEL_SETTING.equals(bean.getName())) {
IUIMatchingMode[] matchModel = getMatchModel();
List<String> names = new ArrayList<String>();
for (IUIMatchingMode element : matchModel) {
names.add(element.getLabel());
}
functComboBox.setItems(names.toArray(new String[names.size()]));
IUIMatchingMode matchingMode = ((InputTable) parent).getMatchingMode();
if (names.contains(matchingMode.getLabel())) {
return matchingMode.getLabel();
}
} else if (JOIN_MODEL_SETTING.equals(bean.getName())) {
String[] items = new String[] { INNER_JOIN, LEFT_OUTER_JOIN };
functComboBox.setItems(items);
boolean innerJoin = ((InputTable) parent).isInnerJoin();
if (innerJoin) {
return items[0];
}
return items[1];
} else if (PERSISTENCE_MODEL_SETTING.equals(bean.getName())) {
functComboBox.setItems(new String[] { "true", "false" });
boolean persistent = ((InputTable) parent).isPersistent();
return String.valueOf(persistent);
}
} else if (cellEditor instanceof CustomDialogCellEditor) {
CustomDialogCellEditor customDialogCellEditor = (CustomDialogCellEditor) cellEditor;
if (LOOKUP_MODEL_SETTING.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.LOOKUP_MODEL);
final IUILookupMode lookupMode = inputTable.getLookupMode();
if (lookupMode != null) {
return lookupMode.getLabel();
}
} else if (MATCH_MODEL_SETTING.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.MATCH_MODEL);
IUIMatchingMode matchingMode = inputTable.getMatchingMode();
if (matchingMode != null) {
return matchingMode.getLabel();
}
} else if (JOIN_MODEL_SETTING.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.JOIN_MODEL);
boolean innerJoin = inputTable.isInnerJoin();
return innerJoin ? INNER_JOIN : LEFT_OUTER_JOIN;
} else if (PERSISTENCE_MODEL_SETTING.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.BOOL);
boolean persistent = inputTable.isPersistent();
return String.valueOf(persistent);
} else if (SCHEMA_TYPE.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.SCHEMA_TYPE);
enableDiaplayViewer(inputTable.isRepository());
return inputTable.isRepository() ? REPOSITORY : BUILT_IN;
} else if (SCHEMA_ID.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.SCHEMA_ID);
return getSchemaDisplayName(inputTable.getId());
}
}
return "";
}
public void set(GlobalMapEntry bean, Object value) {
IDataMapTable parent = bean.getParent();
InputTable inputTable = (InputTable) parent;
if (LOOKUP_MODEL_SETTING.equals(bean.getName())) {
IUILookupMode[] availableJoins = { TMAP_LOOKUP_MODE.LOAD_ONCE, TMAP_LOOKUP_MODE.RELOAD, TMAP_LOOKUP_MODE.CACHE_OR_RELOAD };
for (final IUILookupMode lookupMode : availableJoins) {
if (value != null && value.equals(lookupMode.getLabel())) {
inputTable.setLookupMode(lookupMode);
if (TMAP_LOOKUP_MODE.CACHE_OR_RELOAD == lookupMode) {
persistentCheckEditable = false;
} else {
persistentCheckEditable = true;
}
if (lookupMode == TMAP_LOOKUP_MODE.RELOAD || lookupMode == TMAP_LOOKUP_MODE.CACHE_OR_RELOAD) {
showTableGlobalMap(true);
} else {
showTableGlobalMap(false);
}
enableDisablePersistentMode((TMAP_LOOKUP_MODE) lookupMode);
mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true);
checkChangementsAfterEntryModifiedOrAdded(true);
}
}
} else if (MATCH_MODEL_SETTING.equals(bean.getName())) {
for (IUIMatchingMode model : TMAP_MATCHING_MODE.values()) {
if (value != null && value.equals(model.getLabel())) {
inputTable.setMatchingMode(model);
previousMatchingModeSelected = model;
}
}
} else if (JOIN_MODEL_SETTING.equals(bean.getName())) {
if (LEFT_OUTER_JOIN.equals(value)) {
((InputTable) parent).setInnerJoin(false);
previousInnerJoinSelection = false;
} else {
((InputTable) parent).setInnerJoin(true);
previousInnerJoinSelection = true;
}
} else if (PERSISTENCE_MODEL_SETTING.equals(bean.getName())) {
if ("true".equals(value) || "false".equals(value)) {
((InputTable) parent).setPersistent(Boolean.valueOf(value.toString()));
previousValidPersistentMode = Boolean.valueOf(value.toString());
}
} else if (SCHEMA_TYPE.equals(bean.getName())) {
inputTable.setRepository(REPOSITORY.equals(value));
showSchemaIDSetting(REPOSITORY.equals(value));
enableDiaplayViewer(REPOSITORY.equals(value));
} else if (SCHEMA_ID.equals(bean.getName())) {
inputTable.setId(String.valueOf(value));
}
refreshCondensedImage((InputTable) bean.getParent(), bean.getName());
}
};
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class MapperUI method getMinimizedButtonState.
/**
* DOC amaumont Comment method "getCommonMinimizedStateOfTables".
*
* @param tables
* @return new Boolean(true) if button state should be to minimize, else new Boolean(false)
*/
private Boolean getMinimizedButtonState(List<? extends IDataMapTable> tables) {
boolean allTablesAreMinimized = true;
boolean allTablesAreNotMinimized = true;
for (IDataMapTable table : tables) {
if (table.isMinimized()) {
allTablesAreNotMinimized = false;
} else {
allTablesAreMinimized = false;
}
}
if (allTablesAreMinimized) {
return new Boolean(true);
} else if (allTablesAreNotMinimized) {
return new Boolean(false);
}
return new Boolean(false);
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class MapperUI method createOutputZoneWithTables.
private void createOutputZoneWithTables(MapperModel mapperModel, final UIManager uiManager, final Display display) {
Control previousControl;
outputsZone = new OutputsZone(datasFlowViewSashForm, SWT.NONE, mapperManager);
outputsZone.createHeaderZoneComponents();
// this.dropTargetOperationListener.addControl(outputsZone);
sc3 = new ScrolledComposite(outputsZone, getBorder() | SWT.H_SCROLL | SWT.V_SCROLL);
// this.dropTargetOperationListener.addControl(sc3);
GridData sc3GridData = new GridData(GridData.FILL_BOTH);
sc3.setLayoutData(sc3GridData);
sc3.setBackgroundMode(SWT.INHERIT_DEFAULT);
sc3.addControlListener(new ControlListener() {
public void controlMoved(ControlEvent e) {
// System.out.println("sc3 controlMoved");
}
public void controlResized(ControlEvent e) {
// System.out.println("sc3 controlResized");
onSashResized(display);
}
});
outputTablesZoneView = new OutputTablesZoneView(sc3, getBorder(), mapperManager);
// this.dropTargetOperationListener.addControl(outputTablesZoneView);
outputTablesZoneView.setBackgroundMode(SWT.INHERIT_DEFAULT);
sc3.setExpandHorizontal(true);
sc3.setContent(outputTablesZoneView);
sc3MSListener = new MouseScrolledListener(mapperManager.getUiManager(), sc3);
outputTablesZoneView.initInsertionIndicator();
previousControl = null;
List<OutputTable> tables = mapperModel.getOutputDataMapTables();
Boolean minimizeStateOfTables = getMinimizedButtonState(tables);
if (minimizeStateOfTables != null) {
outputsZone.getToolbar().setMinimizeButtonState(minimizeStateOfTables.booleanValue());
}
for (IDataMapTable abstractDataMapTable : tables) {
OutputDataMapTableView dataMapTableView = uiManager.createNewOutputTableView(previousControl, abstractDataMapTable, outputTablesZoneView);
previousControl = dataMapTableView;
}
outputTablesZoneView.setSize(outputTablesZoneView.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable 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();
}
}
Aggregations