use of org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView in project tdi-studio-se by Talend.
the class MapperManager method addOutput.
/**
* DOC amaumont Comment method "addOutput".
*/
public void addOutput() {
String tableName = uiManager.openNewOutputCreationDialog();
if (tableName == null) {
return;
}
IProcess process = mapperComponent.getProcess();
//$NON-NLS-1$
String uniqueName = process.generateUniqueConnectionName("table");
process.addUniqueConnectionName(uniqueName);
MetadataTable metadataTable = new MetadataTable();
metadataTable.setTableName(uniqueName);
// metadataTable.setId(uniqueName);
metadataTable.setLabel(tableName);
List<DataMapTableView> outputsTablesView = getUiManager().getOutputsTablesView();
int sizeOutputsView = outputsTablesView.size();
Control lastChild = null;
if (sizeOutputsView - 1 >= 0) {
lastChild = outputsTablesView.get(sizeOutputsView - 1);
}
IDataMapTable abstractDataMapTable = new OutputTable(this, metadataTable, uniqueName, tableName);
TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
DataMapTableView dataMapTableView = uiManager.createNewOutputTableView(lastChild, abstractDataMapTable, tablesZoneViewOutputs);
tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tablesZoneViewOutputs.layout();
uiManager.moveOutputScrollBarZoneToMax();
uiManager.refreshBackground(true, false);
tablesZoneViewOutputs.layout();
uiManager.selectDataMapTableView(dataMapTableView, true, false);
}
use of org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView in project tdi-studio-se by Talend.
the class CompleteDropTargetListener method retrieveInsertionIndicator.
private InsertionIndicator retrieveInsertionIndicator() {
DataMapTableView dataMapTableViewTarget = getMapperManager().retrieveDataMapTableView(draggableTable);
TablesZoneView targetTablesZoneView = getUiManager().getTablesZoneView(dataMapTableViewTarget);
InsertionIndicator insertionIndicator = targetTablesZoneView.getInsertionIndicator();
return insertionIndicator;
}
use of org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView 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.zone.scrollable.TablesZoneView in project tdi-studio-se by Talend.
the class InsertionIndicator method updatePosition.
/**
* Update position of the indicator at top of <code>itemIndexTarget</code> position of the
* <code>draggableTable</code>.
*
* @param currentTable
* @param itemIndexTarget
*/
public void updatePosition(Table currentTable, int itemIndexTarget) {
// System.out.println(itemIndexTarget);
this.draggableTable = currentTable;
removeTablePaintListener();
if (tablePaintListener == null) {
tablePaintListener = new Listener() {
public void handleEvent(Event event) {
drawIndicatorLineInTable(event);
}
};
}
FormLayout formLayout = tablesZoneViewParent.getLayout();
UIManager uiManager = mapperManager.getUiManager();
TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
Display display = tablesZoneViewOutputs.getDisplay();
Point tablePositionRefZone = display.map(currentTable, tablesZoneViewParent, new Point(0, 0));
FormData formDataLeftArrow = (FormData) leftArrowDraggingIndicator.getLayoutData();
FormData formDataRightArrow = (FormData) rightArrowDraggingIndicator.getLayoutData();
ScrollBar verticalBar = currentTable.getVerticalBar();
int offsetVerticalBar = -verticalBar.getSelection() * currentTable.getItemHeight();
int indicYPositionRefZone = 0;
if (WindowSystem.isGTK()) {
if (itemIndexTarget == 0) {
indicYPositionRefTable = 0 + offsetVerticalBar;
} else {
indicYPositionRefTable = itemIndexTarget * (currentTable.getItemHeight() + 2) + offsetVerticalBar;
}
indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2;
indicYPositionRefZone -= currentTable.getItemHeight() + 1;
} else {
if (itemIndexTarget == 0) {
indicYPositionRefTable = 0 + offsetVerticalBar;
} else {
indicYPositionRefTable = itemIndexTarget * currentTable.getItemHeight() - 1 + offsetVerticalBar;
}
indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2 + 4;
}
DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(currentTable);
Rectangle boundsTableView = dataMapTableView.getBounds();
int testValue = boundsTableView.y + boundsTableView.height - formLayout.marginTop - HEIGHT_INDICATOR / 2 - 5;
if (indicYPositionRefZone > testValue) {
indicYPositionRefZone = testValue;
}
currentTable.addListener(SWT.Paint, tablePaintListener);
if (lastIndicYPositionRefZone != indicYPositionRefZone) {
formDataLeftArrow.top.offset = indicYPositionRefZone;
formDataRightArrow.top.offset = indicYPositionRefZone;
formDataRightArrow.left.offset = currentTable.getSize().x + 2;
currentTable.redraw();
tablesZoneViewParent.layout();
}
lastIndicYPositionRefZone = indicYPositionRefZone;
}
use of org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView in project tdi-studio-se by Talend.
the class UIManager method resizeTablesZoneViewAtComputedSize.
/**
* recalculate parent size don't hide DataMapTableView when resized.
*/
public void resizeTablesZoneViewAtComputedSize(Zone zone) {
TablesZoneView tablesZoneView = null;
if (zone == Zone.INPUTS) {
tablesZoneView = getTablesZoneViewInputs();
} else if (zone == Zone.OUTPUTS) {
tablesZoneView = getTablesZoneViewOutputs();
}
tablesZoneView.setSize(tablesZoneView.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
Aggregations