Search in sources :

Example 21 with Cluster

use of org.netxms.client.objects.Cluster in project netxms by netxms.

the class AddClusterNode method selectionChanged.

/**
 * @see IActionDelegate#selectionChanged(IAction, ISelection)
 */
public void selectionChanged(IAction action, ISelection selection) {
    if (selection instanceof IStructuredSelection) {
        Object obj = ((IStructuredSelection) selection).getFirstElement();
        if (obj instanceof Cluster) {
            action.setEnabled(true);
            clusterId = ((AbstractObject) obj).getObjectId();
        } else {
            action.setEnabled(false);
            clusterId = 0;
        }
    } else {
        action.setEnabled(false);
        clusterId = 0;
    }
}
Also used : Cluster(org.netxms.client.objects.Cluster) AbstractObject(org.netxms.client.objects.AbstractObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 22 with Cluster

use of org.netxms.client.objects.Cluster 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);
    }
}
Also used : Container(org.netxms.client.objects.Container) Composite(org.eclipse.swt.widgets.Composite) AbstractObject(org.netxms.client.objects.AbstractObject) RowLayout(org.eclipse.swt.layout.RowLayout) ArrayList(java.util.ArrayList) GridData(org.eclipse.swt.layout.GridData) Cluster(org.netxms.client.objects.Cluster) ServiceRoot(org.netxms.client.objects.ServiceRoot)

Aggregations

Cluster (org.netxms.client.objects.Cluster)22 AbstractObject (org.netxms.client.objects.AbstractObject)21 Container (org.netxms.client.objects.Container)11 AbstractNode (org.netxms.client.objects.AbstractNode)10 ServiceRoot (org.netxms.client.objects.ServiceRoot)7 Condition (org.netxms.client.objects.Condition)6 MobileDevice (org.netxms.client.objects.MobileDevice)6 Node (org.netxms.client.objects.Node)6 Sensor (org.netxms.client.objects.Sensor)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 Composite (org.eclipse.swt.widgets.Composite)5 NXCSession (org.netxms.client.NXCSession)5 Subnet (org.netxms.client.objects.Subnet)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 GridData (org.eclipse.swt.layout.GridData)4 Template (org.netxms.client.objects.Template)4 ArrayList (java.util.ArrayList)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 RowLayout (org.eclipse.swt.layout.RowLayout)3 PartInitException (org.eclipse.ui.PartInitException)3