use of org.talend.designer.mapper.ui.visualmap.TableEntryProperties 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) {
DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(tableEntry);
int entriesSize = 0;
int minHeight = dataMapTableView.getTableViewerCreatorForColumns().getTable().getHeaderHeight() + dataMapTableView.getTableViewerCreatorForColumns().getTable().getItemHeight();
TableItem[] tableItems = new TableItem[0];
if (tableEntry instanceof InputColumnTableEntry || tableEntry instanceof OutputColumnTableEntry) {
tableItems = dataMapTableView.getTableViewerCreatorForColumns().getTable().getItems();
AbstractInOutTable abstractInOutTable = (AbstractInOutTable) dataMapTableView.getDataMapTable();
if (dataMapTableView.getZone() == Zone.OUTPUTS) {
OutputTable outputTable = (OutputTable) abstractInOutTable;
List<IColumnEntry> oldOuputEntries = outputTable.getDataMapTableEntries();
entriesSize = oldOuputEntries.size();
}
if (dataMapTableView.getZone() == Zone.INPUTS) {
InputTable inputTable = (InputTable) abstractInOutTable;
List<IColumnEntry> oldOuputEntries = inputTable.getDataMapTableEntries();
entriesSize = oldOuputEntries.size();
}
}
Rectangle tableViewBounds = dataMapTableView.getBounds();
Point pointFromTableViewOrigin = null;
Display display = dataMapTableView.getDisplay();
Point returnedPoint = new Point(0, 0);
TableEntryProperties tableEntryProperties = null;
int itemIndex = 0;
if (tableEntry instanceof IColumnEntry || tableEntry instanceof FilterTableEntry || tableEntry instanceof GlobalMapEntry) {
tableEntryProperties = mapperManager.getTableEntryProperties(tableEntry);
returnedPoint = tableEntryProperties.position;
if (forceRecalculate || returnedPoint == null) {
int y;
TableItem tableItem = mapperManager.retrieveTableItem(tableEntry);
boolean isOutputEntry = tableEntry instanceof OutputColumnTableEntry;
boolean isIntputEntry = tableEntry instanceof InputColumnTableEntry;
boolean checked = false;
for (int i = 0; i < tableItems.length; i++) {
if (tableItems[i].getData() == tableEntry) {
itemIndex = i;
break;
}
}
boolean allIsNull = false;
if (tableItem == null && (isIntputEntry || isOutputEntry)) {
if (tableItems.length > 0) {
tableItem = tableItems[0];
checked = true;
} else {
allIsNull = true;
}
}
if (!allIsNull) {
Table table = tableItem.getParent();
// FIX for issue 1225 ("1" parameter added)
Rectangle boundsTableItem = tableItem.getBounds(1);
y = boundsTableItem.y + table.getItemHeight() / 2 + dataMapTableView.getBorderWidth();
if (isOutputEntry || isIntputEntry) {
if (entriesSize != tableItems.length) {
y = boundsTableItem.y + table.getItemHeight() / 2 + dataMapTableView.getBorderWidth();
}
}
if (checked) {
y = boundsTableItem.y + dataMapTableView.getBorderWidth();
checked = false;
}
int x = 0;
if (y < 0) {
y = 0;
}
Point point = new Point(x, y);
pointFromTableViewOrigin = display.map(tableItem.getParent(), dataMapTableView, point);
} else {
Text columnFilterText = dataMapTableView.getColumnNameFilterText();
Point point = new Point(-dataMapTableView.getBorderWidth() - 19, minHeight);
pointFromTableViewOrigin = display.map(columnFilterText, dataMapTableView, point);
}
}
} else if (tableEntry instanceof ExpressionFilterEntry) {
StyledText expressionFilterText = dataMapTableView.getExpressionFilterText();
// dataMapTableView.getex
Point point = new Point(-dataMapTableView.getBorderWidth() - 19, 16);
pointFromTableViewOrigin = display.map(expressionFilterText, dataMapTableView, point);
} else {
//$NON-NLS-1$
throw new IllegalStateException("Case not found");
}
if (pointFromTableViewOrigin.y > tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION) {
pointFromTableViewOrigin.y = tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION;
}
returnedPoint = convertPointToReferenceOrigin(getReferenceComposite(), pointFromTableViewOrigin, dataMapTableView);
if (tableEntryProperties != null) {
tableEntryProperties.position = returnedPoint;
}
return returnedPoint;
}
use of org.talend.designer.mapper.ui.visualmap.TableEntryProperties in project tdi-studio-se by Talend.
the class TableEntriesManager method getTableEntryProperties.
/**
* DOC amaumont Comment method "getTableEntryProperties".
*
* @param dataMapTableEntry
* @return
*/
TableEntryProperties getTableEntryProperties(ITableEntry dataMapTableEntry) {
TableEntryProperties tableEntryProperties = dataMapTableEntryToProperties.get(dataMapTableEntry);
if (tableEntryProperties == null) {
tableEntryProperties = new TableEntryProperties();
dataMapTableEntryToProperties.put(dataMapTableEntry, tableEntryProperties);
}
return tableEntryProperties;
}
Aggregations