Search in sources :

Example 66 with Control

use of org.eclipse.swt.widgets.Control in project tdi-studio-se by Talend.

the class DynamicTabbedPropertySection method addComponents.

/**
     * Initialize all components for the defined section for this node.
     */
public void addComponents(boolean forceRedraw, boolean reInitialize) {
    registerListenerForRefreshingSection();
    checkErrorsWhenViewRefreshed = true;
    int heightSize = 0, maxRowSize = 0, nbInRow, numInRow;
    int maxRow;
    List<? extends IElementParameter> listParam = elem.getElementParameters();
    oldQueryStoreType = (String) elem.getPropertyValue(EParameterName.QUERYSTORE_TYPE.getName());
    if (oldQueryStoreType != null) {
        if (oldQueryStoreType.equals(EmfComponent.REPOSITORY)) {
            showQueryStoreRepositoryList(true);
            updateRepositoryList();
        } else {
            showQueryStoreRepositoryList(false);
        }
    }
    IElementParameter param = elem.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
    if (param != null) {
        oldPropertyType = (String) param.getValue();
        if (param.isShow(elem.getElementParameters())) {
            if (oldPropertyType.equals(EmfComponent.REPOSITORY)) {
                showPropertyRepositoryList(true, false);
                updateRepositoryList();
            } else {
                showPropertyRepositoryList(false, false);
            }
        } else {
            showPropertyRepositoryList(false, false);
        }
    }
    // param = elem.getElementParameter(extraPropertyTypeName);
    if (param != null) {
        oldPropertyType = (String) param.getValue();
        if (param.isShow(elem.getElementParameters())) {
            if (oldPropertyType.equals(EmfComponent.REPOSITORY)) {
                showPropertyRepositoryList(true, true);
                updateRepositoryList();
            } else {
                showPropertyRepositoryList(false, true);
            }
        } else {
            showPropertyRepositoryList(false, true);
        }
    }
    oldProcessType = (String) elem.getPropertyValue(EParameterName.PROCESS_TYPE_PROCESS.getName());
    if (oldProcessType != null) {
        String[] list = elem.getElementParameter(EParameterName.PROCESS_TYPE_PROCESS.getName()).getListItemsDisplayName();
        if ((oldProcessType.equals("NO_PROCESS") || (list.length == 0))) {
            //$NON-NLS-1$
            updateProcessList();
            updateContextList();
            if (elem instanceof Node) {
                ((Node) elem).checkAndRefreshNode();
            }
        }
    }
    if (!forceRedraw) {
        boolean needRedraw = false;
        for (IElementParameter elementParameter : elem.getElementParametersWithChildrens()) {
            if (elementParameter.getCategory().equals(section) && (elementParameter.getFieldType() != EParameterFieldType.SCHEMA_TYPE) && (elementParameter.getFieldType() != EParameterFieldType.SCHEMA_REFERENCE) && (elementParameter.getFieldType() != EParameterFieldType.QUERYSTORE_TYPE)) {
                // if the component must be displayed, then check if the
                // control exists or not.
                boolean show = elementParameter.isShow(elem.getElementParameters());
                Object control;
                if (elementParameter.getParentParameter() == null) {
                    control = this.hashCurControls.get(elementParameter.getName());
                } else {
                    control = this.hashCurControls.get(//$NON-NLS-1$
                    elementParameter.getParentParameter().getName() + ":" + elementParameter.getName());
                }
                if ((control == null && show) || (control != null && !show)) {
                    needRedraw = true;
                    break;
                // System.out.println(elementParameter.getName() + "
                // need redraw");
                }
            }
        }
        if (!needRedraw) {
            // System.out.println("no need redraw");
            return;
        }
    }
    Control lastControl = null;
    if (reInitialize) {
        if (currentComponent != null && composite != null) {
            Control[] ct = composite.getChildren();
            for (Control element : ct) {
                element.dispose();
            }
        }
    } else {
        // Control[] ct = composite.getChildren();
        // int curY = 0, maxY = 0;
        // for (int i = 0; i < ct.length; i++) {
        // curY = ct[i].getLocation().y + ct[i].computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
        // if (curY > maxY) {
        // maxY = curY;
        // }
        // }
        heightSize = curRowSize;
    }
    hashCurControls = new DualHashBidiMap();
    maxRow = 0;
    for (int i = 0; i < listParam.size(); i++) {
        if (listParam.get(i).getCategory() == section) {
            if (listParam.get(i).getNumRow() > maxRow && listParam.get(i).isShow(listParam)) {
                maxRow = listParam.get(i).getNumRow();
            }
        }
    }
    generator.initController(this);
    // System.out.println("********************** NEW ADDCOMPONENTS
    // **********************");
    TabbedPropertyComposite tabbedPropertyComposite = this.getTabbedPropertyComposite();
    int additionalHeightSize = 0;
    if (tabbedPropertyComposite != null && (!(elem instanceof org.talend.designer.core.ui.editor.connections.Connection))) {
        boolean hasDynamicRow = false;
        for (int i = 0; i < listParam.size(); i++) {
            IElementParameter curParam = listParam.get(i);
            if (curParam.getCategory() == section) {
                if (curParam.getFieldType() != EParameterFieldType.TECHNICAL) {
                    if (curParam.isShow(listParam)) {
                        AbstractElementPropertySectionController controller = generator.getController(curParam.getFieldType(), this);
                        if (controller == null) {
                            continue;
                        }
                        if (controller.hasDynamicRowSize()) {
                            hasDynamicRow = true;
                            break;
                        }
                    }
                }
            }
        }
        if (hasDynamicRow) {
            additionalHeightSize = estimatePropertyHeightSize(maxRow, listParam, tabbedPropertyComposite);
        }
    }
    //$NON-NLS-1$
    long lastTime = TimeMeasure.timeSinceBegin("DTP:refresh:" + getCurrentComponent());
    curRowSize = 0;
    for (int curRow = 1; curRow <= maxRow; curRow++) {
        maxRowSize = 0;
        nbInRow = 0;
        for (int i = 0; i < listParam.size(); i++) {
            IElementParameter curParam = listParam.get(i);
            if (curParam.getCategory() == section) {
                if (curParam.getNumRow() == curRow && curParam.isShow(listParam) && (curParam.getFieldType() != EParameterFieldType.TECHNICAL)) {
                    nbInRow++;
                }
            }
        }
        numInRow = 0;
        lastControl = null;
        for (int i = 0; i < listParam.size(); i++) {
            IElementParameter curParam = listParam.get(i);
            if (curParam.getCategory() == section) {
                if (curParam.getNumRow() == curRow && (curParam.getFieldType() != EParameterFieldType.TECHNICAL)) {
                    // field:"+curParam.getField());
                    if (curParam.isShow(listParam)) {
                        // System.out.println("show:" + curParam.getName()+
                        // " field:"+curParam.getField());
                        numInRow++;
                        AbstractElementPropertySectionController controller = generator.getController(curParam.getFieldType(), this);
                        if (controller == null) {
                            continue;
                        }
                        if (controller.hasDynamicRowSize()) {
                            controller.setAdditionalHeightSize(additionalHeightSize);
                        }
                        lastControl = controller.createControl(composite, curParam, numInRow, nbInRow, heightSize, lastControl);
                        //$NON-NLS-1$
                        lastTime = TimeMeasure.timeSinceBegin("DTP:refresh:" + getCurrentComponent()) - lastTime;
                        if ((DynamicTabbedPropertySection.DEBUG_TIME) && !getCurrentComponent().equals("Job")) {
                            //$NON-NLS-1$
                            System.out.println(//$NON-NLS-1$ //$NON-NLS-2$
                            "DTP;create:" + curParam.getFieldType().getName() + ";" + getCurrentComponent() + ";" + //$NON-NLS-1$
                            lastTime);
                        }
                        if (curRowSize > maxRowSize) {
                            maxRowSize = curRowSize;
                        }
                    }
                }
            }
        }
        heightSize += maxRowSize;
    }
    resizeScrolledComposite();
}
Also used : TabbedPropertyComposite(org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) SalesforceSchemaConnection(org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection) GenericSchemaConnection(org.talend.core.model.metadata.builder.connection.GenericSchemaConnection) PositionalFileConnection(org.talend.core.model.metadata.builder.connection.PositionalFileConnection) RegexpFileConnection(org.talend.core.model.metadata.builder.connection.RegexpFileConnection) IConnection(org.talend.core.model.process.IConnection) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) HeaderFooterConnection(org.talend.core.model.metadata.builder.connection.HeaderFooterConnection) XmlFileConnection(org.talend.core.model.metadata.builder.connection.XmlFileConnection) QueriesConnection(org.talend.core.model.metadata.builder.connection.QueriesConnection) LDAPSchemaConnection(org.talend.core.model.metadata.builder.connection.LDAPSchemaConnection) FileExcelConnection(org.talend.core.model.metadata.builder.connection.FileExcelConnection) Point(org.eclipse.swt.graphics.Point) Control(org.eclipse.swt.widgets.Control) DualHashBidiMap(org.apache.commons.collections.bidimap.DualHashBidiMap) AbstractElementPropertySectionController(org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController) IElementParameter(org.talend.core.model.process.IElementParameter) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 67 with Control

use of org.eclipse.swt.widgets.Control in project tdi-studio-se by Talend.

the class AS400CheckController method estimateRowSize.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController#estimateRowSize
     * (org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter)
     */
@Override
public int estimateRowSize(Composite subComposite, final IElementParameter param) {
    // TODO Auto-generated method stub
    final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, new IControlCreator() {

        @Override
        public Control createControl(Composite parent, int style) {
            return getWidgetFactory().createButton(parent, param.getDisplayName(), SWT.CHECK);
        }
    });
    Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    dField.getLayoutControl().dispose();
    return initialSize.y + ITabbedPropertyConstants.VSPACE;
}
Also used : IControlCreator(org.eclipse.jface.fieldassist.IControlCreator) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) DecoratedField(org.eclipse.jface.fieldassist.DecoratedField) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point)

Example 68 with Control

use of org.eclipse.swt.widgets.Control in project tdi-studio-se by Talend.

the class SetupProcessDependenciesRoutinesDialog method createContents.

@Override
protected Control createContents(Composite parent) {
    Control contents = super.createContents(parent);
    updateButtons();
    return contents;
}
Also used : Control(org.eclipse.swt.widgets.Control)

Example 69 with Control

use of org.eclipse.swt.widgets.Control in project tdi-studio-se by Talend.

the class ReconcilerViewer method initializeViewer.

protected void initializeViewer(IDocument document) {
    fAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
    setDocument(document);
    installViewerConfiguration();
    setEditable(true);
    Font font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
    getTextWidget().setFont(font);
    Control control = getControl();
    GridData data = new GridData(GridData.FILL_BOTH);
    control.setLayoutData(data);
    prependVerifyKeyListener(new VerifyKeyListener() {

        @Override
        public void verifyKey(VerifyEvent event) {
            handleVerifyKeyPressed(event);
        }
    });
    addDocumentListener(document);
    addMenu();
}
Also used : IInformationControl(org.eclipse.jface.text.IInformationControl) SourceViewerInformationControl(org.eclipse.jdt.internal.ui.text.java.hover.SourceViewerInformationControl) Control(org.eclipse.swt.widgets.Control) VerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener) GridData(org.eclipse.swt.layout.GridData) VerifyEvent(org.eclipse.swt.events.VerifyEvent) Font(org.eclipse.swt.graphics.Font)

Example 70 with Control

use of org.eclipse.swt.widgets.Control in project tdi-studio-se by Talend.

the class MapperUI method createVarsZoneWithTables.

private void createVarsZoneWithTables(MapperModel mapperModel, final Display display) {
    Control previousControl;
    // Feature TDI-26691 : Add search option
    SearchZone searchZone = new SearchZone(datasFlowViewSashForm, SWT.NONE, mapperManager);
    searchZone.createSearchZone();
    sc2 = new ScrolledComposite(searchZone, getBorder() | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData sc2GridData = new GridData(GridData.FILL_BOTH);
    sc2.setLayoutData(sc2GridData);
    varsTableZoneView = new VarsTableZoneView(sc2, getBorder(), mapperManager);
    // this.dropTargetOperationListener.addControl(varsTableZoneView);
    sc2.setContent(varsTableZoneView);
    sc2.setBackgroundMode(SWT.INHERIT_DEFAULT);
    sc2.setExpandHorizontal(true);
    sc2.addControlListener(new ControlListener() {

        public void controlMoved(ControlEvent e) {
        // System.out.println("sc2 controlMoved");
        }

        public void controlResized(ControlEvent e) {
            // System.out.println("sc2 controlResized");
            onSashResized(display);
        }
    });
    sc2MSListener = new MouseScrolledListener(mapperManager.getUiManager(), sc2);
    // varsTableZoneView.initInsertionIndicator();
    //
    // // final Composite finalTablesZoneViewVars = tablesZoneViewVars;
    //
    // previousControl = null;
    // for (IDataMapTable abstractDataMapTable : mapperModel.getVarsDataMapTables()) {
    //
    // DataMapTableView dataMapTableView = new VarsDataMapTableView(varsTableZoneView, SWT.BORDER,
    // abstractDataMapTable, mapperManager);
    //
    // FormData formData = new FormData();
    // formData.left = new FormAttachment(0, 0);
    // formData.right = new FormAttachment(100, 0);
    // formData.top = new FormAttachment(previousControl);
    // dataMapTableView.setLayoutData(formData);
    // previousControl = dataMapTableView;
    // dataMapTableView.minimizeTable(abstractDataMapTable.isMinimized());
    // // dataMapTableView.registerStyledExpressionEditor(getTabFolderEditors().getStyledTextHandler());
    // // dataMapTableView.fillMinimumSize(false);
    // }
    varsTableZoneView.setSize(varsTableZoneView.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
Also used : Control(org.eclipse.swt.widgets.Control) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlListener(org.eclipse.swt.events.ControlListener) ControlEvent(org.eclipse.swt.events.ControlEvent) MouseScrolledListener(org.talend.designer.abstractmap.ui.listener.MouseScrolledListener) SearchZone(org.talend.designer.dbmap.ui.visualmap.zone.SearchZone) VarsTableZoneView(org.talend.designer.dbmap.ui.visualmap.zone.scrollable.VarsTableZoneView)

Aggregations

Control (org.eclipse.swt.widgets.Control)475 Point (org.eclipse.swt.graphics.Point)149 Composite (org.eclipse.swt.widgets.Composite)141 GridData (org.eclipse.swt.layout.GridData)102 Button (org.eclipse.swt.widgets.Button)93 Label (org.eclipse.swt.widgets.Label)73 GridLayout (org.eclipse.swt.layout.GridLayout)71 Text (org.eclipse.swt.widgets.Text)70 FormData (org.eclipse.swt.layout.FormData)62 FormAttachment (org.eclipse.swt.layout.FormAttachment)61 Node (org.talend.designer.core.ui.editor.nodes.Node)46 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)45 SelectionEvent (org.eclipse.swt.events.SelectionEvent)44 StyledText (org.eclipse.swt.custom.StyledText)42 GC (org.eclipse.swt.graphics.GC)41 CLabel (org.eclipse.swt.custom.CLabel)38 ArrayList (java.util.ArrayList)36 Shell (org.eclipse.swt.widgets.Shell)35 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)33 CCombo (org.eclipse.swt.custom.CCombo)32