Search in sources :

Example 1 with ComplexTableViewerR

use of com.amalto.workbench.widgets.ComplexTableViewerR 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)

Aggregations

Line (com.amalto.workbench.models.Line)1 WSTransformerProcessStep (com.amalto.workbench.webservices.WSTransformerProcessStep)1 WSTransformerVariablesMapping (com.amalto.workbench.webservices.WSTransformerVariablesMapping)1 ComplexTableViewerColumn (com.amalto.workbench.widgets.ComplexTableViewerColumn)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 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Group (org.eclipse.swt.widgets.Group)1 Table (org.eclipse.swt.widgets.Table)1 Text (org.eclipse.swt.widgets.Text)1