use of org.talend.designer.mapper.model.table.AbstractInOutTable 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.AbstractInOutTable in project tdi-studio-se by Talend.
the class InputDataMapTableView method createMapSettingTable.
@Override
protected void createMapSettingTable() {
ExtendedTableModel<GlobalMapEntry> tableMapSettingEntriesModel = ((InputTable) 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) {
if (!getInputTable().isMainConnection()) {
if (!getMapperManager().isMRProcess()) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, LOOKUP_MODEL_SETTING, null));
}
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, MATCH_MODEL_SETTING, null));
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, JOIN_MODEL_SETTING, null));
if (!getMapperManager().isBigDataProcess()) {
tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, PERSISTENCE_MODEL_SETTING, null));
}
// remove schema type in input tables
// tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, SCHEMA_TYPE, null));
} else {
// tableMapSettingEntriesModel.add(new GlobalMapEntry(abstractDataMapTable, SCHEMA_TYPE, null));
}
// if (getInputTable().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.setCellModifier(new TableCellModifier(mapSettingViewerCreator));
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.AbstractInOutTable in project tdi-studio-se by Talend.
the class OutputDataMapTableView method createFiltersTable.
protected void createFiltersTable() {
this.extendedTableViewerForFilters = new AbstractExtendedTableViewer<FilterTableEntry>(((OutputTable) abstractDataMapTable).getTableFiltersEntriesModel(), centerComposite) {
@Override
protected void createColumns(TableViewerCreator<FilterTableEntry> tableViewerCreator, Table table) {
createFiltersColumns(tableViewerCreator);
}
/*
* (non-Javadoc)
*
* @see
* org.talend.commons.ui.swt.extended.macrotable.AbstractExtendedTableViewer#setTableViewerCreatorOptions
* (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)
*/
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<FilterTableEntry> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setColumnsResizableByDefault(false);
newTableViewerCreator.setBorderVisible(false);
newTableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
newTableViewerCreator.setKeyboardManagementForCellEdition(true);
// tableViewerCreatorForColumns.setUseCustomItemColoring(this.getDataMapTable()
// instanceof
// AbstractInOutTable);
newTableViewerCreator.setFirstColumnMasked(true);
}
};
tableViewerCreatorForFilters = this.extendedTableViewerForFilters.getTableViewerCreator();
this.extendedTableViewerForFilters.setCommandStack(mapperManager.getCommandStack());
tableForConstraints = tableViewerCreatorForFilters.getTable();
tableForConstraintsGridData = new GridData(GridData.FILL_HORIZONTAL);
tableForConstraints.setLayoutData(tableForConstraintsGridData);
boolean tableConstraintsVisible = false;
if (abstractDataMapTable instanceof OutputTable) {
tableConstraintsVisible = ((OutputTable) abstractDataMapTable).getFilterEntries().size() > 0;
}
tableForConstraintsGridData.exclude = !tableConstraintsVisible;
tableForConstraints.setVisible(tableConstraintsVisible);
if (!mapperManager.componentIsReadOnly()) {
new DragNDrop(mapperManager, tableForConstraints, false, true);
}
tableViewerCreatorForFilters.addCellValueModifiedListener(new ITableCellValueModifiedListener() {
public void cellValueModified(TableCellValueModifiedEvent e) {
unselectAllEntriesIfErrorDetected(e);
}
});
final TableViewer tableViewer = tableViewerCreatorForFilters.getTableViewer();
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
selectThisDataMapTableView();
UIManager uiManager = mapperManager.getUiManager();
uiManager.selectLinks(OutputDataMapTableView.this, uiManager.extractSelectedTableEntries(selection), false, false);
}
});
tableForConstraints.addListener(SWT.KeyDown, new Listener() {
public void handleEvent(Event event) {
processEnterKeyDown(tableViewerCreatorForFilters, event);
}
});
tableViewerCreatorForFilters.setLabelProvider(new DefaultTableLabelProvider(tableViewerCreatorForFilters) {
@Override
public Color getBackground(Object element, int columnIndex) {
return getBackgroundCellColor(tableViewerCreator, element, columnIndex);
}
@Override
public Color getForeground(Object element, int columnIndex) {
return getForegroundCellColor(tableViewerCreator, element, columnIndex);
}
});
initShowMessageErrorListener(tableForConstraints);
}
use of org.talend.designer.mapper.model.table.AbstractInOutTable in project tdi-studio-se by Talend.
the class UIManager method selectDataMapTableView.
/**
* Select a table view.
*
* @param dataMapTableView
* @param useNewCommand
* @param selectAllEntries TODO
*/
public void selectDataMapTableView(final DataMapTableView dataMapTableView, boolean useNewCommand, boolean selectAllEntries) {
// reject table readonly
IDataMapTable dataMapTable = dataMapTableView.getDataMapTable();
if (dataMapTable instanceof OutputTable && ((OutputTable) dataMapTable).isErrorRejectTable()) {
OutputTable table = (OutputTable) dataMapTable;
if (table.getMetadataTable() != null) {
for (IMetadataColumn column : table.getMetadataTable().getListColumns()) {
if (mapperManager.ERROR_REJECT_MESSAGE.equals(column.getLabel()) || mapperManager.ERROR_REJECT_STACK_TRACE.equals(column.getLabel())) {
column.setCustom(true);
}
}
}
CustomTableManager.addCustomManagementToTable(getOutputMetaEditorView(), true);
}
TabFolderEditors tabFolderEditors = mapperUI.getTabFolderEditors();
// tabFolderEditors.setSelection(TabFolderEditors.INDEX_TAB_METADATA_EDITOR);
MetadataTableEditorView metadataTableEditorView = null;
MetadataTableEditorView otherMetadataTableEditorView = null;
final Zone currentZone = dataMapTableView.getZone();
List<? extends AbstractDataMapTable> tables = null;
DataMapTableView previousSelectedTableView = null;
if (currentZone == Zone.INPUTS) {
metadataTableEditorView = tabFolderEditors.getInputMetaEditorView();
otherMetadataTableEditorView = tabFolderEditors.getOutputMetaEditorView();
tables = mapperManager.getInputTables();
previousSelectedTableView = this.currentSelectedInputTableView;
this.currentSelectedInputTableView = (InputDataMapTableView) dataMapTableView;
metadataTableEditorView.setReadOnly(this.currentSelectedInputTableView.getInputTable().hasReadOnlyMetadataColumns() || mapperManager.componentIsReadOnly() || this.currentSelectedInputTableView.getInputTable().isReadOnly());
} else if (currentZone == Zone.OUTPUTS) {
metadataTableEditorView = tabFolderEditors.getOutputMetaEditorView();
otherMetadataTableEditorView = tabFolderEditors.getInputMetaEditorView();
tables = mapperManager.getOutputTables();
previousSelectedTableView = this.currentSelectedOutputTableView;
this.currentSelectedOutputTableView = (OutputDataMapTableView) dataMapTableView;
metadataTableEditorView.setReadOnly(this.currentSelectedOutputTableView.getOutputTable().hasReadOnlyMetadataColumns() || mapperManager.componentIsReadOnly());
} else {
this.currentSelectedVarsTableView = (VarsDataMapTableView) dataMapTableView;
}
if (currentZone != Zone.VARS) {
updateToolbarButtonsStates(currentZone);
final AbstractInOutTable abstractDataMapTable = (AbstractInOutTable) mapperManager.retrieveAbstractDataMapTable(dataMapTableView);
MetadataTableEditor currentMetadataTableEditor = metadataTableEditorView.getMetadataTableEditor();
final TableViewerCreator dataMapTVCreator = dataMapTableView.getTableViewerCreatorForColumns();
final TableViewer dataMapTableViewer = dataMapTableView.getTableViewerCreatorForColumns().getTableViewer();
if (currentMetadataTableEditor == null || currentMetadataTableEditor != null && oldSelectedView != dataMapTableView) {
oldSelectedView = dataMapTableView;
if (useNewCommand) {
DataMapTableViewSelectedCommand command = new DataMapTableViewSelectedCommand(this, previousSelectedTableView, dataMapTableView);
mapperManager.executeCommand(command);
}
currentMetadataTableEditor = new MetadataTableEditor(abstractDataMapTable.getMetadataTable(), abstractDataMapTable.getName());
currentMetadataTableEditor.setModifiedBeanListenable(metadataTableEditorView.getTableViewerCreator());
final MetadataTableEditorView metadataTableEditorViewFinal = metadataTableEditorView;
final TableViewerCreator metadataTVCreator = metadataTableEditorViewFinal.getTableViewerCreator();
final MetadataTableEditor metadataTableEditor = currentMetadataTableEditor;
modifySelectionChangedListener(currentZone, metadataTableEditorViewFinal, metadataTVCreator, metadataTableEditor, dataMapTableView, previousSelectedTableView);
// init actions listeners for list which contains metadata
metadataTableEditor.addAfterOperationListListener(new IListenableListListener() {
/**
* DOC acer Comment method "handleEvent".
*
* @param event
*/
public void handleEvent(ListenableListEvent event) {
DataMapTableView view = mapperManager.retrieveAbstractDataMapTableView(abstractDataMapTable);
List<DataMapTableView> relatedOutputsTableView = getRelatedOutputsTableView(dataMapTableView);
if (event.type == TYPE.ADDED) {
// metadataEditorTableViewer.refresh();
List<IMetadataColumn> metadataColumns = (List<IMetadataColumn>) event.addedObjects;
lastCreatedInOutColumnEntries.clear();
if (event.index != null) {
int index = event.index;
for (IMetadataColumn metadataColumn : metadataColumns) {
lastCreatedInOutColumnEntries.add(mapperManager.addNewColumnEntry(dataMapTableView, metadataColumn, index));
// handle related table view
for (DataMapTableView tableView : relatedOutputsTableView) {
// changed for bug TDI-26551 in July 2,2013 by fwang, should use original
// expression for related table.
IMetadataColumn relatedMetadata = metadataColumn;
if (!oldMappingMap.isEmpty()) {
IDataMapTable retrieveAbstractDataMapTable = mapperManager.retrieveAbstractDataMapTable(tableView);
relatedMetadata = metadataColumn.clone();
String label = relatedMetadata.getLabel();
String expression = oldMappingMap.get(retrieveAbstractDataMapTable.getName() + "_" + label);
relatedMetadata.setExpression(expression == null ? "" : expression);
}
mapperManager.addNewColumnEntry(tableView, relatedMetadata, index);
}
index = index + 1;
}
} else if (event.indicesTarget != null) {
List<Integer> indicesTarget = event.indicesTarget;
int lstSize = indicesTarget.size();
for (int i = 0; i < lstSize; i++) {
Integer indice = indicesTarget.get(i);
IMetadataColumn metadataColumn = metadataColumns.get(i);
lastCreatedInOutColumnEntries.add(mapperManager.addNewColumnEntry(dataMapTableView, metadataColumn, indice));
// handle related table view
for (DataMapTableView tableView : relatedOutputsTableView) {
mapperManager.addNewColumnEntry(tableView, metadataColumn, indice);
}
}
} else {
//$NON-NLS-1$
throw new IllegalStateException(Messages.getString("UIManager.1"));
}
refreshBackground(false, false);
if (event.index != null) {
dataMapTableViewer.refresh();
dataMapTVCreator.getSelectionHelper().setSelection(event.index);
if (dataMapTableView.canBeResizedAtPreferedSize()) {
dataMapTableView.changeSize(view.getPreferredSize(true, false, false), true, true);
}
// resize ralated table
for (DataMapTableView tableView : relatedOutputsTableView) {
if (tableView.canBeResizedAtPreferedSize()) {
tableView.changeSize(tableView.getPreferredSize(true, false, false), true, true);
}
}
} else if (event.indicesTarget != null) {
dataMapTableViewer.refresh();
dataMapTableView.changeSize(view.getPreferredSize(false, true, false), true, true);
int[] selection = ArrayUtils.toPrimitive((Integer[]) event.indicesTarget.toArray(new Integer[0]));
dataMapTVCreator.getSelectionHelper().setSelection(selection);
for (DataMapTableView tableView : relatedOutputsTableView) {
tableView.changeSize(tableView.getPreferredSize(false, true, false), true, true);
}
}
}
if (event.type == TYPE.REMOVED) {
// metadataEditorTableViewer.refresh();
List<IMetadataColumn> metadataColumns = (List<IMetadataColumn>) event.removedObjects;
for (IMetadataColumn metadataColumn : metadataColumns) {
ITableEntry metadataTableEntry = mapperManager.retrieveTableEntry(new TableEntryLocation(abstractDataMapTable.getName(), metadataColumn.getLabel()));
mapperManager.removeTableEntry(metadataTableEntry);
for (DataMapTableView tableView : relatedOutputsTableView) {
IDataMapTable retrieveAbstractDataMapTable = mapperManager.retrieveAbstractDataMapTable(tableView);
metadataTableEntry = mapperManager.retrieveTableEntry(new TableEntryLocation(retrieveAbstractDataMapTable.getName(), metadataColumn.getLabel()));
mapperManager.removeTableEntry(metadataTableEntry);
if (tableView.canBeResizedAtPreferedSize()) {
tableView.resizeAtExpandedSize();
}
}
}
dataMapTableViewer.refresh();
if (dataMapTableView.canBeResizedAtPreferedSize()) {
dataMapTableView.resizeAtExpandedSize();
}
resizeTablesZoneViewAtComputedSize(dataMapTableView.getZone());
moveScrollBarZoneAtSelectedTable(dataMapTableView.getZone());
refreshBackground(true, false);
}
if (event.type == TYPE.SWAPED) {
List<Integer> listIndexTarget = event.indicesTarget;
abstractDataMapTable.swapColumnElements(event.indicesOrigin, listIndexTarget);
// handle related table view
for (DataMapTableView tableView : relatedOutputsTableView) {
AbstractDataMapTable relatedTable = (AbstractDataMapTable) tableView.getDataMapTable();
relatedTable.swapColumnElements(event.indicesOrigin, listIndexTarget);
}
// dataMapTableViewer.refresh();
refreshBackground(true, false);
}
}
});
metadataTableEditorView.getTableViewerCreator().getSelectionHelper().setActiveFireSelectionChanged(false);
metadataTableEditorView.setMetadataTableEditor(metadataTableEditor);
metadataTableEditorView.getTableViewerCreator().getSelectionHelper().setActiveFireSelectionChanged(true);
metadataTableEditorView.getExtendedToolbar().updateEnabledStateOfButtons();
dataMapTVCreator.getSelectionHelper().setActiveFireSelectionChanged(false);
metadataTableEditorView.getTableViewerCreator().getSelectionHelper().setSelection(dataMapTableViewer.getTable().getSelectionIndices());
dataMapTVCreator.getSelectionHelper().setActiveFireSelectionChanged(true);
// disable highlight for other DataMapTableView and highlight selected DataMapTableView
for (IDataMapTable table : tables) {
DataMapTableView otherDataMapTableView = mapperManager.retrieveAbstractDataMapTableView(table);
otherDataMapTableView.setBackground(dataMapTableView.getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
}
dataMapTableView.setBackground(dataMapTableView.getDisplay().getSystemColor(SWT.COLOR_YELLOW));
}
if (selectAllEntries) {
dataMapTVCreator.getTable().selectAll();
selectAllLinks(dataMapTableView);
if (currentZone != Zone.VARS) {
metadataTableEditorView.getTableViewerCreator().getTable().selectAll();
metadataTableEditorView.getToolBar().updateEnabledStateOfButtons();
}
if (currentZone == Zone.OUTPUTS) {
dataMapTableView.getTableViewerCreatorForFilters().getTable().selectAll();
}
}
boolean isMainSchemaRepository = false;
if (abstractDataMapTable instanceof OutputTable) {
OutputTable outputTable = (OutputTable) abstractDataMapTable;
if (outputTable.getIsJoinTableOf() != null || !"".equals(outputTable.getIsJoinTableOf())) {
final OutputTable outputTableByName = mapperManager.getOutputTableByName(outputTable.getIsJoinTableOf());
if (outputTableByName != null && outputTableByName.getId() != null) {
isMainSchemaRepository = true;
}
}
}
dataMapTableView.enableDiaplayViewer(abstractDataMapTable.isRepository() || isMainSchemaRepository);
}
if (selectAllEntries && currentZone == Zone.VARS) {
selectAllLinks(dataMapTableView);
mapperManager.getUiManager().getVarsTablesView().get(0).getTableViewerCreatorForColumns().getTable().selectAll();
}
if (otherMetadataTableEditorView != null) {
otherMetadataTableEditorView.getExtendedToolbar().updateEnabledStateOfButtons();
}
}
use of org.talend.designer.mapper.model.table.AbstractInOutTable 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;
}
Aggregations