use of org.netxms.client.objects.Container in project netxms by netxms.
the class UploadFileToAgent method selectionChanged.
/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
@SuppressWarnings("rawtypes")
public void selectionChanged(IAction action, ISelection selection) {
nodes.clear();
if (!(selection instanceof IStructuredSelection)) {
action.setEnabled(false);
return;
}
Iterator it = ((IStructuredSelection) selection).iterator();
while (it.hasNext()) {
Object object = it.next();
if (object instanceof Node) {
nodes.add(((Node) object).getObjectId());
} else if ((object instanceof Container) || (object instanceof ServiceRoot) || (object instanceof Subnet) || (object instanceof EntireNetwork)) {
Set<AbstractObject> set = ((AbstractObject) object).getAllChilds(AbstractObject.OBJECT_NODE);
for (AbstractObject o : set) nodes.add(o.getObjectId());
}
}
action.setEnabled(nodes.size() > 0);
}
use of org.netxms.client.objects.Container in project netxms by netxms.
the class ServiceComponents method addServiceComponents.
/**
* Add parent services for given object
*
* @param object
*/
private void addServiceComponents(AbstractObject object, long parentElementId) {
Iterator<Long> it = object.getChildren();
while (it.hasNext()) {
long objectId = it.next();
AbstractObject child = session.findObjectById(objectId);
if ((child != null) && ((child instanceof Container) || (child instanceof Cluster) || (child instanceof Node) || (child instanceof Condition))) {
long elementId = mapPage.createElementId();
mapPage.addElement(new NetworkMapObject(elementId, objectId));
mapPage.addLink(new NetworkMapLink(NetworkMapLink.NORMAL, parentElementId, elementId));
addServiceComponents(child, elementId);
}
}
}
use of org.netxms.client.objects.Container in project netxms by netxms.
the class ServiceComponentsElement method addServiceComponents.
/**
* Add parent services for given object
*
* @param object
*/
private void addServiceComponents(AbstractObject object, long parentElementId) {
Iterator<Long> it = object.getChildren();
while (it.hasNext()) {
long objectId = it.next();
AbstractObject child = session.findObjectById(objectId);
if ((child != null) && ((child instanceof Container) || (child instanceof Cluster) || (child instanceof Node) || (child instanceof Condition))) {
long elementId = mapPage.createElementId();
mapPage.addElement(new NetworkMapObject(elementId, objectId));
mapPage.addLink(new NetworkMapLink(NetworkMapLink.NORMAL, parentElementId, elementId));
addServiceComponents(child, elementId);
}
}
}
use of org.netxms.client.objects.Container in project netxms by netxms.
the class BindObject method selectionChanged.
/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
if ((selection instanceof IStructuredSelection) && (((IStructuredSelection) selection).size() == 1)) {
Object obj = ((IStructuredSelection) selection).getFirstElement();
if ((obj instanceof ServiceRoot) || (obj instanceof Container)) {
action.setEnabled(true);
parentId = ((AbstractObject) obj).getObjectId();
} else {
action.setEnabled(false);
parentId = 0;
}
} else {
action.setEnabled(false);
parentId = 0;
}
}
use of org.netxms.client.objects.Container in project netxms by netxms.
the class ObjectStatusMap method buildFlatView.
/**
* Build flat view - all nodes in one group
*/
private void buildFlatView() {
AbstractObject root = session.findObjectById(rootObjectId);
if ((root == null) || !((root instanceof Container) || (root instanceof ServiceRoot) || (root instanceof Cluster)))
return;
List<AbstractObject> objects = new ArrayList<AbstractObject>(root.getAllChilds(new int[] { AbstractObject.OBJECT_NODE, AbstractObject.OBJECT_CLUSTER, AbstractObject.OBJECT_MOBILEDEVICE }));
filterObjects(objects);
Collections.sort(objects, new Comparator<AbstractObject>() {
@Override
public int compare(AbstractObject o1, AbstractObject o2) {
return o1.getObjectName().compareToIgnoreCase(o2.getObjectName());
}
});
final Composite clientArea = new Composite(dataArea, SWT.NONE);
clientArea.setBackground(getBackground());
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
clientArea.setLayoutData(gd);
RowLayout clayout = new RowLayout();
clayout.marginBottom = 0;
clayout.marginTop = 0;
clayout.marginLeft = 0;
clayout.marginRight = 0;
clayout.type = SWT.HORIZONTAL;
clayout.wrap = true;
clayout.pack = false;
clientArea.setLayout(clayout);
sections.add(clientArea);
for (AbstractObject o : objects) {
if (!isLeafObject(o))
continue;
addObjectElement(clientArea, o);
}
}
Aggregations