use of com.amalto.workbench.widgets.celleditor.DefaultXPathValidator 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;
}
use of com.amalto.workbench.widgets.celleditor.DefaultXPathValidator 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;
}
Aggregations