use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class UIManager method getTableEntryPosition.
/**
* DOC amaumont Comment method "getTableEntryPosition".
*
* @param manager TODO
* @param tableEntry
* @param forceRecalculate TODO
* @return
*/
public Point getTableEntryPosition(ITableEntry tableEntry, boolean forceRecalculate) {
TableEntryProperties tableEntryProperties = mapperManager.getTableEntryProperties(tableEntry);
Point returnedPoint = tableEntryProperties.position;
if (forceRecalculate || returnedPoint == null) {
TableItem tableItem = mapperManager.retrieveTableItem(tableEntry);
DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(tableEntry);
Rectangle tableViewBounds = dataMapTableView.getBounds();
Table table = tableItem.getParent();
// FIX for issue 1225 ("1" parameter added)
Rectangle boundsTableItem = tableItem.getBounds(1);
int x = 0;
int y = boundsTableItem.y + table.getItemHeight() / 2 + dataMapTableView.getBorderWidth();
if (y < 0) {
y = 0;
}
Point point = new Point(x, y);
Display display = dataMapTableView.getDisplay();
Point pointFromTableViewOrigin = display.map(tableItem.getParent(), dataMapTableView, point);
if (pointFromTableViewOrigin.y > tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION) {
pointFromTableViewOrigin.y = tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION;
}
returnedPoint = convertPointToReferenceOrigin(getReferenceComposite(), pointFromTableViewOrigin, dataMapTableView);
tableEntryProperties.position = returnedPoint;
}
return returnedPoint;
}
use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class TableEntriesManager method retrieveTableItem.
TableItem retrieveTableItem(ITableEntry dataMapTableEntry) {
DataMapTableView dataMapTableView = this.mapperManager.retrieveIDataMapTableView(dataMapTableEntry.getParent());
TableItem[] tableItems = new TableItem[0];
if (dataMapTableEntry instanceof IColumnEntry) {
tableItems = dataMapTableView.getTableViewerCreatorForColumns().getTable().getItems();
} else if (dataMapTableEntry instanceof FilterTableEntry) {
if (FilterTableEntry.OTHER_FILTER.equals(((FilterTableEntry) dataMapTableEntry).getFilterKind())) {
tableItems = dataMapTableView.getTableViewerCreatorForOtherFilters().getTable().getItems();
} else {
tableItems = dataMapTableView.getTableViewerCreatorForWhereFilters().getTable().getItems();
}
} else {
//$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("TableEntriesManager.exceptionMessage.caseNotFound"));
}
TableItem tableItem = null;
for (TableItem tableItem2 : tableItems) {
if (tableItem2.getData() == dataMapTableEntry) {
tableItem = tableItem2;
break;
}
}
getTableEntryProperties(dataMapTableEntry).setTableItem(tableItem);
return tableItem;
}
use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class UIManager method minimizeAllTables.
public void minimizeAllTables(Zone zone, boolean minimize, ToolItem minimizeButton) {
List<DataMapTableView> tablesView = null;
TablesZoneView tablesZoneView = null;
if (zone == Zone.INPUTS) {
tablesView = getInputsTablesView();
tablesZoneView = getTablesZoneViewInputs();
} else if (zone == Zone.OUTPUTS) {
tablesZoneView = getTablesZoneViewOutputs();
tablesView = getOutputsTablesView();
} else {
//$NON-NLS-1$
throw new RuntimeException("Case not found:" + zone);
}
Layout layout = tablesZoneView.getLayout();
try {
tablesZoneView.setLayout(null);
for (DataMapTableView view : tablesView) {
view.minimizeTable(minimize);
}
} catch (RuntimeException e) {
ExceptionHandler.process(e);
} finally {
tablesZoneView.setLayout(layout);
}
tablesZoneView.layout();
for (DataMapTableView view : tablesView) {
view.layout();
}
resizeTablesZoneViewAtComputedSize(zone);
moveScrollBarZoneAtSelectedTable(zone);
}
use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class UIManager method parseExpression.
/**
*
*
* @param expression
* @param currentModifiedITableEntry
* @param linkMustHaveSelectedState
* @param checkInputKeyAutomatically TODO
* @param inputExpressionAppliedOrCanceled TODO
* @param newSelectedDataMapTableView
* @return true if a link has been added or removed, false else
*/
public ParseExpressionResult parseExpression(String expression, ITableEntry currentModifiedITableEntry, boolean linkMustHaveSelectedState, boolean checkInputKeyAutomatically, boolean inputExpressionAppliedOrCanceled) {
DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(currentModifiedITableEntry);
boolean linkHasBeenAdded = false;
boolean linkHasBeenRemoved = false;
DataMapExpressionParser dataMapExpressionParser = new DataMapExpressionParser(mapperManager.getCurrentLanguage());
TableEntryLocation[] tableEntriesLocationsSources = dataMapExpressionParser.parseTableEntryLocations(expression);
Set<TableEntryLocation> alreadyProcessed = new HashSet<TableEntryLocation>();
Set<ITableEntry> sourcesForTarget = mapperManager.getSourcesForTarget(currentModifiedITableEntry);
Set<ITableEntry> sourcesForTargetToDelete = new HashSet<ITableEntry>(sourcesForTarget);
boolean isInputEntry = currentModifiedITableEntry instanceof InputColumnTableEntry;
for (TableEntryLocation tableEntriesLocationsSource : tableEntriesLocationsSources) {
TableEntryLocation location = tableEntriesLocationsSource;
if (!alreadyProcessed.contains(location) && checkSourceLocationIsValid(location, currentModifiedITableEntry)) {
ITableEntry sourceTableEntry = mapperManager.retrieveTableEntry(location);
sourcesForTargetToDelete.remove(sourceTableEntry);
if (sourceTableEntry != null && !sourcesForTarget.contains(sourceTableEntry)) {
DataMapTableView sourceDataMapTableView = mapperManager.retrieveDataMapTableView(sourceTableEntry);
IMapperLink link = new Link(new PointLinkDescriptor(sourceTableEntry, sourceDataMapTableView.getZone()), new PointLinkDescriptor(currentModifiedITableEntry, dataMapTableView.getZone()), mapperManager);
link.setState(linkMustHaveSelectedState ? LinkState.SELECTED : LinkState.UNSELECTED);
mapperManager.addLink(link);
linkHasBeenAdded = true;
}
alreadyProcessed.add(location);
}
}
Set<IMapperLink> targets = mapperManager.getGraphicalLinksFromTarget(currentModifiedITableEntry);
Set<IMapperLink> linksFromTarget = new HashSet<IMapperLink>(targets);
for (IMapperLink link : linksFromTarget) {
if (sourcesForTargetToDelete.contains(link.getPointLinkDescriptor1().getTableEntry())) {
mapperManager.removeLink(link, link.getPointLinkDescriptor2().getTableEntry());
linkHasBeenRemoved = true;
}
}
mapperManager.orderLinks();
return new ParseExpressionResult(linkHasBeenAdded, linkHasBeenRemoved);
}
use of org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class UIManager method unselectAllEntriesOfAllTables.
public void unselectAllEntriesOfAllTables() {
List<DataMapTableView> tablesView = getOutputsTablesView();
tablesView.addAll(getInputsTablesView());
tablesView.addAll(getVarsTablesView());
for (DataMapTableView view : tablesView) {
view.unselectAllEntries();
}
}
Aggregations