a1ae3eb2e50274d11e7eff7be79726a92ed9f1fe
[public/netxms.git] / src / java / netxms-eclipse / AlarmViewer / src / org / netxms / ui / eclipse / alarmviewer / objecttabs / AlarmTab.java
1 /**
2 * NetXMS - open source network management system
3 * Copyright (C) 2003-2013 Victor Kirhenshtein
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 package org.netxms.ui.eclipse.alarmviewer.objecttabs;
20
21 import org.eclipse.jface.viewers.ISelectionProvider;
22 import org.eclipse.swt.SWT;
23 import org.eclipse.swt.widgets.Composite;
24 import org.netxms.client.objects.AbstractNode;
25 import org.netxms.client.objects.AbstractObject;
26 import org.netxms.client.objects.Cluster;
27 import org.netxms.client.objects.Container;
28 import org.netxms.client.objects.EntireNetwork;
29 import org.netxms.client.objects.MobileDevice;
30 import org.netxms.client.objects.ServiceRoot;
31 import org.netxms.client.objects.Subnet;
32 import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;
33 import org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab;
34
35 /**
36 * Alarm tab
37 */
38 public class AlarmTab extends ObjectTab
39 {
40 private AlarmList alarmList;
41
42 /* (non-Javadoc)
43 * @see org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab#createTabContent(org.eclipse.swt.widgets.Composite)
44 */
45 @Override
46 protected void createTabContent(Composite parent)
47 {
48 alarmList = new AlarmList(getViewPart(), parent, SWT.NONE, "AlarmTab"); //$NON-NLS-1$
49 }
50
51 /* (non-Javadoc)
52 * @see org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab#objectChanged(org.netxms.client.objects.AbstractObject)
53 */
54 @Override
55 public void objectChanged(AbstractObject object)
56 {
57 if (object != null)
58 alarmList.setRootObject(object.getObjectId());
59 }
60
61 /* (non-Javadoc)
62 * @see org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab#refresh()
63 */
64 @Override
65 public void refresh()
66 {
67 alarmList.refresh();
68 }
69
70 /* (non-Javadoc)
71 * @see org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab#getSelectionProvider()
72 */
73 @Override
74 public ISelectionProvider getSelectionProvider()
75 {
76 return alarmList.getSelectionProvider();
77 }
78
79 /* (non-Javadoc)
80 * @see org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab#showForObject(org.netxms.client.objects.AbstractObject)
81 */
82 @Override
83 public boolean showForObject(AbstractObject object)
84 {
85 return (object instanceof AbstractNode) || (object instanceof Subnet) ||
86 (object instanceof EntireNetwork) || (object instanceof Container) ||
87 (object instanceof Cluster) || (object instanceof ServiceRoot) ||
88 (object instanceof MobileDevice);
89 }
90
91 /* (non-Javadoc)
92 * @see org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab#dispose()
93 */
94 @Override
95 public void dispose()
96 {
97 if (alarmList != null)
98 alarmList.dispose();
99 super.dispose();
100 }
101 }