Search in sources :

Example 11 with AbstractElementPropertySectionController

use of org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController 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 12 with AbstractElementPropertySectionController

use of org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController 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)

Aggregations

AbstractElementPropertySectionController (org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController)12 IElementParameter (org.talend.core.model.process.IElementParameter)9 Composite (org.eclipse.swt.widgets.Composite)4 Node (org.talend.designer.core.ui.editor.nodes.Node)4 DualHashBidiMap (org.apache.commons.collections.bidimap.DualHashBidiMap)3 Point (org.eclipse.swt.graphics.Point)3 Control (org.eclipse.swt.widgets.Control)3 HashMap (java.util.HashMap)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 FormAttachment (org.eclipse.swt.layout.FormAttachment)2 FormData (org.eclipse.swt.layout.FormData)2 Table (org.eclipse.swt.widgets.Table)2 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)2 INode (org.talend.core.model.process.INode)2 MetadataTableEditor (org.talend.core.ui.metadata.editor.MetadataTableEditor)2 MetadataTableEditorView (org.talend.core.ui.metadata.editor.MetadataTableEditorView)2 Connection (org.talend.designer.core.ui.editor.connections.Connection)2 GroupController (org.talend.designer.core.ui.editor.properties.controllers.GroupController)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1