Search in sources :

Example 1 with Dashboard

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);
}
Also used : Dashboard(org.netxms.client.objects.Dashboard) AbstractObject(org.netxms.client.objects.AbstractObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 2 with Dashboard

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);
}
Also used : Dashboard(org.netxms.client.objects.Dashboard) AbstractObject(org.netxms.client.objects.AbstractObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 3 with Dashboard

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);
    }
}
Also used : NXCSession(org.netxms.client.NXCSession) Composite(org.eclipse.swt.widgets.Composite) DashboardControl(org.netxms.ui.eclipse.dashboard.widgets.DashboardControl) Dashboard(org.netxms.client.objects.Dashboard)

Example 4 with Dashboard

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;
            }
        }
    };
}
Also used : TemplateRoot(org.netxms.client.objects.TemplateRoot) DashboardGroup(org.netxms.client.objects.DashboardGroup) Node(org.netxms.client.objects.Node) DashboardRoot(org.netxms.client.objects.DashboardRoot) ArrayList(java.util.ArrayList) NetworkMapGroup(org.netxms.client.objects.NetworkMapGroup) Dashboard(org.netxms.client.objects.Dashboard) Template(org.netxms.client.objects.Template) SubtreeType(org.netxms.ui.eclipse.objectbrowser.api.SubtreeType) Rack(org.netxms.client.objects.Rack) Container(org.netxms.client.objects.Container) BusinessServiceRoot(org.netxms.client.objects.BusinessServiceRoot) MobileDevice(org.netxms.client.objects.MobileDevice) TemplateGroup(org.netxms.client.objects.TemplateGroup) PolicyRoot(org.netxms.client.objects.PolicyRoot) ObjectActionValidator(org.netxms.ui.eclipse.objectbrowser.api.ObjectActionValidator) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry) Condition(org.netxms.client.objects.Condition) PolicyGroup(org.netxms.client.objects.PolicyGroup) Cluster(org.netxms.client.objects.Cluster) NetworkMapRoot(org.netxms.client.objects.NetworkMapRoot) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) ServiceRoot(org.netxms.client.objects.ServiceRoot) BusinessServiceRoot(org.netxms.client.objects.BusinessServiceRoot) BusinessService(org.netxms.client.objects.BusinessService) AgentPolicy(org.netxms.client.objects.AgentPolicy) CoreException(org.eclipse.core.runtime.CoreException) AbstractObject(org.netxms.client.objects.AbstractObject) Subnet(org.netxms.client.objects.Subnet) NetworkMap(org.netxms.client.objects.NetworkMap) Sensor(org.netxms.client.objects.Sensor)

Example 5 with Dashboard

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));
            }
        }
    });
}
Also used : Dashboard(org.netxms.client.objects.Dashboard) DashboardView(org.netxms.ui.android.main.views.DashboardView)

Aggregations

Dashboard (org.netxms.client.objects.Dashboard)10 AbstractObject (org.netxms.client.objects.AbstractObject)7 NetworkMap (org.netxms.client.objects.NetworkMap)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 PartInitException (org.eclipse.ui.PartInitException)3 NXCSession (org.netxms.client.NXCSession)2 NetworkMapObject (org.netxms.client.maps.elements.NetworkMapObject)2 AgentPolicy (org.netxms.client.objects.AgentPolicy)2 BusinessService (org.netxms.client.objects.BusinessService)2 BusinessServiceRoot (org.netxms.client.objects.BusinessServiceRoot)2 Cluster (org.netxms.client.objects.Cluster)2 Condition (org.netxms.client.objects.Condition)2 Container (org.netxms.client.objects.Container)2 DashboardGroup (org.netxms.client.objects.DashboardGroup)2 DashboardRoot (org.netxms.client.objects.DashboardRoot)2 MobileDevice (org.netxms.client.objects.MobileDevice)2 NetworkMapGroup (org.netxms.client.objects.NetworkMapGroup)2 NetworkMapRoot (org.netxms.client.objects.NetworkMapRoot)2 Node (org.netxms.client.objects.Node)2 PolicyGroup (org.netxms.client.objects.PolicyGroup)2