use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class UIManager method moveSelectedTableDown.
private void moveSelectedTableDown(DataMapTableView currentSelectedTableView, List<DataMapTableView> tablesView, int indexStartMovedAuthorized) {
int indexCurrentTable = tablesView.indexOf(currentSelectedTableView);
if (indexCurrentTable < indexStartMovedAuthorized || indexCurrentTable == tablesView.size() - 1) {
return;
}
DataMapTableView nextTableView = tablesView.get(indexCurrentTable + 1);
FormData formDataCurrent = (FormData) currentSelectedTableView.getLayoutData();
formDataCurrent.top.control = nextTableView;
if (indexCurrentTable + 2 <= tablesView.size() - 1) {
DataMapTableView afterNextTableView = tablesView.get(indexCurrentTable + 2);
FormData formDataAfterNext = (FormData) afterNextTableView.getLayoutData();
formDataAfterNext.top.control = currentSelectedTableView;
}
FormData formDataNext = (FormData) nextTableView.getLayoutData();
if (indexCurrentTable - 1 >= 0) {
formDataNext.top.control = tablesView.get(indexCurrentTable - 1);
} else {
formDataNext.top.control = null;
}
tableManager.swapWithNextTable(currentSelectedTableView.getDataMapTable());
currentSelectedTableView.getParent().layout();
parseAllExpressions(currentSelectedTableView, false);
parseAllExpressions(nextTableView, false);
mapperManager.getProblemsManager().checkProblemsForAllEntries(currentSelectedTableView, true);
mapperManager.getProblemsManager().checkProblemsForAllEntries(nextTableView, true);
}
use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class MapperManager method addInputAliasTable.
/**
* DOC amaumont Comment method "addAlias".
*/
public void addInputAliasTable() {
AliasDialog aliasDialog = new AliasDialog(this, tableManager.getPhysicalInputTableNames(), tableManager.getAliases(), tableManager.getVisibleTables());
if (!aliasDialog.open()) {
return;
}
List<IOConnection> incomingConnections = getComponent().getMapperMain().getIoInputConnections();
IOConnection connectionFound = null;
for (IOConnection connection : incomingConnections) {
if (connection.getName().equalsIgnoreCase(aliasDialog.getTableName())) {
connectionFound = connection;
break;
}
}
List<DataMapTableView> inputsTablesView = getUiManager().getInputsTablesView();
int sizeOutputsView = inputsTablesView.size();
Control lastChild = null;
if (sizeOutputsView - 1 >= 0) {
lastChild = inputsTablesView.get(sizeOutputsView - 1);
}
String alias = aliasDialog.getAlias();
//$NON-NLS-1$
boolean isPhysicalTable = alias.equals("") || alias.equalsIgnoreCase(aliasDialog.getTableName());
String aliasOrTableName = isPhysicalTable ? aliasDialog.getTableName() : alias;
IMetadataTable metadataTable = isPhysicalTable ? connectionFound.getTable() : connectionFound.getTable().clone();
boolean isInvisiblePhysicalTable = aliasDialog.isSameAsPhysicalTable(aliasOrTableName) && !aliasDialog.isSameAsVisibleTableName(aliasOrTableName);
InputTable inputTable = new InputTable(this, metadataTable, aliasOrTableName);
if (isInvisiblePhysicalTable) {
inputTable.setAlias(null);
} else {
inputTable.setAlias(aliasOrTableName);
}
inputTable.setTableName(aliasDialog.getTableName());
inputTable.initFromExternalData(null);
TablesZoneView tablesZoneViewInputs = uiManager.getTablesZoneViewInputs();
DataMapTableView dataMapTableView = uiManager.createNewInputTableView(lastChild, inputTable, tablesZoneViewInputs);
tablesZoneViewInputs.setSize(tablesZoneViewInputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tablesZoneViewInputs.layout(true, true);
uiManager.moveInputScrollBarZoneToMax();
uiManager.refreshBackground(true, false);
tablesZoneViewInputs.layout();
uiManager.selectDataMapTableView(dataMapTableView, true, false);
uiManager.updateDropDownJoinTypeForInputs();
uiManager.parseAllExpressionsForAllTables();
uiManager.refreshSqlExpression();
getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
}
use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class MapperManager method replaceLocation.
/**
*
* DOC amaumont Comment method "replaceLocation".
*
* @param previousLocation
* @param newLocation
* @param dataMapExpressionParser
* @param table
* @param entry
* @return true if expression of entry has changed
*/
private boolean replaceLocation(final TableEntryLocation previousLocation, final TableEntryLocation newLocation, DataMapExpressionParser dataMapExpressionParser, IDataMapTable table, ITableEntry entry) {
boolean expressionHasChanged = false;
String currentExpression = entry.getExpression();
TableEntryLocation[] tableEntryLocations = dataMapExpressionParser.parseTableEntryLocations(currentExpression);
// loop on all locations of current expression
for (TableEntryLocation currentLocation : tableEntryLocations) {
if (currentLocation.equals(previousLocation)) {
currentExpression = dataMapExpressionParser.replaceLocation(currentExpression, previousLocation, newLocation);
expressionHasChanged = true;
}
}
if (expressionHasChanged) {
entry.setExpression(currentExpression);
DataMapTableView dataMapTableView = retrieveIDataMapTableView(table);
TableViewerCreator tableViewerCreator = null;
if (entry instanceof IColumnEntry) {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForColumns();
} else if (entry instanceof FilterTableEntry) {
if (FilterTableEntry.OTHER_FILTER.equals(((FilterTableEntry) entry).getFilterKind())) {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForOtherFilters();
} else {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForWhereFilters();
}
}
tableViewerCreator.getTableViewer().refresh(entry);
uiManager.parseExpression(currentExpression, entry, false, true, false);
return true;
}
return false;
}
use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class UIManager method unregisterCustomPaint.
public void unregisterCustomPaint() {
List<DataMapTableView> tablesView = getOutputsTablesView();
tablesView.addAll(getInputsTablesView());
for (DataMapTableView view : tablesView) {
view.getTableViewerCreatorForColumns().setUseCustomItemColoring(false);
}
}
use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class UIManager method isTableViewMoveable.
public boolean isTableViewMoveable(Zone zone, boolean moveUp) {
if (zone == Zone.INPUTS) {
if (currentSelectedInputTableView == null) {
return false;
}
List<DataMapTableView> tablesView = getInputsTablesView();
int indexCurrentTable = tablesView.indexOf(currentSelectedInputTableView);
if (moveUp) {
if (indexCurrentTable > 0) {
return true;
}
return false;
} else {
if (indexCurrentTable < tablesView.size() - 1 && indexCurrentTable >= 0) {
return true;
}
return false;
}
} else if (zone == Zone.OUTPUTS) {
if (currentSelectedOutputTableView == null) {
return false;
}
List<DataMapTableView> tablesView = getOutputsTablesView();
int indexCurrentTable = tablesView.indexOf(currentSelectedOutputTableView);
if (moveUp) {
if (indexCurrentTable > 0) {
return true;
}
return false;
} else {
if (indexCurrentTable < tablesView.size() - 1) {
return true;
}
return false;
}
}
return false;
}
Aggregations