use of com.amalto.workbench.models.TreeParent in project tmdm-studio-se by Talend.
the class DataClusterComposite method getServerRoot.
private TreeParent getServerRoot(MDMServerDef serverDef) {
if (serverDef == null) {
return null;
}
if (serverMap.containsKey(serverDef)) {
return serverMap.get(serverDef);
}
String serverName = serverDef.getName();
String username = serverDef.getUser();
String password = serverDef.getPasswd();
String endpointaddress = serverDef.getUrl();
TreeParent serverRoot = new TreeParent(serverName, null, TreeObject._SERVER_, endpointaddress, username + ":" + // $NON-NLS-1$//$NON-NLS-2$
(password == null ? "" : password));
UserInfo user = new UserInfo();
user.setUsername(username);
user.setPassword(password);
user.setServerUrl(endpointaddress);
serverRoot.setUser(user);
serverMap.put(serverDef, serverRoot);
return serverRoot;
}
use of com.amalto.workbench.models.TreeParent in project tmdm-studio-se by Talend.
the class DataClusterDialog method getAllDataContainers.
private boolean getAllDataContainers(List<TreeObject> dataContainers) {
MDMServerDef serverDef = getSelectedMdmServerDef();
String username = serverDef.getUser();
String password = serverDef.getPasswd();
String serverName = serverDef.getName();
String endpointaddress = serverDef.getUrl();
boolean canConnect = checkConnection(endpointaddress, username, password);
if (!canConnect) {
MessageDialog.openError(site.getShell(), Messages.DataClusterDialog_7, Messages.DataClusterDialog_8);
return false;
}
List<WSDataClusterPK> xdcPKs = null;
try {
TMDMService service = Util.getMDMService(new URL(endpointaddress), username, password);
TreeParent serverRoot = new TreeParent(serverName, null, TreeObject._SERVER_, endpointaddress, username + ":" + // $NON-NLS-1$//$NON-NLS-2$
(password == null ? "" : password));
// $NON-NLS-1$
xdcPKs = service.getDataClusterPKs(new WSRegexDataClusterPKs("*")).getWsDataClusterPKs();
for (WSDataClusterPK pk : xdcPKs) {
String name = pk.getPk();
if (!("CACHE".equals(name))) {
// $NON-NLS-1$
WSDataCluster wsObject = null;
boolean retriveWSObject = false;
try {
if (retriveWSObject) {
wsObject = service.getDataCluster(new WSGetDataCluster(pk));
}
TreeObject obj = new TreeObject(name, serverRoot, TreeObject.DATA_CLUSTER, pk, wsObject);
dataContainers.add(obj);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return false;
}
return true;
}
use of com.amalto.workbench.models.TreeParent in project tmdm-studio-se by Talend.
the class DataModelSelectDialog method selectDataModel.
private void selectDataModel() {
Object input = domViewer.getInput();
TreeObject[] elements = (TreeObject[]) contentProvider.getElements(input);
selectDefaultDataModel(elements);
domViewer.addTreeListener(new ITreeViewerListener() {
public void treeExpanded(TreeExpansionEvent event) {
TreeParent parent = (TreeParent) event.getElement();
TreeObject[] children = parent.getChildren();
selectDefaultDataModel(children);
}
public void treeCollapsed(TreeExpansionEvent event) {
//
}
});
}
use of com.amalto.workbench.models.TreeParent in project tmdm-studio-se by Talend.
the class DataModelSelectDialog method changeToResource.
private void changeToResource() {
TreeParent parent = null;
// Modified by hbhong,to fix bug 21784
TreeObject[] children = treeParent.getChildren();
for (TreeObject element : children) {
parent = (TreeParent) element;
if (parent.getType() == TreeObject.DATA_MODEL) {
break;
}
}
// The ending| bug:21784
contentProvider = new ServerTreeContentProvider(site, parent);
setTreeContentProvider(contentProvider);
domViewer.setLabelProvider(new ServerTreeLabelProvider());
domViewer.setSorter(new ViewerSorter() {
@Override
public int category(Object element) {
if (element instanceof TreeParent) {
TreeParent category = (TreeParent) element;
if (category.getType() == TreeObject.CATEGORY_FOLDER) {
return -1;
}
}
return 0;
}
});
domViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent e) {
StructuredSelection sel = (StructuredSelection) e.getSelection();
List<String> xpathList = new ArrayList<String>();
Object[] selections = sel.toArray();
for (Object obj : selections) {
TreeObject treeObj = (TreeObject) obj;
if (treeObj != null && treeObj.getType() == TreeObject.DATA_MODEL) {
xpathList.add(treeObj.getDisplayName());
}
}
xpaths = xpathList.toArray(new String[0]);
if (getButton(IDialogConstants.OK_ID) != null) {
getButton(IDialogConstants.OK_ID).setEnabled(xpathList.size() > 0);
}
}
});
domViewer.setInput(site);
}
use of com.amalto.workbench.models.TreeParent 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