Search in sources :

Example 1 with RadioInterface

use of org.netxms.client.topology.RadioInterface in project netxms by netxms.

the class RadioInterfaces method refresh.

/**
 * Refresh content
 */
private void refresh() {
    Node node = (Node) session.findObjectById(rootObject, Node.class);
    if (node == null)
        return;
    List<RadioInterface> list = new ArrayList<RadioInterface>();
    for (AbstractObject o : node.getAllChilds(AbstractObject.OBJECT_ACCESSPOINT)) {
        if (o instanceof AccessPoint) {
            for (RadioInterface rif : ((AccessPoint) o).getRadios()) list.add(rif);
        }
    }
    viewer.setInput(list.toArray());
}
Also used : Node(org.netxms.client.objects.Node) AbstractObject(org.netxms.client.objects.AbstractObject) AccessPoint(org.netxms.client.objects.AccessPoint) ArrayList(java.util.ArrayList) RadioInterface(org.netxms.client.topology.RadioInterface)

Example 2 with RadioInterface

use of org.netxms.client.topology.RadioInterface in project netxms by netxms.

the class RadioInterfaceComparator method compare.

/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
	 */
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    RadioInterface rif1 = (RadioInterface) e1;
    RadioInterface rif2 = (RadioInterface) e2;
    int result;
    switch(// $NON-NLS-1$
    (Integer) ((SortableTableViewer) viewer).getTable().getSortColumn().getData("ID")) {
        case RadioInterfaces.COLUMN_AP_MAC_ADDR:
            result = rif1.getAccessPoint().getMacAddress().compareTo(rif2.getAccessPoint().getMacAddress());
            break;
        case RadioInterfaces.COLUMN_AP_MODEL:
            result = rif1.getAccessPoint().getModel().compareToIgnoreCase(rif2.getAccessPoint().getModel());
            break;
        case RadioInterfaces.COLUMN_AP_NAME:
            result = rif1.getAccessPoint().getObjectName().compareToIgnoreCase(rif2.getAccessPoint().getObjectName());
            break;
        case RadioInterfaces.COLUMN_AP_SERIAL:
            result = rif1.getAccessPoint().getSerialNumber().compareToIgnoreCase(rif2.getAccessPoint().getSerialNumber());
            break;
        case RadioInterfaces.COLUMN_AP_VENDOR:
            result = rif1.getAccessPoint().getVendor().compareToIgnoreCase(rif2.getAccessPoint().getVendor());
            break;
        case RadioInterfaces.COLUMN_CHANNEL:
            result = rif1.getChannel() - rif2.getChannel();
            break;
        case RadioInterfaces.COLUMN_INDEX:
            result = rif1.getIndex() - rif2.getIndex();
            break;
        case RadioInterfaces.COLUMN_MAC_ADDR:
            result = rif1.getMacAddress().compareTo(rif2.getMacAddress());
            break;
        case RadioInterfaces.COLUMN_NAME:
            result = rif1.getName().compareToIgnoreCase(rif2.getName());
            break;
        case RadioInterfaces.COLUMN_TX_POWER_DBM:
            result = rif1.getPowerDBm() - rif2.getPowerDBm();
            break;
        case RadioInterfaces.COLUMN_TX_POWER_MW:
            result = rif1.getPowerMW() - rif2.getPowerMW();
            break;
        default:
            result = 0;
            break;
    }
    return (((SortableTableViewer) viewer).getTable().getSortDirection() == SWT.UP) ? result : -result;
}
Also used : SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) RadioInterface(org.netxms.client.topology.RadioInterface)

Aggregations

RadioInterface (org.netxms.client.topology.RadioInterface)2 ArrayList (java.util.ArrayList)1 AbstractObject (org.netxms.client.objects.AbstractObject)1 AccessPoint (org.netxms.client.objects.AccessPoint)1 Node (org.netxms.client.objects.Node)1 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)1