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;
}
Aggregations