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;
}
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");
}
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();
}
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;
}
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");
}
}
Aggregations