use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class SearchZoneMapper method moveScrollBarZoneAtSelectedTableItem.
public void moveScrollBarZoneAtSelectedTableItem(ITableEntry entry) {
if (entry != null) {
DataMapTableView dataMapTableView = mapperManager.retrieveIDataMapTableView(entry.getParent());
Rectangle tableViewBounds = dataMapTableView.getBounds();
IDataMapTable table = entry.getParent();
TableItem tableItem = mapperManager.retrieveTableItem(entry);
if (table != null && tableItem != null) {
Rectangle tableItemBounds = tableItem.getBounds();
int selection = tableViewBounds.y + tableItemBounds.y;
ScrolledComposite scrollComposite = null;
if (table instanceof InputTable) {
scrollComposite = uiManager.getScrolledCompositeViewInputs();
} else if (table instanceof OutputTable) {
scrollComposite = uiManager.getScrolledCompositeViewOutputs();
}
if (scrollComposite != null) {
setPositionOfVerticalScrollBarZone(scrollComposite, selection);
}
}
}
}
use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class UIManager method removeOutputTableView.
/**
* Call mapperManager.removeSelectedOutput() to remove a table view.
*
* @param dataMapTableViewToRemove
*/
public void removeOutputTableView(OutputDataMapTableView dataMapTableViewToRemove) {
List<DataMapTableView> outputsTablesView = getOutputsTablesView();
int sizeList = outputsTablesView.size();
for (int i = 0; i < sizeList; i++) {
Control control = outputsTablesView.get(i);
if (control == dataMapTableViewToRemove && i < sizeList - 1 && i > 0) {
FormData formData = (FormData) outputsTablesView.get(i + 1).getLayoutData();
formData.top = new FormAttachment(outputsTablesView.get(i - 1));
break;
}
}
mapperManager.removeTablePair(dataMapTableViewToRemove);
MetadataTableEditorView outputMetaEditorView = getOutputMetaEditorView();
OutputTable outputTable = (OutputTable) dataMapTableViewToRemove.getDataMapTable();
if (outputMetaEditorView.getMetadataTableEditor().getMetadataTable() == outputTable.getMetadataTable()) {
getOutputMetaEditorView().setMetadataTableEditor(null);
}
dataMapTableViewToRemove.dispose();
dataMapTableViewToRemove = null;
getTablesZoneViewOutputs().layout();
refreshBackground(true, false);
setCurrentSelectedOutputTableView(null);
}
use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class DropContextAnalyzer method checkDropIsValid.
/**
* DOC amaumont Comment method "checkDropHasValidTarget".
*/
private boolean checkDropIsValid() {
isInputToInput = false;
mapOneToOneAuthorized = true;
if (targetTableIsFiltersTable() || draggedData.getTransferableEntryList().size() <= 1) {
mapOneToOneAuthorized = false;
}
if (invalidKeyPressed) {
return false;
}
/*
* INPUT => INPUT
*/
if (zoneSource == Zone.INPUTS && zoneTarget == Zone.INPUTS) {
isInputToInput = true;
mapOneToOneAuthorized = false;
List<InputTable> inputTables = mapperManager.getInputTables();
int indexSourceInputTable = inputTables.indexOf(dataMapTableViewSource.getDataMapTable());
int indexTargetInputTable = inputTables.indexOf(dataMapTableViewTarget.getDataMapTable());
if (indexSourceInputTable == indexTargetInputTable) {
return false;
} else {
return true;
}
}
/*
* OUTPUT => OUTPUT
*/
if (zoneSource == Zone.OUTPUTS && zoneTarget == Zone.OUTPUTS) {
isOutputToOutput = true;
mapOneToOneAuthorized = true;
List<OutputTable> outputTables = mapperManager.getOutputTables();
int indexSourceOutputTable = outputTables.indexOf(dataMapTableViewSource.getDataMapTable());
int indexTargetOutputTable = outputTables.indexOf(dataMapTableViewTarget.getDataMapTable());
if (indexSourceOutputTable == indexTargetOutputTable) {
return false;
} else {
return true;
}
}
TableItem tableItemTarget = getTableItemFromPosition(new Point(event.x, event.y));
if (zoneSource == Zone.OUTPUTS && zoneTarget == Zone.INPUTS) {
/*
* OUTPUT => OUTPUT OUTPUT => INPUT
*/
return false;
}
return true;
}
use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class MapperUI method createOutputZoneWithTables.
private void createOutputZoneWithTables(MapperModel mapperModel, final UIManager uiManager, final Display display) {
Control previousControl;
outputsZone = new OutputsZone(datasFlowViewSashForm, SWT.NONE, mapperManager);
outputsZone.createHeaderZoneComponents();
// this.dropTargetOperationListener.addControl(outputsZone);
sc3 = new ScrolledComposite(outputsZone, getBorder() | SWT.H_SCROLL | SWT.V_SCROLL);
// this.dropTargetOperationListener.addControl(sc3);
GridData sc3GridData = new GridData(GridData.FILL_BOTH);
sc3.setLayoutData(sc3GridData);
sc3.setBackgroundMode(SWT.INHERIT_DEFAULT);
sc3.addControlListener(new ControlListener() {
public void controlMoved(ControlEvent e) {
// System.out.println("sc3 controlMoved");
}
public void controlResized(ControlEvent e) {
// System.out.println("sc3 controlResized");
onSashResized(display);
}
});
outputTablesZoneView = new OutputTablesZoneView(sc3, getBorder(), mapperManager);
// this.dropTargetOperationListener.addControl(outputTablesZoneView);
outputTablesZoneView.setBackgroundMode(SWT.INHERIT_DEFAULT);
sc3.setExpandHorizontal(true);
sc3.setContent(outputTablesZoneView);
sc3MSListener = new MouseScrolledListener(mapperManager.getUiManager(), sc3);
outputTablesZoneView.initInsertionIndicator();
previousControl = null;
List<OutputTable> tables = mapperModel.getOutputDataMapTables();
Boolean minimizeStateOfTables = getMinimizedButtonState(tables);
if (minimizeStateOfTables != null) {
outputsZone.getToolbar().setMinimizeButtonState(minimizeStateOfTables.booleanValue());
}
for (IDataMapTable abstractDataMapTable : tables) {
OutputDataMapTableView dataMapTableView = uiManager.createNewOutputTableView(previousControl, abstractDataMapTable, outputTablesZoneView);
previousControl = dataMapTableView;
}
outputTablesZoneView.setSize(outputTablesZoneView.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class AutoMapper method map.
/**
* DOC amaumont Comment method "map".
*/
public void map() {
List<InputTable> inputTables = mapperManager.getInputTables();
List<OutputTable> outputTables = mapperManager.getOutputTables();
IDbLanguage currentLanguage = mapperManager.getCurrentLanguage();
HashMap<String, InputTable> nameToInputTable = new HashMap<String, InputTable>(inputTables.size());
for (InputTable inputTable : inputTables) {
nameToInputTable.put(inputTable.getName(), inputTable);
}
// output tables are the references
for (OutputTable outputTable : outputTables) {
List<IColumnEntry> outputEntries = outputTable.getColumnEntries();
boolean mapFound = false;
for (IColumnEntry outputEntry : outputEntries) {
mapFound = false;
if (mapperManager.checkEntryHasEmptyExpression(outputEntry)) {
String outputColumnName = outputEntry.getName();
for (InputTable inputTable : inputTables) {
List<IColumnEntry> inputColumnEntries = inputTable.getColumnEntries();
for (IColumnEntry inputEntry : inputColumnEntries) {
if (inputEntry.getName().equalsIgnoreCase(outputColumnName)) {
outputEntry.setExpression(currentLanguage.getLocation(inputTable.getName(), inputEntry.getName()));
mapFound = true;
break;
}
}
if (mapFound) {
break;
}
}
}
}
DataMapTableView view = mapperManager.retrieveIDataMapTableView(outputTable);
view.getTableViewerCreatorForColumns().getTableViewer().refresh();
}
mapperManager.getProblemsManager().checkProblems();
List<DataMapTableView> outputsTablesView = mapperManager.getUiManager().getOutputsTablesView();
for (DataMapTableView view : outputsTablesView) {
mapperManager.getUiManager().parseAllExpressions(view, true);
mapperManager.getProblemsManager().checkProblemsForAllEntries(view, true);
}
mapperManager.getUiManager().refreshBackground(true, false);
}
Aggregations