use of org.netxms.ui.eclipse.datacollection.widgets.DciList in project netxms by netxms.
the class SelectDciDialog method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
IDialogSettings settings = Activator.getDefault().getDialogSettings();
Composite dialogArea = (Composite) super.createDialogArea(parent);
dialogArea.setLayout(new FillLayout());
if (fixedNode == 0) {
splitter = new SashForm(dialogArea, SWT.HORIZONTAL);
objectTree = new ObjectTree(splitter, SWT.BORDER, ObjectTree.NONE, null, ObjectSelectionDialog.createNodeSelectionFilter(true), true, false);
// $NON-NLS-1$
String text = settings.get("SelectDciDialog.Filter");
if (text != null)
objectTree.setFilter(text);
}
dciList = new DciList(null, (fixedNode == 0) ? splitter : dialogArea, SWT.BORDER, null, "SelectDciDialog.dciList", dcObjectType, allowSingleSelection ? SWT.NONE : SWT.MULTI, // $NON-NLS-1$
allowNoValueObjects);
dciList.setDcObjectType(dcObjectType);
dciList.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
okPressed();
}
});
if (fixedNode == 0) {
try {
int[] weights = new int[2];
// $NON-NLS-1$
weights[0] = settings.getInt("SelectDciDialog.weight1");
// $NON-NLS-1$
weights[1] = settings.getInt("SelectDciDialog.weight2");
splitter.setWeights(weights);
} catch (NumberFormatException e) {
splitter.setWeights(new int[] { 30, 70 });
}
objectTree.getTreeViewer().addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
AbstractObject object = objectTree.getFirstSelectedObject2();
if ((object != null) && ((object instanceof AbstractNode) || (object instanceof MobileDevice) || (object instanceof Cluster) || (allowTemplateItems && (object instanceof Template) || (object instanceof Sensor)))) {
dciList.setNode(object);
} else {
dciList.setNode(null);
}
}
});
objectTree.setFocus();
} else {
dciList.setNode(((NXCSession) ConsoleSharedData.getSession()).findObjectById(fixedNode));
}
return dialogArea;
}
use of org.netxms.ui.eclipse.datacollection.widgets.DciList in project netxms by netxms.
the class SelectNodeDciDialog method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
dialogArea.setLayout(new FillLayout());
// $NON-NLS-1$
dciList = new DciList(null, dialogArea, SWT.BORDER, null, "SelectNodeDciDialog.dciList", dcObjectType, SWT.SINGLE, false);
dciList.setDcObjectType(dcObjectType);
dciList.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
okPressed();
}
});
dciList.setNode(((NXCSession) ConsoleSharedData.getSession()).findObjectById(nodeId));
return dialogArea;
}
Aggregations