use of com.amalto.workbench.models.TreeParent 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.models.TreeParent in project tmdm-studio-se by Talend.
the class Util method getRevision.
public static String getRevision(TreeObject xobject) {
// $NON-NLS-1$
String revision = "";
if (xobject.getType() != TreeObject.DATA_CLUSTER) {
TreeParent parent = xobject.findServerFolder(xobject.getType());
if (parent != null) {
// $NON-NLS-1$
Pattern p = Pattern.compile("\\[.*\\]");
Matcher m = p.matcher(parent.getDisplayName());
while (m.find()) {
revision = m.group();
break;
}
}
}
return revision;
}
use of com.amalto.workbench.models.TreeParent in project tmdm-studio-se by Talend.
the class Util method getForeingKeyInDataModel.
/**
* set the list with all the foreign concepty name in the parent
*
* @author ymli
* @param list
* @param parent
* @throws Exception
*/
public static void getForeingKeyInDataModel(Set<String> list, TreeParent parent, TMDMService service) throws Exception {
TreeObject[] children = parent.getChildren();
for (TreeObject object : children) {
if (object instanceof TreeParent) {
getForeingKeyInDataModel(list, (TreeParent) object, service);
continue;
}
WSDataModel wsDataModel = service.getDataModel(new WSGetDataModel(new WSDataModelPK(object.getDisplayName())));
XSDSchema xsd = Util.createXsdSchema(wsDataModel.getXsdSchema(), object);
getForeingKeyInSchema(list, xsd);
}
}
use of com.amalto.workbench.models.TreeParent in project tmdm-studio-se by Talend.
the class Util method getCachedXObjectsNameSet.
/**
* @deprecated using getChildren(TreeParent xObject,int objectType)
* @param xObject
* @param objectType
* @return
*/
@Deprecated
public static List<String> getCachedXObjectsNameSet(TreeObject xObject, int objectType) {
List<String> xObjectsNameSet = new ArrayList<String>();
if (xObject != null) {
TreeParent treeNode = xObject.findServerFolder(objectType);
TreeObject[] xObjectsSet = treeNode.getChildren();
for (TreeObject element : xObjectsSet) {
xObject = element;
String xObjectName = xObject.getDisplayName();
xObjectsNameSet.add(xObjectName);
}
}
return xObjectsNameSet;
}
use of com.amalto.workbench.models.TreeParent in project tmdm-studio-se by Talend.
the class Util method getChildren.
public static List<String> getChildren(TreeParent xObject, int objectType) {
List<String> objs = new ArrayList<String>();
for (TreeObject obj : xObject.getChildren()) {
if (obj instanceof TreeParent) {
TreeParent parent = (TreeParent) obj;
objs.addAll(getChildren(parent, objectType));
} else {
if (obj.getType() == objectType) {
objs.add(obj.getDisplayName());
}
}
}
return objs;
}
Aggregations