Search in sources :

Example 11 with UIManager

use of org.talend.designer.dbmap.managers.UIManager in project tdi-studio-se by Talend.

the class FooterComposite method createComponents.

/**
     * DOC amaumont Comment method "createComponents".
     */
private void createComponents() {
    final UIManager uiManager = mapperManager.getUiManager();
    GridData footerCompositeGridData = new GridData(GridData.FILL_HORIZONTAL);
    this.setLayoutData(footerCompositeGridData);
    FormLayout formLayout = new FormLayout();
    formLayout.spacing = 15;
    this.setLayout(formLayout);
    Button okButton = new Button(this, SWT.NONE);
    //$NON-NLS-1$
    okButton.setText(Messages.getString("FooterComposite.button.OK"));
    FormData okFormData = new FormData();
    okFormData.width = 100;
    okButton.setLayoutData(okFormData);
    okButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            uiManager.closeMapper(SWT.OK);
        }
    });
    // final Button applyButton = new Button(this, SWT.NONE);
    // applyButton.setText("Apply");
    // FormData applyFormData = new FormData();
    // applyButton.setLayoutData(applyFormData);
    // applyButton.addSelectionListener(new SelectionListener() {
    //
    // public void widgetDefaultSelected(SelectionEvent e) {
    // }
    //
    // public void widgetSelected(SelectionEvent e) {
    // MessageBox messageBox = new MessageBox(uiManager.retrieveShellParent(footerComposite));
    // messageBox.setText("Info");
    // messageBox.setMessage("Not implemented yet !");
    // messageBox.open();
    // }
    //
    // });
    Button cancelButton = new Button(this, SWT.NONE);
    //$NON-NLS-1$
    cancelButton.setText(Messages.getString("FooterComposite.button.Cancel"));
    cancelButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            uiManager.closeMapper(SWT.CANCEL);
        }
    });
    FormData cancelFormData = new FormData();
    cancelFormData.width = 100;
    cancelButton.setLayoutData(cancelFormData);
    // applyFormData.right = new FormAttachment(100);
    // cancelFormData.right = new FormAttachment(applyButton, -5);
    cancelFormData.right = new FormAttachment(100, -5);
    okFormData.right = new FormAttachment(cancelButton, -5);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) UIManager(org.talend.designer.dbmap.managers.UIManager) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 12 with UIManager

use of org.talend.designer.dbmap.managers.UIManager in project tdi-studio-se by Talend.

the class DataMapTableView method changeSize.

/**
     * 
     * Change size of the DataMapTableView.
     * 
     * @param newWidth
     * @param newHeight
     * @param refreshNow refresh background with links if true
     * @param recalculateParentSize
     */
public void changeSize(Point newSize, boolean refreshNow, boolean recalculateParentSize) {
    if (newSize.y < getHeaderHeight()) {
        newSize.y = getHeaderHeight();
    }
    FormData formData = (FormData) DataMapTableView.this.getLayoutData();
    formData.width = newSize.x;
    formData.height = newSize.y;
    DataMapTableView.this.setSize(newSize);
    UIManager uiManager = mapperManager.getUiManager();
    if (recalculateParentSize) {
        uiManager.resizeTablesZoneViewAtComputedSize(getZone());
    }
    if (refreshNow) {
        uiManager.refreshBackground(true, false);
    } else {
        uiManager.refreshBackground(true, TIME_BEFORE_NEW_REFRESH_BACKGROUND, true);
    }
// dataMapTableView.redraw();
// dataMapTableView.layout(true, true);
}
Also used : FormData(org.eclipse.swt.layout.FormData) UIManager(org.talend.designer.dbmap.managers.UIManager)

Example 13 with UIManager

use of org.talend.designer.dbmap.managers.UIManager in project tdi-studio-se by Talend.

the class CompleteDropTargetListener method updateExpressionsOfInsertedEntries.

/**
     * DOC amaumont Comment method "updateExpressionsOfInsertedEntries".
     * 
     * @param uiManager
     * @param currentLanguage
     * @param metadataEditorView
     * @param currentIndex
     * @param sourceEntriesOfEntriesBeingAdded
     * @param targetTableIsConstraintsTable
     * @param tableViewerCreatorTarget
     * @param metadataColumnsBeingAdded
     * @param metadataEditorEvent
     */
@SuppressWarnings("unchecked")
private void updateExpressionsOfInsertedEntries(IDbLanguage currentLanguage, MetadataTableEditorView metadataEditorView, int currentIndex, ArrayList<ITableEntry> sourceEntriesOfEntriesBeingAdded, boolean targetTableIsConstraintsTable, TableViewerCreator tableViewerCreatorTarget, ArrayList<IMetadataColumn> metadataColumnsBeingAdded) // , MetadataEditorEvent metadataEditorEvent
{
    UIManager uiManager = getUiManager();
    if (metadataEditorView != null && !targetTableIsConstraintsTable) {
        metadataEditorView.getMetadataTableEditor().addAll(currentIndex, metadataColumnsBeingAdded);
        // metadataEditorEvent.indexStartInsert = currentIndex;
        // IAction action = MetadataEditorActionFactory.getInstance().getAction(metadataEditorView,
        // metadataEditorEvent);
        // action.run(metadataEditorEvent);
        Zone zoneTarget = getMapperManager().retrieveDataMapTableView(tableViewerCreatorTarget.getTable()).getZone();
        List<IColumnEntry> lastCreatedTableEntries = uiManager.getLastCreatedInOutColumnEntries();
        for (int i = 0; i < lastCreatedTableEntries.size(); i++) {
            ITableEntry tableEntrySource = sourceEntriesOfEntriesBeingAdded.get(i);
            ITableEntry dataMapTableEntry = lastCreatedTableEntries.get(i);
            if (zoneTarget == Zone.INPUTS) {
                setDefaultOperator((InputColumnTableEntry) dataMapTableEntry);
            }
            DataMapTableView dataMapTableView = getMapperManager().retrieveIDataMapTableView(tableEntrySource.getParent());
            Zone zoneSource = dataMapTableView.getZone();
            String location = null;
            if (zoneSource == Zone.OUTPUTS) {
                location = tableEntrySource.getExpression();
            } else {
                location = currentLanguage.getLocation(tableEntrySource.getParentName(), tableEntrySource.getName());
            }
            if (location != null) {
                //$NON-NLS-1$
                dataMapTableEntry.setExpression(location + " ");
            }
        }
    }
    tableViewerCreatorTarget.getTableViewer().refresh();
    List<ITableEntry> refreshedTableEntriesList = tableViewerCreatorTarget.getInputList();
    for (ITableEntry tableEntry : refreshedTableEntriesList) {
        uiManager.parseExpression(tableEntry.getExpression(), tableEntry, false, true, false);
    }
}
Also used : Zone(org.talend.designer.dbmap.ui.visualmap.zone.Zone) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) UIManager(org.talend.designer.dbmap.managers.UIManager) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) Point(org.eclipse.swt.graphics.Point)

Example 14 with UIManager

use of org.talend.designer.dbmap.managers.UIManager in project tdi-studio-se by Talend.

the class AliasDialog method open.

public boolean open() {
    UIManager uiManager = this.mapperManager.getUiManager();
    // String inputTableName = getCurrentSelectedInputTableView().getDataMapTable().getName();
    //
    //$NON-NLS-1$
    String proposedAlias = "";
    IInputValidator inputValidator = new //$NON-NLS-1$
    IInputValidator() {

        public String isValid(String newText) {
            String selectedPhysicalTable = aliasInternalDialog.getTableName();
            if (newText.length() == 0 && isSameAsVisibleTableName(selectedPhysicalTable)) {
                //$NON-NLS-1$
                return Messages.getString("AliasDialog.aliasAlreadyExists", new Object[] { selectedPhysicalTable });
            }
            if (selectedPhysicalTable == null || selectedPhysicalTable.length() == 0) {
                //$NON-NLS-1$
                return Messages.getString("AliasDialog.TableMustBeSelected");
            }
            if (isSameAsVisibleTableName(newText)) {
                //$NON-NLS-1$
                return Messages.getString("AliasDialog.aliasAlreadyExists", new Object[] { newText });
            }
            if (KeywordsValidator.isKeyword(newText) || KeywordsValidator.isSqlKeyword(newText)) {
                //$NON-NLS-1$
                return Messages.getString("AliasDialog.inputValid");
            }
            return null;
        }
    };
    aliasInternalDialog = new AliasInternalDialog(mapperManager.getUiManager().getShell(), Messages.getString(//$NON-NLS-1$
    "AliasDialog.addNewAlias"), Messages.getString("AliasDialog.typeAliasOfTable"), proposedAlias, //$NON-NLS-1$
    inputValidator);
    int response = aliasInternalDialog.open();
    if (response == InputDialog.OK) {
        this.tableName = aliasInternalDialog.getTableName();
        this.alias = aliasInternalDialog.getValue();
        return true;
    }
    return false;
}
Also used : UIManager(org.talend.designer.dbmap.managers.UIManager) IInputValidator(org.eclipse.jface.dialogs.IInputValidator)

Example 15 with UIManager

use of org.talend.designer.dbmap.managers.UIManager in project tdi-studio-se by Talend.

the class ToolbarZone method addCommonsComponentListeners.

/**
     * DOC amaumont Comment method "addListeners".
     */
private void addCommonsComponentListeners() {
    final UIManager uiManager = mapperManager.getUiManager();
    upTableButton.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            uiManager.moveSelectedTable(getZone(), true);
        }
    });
    downTableButton.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            uiManager.moveSelectedTable(getZone(), false);
        }
    });
    minimizeButton.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            setMinimizeButtonState(!minimized);
            uiManager.minimizeAllTables(getZone(), minimized, minimizeButton);
        }
    });
}
Also used : Listener(org.eclipse.swt.widgets.Listener) UIManager(org.talend.designer.dbmap.managers.UIManager) Event(org.eclipse.swt.widgets.Event)

Aggregations

UIManager (org.talend.designer.dbmap.managers.UIManager)15 AbstractUIManager (org.talend.designer.abstractmap.managers.AbstractUIManager)6 Point (org.eclipse.swt.graphics.Point)5 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)5 DraggedData (org.talend.designer.abstractmap.ui.dnd.DraggedData)4 DraggingInfosPopup (org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup)4 FormData (org.eclipse.swt.layout.FormData)3 Event (org.eclipse.swt.widgets.Event)3 Listener (org.eclipse.swt.widgets.Listener)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 Rectangle (org.eclipse.swt.graphics.Rectangle)2 FormLayout (org.eclipse.swt.layout.FormLayout)2 GridData (org.eclipse.swt.layout.GridData)2 Display (org.eclipse.swt.widgets.Display)2 InputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView)2 OutputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)2 ArrayList (java.util.ArrayList)1 IInputValidator (org.eclipse.jface.dialogs.IInputValidator)1 ICellEditorListener (org.eclipse.jface.viewers.ICellEditorListener)1