Search in sources :

Example 1 with AbstractObject

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

the class NodeBrowser method getFullPathAsId.

/**
 * Get full path to current position in object tree, as object identifiers
 *
 * @return
 */
private long[] getFullPathAsId() {
    long[] path = new long[containerPath.size() + ((currentParent != null) ? 1 : 0)];
    int i = 0;
    for (AbstractObject o : containerPath) path[i++] = o.getObjectId();
    if (currentParent != null)
        path[i++] = currentParent.getObjectId();
    return path;
}
Also used : AbstractObject(org.netxms.client.objects.AbstractObject)

Example 2 with AbstractObject

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

the class NodeBrowser method onCreateStep2.

/* (non-Javadoc)
	 * @see org.netxms.ui.android.main.activities.AbstractClientActivity#onCreateStep2(android.os.Bundle)
	 */
@Override
protected void onCreateStep2(Bundle savedInstanceState) {
    dialog = new ProgressDialog(this);
    setContentView(R.layout.node_view);
    TextView title = (TextView) findViewById(R.id.ScreenTitlePrimary);
    title.setText(R.string.nodes_title);
    initialParent = getIntent().getIntExtra("parentId", GenericObject.SERVICEROOT);
    // keeps current list of nodes as datasource for listview
    adapter = new ObjectListAdapter(this);
    listView = (ListView) findViewById(R.id.NodeList);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        @SuppressWarnings("rawtypes")
        public void onItemClick(AdapterView parent, View v, int position, long id) {
            AbstractObject obj = (AbstractObject) adapter.getItem(position);
            if ((obj.getObjectClass() == AbstractObject.OBJECT_CONTAINER) || (obj.getObjectClass() == AbstractObject.OBJECT_SUBNET) || (obj.getObjectClass() == AbstractObject.OBJECT_CLUSTER) || (obj.getObjectClass() == AbstractObject.OBJECT_ZONE)) {
                containerPath.push(currentParent);
                currentParent = obj;
                refreshList();
            } else if (obj.getObjectClass() == AbstractObject.OBJECT_NODE || obj.getObjectClass() == AbstractObject.OBJECT_MOBILEDEVICE) {
                showNodeInfo(obj.getObjectId());
            }
        }
    });
    registerForContextMenu(listView);
    // Restore saved state
    if (savedInstanceState != null)
        savedPath = savedInstanceState.getLongArray("currentPath");
}
Also used : ObjectListAdapter(org.netxms.ui.android.main.adapters.ObjectListAdapter) AbstractObject(org.netxms.client.objects.AbstractObject) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ProgressDialog(android.app.ProgressDialog) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 3 with AbstractObject

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

the class TableLastValues method onServiceConnected.

/* (non-Javadoc)
	 * @see org.netxms.ui.android.main.activities.AbstractClientActivity#onServiceConnected(android.content.ComponentName, android.os.IBinder)
	 */
@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
    super.onServiceConnected(name, binder);
    AbstractObject object = service.findObjectById(nodeId);
    TextView title = (TextView) findViewById(R.id.ScreenTitlePrimary);
    title.setText(((object != null) ? object.getObjectName() : ("[" + Long.toString(nodeId) + "]")) + ":" + getIntent().getStringExtra("description"));
    refresh();
}
Also used : AbstractObject(org.netxms.client.objects.AbstractObject) TextView(android.widget.TextView)

Example 4 with AbstractObject

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

the class GenericObjectChildrenLoader method loadInBackground.

@Override
public Set<AbstractObject> loadInBackground() {
    try {
        children = null;
        if (service != null && service.getSession() != null) {
            service.getSession().syncObjectSet(new long[] { objId }, false, NXCSession.OBJECT_SYNC_WAIT);
            AbstractObject go = service.getSession().findObjectById(objId);
            if (go != null) {
                service.getSession().syncMissingObjects(go.getChildIdList(), false, NXCSession.OBJECT_SYNC_WAIT);
                children = go.getAllChilds(classFilter);
            }
        } else
            Log.d(TAG, "loadInBackground: service or session null!");
    } catch (Exception e) {
        Log.e(TAG, "Exception while executing loadInBackground", e);
    }
    return children;
}
Also used : AbstractObject(org.netxms.client.objects.AbstractObject)

Example 5 with AbstractObject

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

the class DashboardBrowser method onCreateStep2.

/* (non-Javadoc)
	 * @see org.netxms.ui.android.main.activities.AbstractClientActivity#onCreateStep2(android.os.Bundle)
	 */
@Override
protected void onCreateStep2(Bundle savedInstanceState) {
    dialog = new ProgressDialog(this);
    setContentView(R.layout.node_view);
    TextView title = (TextView) findViewById(R.id.ScreenTitlePrimary);
    title.setText(R.string.dashboard_title);
    // keeps current list of nodes as datasource for listview
    adapter = new ObjectListAdapter(this);
    listView = (ListView) findViewById(R.id.NodeList);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        @SuppressWarnings("rawtypes")
        public void onItemClick(AdapterView parent, View v, int position, long id) {
            AbstractObject obj = (AbstractObject) adapter.getItem(position);
            if (obj.getChildIdList().length > 0) {
                containerPath.push(currentParent);
                currentParent = obj;
                refreshList();
            } else if (obj.getObjectClass() == AbstractObject.OBJECT_DASHBOARD) {
                showDashboard(obj.getObjectId());
            }
        }
    });
    registerForContextMenu(listView);
    // Restore saved state
    if (savedInstanceState != null) {
        savedPath = savedInstanceState.getLongArray("currentPath");
    }
}
Also used : ObjectListAdapter(org.netxms.ui.android.main.adapters.ObjectListAdapter) AbstractObject(org.netxms.client.objects.AbstractObject) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ProgressDialog(android.app.ProgressDialog) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

AbstractObject (org.netxms.client.objects.AbstractObject)216 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)55 NXCSession (org.netxms.client.NXCSession)51 AbstractNode (org.netxms.client.objects.AbstractNode)31 PartInitException (org.eclipse.ui.PartInitException)27 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)26 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)25 Cluster (org.netxms.client.objects.Cluster)22 ObjectSelectionDialog (org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog)22 ArrayList (java.util.ArrayList)20 Node (org.netxms.client.objects.Node)20 GridData (org.eclipse.swt.layout.GridData)18 Composite (org.eclipse.swt.widgets.Composite)18 NetworkMapObject (org.netxms.client.maps.elements.NetworkMapObject)18 GridLayout (org.eclipse.swt.layout.GridLayout)15 Container (org.netxms.client.objects.Container)15 Interface (org.netxms.client.objects.Interface)12 Template (org.netxms.client.objects.Template)12 SelectionEvent (org.eclipse.swt.events.SelectionEvent)11 Point (org.eclipse.swt.graphics.Point)11