Search in sources :

Example 16 with MetadataTableEditorView

use of org.talend.core.ui.metadata.editor.MetadataTableEditorView in project tdi-studio-se by Talend.

the class MapperManager method isTableOfInputMetadataEditor.

/**
     * DOC amaumont Comment method "isTableOfInputMetadataEditor".
     * 
     * @param table
     * @return
     */
public boolean isTableOfInputMetadataEditor(Table table) {
    MetadataTableEditorView inputEditorView = uiManager.getInputMetaEditorView();
    Table tableEditorView = inputEditorView.getTable();
    return tableEditorView == table;
}
Also used : IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) AbstractDataMapTable(org.talend.designer.dbmap.model.table.AbstractDataMapTable) OutputTable(org.talend.designer.dbmap.model.table.OutputTable) InputTable(org.talend.designer.dbmap.model.table.InputTable) Table(org.eclipse.swt.widgets.Table) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) VarsTable(org.talend.designer.dbmap.model.table.VarsTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView)

Example 17 with MetadataTableEditorView

use of org.talend.core.ui.metadata.editor.MetadataTableEditorView in project tdi-studio-se by Talend.

the class UIManager method refreshInOutTableAndMetaTable.

/**
     * 
     * DOC amaumont Comment method "refreshInOutTableAndMetaTable".
     * 
     * @param dataMapTableView
     */
private void refreshInOutTableAndMetaTable(DataMapTableView dataMapTableView) {
    IMetadataTable metadataTableTarget = ((AbstractInOutTable) dataMapTableView.getDataMapTable()).getMetadataTable();
    dataMapTableView.getTableViewerCreatorForColumns().getTableViewer().refresh();
    MetadataTableEditorView metadataEditorView = getMetadataEditorView(dataMapTableView.getZone());
    if (metadataEditorView != null && metadataEditorView.getMetadataTableEditor() != null && metadataEditorView.getMetadataTableEditor().getMetadataTable() == metadataTableTarget) {
        metadataEditorView.getTableViewerCreator().getTableViewer().refresh();
        metadataEditorView.getTableViewerCreator().refreshTableEditorControls();
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) AbstractInOutTable(org.talend.designer.dbmap.model.table.AbstractInOutTable) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView) AbstractMetadataTableEditorView(org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView)

Example 18 with MetadataTableEditorView

use of org.talend.core.ui.metadata.editor.MetadataTableEditorView in project tdi-studio-se by Talend.

the class MainConnectionComposite method addComponents.

@Override
public void addComponents(boolean forceRedraw) {
    if (conSchema()) {
        disposeChildren();
        curRowSize = 0;
        List<? extends IElementParameter> listParam = ((Connection) elem).getSource().getElementParameters();
        generator.initController(this);
        for (IElementParameter cur : listParam) {
            if (cur.getCategory() == this.section) {
                if ((cur.getFieldType() == EParameterFieldType.SCHEMA_TYPE || cur.getFieldType() == EParameterFieldType.SCHEMA_REFERENCE) && (cur.getContext().equals(((Connection) elem).getConnectorName()))) {
                    AbstractElementPropertySectionController contorller = generator.getController(EParameterFieldType.SCHEMA_TYPE, this);
                    contorller.createControl(composite, cur, 1, 1, 0, null);
                }
            }
        }
        if (((Connection) elem).getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
            IMetadataTable outputMetaTable = ((Connection) elem).getMetadataTable();
            if (outputMetaTable != null && this.section == EComponentCategory.BASIC) {
                // Composite compositeEditorView = new Composite(composite, SWT.BORDER);
                // compositeEditorView.setLayoutData(data);
                metadataTableEditor = new MetadataTableEditor(outputMetaTable, //$NON-NLS-1$
                "Schema from " + ((Connection) elem).getSource().getElementName() + //$NON-NLS-1$
                " output ");
                metadataTableEditorView = new MetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, true, false, true, false);
                MetadataDialog.initializeMetadataTableView(metadataTableEditorView, ((Connection) elem).getSource(), outputMetaTable);
                metadataTableEditorView.initGraphicComponents();
                metadataTableEditorView.getExtendedTableViewer().setCommandStack(getCommandStack());
                CustomTableManager.addCustomManagementToTable(metadataTableEditorView, true);
                Composite compositeEditorView = metadataTableEditorView.getMainComposite();
                Table table = metadataTableEditorView.getTable();
                FormData data = new FormData();
                data.left = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
                data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
                data.top = new FormAttachment(0, curRowSize + ITabbedPropertyConstants.VSPACE);
                // to correct bug of table growing indefinitly
                data.width = 300;
                /*
                     * On windows it will adjust automatically the size depends the number of columns. Seems this system
                     * doesn't work on linux
                     */
                // fix bug 3893.
                int tableHeight = 160;
                int maxTableHeight = table.getHeaderHeight() + 22 * table.getItemHeight();
                int rows = outputMetaTable.getListColumns().size();
                int currentHeightEditor = table.getHeaderHeight() + rows * table.getItemHeight() + 50;
                if (currentHeightEditor > tableHeight) {
                    tableHeight = currentHeightEditor;
                }
                if (currentHeightEditor > maxTableHeight) {
                    tableHeight = maxTableHeight;
                }
                // fix bug 3893.
                data.height = tableHeight;
                compositeEditorView.setLayoutData(data);
                // compositeEditorView.getParent().layout();
                // Table table = metadataTableEditorView.getTable();
                // int currentHeightEditor = table.getHeaderHeight() + outputMetaTable.getListColumns().size()
                // * table.getItemHeight() + table.getItemHeight() + 50;
                curRowSize = tableHeight + ITabbedPropertyConstants.VSPACE + curRowSize;
            }
        }
        super.addComponents(forceRedraw, false, curRowSize);
    } else if (conIf()) {
        super.addComponents(forceRedraw);
    } else if (resumingIf()) {
        super.addComponents(forceRedraw);
    } else {
        disposeChildren();
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) FormData(org.eclipse.swt.layout.FormData) MetadataTableEditor(org.talend.core.ui.metadata.editor.MetadataTableEditor) Table(org.eclipse.swt.widgets.Table) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MultipleThreadDynamicComposite(org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite) Composite(org.eclipse.swt.widgets.Composite) AbstractElementPropertySectionController(org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController) Connection(org.talend.designer.core.ui.editor.connections.Connection) IElementParameter(org.talend.core.model.process.IElementParameter) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 19 with MetadataTableEditorView

use of org.talend.core.ui.metadata.editor.MetadataTableEditorView in project tdi-studio-se by Talend.

the class MainConnectionSection method addComponents.

@Override
public void addComponents(boolean forceRedraw) {
    if (conSchema()) {
        disposeChildren();
        curRowSize = 0;
        List<? extends IElementParameter> listParam = ((Connection) elem).getSource().getElementParameters();
        generator.initController(this);
        for (IElementParameter cur : listParam) {
            if ((cur.getFieldType() == EParameterFieldType.SCHEMA_TYPE || cur.getFieldType() == EParameterFieldType.SCHEMA_REFERENCE) && (cur.getContext().equals(((Connection) elem).getConnectorName()))) {
                AbstractElementPropertySectionController contorller = generator.getController(EParameterFieldType.SCHEMA_TYPE, this);
                contorller.createControl(composite, cur, 0, 0, 0, null);
            }
        }
        FormData data = new FormData();
        data.left = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
        data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
        data.top = new FormAttachment(0, curRowSize + ITabbedPropertyConstants.VSPACE);
        // to correct bug of table growing indefinitly
        data.width = 300;
        IMetadataTable outputMetaTable = ((Connection) elem).getMetadataTable();
        if (outputMetaTable != null) {
            // Composite compositeEditorView = new Composite(composite, SWT.BORDER);
            // compositeEditorView.setLayoutData(data);
            metadataTableEditor = new MetadataTableEditor(outputMetaTable, //$NON-NLS-1$
            "Schema from " + ((Connection) elem).getSource().getElementName() + //$NON-NLS-1$
            " output ");
            metadataTableEditorView = new MetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, true, false, true, false);
            MetadataDialog.initializeMetadataTableView(metadataTableEditorView, ((Connection) elem).getSource(), outputMetaTable);
            metadataTableEditorView.initGraphicComponents();
            metadataTableEditorView.getExtendedTableViewer().setCommandStack(getCommandStack());
            CustomTableManager.addCustomManagementToTable(metadataTableEditorView, true);
            Composite compositeEditorView = metadataTableEditorView.getMainComposite();
            compositeEditorView.setLayoutData(data);
            // compositeEditorView.getParent().layout();
            Table table = metadataTableEditorView.getTable();
            int currentHeightEditor = table.getHeaderHeight() + outputMetaTable.getListColumns().size() * table.getItemHeight() + table.getItemHeight() + 50;
            curRowSize = currentHeightEditor + ITabbedPropertyConstants.VSPACE + curRowSize;
        }
        super.addComponents(forceRedraw, false);
    } else if (conIf()) {
        super.addComponents(forceRedraw);
    } else {
        disposeChildren();
    }
}
Also used : FormData(org.eclipse.swt.layout.FormData) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTableEditor(org.talend.core.ui.metadata.editor.MetadataTableEditor) Table(org.eclipse.swt.widgets.Table) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) Composite(org.eclipse.swt.widgets.Composite) AbstractElementPropertySectionController(org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController) Connection(org.talend.designer.core.ui.editor.connections.Connection) IElementParameter(org.talend.core.model.process.IElementParameter) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 20 with MetadataTableEditorView

use of org.talend.core.ui.metadata.editor.MetadataTableEditorView in project tdi-studio-se by Talend.

the class UIManager method refreshInOutTableAndMetaTable.

/**
     * 
     * DOC amaumont Comment method "refreshInOutTableAndMetaTable".
     * 
     * @param dataMapTableView
     */
private void refreshInOutTableAndMetaTable(DataMapTableView dataMapTableView) {
    IMetadataTable metadataTableTarget = ((AbstractInOutTable) dataMapTableView.getDataMapTable()).getMetadataTable();
    dataMapTableView.getTableViewerCreatorForColumns().getTableViewer().refresh();
    MetadataTableEditorView metadataEditorView = getMetadataEditorView(dataMapTableView.getZone());
    if (metadataEditorView != null && metadataEditorView.getMetadataTableEditor() != null && metadataEditorView.getMetadataTableEditor().getMetadataTable() == metadataTableTarget) {
        metadataEditorView.getTableViewerCreator().getTableViewer().refresh();
        metadataEditorView.getTableViewerCreator().refreshTableEditorControls();
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) AbstractMetadataTableEditorView(org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView)

Aggregations

MetadataTableEditorView (org.talend.core.ui.metadata.editor.MetadataTableEditorView)25 AbstractMetadataTableEditorView (org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView)14 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)12 ArrayList (java.util.ArrayList)7 Point (org.eclipse.swt.graphics.Point)7 Table (org.eclipse.swt.widgets.Table)6 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)6 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)6 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)6 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)6 FormAttachment (org.eclipse.swt.layout.FormAttachment)5 FormData (org.eclipse.swt.layout.FormData)5 IListenableListListener (org.talend.commons.utils.data.list.IListenableListListener)5 ListenableListEvent (org.talend.commons.utils.data.list.ListenableListEvent)5 MetadataTableEditor (org.talend.core.ui.metadata.editor.MetadataTableEditor)5 AbstractInOutTable (org.talend.designer.mapper.model.table.AbstractInOutTable)5 List (java.util.List)4 TableViewer (org.eclipse.jface.viewers.TableViewer)4 MetadataTable (org.talend.core.model.metadata.MetadataTable)4 OutputTable (org.talend.designer.dbmap.model.table.OutputTable)4