Search in sources :

Example 1 with ComplexTableViewerColumn

use of com.amalto.workbench.widgets.ComplexTableViewerColumn in project tmdm-studio-se by Talend.

the class SetupTransformerInputVariablesDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Group comp = new Group(parent, SWT.NONE);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    ((GridLayout) parent.getLayout()).marginTop = 5;
    ((GridLayout) parent.getLayout()).marginLeft = 5;
    ((GridLayout) parent.getLayout()).marginRight = 5;
    ((GridLayout) parent.getLayout()).marginBottom = 5;
    parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    comp.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    comp.setLayout(new GridLayout(1, false));
    comp.setText(Messages.bind(Messages.SetupTransformerInputVariablesDialog_CompText, transformer.getName()));
    // Get the input variable names
    Set<String> inputVariables = new HashSet<String>();
    for (WSTransformerProcessStep step : transformer.getProcessSteps()) {
        for (WSTransformerVariablesMapping mapping : step.getInputMappings()) {
            inputVariables.add(mapping.getPipelineVariable() == null ? TransformerMainPage.DEFAULT_VAR : mapping.getPipelineVariable());
        }
    }
    ComplexTableViewerColumn[] columns = new ComplexTableViewerColumn[] { new // name
    ComplexTableViewerColumn(// name
    Messages.SetupTransformerInputVariablesDialog_InputVariables, // is Nillable ?
    true, // Nill value//$NON-NLS-1$
    "_DEFAULT_", // Nill display//$NON-NLS-1$
    "_DEFAULT_", // Default Value//$NON-NLS-1$
    "", // is Combo ?
    ComplexTableViewerColumn.COMBO_STYLE, // Combo Values
    inputVariables.toArray(new String[inputVariables.size()]), // Text Lines
    0), new // name
    ComplexTableViewerColumn(// name
    Messages.SetupTransformerInputVariablesDialog_ContentType, // is Nillable ?
    false, // Nill value//$NON-NLS-1$
    "", // Nill display//$NON-NLS-1$
    "", // Default Value//$NON-NLS-1$
    "text/xml", // is Combo ?
    ComplexTableViewerColumn.COMBO_STYLE, // Combo Values
    EContentType.allTypes().toArray(new String[EContentType.allTypes().size()]), // Text Lines
    0), new // name
    ComplexTableViewerColumn(// name
    Messages.SetupTransformerInputVariablesDialog_Value, // is Nillable ?
    true, // Nill value//$NON-NLS-1$
    "", // Nill display//$NON-NLS-1$
    "", // Default Value//$NON-NLS-1$
    "", // is Combo ?
    ComplexTableViewerColumn.TEXT_STYLE, // Combo Values
    null, // Text Lines
    10) };
    objectViewer = new ComplexTableViewerR(Arrays.asList(columns), toolkit, comp, page.getSite());
    objectViewer.create();
    Table table = objectViewer.getViewer().getTable();
    table.getColumns()[2].setWidth(500);
    // GridData gd=(GridData)objectViewer.getTxtLists().get(0).getLayoutData();
    // gd.minimumHeight=200;
    // gd.minimumWidth=300;
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    // ((GridData)table.getLayoutData()).minimumWidth = 600;
    if (page.getCacheList() != null) {
        objectViewer.getViewer().setInput(page.getCacheList());
    } else {
        List<Line> list = new ArrayList<Line>();
        objectViewer.getViewer().setInput(list);
    }
    final CCombo combo = (CCombo) objectViewer.getColumns().get(1).getControl();
    combo.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (combo.getText().equals(EInputTemplate.APPLICATION_ITEMPK.getName())) {
                Text t = (Text) objectViewer.getColumns().get(2).getControl();
                t.setText(EInputTemplate.APPLICATION_ITEMPK.getContent());
            }
        }
    });
    return comp;
}
Also used : Group(org.eclipse.swt.widgets.Group) Table(org.eclipse.swt.widgets.Table) ComplexTableViewerColumn(com.amalto.workbench.widgets.ComplexTableViewerColumn) ComplexTableViewerR(com.amalto.workbench.widgets.ComplexTableViewerR) ArrayList(java.util.ArrayList) Text(org.eclipse.swt.widgets.Text) Line(com.amalto.workbench.models.Line) GridLayout(org.eclipse.swt.layout.GridLayout) CCombo(org.eclipse.swt.custom.CCombo) WSTransformerVariablesMapping(com.amalto.workbench.webservices.WSTransformerVariablesMapping) GridData(org.eclipse.swt.layout.GridData) WSTransformerProcessStep(com.amalto.workbench.webservices.WSTransformerProcessStep) SelectionEvent(org.eclipse.swt.events.SelectionEvent) HashSet(java.util.HashSet) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with ComplexTableViewerColumn

use of com.amalto.workbench.widgets.ComplexTableViewerColumn in project tmdm-studio-se by Talend.

the class ValidationRuleDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    parent.getShell().setText(this.title);
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new GridLayout(2, false));
    Label label = new Label(composite, SWT.NONE);
    label.setText(Messages.ValidationRuleDialog_);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
    text = new Text(composite, SWT.BORDER);
    text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
    columns = new ComplexTableViewerColumn[] { new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "Type", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn.COMBO_STYLE, IConstants.SCHEMATRON_TYPES, 0), new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "Context XPath", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "newXPath", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "newXPath", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", ComplexTableViewerColumn.XPATH_STYLE, new String[] {}, 0), new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "Expression", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn.VALIDATIONRULE_STYLE, new String[] {}, 0), new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "Message", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn.MULTIMESSAGE_STYLE, new String[] {}, 0) };
    columns[0].setColumnWidth(70);
    columns[1].setColumnWidth(130);
    columns[2].setColumnWidth(300);
    columns[3].setColumnWidth(300);
    viewer = getNewTisTableViewer(Arrays.asList(columns), WidgetFactory.getWidgetFactory(), composite);
    Map<ComplexTableViewerColumn, IXPathValidator> validators = new HashMap<ComplexTableViewerColumn, IXPathValidator>();
    // set to "Context XPath" column the xpath validator
    validators.put(columns[1], new DefaultXPathValidator());
    viewer.setValidators(validators);
    // Modified by hhb,to fix bug 21784
    TreeParent treeParent = (TreeParent) page.getAdapter(TreeParent.class);
    viewer.setTreeParent(treeParent);
    // The ending| bug:21784
    viewer.setXpath(true);
    // viewer.setMainPage(page);
    String modelName = page.getDataModel().getName();
    viewer.setDatamodelName(modelName);
    viewer.setConceptName(conceptName);
    viewer.setContext(true);
    viewer.create();
    viewer.getViewer().setInput(parseRules());
    viewer.setHeight(110);
    viewer.setWidth(800);
    viewer.getMainComposite().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 3));
    parent.getShell().addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            XpathSelectDialog.setContext(null);
        }
    });
    return composite;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) Composite(org.eclipse.swt.widgets.Composite) HashMap(java.util.HashMap) TreeParent(com.amalto.workbench.models.TreeParent) Label(org.eclipse.swt.widgets.Label) ComplexTableViewerColumn(com.amalto.workbench.widgets.ComplexTableViewerColumn) DefaultXPathValidator(com.amalto.workbench.widgets.celleditor.DefaultXPathValidator) Text(org.eclipse.swt.widgets.Text) DisposeEvent(org.eclipse.swt.events.DisposeEvent) IXPathValidator(com.amalto.workbench.widgets.celleditor.IXPathValidator) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData)

Example 3 with ComplexTableViewerColumn

use of com.amalto.workbench.widgets.ComplexTableViewerColumn in project tmdm-studio-se by Talend.

the class AMainPageV2 method initCoditionsColumns.

// createFormContent
protected void initCoditionsColumns() {
    ComplexTableViewerColumn operatorColumn;
    if (isCompositeView) {
        operatorColumn = new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        "Operator", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        ComplexTableViewerColumn.COMBO_STYLE, IConstants.COMPOSITE_VIEW_CONDITION_OPERATORS, 0);
    } else {
        operatorColumn = new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        "Operator", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        ComplexTableViewerColumn.COMBO_STYLE, IConstants.VIEW_CONDITION_OPERATORS, 0);
    }
    conditionsColumns = new ComplexTableViewerColumn[] { new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "XPath", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "newXPath", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "newXPath", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn.XPATH_STYLE, new String[] {}, 0), operatorColumn, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    new ComplexTableViewerColumn("Value", false, "", "", "", ComplexTableViewerColumn.XPATH_STYLE, new String[] {}, 0), new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "Predicate", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    true, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn.COMBO_STYLE, IConstants.PREDICATES, 0) };
}
Also used : ComplexTableViewerColumn(com.amalto.workbench.widgets.ComplexTableViewerColumn)

Example 4 with ComplexTableViewerColumn

use of com.amalto.workbench.widgets.ComplexTableViewerColumn in project tmdm-studio-se by Talend.

the class FKFilterDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    parent.getShell().setText(this.title);
    dialogAreaComposite = (Composite) super.createDialogArea(parent);
    dialogAreaComposite.setLayout(new GridLayout(2, false));
    columns = new ComplexTableViewerColumn[] { new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "XPath", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "newXPath", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "newXPath", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn.XPATH_STYLE, new String[] {}, 0), new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "Operator", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    false, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn.COMBO_STYLE, IConstants.VIEW_CONDITION_OPERATORS, 0), // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    new ComplexTableViewerColumn("Value", false, "", "", "", ComplexTableViewerColumn.XPATH_STYLE, new String[] {}, 0), new // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn(// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "Predicate", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    true, // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    "", // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
    ComplexTableViewerColumn.COMBO_STYLE, IConstants.PREDICATES, 0) };
    columns[0].setColumnWidth(200);
    columns[1].setColumnWidth(140);
    columns[2].setColumnWidth(200);
    columns[3].setColumnWidth(140);
    viewer = getNewTisTableViewer(Arrays.asList(columns), WidgetFactory.getWidgetFactory(), dialogAreaComposite);
    viewer.setModelLock(lock);
    viewer.setXpath(true);
    viewer.setDatamodelName(dataModelName);
    Map<ComplexTableViewerColumn, IXPathValidator> validators = new HashMap<ComplexTableViewerColumn, IXPathValidator>();
    // set to "XPath" column the xpath validator
    validators.put(columns[0], new DefaultXPathValidator());
    viewer.setValidators(validators);
    // viewer.setMainPage(page);//TODO
    // viewer.setConceptName(conceptName);
    // viewer.setContext(true);
    // Modified by hbhong,to fix bug 21784
    TreeParent treeParent = (TreeParent) page.getAdapter(TreeParent.class);
    viewer.setTreeParent(treeParent);
    // The ending| bug:21784
    viewer.create();
    viewer.setHeight(140);
    viewer.setWidth(680);
    viewer.getMainComposite().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 3));
    parent.getShell().addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            XpathSelectDialog.setContext(null);
        }
    });
    // init data
    parseRules();
    return dialogAreaComposite;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) GridLayout(org.eclipse.swt.layout.GridLayout) HashMap(java.util.HashMap) TreeParent(com.amalto.workbench.models.TreeParent) ComplexTableViewerColumn(com.amalto.workbench.widgets.ComplexTableViewerColumn) DefaultXPathValidator(com.amalto.workbench.widgets.celleditor.DefaultXPathValidator) GridData(org.eclipse.swt.layout.GridData) DisposeEvent(org.eclipse.swt.events.DisposeEvent) IXPathValidator(com.amalto.workbench.widgets.celleditor.IXPathValidator)

Aggregations

ComplexTableViewerColumn (com.amalto.workbench.widgets.ComplexTableViewerColumn)4 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 TreeParent (com.amalto.workbench.models.TreeParent)2 DefaultXPathValidator (com.amalto.workbench.widgets.celleditor.DefaultXPathValidator)2 IXPathValidator (com.amalto.workbench.widgets.celleditor.IXPathValidator)2 HashMap (java.util.HashMap)2 DisposeEvent (org.eclipse.swt.events.DisposeEvent)2 DisposeListener (org.eclipse.swt.events.DisposeListener)2 Text (org.eclipse.swt.widgets.Text)2 Line (com.amalto.workbench.models.Line)1 WSTransformerProcessStep (com.amalto.workbench.webservices.WSTransformerProcessStep)1 WSTransformerVariablesMapping (com.amalto.workbench.webservices.WSTransformerVariablesMapping)1 ComplexTableViewerR (com.amalto.workbench.widgets.ComplexTableViewerR)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 CCombo (org.eclipse.swt.custom.CCombo)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Composite (org.eclipse.swt.widgets.Composite)1