use of org.netxms.client.objects.Dashboard in project netxms by netxms.
the class ExportDashboard method selectionChanged.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
@Override
public void selectionChanged(IAction action, ISelection selection) {
Object obj;
if ((selection instanceof IStructuredSelection) && (((IStructuredSelection) selection).size() == 1) && ((obj = ((IStructuredSelection) selection).getFirstElement()) instanceof Dashboard)) {
dashboard = (Dashboard) obj;
} else {
dashboard = null;
}
action.setEnabled(dashboard != null);
}
use of org.netxms.client.objects.Dashboard in project netxms by netxms.
the class CloneDashboard method selectionChanged.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
@Override
public void selectionChanged(final IAction action, final ISelection selection) {
Object obj;
if ((selection instanceof IStructuredSelection) && (((IStructuredSelection) selection).size() == 1) && ((obj = ((IStructuredSelection) selection).getFirstElement()) instanceof Dashboard)) {
sourceObject = ((Dashboard) obj);
} else {
sourceObject = null;
}
action.setEnabled(sourceObject != null);
}
use of org.netxms.client.objects.Dashboard in project netxms by netxms.
the class DashboardPage method createContent.
/* (non-Javadoc)
* @see org.netxms.webui.mobile.pages.AbstractPage#createContent(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Composite createContent(Composite parent) {
NXCSession session = (NXCSession) ConsoleSharedData.getSession();
Dashboard dashboard = (Dashboard) session.findObjectById(objectId, Dashboard.class);
if (dashboard != null) {
DashboardControl dbc = new DashboardControl(parent, SWT.NONE, dashboard, null, false);
setTitle(dashboard.getObjectName());
return dbc;
} else {
setTitle("[" + objectId + "]");
return new Composite(parent, SWT.NONE);
}
}
use of org.netxms.client.objects.Dashboard in project netxms by netxms.
the class ObjectBrowser method registerActionValidators.
/**
* Register object action validators
*/
private void registerActionValidators() {
List<ActionValidatorData> list = new ArrayList<ActionValidatorData>();
// Read all registered extensions and create validators
final IExtensionRegistry reg = Platform.getExtensionRegistry();
// $NON-NLS-1$
IConfigurationElement[] elements = reg.getConfigurationElementsFor("org.netxms.ui.eclipse.objectbrowser.objectActionValidators");
for (int i = 0; i < elements.length; i++) {
try {
final ActionValidatorData v = new ActionValidatorData();
// $NON-NLS-1$
v.validator = (ObjectActionValidator) elements[i].createExecutableExtension("class");
// $NON-NLS-1$
v.priority = safeParseInt(elements[i].getAttribute("priority"));
list.add(v);
} catch (CoreException e) {
e.printStackTrace();
}
}
// Sort handlers by priority
Collections.sort(list, new Comparator<ActionValidatorData>() {
@Override
public int compare(ActionValidatorData arg0, ActionValidatorData arg1) {
return arg0.priority - arg1.priority;
}
});
actionValidators = new ObjectActionValidator[list.size() + 1];
int i = 0;
for (ActionValidatorData v : list) actionValidators[i++] = v.validator;
// Default validator
actionValidators[i] = new ObjectActionValidator() {
@Override
public int isValidSelectionForMove(SubtreeType subtree, AbstractObject currentObject, AbstractObject parentObject) {
switch(subtree) {
case INFRASTRUCTURE:
return ((currentObject instanceof Node) || (currentObject instanceof Cluster) || (currentObject instanceof Subnet) || (currentObject instanceof Condition) || (currentObject instanceof Rack) || (currentObject instanceof MobileDevice) || (currentObject instanceof Container) || (currentObject instanceof Sensor)) && ((parentObject instanceof Container) || (parentObject instanceof ServiceRoot)) ? APPROVE : REJECT;
case TEMPLATES:
return ((currentObject instanceof Template) || (currentObject instanceof TemplateGroup)) && ((parentObject instanceof TemplateGroup) || (parentObject instanceof TemplateRoot)) ? APPROVE : REJECT;
case BUSINESS_SERVICES:
return (currentObject instanceof BusinessService) && ((parentObject instanceof BusinessService) || (parentObject instanceof BusinessServiceRoot)) ? APPROVE : REJECT;
case MAPS:
return ((currentObject instanceof NetworkMap) || (currentObject instanceof NetworkMapGroup)) && ((parentObject instanceof NetworkMapGroup) || (parentObject instanceof NetworkMapRoot)) ? APPROVE : REJECT;
case DASHBOARDS:
return (((currentObject instanceof Dashboard) || (currentObject instanceof DashboardGroup)) && ((parentObject instanceof DashboardRoot) || (parentObject instanceof DashboardGroup) || (parentObject instanceof Dashboard))) ? APPROVE : REJECT;
case POLICIES:
return ((currentObject instanceof AgentPolicy) || (currentObject instanceof PolicyGroup)) && ((parentObject instanceof PolicyGroup) || (parentObject instanceof PolicyRoot)) ? APPROVE : REJECT;
default:
return REJECT;
}
}
};
}
use of org.netxms.client.objects.Dashboard in project netxms by netxms.
the class EmbeddedDashboardElement method refresh.
/* (non-Javadoc)
* @see org.netxms.ui.android.main.dashboards.elements.AbstractDashboardElement#refresh()
*/
@Override
public void refresh() {
final Dashboard dashboard = (Dashboard) service.getSession().findObjectById(config.getDashboardObjects()[current], Dashboard.class);
current++;
if (current >= config.getDashboardObjects().length)
current = 0;
post(new Runnable() {
@Override
public void run() {
removeAllViews();
if (dashboard != null) {
DashboardView view = new DashboardView(getContext(), dashboard, service, scheduleTaskExecutor);
addView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, Gravity.FILL));
}
}
});
}
Aggregations