Search in sources :

Example 1 with DropTargetOperationListener

use of org.talend.designer.abstractmap.ui.listener.DropTargetOperationListener in project tdi-studio-se by Talend.

the class MapperUI method init.

public void init(MapperModel mapperModel) {
    // long time1 = System.currentTimeMillis();
    // CommandStack commandStack = new CommandStackForComposite(this.mapperUIParent);
    // mapperManager.setCommandStack(commandStack);
    final UIManager uiManager = mapperManager.getUiManager();
    final ExternalDbMapUiProperties uiProperties = uiManager.getUiProperties();
    addParentListeners(uiManager, uiProperties);
    final Display display = mapperUIParent.getDisplay();
    bgColorLinksZone = ColorProviderMapper.getColor(ColorInfo.COLOR_BACKGROUND_LINKS_ZONE);
    GridLayout parentLayout = new GridLayout(1, true);
    mapperUIParent.setLayout(parentLayout);
    addKeyListener(uiManager, display);
    addBackgroundRefreshLimiters(display);
    this.dropTargetOperationListener = new DropTargetOperationListener(mapperManager);
    dropTargetOperationListener.addControl(this.mapperUIParent.getShell());
    mainSashForm = new SashForm(mapperUIParent, SWT.SMOOTH | SWT.VERTICAL);
    GridData mainSashFormGridData = new GridData(GridData.FILL_BOTH);
    mainSashForm.setLayoutData(mainSashFormGridData);
    datasFlowViewSashForm = new SashForm(mainSashForm, SWT.SMOOTH | SWT.HORIZONTAL | SWT.BORDER);
    datasFlowViewSashForm.setBackgroundMode(SWT.INHERIT_FORCE);
    initBackgroundComponents();
    if (WindowSystem.isGTK()) {
        datasFlowViewSashForm.setBackground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
    }
    // dropTargetOperationListener.addControl(datasFlowViewSashForm);
    // datasFlowViewSashForm.addControlListener(new ControlListener() {
    //
    // public void controlMoved(ControlEvent e) {
    // }
    //
    // public void controlResized(ControlEvent e) {
    // createBgImages();
    // updateBackground(true, false);
    // }
    //
    // });
    /* Create the tabs */
    String dbmsId = null;
    if (mapperModel.getInputDataMapTables() != null && !mapperModel.getInputDataMapTables().isEmpty()) {
        InputTable input = mapperModel.getInputDataMapTables().get(0);
        if (input.getMetadataTable() != null) {
            dbmsId = input.getMetadataTable().getDbms();
        }
    }
    tabFolderEditors = new TabFolderEditors(mainSashForm, SWT.BORDER, mapperManager, dbmsId);
    createInputZoneWithTables(mapperModel, uiManager, display);
    createVarsZoneWithTables(mapperModel, display);
    createOutputZoneWithTables(mapperModel, uiManager, display);
    mapperManager.initInternalData();
    uiManager.parseAllExpressionsForAllTables();
    mapperManager.getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
    this.draggingInfosPopup = DraggingInfosPopup.getNewShell(this.mapperUIParent.getShell());
    configureZoneScrollBars(display);
    int[] weightsDatasFlowViewSashForm = uiProperties.getWeightsDatasFlowViewSashForm();
    datasFlowViewSashForm.setWeights(weightsDatasFlowViewSashForm.length != 0 ? weightsDatasFlowViewSashForm : ExternalDbMapUiProperties.DEFAULT_WEIGHTS_DATAS_FLOW_SASH_FORM);
    int[] weightsMainSashForm = uiProperties.getWeightsMainSashForm();
    mainSashForm.setWeights(weightsMainSashForm.length != 0 ? weightsMainSashForm : ExternalDbMapUiProperties.DEFAULT_WEIGHTS_MAIN_SASH_FORM);
    new FooterComposite(this.mapperUIParent, SWT.NONE, mapperManager);
    if (WindowSystem.isGTK()) {
        // resize especially for GTK
        new AsynchronousThreading(1000, false, display, new Runnable() {

            public void run() {
                resizeNotMinimizedTablesAtExpandedSize(display);
                mapperUIParent.getShell().layout();
            }
        }).start();
    }
    if (WindowSystem.isWIN32()) {
        List<DataMapTableView> inputsTablesView = uiManager.getInputsTablesView();
        for (DataMapTableView view : inputsTablesView) {
            ((InputDataMapTableView) view).refreshLabelForJoinDropDown();
        }
    }
    selectFirstInOutTablesView();
    mapperManager.getUiManager().refreshSqlExpression();
}
Also used : TabFolderEditors(org.talend.designer.dbmap.ui.tabs.TabFolderEditors) FooterComposite(org.talend.designer.dbmap.ui.footer.FooterComposite) InputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView) UIManager(org.talend.designer.dbmap.managers.UIManager) InputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) ExternalDbMapUiProperties(org.talend.designer.dbmap.external.data.ExternalDbMapUiProperties) AsynchronousThreading(org.talend.commons.ui.runtime.thread.AsynchronousThreading) SashForm(org.eclipse.swt.custom.SashForm) InputTable(org.talend.designer.dbmap.model.table.InputTable) GridLayout(org.eclipse.swt.layout.GridLayout) DropTargetOperationListener(org.talend.designer.abstractmap.ui.listener.DropTargetOperationListener) GridData(org.eclipse.swt.layout.GridData) Display(org.eclipse.swt.widgets.Display)

Example 2 with DropTargetOperationListener

use of org.talend.designer.abstractmap.ui.listener.DropTargetOperationListener in project tdi-studio-se by Talend.

the class MapperUI method createCompositeContent.

public void createCompositeContent(MapperModel mapperModel) {
    // long time1 = System.currentTimeMillis();
    // CommandStack commandStack = new CommandStackForComposite(this.mapperUIParent);
    // mapperManager.setCommandStack(commandStack);
    updateBackgroundEnabled = false;
    List<? extends IConnection> inConnections = mapperManager.getAbstractMapComponent().getIncomingConnections();
    List<? extends IConnection> outConnections = mapperManager.getAbstractMapComponent().getOutgoingConnections();
    // see bug 7471, record the precolumns value
    for (IConnection conn : inConnections) {
        conn.getMetadataTable();
        if (conn.getMetadataTable() != null) {
            List<IMetadataColumn> inputColumns = conn.getMetadataTable().getListColumns();
            for (IMetadataColumn inputColumn : inputColumns) {
                Set<String> columnSet = preColumnSet.get(conn);
                if (columnSet == null) {
                    columnSet = new HashSet<String>();
                    preColumnSet.put(conn, columnSet);
                }
                columnSet.add(inputColumn.getLabel());
                preColumnSet.put(conn, columnSet);
            }
        }
    }
    for (IConnection conn : outConnections) {
        if (conn.getMetadataTable() != null) {
            List<IMetadataColumn> outputColumns = conn.getMetadataTable().getListColumns();
            for (IMetadataColumn outputColumn : outputColumns) {
                Set<String> columnSet = preColumnSet.get(conn);
                if (columnSet == null) {
                    columnSet = new HashSet<String>();
                    preColumnSet.put(conn, columnSet);
                }
                columnSet.add(outputColumn.getLabel());
                preColumnSet.put(conn, columnSet);
            }
        }
    }
    final UIManager uiManager = mapperManager.getUiManager();
    final ExternalMapperUiProperties uiProperties = uiManager.getUiProperties();
    addParentListeners(uiManager, uiProperties);
    bgColorLinksZone = ColorProviderMapper.getColor(ColorInfo.COLOR_BACKGROUND_LINKS_ZONE);
    GridLayout parentLayout = new GridLayout(1, true);
    mapperUIParent.setLayout(parentLayout);
    addKeyListener(uiManager, display);
    addBackgroundRefreshLimiters(display);
    this.dropTargetOperationListener = new DropTargetOperationListener(mapperManager);
    dropTargetOperationListener.addControl(this.mapperUIParent.getShell());
    mainSashForm = new SashForm(mapperUIParent, SWT.SMOOTH | SWT.VERTICAL);
    GridData mainSashFormGridData = new GridData(GridData.FILL_BOTH);
    mainSashForm.setLayoutData(mainSashFormGridData);
    datasFlowViewSashForm = new SashForm(mainSashForm, SWT.SMOOTH | SWT.HORIZONTAL | SWT.BORDER);
    datasFlowViewSashForm.setBackgroundMode(SWT.INHERIT_FORCE);
    initBackgroundComponents();
    if (WindowSystem.isGTK()) {
        datasFlowViewSashForm.setBackground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
    }
    // dropTargetOperationListener.addControl(datasFlowViewSashForm);
    // datasFlowViewSashForm.addControlListener(new ControlListener() {
    //
    // public void controlMoved(ControlEvent e) {
    // }
    //
    // public void controlResized(ControlEvent e) {
    // createBgImages();
    // updateBackground(true, false);
    // }
    //
    // });
    /* Create the tabs */
    tabFolderEditors = new TabFolderEditors(mainSashForm, SWT.BORDER, mapperManager);
    createInputZoneWithTables(mapperModel, display);
    createVarsZoneWithTables(mapperModel, display);
    createOutputZoneWithTables(mapperModel, uiManager, display);
    uiManager.parseAllExpressionsForAllTables();
    mapperManager.getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
    mapperManager.getProblemsManager().checkLookupExpressionProblem();
    this.draggingInfosPopup = DraggingInfosPopup.getNewShell(this.mapperUIParent.getShell());
    configureZoneScrollBars(display);
    int[] weightsDatasFlowViewSashForm = uiProperties.getWeightsDatasFlowViewSashForm();
    datasFlowViewSashForm.setWeights(weightsDatasFlowViewSashForm.length != 0 ? weightsDatasFlowViewSashForm : ExternalMapperUiProperties.DEFAULT_WEIGHTS_DATAS_FLOW_SASH_FORM);
    int[] weightsMainSashForm = uiProperties.getWeightsMainSashForm();
    weightsMainSashForm = weightsMainSashForm.length != 0 ? weightsMainSashForm : ExternalMapperUiProperties.DEFAULT_WEIGHTS_MAIN_SASH_FORM;
    mainSashForm.setWeights(weightsMainSashForm);
    footerComposite = new FooterComposite(this.mapperUIParent, SWT.NONE, mapperManager);
    selectFirstInOutTablesView();
    updateBackgroundEnabled = true;
    updateBackground(true, false);
// List<DataMapTableView> inputsTablesView = uiManager.getInputsTablesView();
// for (DataMapTableView table : inputsTablesView) {
//
// table.showTableGlobalMap(false);
// table.showTableGlobalMap(true);
//
// // table.updateGridDataHeightForTableGlobalMap();
// // table.resizeAtExpandedSize();
// }
}
Also used : TabFolderEditors(org.talend.designer.mapper.ui.tabs.TabFolderEditors) FooterComposite(org.talend.designer.mapper.ui.footer.FooterComposite) UIManager(org.talend.designer.mapper.managers.UIManager) IConnection(org.talend.core.model.process.IConnection) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) DropTargetOperationListener(org.talend.designer.abstractmap.ui.listener.DropTargetOperationListener) ExternalMapperUiProperties(org.talend.designer.mapper.external.data.ExternalMapperUiProperties) GridData(org.eclipse.swt.layout.GridData)

Aggregations

SashForm (org.eclipse.swt.custom.SashForm)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 DropTargetOperationListener (org.talend.designer.abstractmap.ui.listener.DropTargetOperationListener)2 Display (org.eclipse.swt.widgets.Display)1 AsynchronousThreading (org.talend.commons.ui.runtime.thread.AsynchronousThreading)1 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)1 IConnection (org.talend.core.model.process.IConnection)1 ExternalDbMapUiProperties (org.talend.designer.dbmap.external.data.ExternalDbMapUiProperties)1 UIManager (org.talend.designer.dbmap.managers.UIManager)1 InputTable (org.talend.designer.dbmap.model.table.InputTable)1 FooterComposite (org.talend.designer.dbmap.ui.footer.FooterComposite)1 TabFolderEditors (org.talend.designer.dbmap.ui.tabs.TabFolderEditors)1 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)1 InputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView)1 OutputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)1 ExternalMapperUiProperties (org.talend.designer.mapper.external.data.ExternalMapperUiProperties)1 UIManager (org.talend.designer.mapper.managers.UIManager)1 FooterComposite (org.talend.designer.mapper.ui.footer.FooterComposite)1 TabFolderEditors (org.talend.designer.mapper.ui.tabs.TabFolderEditors)1