Search in sources :

Example 6 with Dashboard

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

the class NXCSession method createObjectFromMessage.

/**
 * Create object from message
 *
 * @param msg Source NXCP message
 * @return NetXMS object
 */
private AbstractObject createObjectFromMessage(NXCPMessage msg) {
    final int objectClass = msg.getFieldAsInt32(NXCPCodes.VID_OBJECT_CLASS);
    AbstractObject object = createCustomObjectFromMessage(objectClass, msg);
    if (object != null)
        return object;
    switch(objectClass) {
        case AbstractObject.OBJECT_ACCESSPOINT:
            object = new AccessPoint(msg, this);
            break;
        case AbstractObject.OBJECT_AGENTPOLICY:
            object = new AgentPolicy(msg, this);
            break;
        case AbstractObject.OBJECT_AGENTPOLICY_CONFIG:
            object = new AgentPolicyConfig(msg, this);
            break;
        case AbstractObject.OBJECT_AGENTPOLICY_LOGPARSER:
            object = new AgentPolicyLogParser(msg, this);
            break;
        case AbstractObject.OBJECT_BUSINESSSERVICE:
            object = new BusinessService(msg, this);
            break;
        case AbstractObject.OBJECT_BUSINESSSERVICEROOT:
            object = new BusinessServiceRoot(msg, this);
            break;
        case AbstractObject.OBJECT_CHASSIS:
            object = new Chassis(msg, this);
            break;
        case AbstractObject.OBJECT_CLUSTER:
            object = new Cluster(msg, this);
            break;
        case AbstractObject.OBJECT_CONDITION:
            object = new Condition(msg, this);
            break;
        case AbstractObject.OBJECT_CONTAINER:
            object = new Container(msg, this);
            break;
        case AbstractObject.OBJECT_DASHBOARDGROUP:
            object = new DashboardGroup(msg, this);
            break;
        case AbstractObject.OBJECT_DASHBOARD:
            object = new Dashboard(msg, this);
            break;
        case AbstractObject.OBJECT_DASHBOARDROOT:
            object = new DashboardRoot(msg, this);
            break;
        case AbstractObject.OBJECT_INTERFACE:
            object = new Interface(msg, this);
            break;
        case AbstractObject.OBJECT_MOBILEDEVICE:
            object = new MobileDevice(msg, this);
            break;
        case AbstractObject.OBJECT_NETWORK:
            object = new EntireNetwork(msg, this);
            break;
        case AbstractObject.OBJECT_NETWORKMAP:
            object = new NetworkMap(msg, this);
            break;
        case AbstractObject.OBJECT_NETWORKMAPGROUP:
            object = new NetworkMapGroup(msg, this);
            break;
        case AbstractObject.OBJECT_NETWORKMAPROOT:
            object = new NetworkMapRoot(msg, this);
            break;
        case AbstractObject.OBJECT_NETWORKSERVICE:
            object = new NetworkService(msg, this);
            break;
        case AbstractObject.OBJECT_NODE:
            object = new Node(msg, this);
            break;
        case AbstractObject.OBJECT_NODELINK:
            object = new NodeLink(msg, this);
            break;
        case AbstractObject.OBJECT_POLICYGROUP:
            object = new PolicyGroup(msg, this);
            break;
        case AbstractObject.OBJECT_POLICYROOT:
            object = new PolicyRoot(msg, this);
            break;
        case AbstractObject.OBJECT_RACK:
            object = new Rack(msg, this);
            break;
        case AbstractObject.OBJECT_SENSOR:
            object = new Sensor(msg, this);
            break;
        case AbstractObject.OBJECT_SERVICEROOT:
            object = new ServiceRoot(msg, this);
            break;
        case AbstractObject.OBJECT_SLMCHECK:
            object = new ServiceCheck(msg, this);
            break;
        case AbstractObject.OBJECT_SUBNET:
            object = new Subnet(msg, this);
            break;
        case AbstractObject.OBJECT_TEMPLATE:
            object = new Template(msg, this);
            break;
        case AbstractObject.OBJECT_TEMPLATEGROUP:
            object = new TemplateGroup(msg, this);
            break;
        case AbstractObject.OBJECT_TEMPLATEROOT:
            object = new TemplateRoot(msg, this);
            break;
        case AbstractObject.OBJECT_VPNCONNECTOR:
            object = new VPNConnector(msg, this);
            break;
        case AbstractObject.OBJECT_ZONE:
            object = new Zone(msg, this);
            break;
        default:
            object = new GenericObject(msg, this);
            break;
    }
    return object;
}
Also used : Chassis(org.netxms.client.objects.Chassis) DashboardGroup(org.netxms.client.objects.DashboardGroup) ServiceCheck(org.netxms.client.objects.ServiceCheck) TemplateRoot(org.netxms.client.objects.TemplateRoot) DashboardRoot(org.netxms.client.objects.DashboardRoot) AbstractNode(org.netxms.client.objects.AbstractNode) Node(org.netxms.client.objects.Node) NetworkMapGroup(org.netxms.client.objects.NetworkMapGroup) Dashboard(org.netxms.client.objects.Dashboard) AgentPolicyConfig(org.netxms.client.objects.AgentPolicyConfig) Template(org.netxms.client.objects.Template) Rack(org.netxms.client.objects.Rack) BusinessServiceRoot(org.netxms.client.objects.BusinessServiceRoot) Container(org.netxms.client.objects.Container) MobileDevice(org.netxms.client.objects.MobileDevice) TemplateGroup(org.netxms.client.objects.TemplateGroup) PolicyRoot(org.netxms.client.objects.PolicyRoot) Condition(org.netxms.client.objects.Condition) PolicyGroup(org.netxms.client.objects.PolicyGroup) Zone(org.netxms.client.objects.Zone) AccessPoint(org.netxms.client.objects.AccessPoint) VPNConnector(org.netxms.client.objects.VPNConnector) Cluster(org.netxms.client.objects.Cluster) NetworkMapRoot(org.netxms.client.objects.NetworkMapRoot) EntireNetwork(org.netxms.client.objects.EntireNetwork) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint) ServiceRoot(org.netxms.client.objects.ServiceRoot) BusinessServiceRoot(org.netxms.client.objects.BusinessServiceRoot) BusinessService(org.netxms.client.objects.BusinessService) AgentPolicy(org.netxms.client.objects.AgentPolicy) AbstractObject(org.netxms.client.objects.AbstractObject) GenericObject(org.netxms.client.objects.GenericObject) AgentPolicyLogParser(org.netxms.client.objects.AgentPolicyLogParser) NetworkService(org.netxms.client.objects.NetworkService) NodeLink(org.netxms.client.objects.NodeLink) Subnet(org.netxms.client.objects.Subnet) Interface(org.netxms.client.objects.Interface) NetworkMap(org.netxms.client.objects.NetworkMap) Sensor(org.netxms.client.objects.Sensor)

Example 7 with Dashboard

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

the class AbstractNetworkMapView method openDrillDownObject.

/**
 * Open drill-down object for currently selected object
 */
private void openDrillDownObject() {
    if (currentSelection == null)
        return;
    long objectId = 0;
    Object object = currentSelection.getFirstElement();
    if (object instanceof AbstractObject)
        objectId = (object instanceof NetworkMap) ? ((AbstractObject) object).getObjectId() : ((AbstractObject) object).getDrillDownObjectId();
    else if (object instanceof NetworkMapTextBox)
        objectId = ((NetworkMapTextBox) object).getDrillDownObjectId();
    if (objectId != 0) {
        Object test = session.findObjectById(objectId);
        if (test instanceof NetworkMap) {
            try {
                getSite().getPage().showView(PredefinedMap.ID, Long.toString(objectId), IWorkbenchPage.VIEW_ACTIVATE);
            } catch (PartInitException e) {
                MessageDialogHelper.openError(getSite().getShell(), Messages.get().AbstractNetworkMapView_Error, String.format("Cannot open drill-down object view: %s", e.getMessage()));
            }
        }
        if (test instanceof Dashboard) {
            try {
                getSite().getPage().showView("org.netxms.ui.eclipse.dashboard.views.DashboardView", Long.toString(objectId), IWorkbenchPage.VIEW_ACTIVATE);
            } catch (PartInitException e) {
                MessageDialogHelper.openError(getSite().getShell(), Messages.get().AbstractNetworkMapView_Error, String.format("Cannot open drill-down object view: %s", e.getMessage()));
            }
        }
    }
}
Also used : NetworkMapTextBox(org.netxms.client.maps.elements.NetworkMapTextBox) AbstractObject(org.netxms.client.objects.AbstractObject) Dashboard(org.netxms.client.objects.Dashboard) NetworkMapObject(org.netxms.client.maps.elements.NetworkMapObject) AbstractObject(org.netxms.client.objects.AbstractObject) PartInitException(org.eclipse.ui.PartInitException) NetworkMap(org.netxms.client.objects.NetworkMap)

Example 8 with Dashboard

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

the class NetworkMapWidget method openDrillDownObject.

/**
 * Open drill-down object for currently selected object
 *
 * @param object
 */
private void openDrillDownObject(AbstractObject object) {
    long objectId = (object instanceof NetworkMap) ? object.getObjectId() : object.getDrillDownObjectId();
    if (objectId == 0)
        return;
    Object test = ConsoleSharedData.getSession().findObjectById(objectId);
    if (test instanceof NetworkMap) {
        if (test != null) {
            history.push(currentMapId);
            setContent((NetworkMap) test, false);
            viewer.showBackButton(new Runnable() {

                @Override
                public void run() {
                    goBack();
                }
            });
        }
    }
    if (viewPart != null && test instanceof Dashboard) {
        try {
            viewPart.getSite().getPage().showView("org.netxms.ui.eclipse.dashboard.views.DashboardView", Long.toString(objectId), IWorkbenchPage.VIEW_ACTIVATE);
        } catch (PartInitException e) {
            MessageDialogHelper.openError(viewPart.getSite().getShell(), Messages.get().AbstractNetworkMapView_Error, String.format("Cannot open drill-down object view: %s", e.getMessage()));
        }
    }
}
Also used : Dashboard(org.netxms.client.objects.Dashboard) AbstractObject(org.netxms.client.objects.AbstractObject) NetworkMapObject(org.netxms.client.maps.elements.NetworkMapObject) PartInitException(org.eclipse.ui.PartInitException) NetworkMap(org.netxms.client.objects.NetworkMap)

Example 9 with Dashboard

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

the class DashboardDynamicView method createPartControl.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
	 * .Composite)
	 */
@Override
public void createPartControl(Composite parent) {
    selectionProvider = new IntermediateSelectionProvider();
    getSite().setSelectionProvider(selectionProvider);
    parentComposite = parent;
    if (dashboard != null)
        dbc = new DashboardControl(parent, SWT.NONE, dashboard, this, selectionProvider, false);
    createActions();
    contributeToActionBars();
    selectionService = getSite().getWorkbenchWindow().getSelectionService();
    selectionListener = new ISelectionListener() {

        @Override
        public void selectionChanged(IWorkbenchPart part, ISelection selection) {
            if ((part instanceof DashboardNavigator) && (selection instanceof IStructuredSelection) && !selection.isEmpty()) {
                Object object = ((IStructuredSelection) selection).getFirstElement();
                if (object instanceof Dashboard) {
                    setObject((Dashboard) object);
                }
            }
        }
    };
    selectionService.addSelectionListener(selectionListener);
}
Also used : IntermediateSelectionProvider(org.netxms.ui.eclipse.tools.IntermediateSelectionProvider) DashboardControl(org.netxms.ui.eclipse.dashboard.widgets.DashboardControl) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) ISelection(org.eclipse.jface.viewers.ISelection) Dashboard(org.netxms.client.objects.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISelectionListener(org.eclipse.ui.ISelectionListener)

Example 10 with Dashboard

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

the class ApplicationWorkbenchWindowAdvisor method showDashboard.

/**
 * Show dashboard
 *
 * @param dashboardId
 */
private void showDashboard(String dashboardId) {
    NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    long objectId;
    try {
        objectId = Long.parseLong(dashboardId);
    } catch (NumberFormatException e) {
        AbstractObject object = session.findObjectByName(dashboardId);
        if ((object == null) || !(object instanceof Dashboard)) {
            MessageDialogHelper.openError(null, Messages.get().ApplicationWorkbenchWindowAdvisor_Error, String.format(Messages.get().ApplicationWorkbenchWindowAdvisor_CannotOpenDashboard, dashboardId));
            return;
        }
        objectId = object.getObjectId();
    }
    Dashboard dashboard = (Dashboard) session.findObjectById(objectId, Dashboard.class);
    if (dashboard == null) {
        MessageDialogHelper.openError(null, Messages.get().ApplicationWorkbenchWindowAdvisor_Error, String.format(Messages.get().ApplicationWorkbenchWindowAdvisor_CannotOpenDashboard, dashboardId));
        return;
    }
    IWorkbenchPage page = getWindowConfigurer().getWindow().getActivePage();
    try {
        // $NON-NLS-1$
        IViewPart view = page.showView("org.netxms.ui.eclipse.dashboard.views.DashboardView", Long.toString(objectId), IWorkbenchPage.VIEW_ACTIVATE);
        page.setPartState(page.getReference(view), IWorkbenchPage.STATE_MAXIMIZED);
    } catch (PartInitException e) {
        MessageDialogHelper.openError(null, Messages.get().ApplicationWorkbenchWindowAdvisor_Error, String.format(Messages.get().ApplicationWorkbenchWindowAdvisor_CannotOpenDashboardType2, dashboardId, e.getLocalizedMessage()));
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) NXCSession(org.netxms.client.NXCSession) AbstractObject(org.netxms.client.objects.AbstractObject) Dashboard(org.netxms.client.objects.Dashboard) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException)

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