summaryrefslogtreecommitdiffstats
path: root/data/mnet/Common/Java
diff options
context:
space:
mode:
Diffstat (limited to 'data/mnet/Common/Java')
-rw-r--r--data/mnet/Common/Java/AlarmApplet/Alarm.java102
-rw-r--r--data/mnet/Common/Java/AlarmApplet/AlarmStatusApplet.java139
-rw-r--r--data/mnet/Common/Java/AlarmApplet/AlarmStatusData.java139
-rw-r--r--data/mnet/Common/Java/AlarmApplet/AlarmStatusPanel.java53
-rw-r--r--data/mnet/Common/Java/AlarmApplet/AlarmStatusTable.java221
-rw-r--r--data/mnet/Common/Java/AlarmApplet/AlarmStatusTableModel.java34
-rw-r--r--data/mnet/Common/Java/AlarmApplet/AlarmStatusTablePopupMenu.java126
-rw-r--r--data/mnet/Common/Java/AlarmApplet/AlarmTCPThread.java469
-rw-r--r--data/mnet/Common/Java/AlarmApplet/FilterFrame.java337
-rw-r--r--data/mnet/Common/Java/AlarmApplet/FilterObject.java35
-rw-r--r--data/mnet/Common/Java/AlarmApplet/Makefile41
-rw-r--r--data/mnet/Common/Java/AlarmApplet/com/jetcell/MibWM/Makefile40
-rw-r--r--data/mnet/Common/Java/Images/Jetcelllogo.jpgbin0 -> 4437 bytes
-rw-r--r--data/mnet/Common/Java/Images/app_icon.GIFbin0 -> 8585 bytes
-rw-r--r--data/mnet/Common/Java/Images/app_icon2.GIFbin0 -> 13151 bytes
-rw-r--r--data/mnet/Common/Java/Images/cisco.JPGbin0 -> 14010 bytes
-rw-r--r--data/mnet/Common/Java/Images/cisco2.JPGbin0 -> 11456 bytes
-rw-r--r--data/mnet/Common/Java/Images/ciscologo.jpgbin0 -> 4437 bytes
-rw-r--r--data/mnet/Common/Java/Images/clear.gifbin0 -> 370 bytes
-rw-r--r--data/mnet/Common/Java/Images/cowbell.wavbin0 -> 1398 bytes
-rw-r--r--data/mnet/Common/Java/Images/critical.gifbin0 -> 341 bytes
-rw-r--r--data/mnet/Common/Java/Images/filler.gifbin0 -> 76 bytes
-rw-r--r--data/mnet/Common/Java/Images/gmc.jpgbin0 -> 6954 bytes
-rw-r--r--data/mnet/Common/Java/Images/grey.gifbin0 -> 145 bytes
-rw-r--r--data/mnet/Common/Java/Images/indeterminate.gifbin0 -> 477 bytes
-rw-r--r--data/mnet/Common/Java/Images/indeterminate2.gifbin0 -> 145 bytes
-rw-r--r--data/mnet/Common/Java/Images/information.gifbin0 -> 897 bytes
-rw-r--r--data/mnet/Common/Java/Images/line-01.gifbin0 -> 6199 bytes
-rw-r--r--data/mnet/Common/Java/Images/line-02.gifbin0 -> 6308 bytes
-rw-r--r--data/mnet/Common/Java/Images/logo.gifbin0 -> 1231 bytes
-rw-r--r--data/mnet/Common/Java/Images/logo.jpgbin0 -> 4437 bytes
-rw-r--r--data/mnet/Common/Java/Images/logo1.gifbin0 -> 1231 bytes
-rw-r--r--data/mnet/Common/Java/Images/major.gifbin0 -> 341 bytes
-rw-r--r--data/mnet/Common/Java/Images/minor.gifbin0 -> 337 bytes
-rw-r--r--data/mnet/Common/Java/Images/minus.gifbin0 -> 840 bytes
-rw-r--r--data/mnet/Common/Java/Images/normal.gifbin0 -> 370 bytes
-rw-r--r--data/mnet/Common/Java/Images/notify.wavbin0 -> 119384 bytes
-rw-r--r--data/mnet/Common/Java/Images/plus.gifbin0 -> 845 bytes
-rw-r--r--data/mnet/Common/Java/Images/scritical.gifbin0 -> 341 bytes
-rw-r--r--data/mnet/Common/Java/Images/sinformation.gifbin0 -> 897 bytes
-rw-r--r--data/mnet/Common/Java/Images/smajor.gifbin0 -> 341 bytes
-rw-r--r--data/mnet/Common/Java/Images/sminor.gifbin0 -> 337 bytes
-rw-r--r--data/mnet/Common/Java/Images/undrkunstrukson.gifbin0 -> 29257 bytes
-rw-r--r--data/mnet/Common/Java/Images/vipercell.gifbin0 -> 21761 bytes
-rw-r--r--data/mnet/Common/Java/Images/wireless.jpgbin0 -> 47266 bytes
-rw-r--r--data/mnet/Common/Java/Images/wireless1.JPGbin0 -> 5825 bytes
-rw-r--r--data/mnet/Common/Java/Java/AlarmApplet.java177
-rw-r--r--data/mnet/Common/Java/Java/AlarmCommThread.java121
-rw-r--r--data/mnet/Common/Java/Java/ConfigApplet.java53
-rw-r--r--data/mnet/Common/Java/Java/ConfigAppletBeanInfo.java70
-rw-r--r--data/mnet/Common/Java/Java/Makefile69
-rw-r--r--data/mnet/Common/Java/Java/SubscriberApplet.java58
-rw-r--r--data/mnet/Common/Java/Java/SubscriberAppletBeanInfo.java69
-rw-r--r--data/mnet/Common/Java/Makefile58
-rw-r--r--data/mnet/Common/Java/Text/AlarmCode.English154
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/AlarmData.java216
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/AlarmMessageMap.java131
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/AlarmPanel.java467
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/AlarmTable.java588
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/AlarmTableModel.java43
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/AlarmTablePopupMenu.java218
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/AlarmTableSorter.java97
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/BaseTable.java312
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/ImageLoader.java136
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/Makefile38
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/TableMap.java104
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/TablePopupMenu.java195
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/TableSorter.java360
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/TextClipboard.java80
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/TextComponentPopupMenu.java280
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/Util.java779
-rw-r--r--data/mnet/Common/Java/com/jetcell/MibWM/WMTextField.java156
-rw-r--r--data/mnet/Common/Java/java.mk60
73 files changed, 6825 insertions, 0 deletions
diff --git a/data/mnet/Common/Java/AlarmApplet/Alarm.java b/data/mnet/Common/Java/AlarmApplet/Alarm.java
new file mode 100644
index 0000000..cdf4b61
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/Alarm.java
@@ -0,0 +1,102 @@
+
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.String;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.net.UnknownHostException;
+import com.jetcell.MibWM.*;
+import java.net.*;
+
+
+public class Alarm{
+ public AlarmPanel alarmPanel = null;
+ JFrame f = null;
+ AlarmTCPThread commObj = null;
+ FilterFrame filterFrame = null;
+ public final static int AM_APPLET_PORT2 = 11798;
+ JPanel jpanel = null;
+
+ // Shrinivas 23rd Apr 01
+ public Alarm(String viperbaseIp, final String vipercellIp){
+ // Shrinivas end
+ JButton setFilterButton = new JButton("Set Filter");
+ final Dimension d = new JFrame().getToolkit().getScreenSize();
+ if (f == null){
+ alarmPanel = new AlarmPanel(viperbaseIp);
+ jpanel = alarmPanel.createPanel();
+ alarmPanel.setViperCellIp(vipercellIp);//passing on viperCellIp to panel
+ JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ southPanel.add(setFilterButton);
+
+ f = new JFrame("Alarm List for source: "+vipercellIp);
+ // Shrinivas 23rd Apr 01
+ f.addWindowListener(new WindowAdapter(){
+ public void windowClosing(WindowEvent evt){
+ AlarmStatusTable.removeAlarmSrcIp(vipercellIp);
+ destroy();
+ }
+ });
+ // Shrinivas end
+ if(Util.applet == null){
+ f.setIconImage(Toolkit.getDefaultToolkit().getImage("../Images/app_icon.gif"));
+ }
+ else{
+ String iconPath = Util.applet.getCodeBase().toString();
+ iconPath += "Images/app_icon.gif";
+ URL iconPathURL = null;
+ try{
+ iconPathURL = new URL(iconPath);
+ }
+ catch(MalformedURLException exc){
+ System.out.println("Bad URL.");
+ }
+ System.out.println(iconPathURL);
+ f.setIconImage(Toolkit.getDefaultToolkit().getImage(iconPathURL));
+ }
+
+ f.getContentPane().setLayout(new BorderLayout());
+ f.getContentPane().add(southPanel,BorderLayout.SOUTH);
+ f.getContentPane().add(jpanel,BorderLayout.CENTER);
+ f.setBounds(0,0, 720,400);
+ f.setLocation(d.width/5,d.height/5);
+ f.setVisible(true);
+ }
+ else
+ f.setVisible(true);
+
+ if (commObj == null)
+ commObj = new AlarmTCPThread(viperbaseIp, AM_APPLET_PORT2);
+ commObj.startReadThread(alarmPanel, vipercellIp, true);
+
+ setFilterButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent evt){
+ AlarmStatusApplet.logDM("Launch filter screen");
+ filterFrame = new FilterFrame(alarmPanel);
+ filterFrame.setLocation(d.width/4,d.width/5);
+ if(Util.applet == null){
+ filterFrame.setTitle("Filter for user : " + AlarmTCPThread.user.toUpperCase());
+ }
+ else{
+ filterFrame.setTitle("Filter Screen");
+ }
+ filterFrame.setResizable(false);
+ filterFrame.setVisible(true);
+ }
+ });
+
+ }
+
+ public void start(String vipercellIp){
+ f.setTitle("Alarm List for source: "+vipercellIp);
+ f.setVisible(true);
+ alarmPanel.setViperCellIp(vipercellIp);//passing on viperCellIp to panel
+ commObj.startReadThread(alarmPanel, vipercellIp, false);
+ }
+
+ public void destroy(){
+ System.out.println("Destroy method has been called");
+ commObj.finishReadThread();
+ }
+}
diff --git a/data/mnet/Common/Java/AlarmApplet/AlarmStatusApplet.java b/data/mnet/Common/Java/AlarmApplet/AlarmStatusApplet.java
new file mode 100644
index 0000000..cd3af38
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/AlarmStatusApplet.java
@@ -0,0 +1,139 @@
+/*
+ * AlarmStatusApplet.java
+ * Kevin Lim
+ * 03/20/00
+ */
+
+import com.jetcell.MibWM.*;
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Calendar;
+import java.lang.String;
+import javax.swing.*;
+import javax.swing.text.Document;
+import javax.swing.event.*;import java.net.*;
+import java.net.UnknownHostException;
+
+public class AlarmStatusApplet extends JApplet{
+
+ public static String ip = null;
+ public static int port = 11798; /*11800;*/
+ AlarmStatusPanel alarmPanel = null;
+ JFrame f = null;
+ static AlarmTCPThread commObj = null;
+
+ public static boolean isDebug = false;
+
+ public void init(){
+ Util.applet = this;
+ String newin = getParameter("NEWWINDOW");
+ ip = getParameter("HOST");
+ port = Integer.parseInt(getParameter("PORT"));
+
+ createUIPanel(newin);
+ }
+ // changes by Shrinivas : the code under this method were under the above init() method
+ // earlier. Function split was done so that the code could run both as an applet and an application
+ protected void createUIPanel(String newin){
+ alarmPanel = new AlarmStatusPanel();
+ if (f != null){
+ f.setVisible(true);
+ }
+ else {
+ if (newin != null){
+ System.out.println("NEWWINDOW VALUE = " +newin);
+ if(newin.equals("FALSE") || newin.equals("false")){
+ getContentPane().setLayout(new BorderLayout());
+ getContentPane().add(alarmPanel.createPanel(this),BorderLayout.CENTER);
+ }
+ else {
+ f = new JFrame("Alarm Status List for " + ip);
+ f.setIconImage(Toolkit.getDefaultToolkit().getImage("../Images/app_icon.gif"));
+ f.getContentPane().setLayout(new BorderLayout());
+ f.getContentPane().add(alarmPanel.createPanel(this));
+ f.setBounds(0,0, 720,400);
+ f.setVisible(true);
+ }
+ }
+ else {
+ System.out.println("Please set NEWWINDOW parameter to TRUE or FALSE");
+ System.out.println("Assuming - no new window");
+ getContentPane().setLayout(new BorderLayout());
+ getContentPane().add(alarmPanel.createPanel(this),BorderLayout.CENTER);
+ }
+ }
+
+ commObj = new AlarmTCPThread(ip, port);
+ commObj.startReadThread(alarmPanel);
+ }
+
+ public void start(){
+ System.out.println("Applet started");
+ }
+
+ public void stop(){
+ System.out.println("Applet stopped");
+ if (commObj != null){
+ commObj.finishReadThread();
+ commObj = null;
+ }
+ }
+
+ public void destroy(){
+ System.out.println("Destroy method has been called");
+ }
+
+ public void sendRemoveReq(AlarmStatusData data){
+ commObj.sendRemoveReq(data);
+ }
+
+ public void sendUpdateReq(){
+ commObj.sendUpdateReq();
+ }
+
+ public static void logDM(String message){
+ if(isDebug){
+ System.out.println(message);
+ }
+ }
+
+ public static void stopAPM1(){
+ if(commObj != null)
+ commObj.finishReadThread();
+ }
+
+ public static void startAPM1(String ipStr,boolean debug,String user){
+
+ isDebug = debug;
+ final JFrame frame = new JFrame();
+
+ try {
+ InetAddress.getByName(ipStr);
+ }
+ catch (UnknownHostException ex) {
+ JOptionPane.showMessageDialog(frame,"Invalid Host ID:","Error",JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ ip = ipStr;
+ final JApplet applet = new AlarmStatusApplet();
+ ((AlarmStatusApplet)applet).createUIPanel("false");
+ AlarmTCPThread.user = user;
+ frame.setContentPane(applet.getContentPane());
+ frame.setBounds(0,0, 720,400);
+ frame.setTitle("Alarm Status List for " + ip);
+ frame.setIconImage(Toolkit.getDefaultToolkit().getImage("../Images/app_icon.gif"));
+ Dimension d = new JFrame().getToolkit().getScreenSize();
+ frame.setLocation(d.width/10,d.height/10);
+ frame.setVisible(true);
+ frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosed(WindowEvent e){
+ applet.stop();
+ }
+ });
+
+ }
+}
+
diff --git a/data/mnet/Common/Java/AlarmApplet/AlarmStatusData.java b/data/mnet/Common/Java/AlarmApplet/AlarmStatusData.java
new file mode 100644
index 0000000..f989f88
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/AlarmStatusData.java
@@ -0,0 +1,139 @@
+/*
+ * AlarmStatusData.java
+ * Kevin Lim
+ * 03/20/00
+ */
+
+import java.util.StringTokenizer;
+
+public class AlarmStatusData
+{
+ final static byte ALARM_SRC_TYPE_VC = (byte)128;
+ final static byte ALARM_SRC_TYPE_VB = (byte)129;
+
+ String source_type;
+ String source_ip;
+ String source_name;
+ String critical;
+ String major;
+ String minor;
+
+ public AlarmStatusData( String source_type, String source_ip, String source_name,
+ String critical, String major, String minor)
+ {
+ this.source_type = source_type;
+ this.source_ip = source_ip;
+ this.source_name = source_name;
+ this.critical = critical;
+ this.major = major;
+ this.minor = minor;
+ }
+
+ public AlarmStatusData(byte[] msg){
+ int i = AlarmTCPThread.ALARM_HEAD_SRC_TYPE_POS;
+ extractSrcType (msg, i);
+ i = AlarmTCPThread.ALARM_MSG_HEADER_LEN;
+ extractSrcIP (msg, i);
+ i += AlarmTCPThread.ALARM_MSG_SRC_IP_SIZE;
+ extractSrcName (msg, i);
+ i += AlarmTCPThread.ALARM_MSG_SRC_NAME_SIZE;
+ extractCriCount(msg, i);
+ i += AlarmTCPThread.ALARM_MSG_CRITICAL_SIZE;
+ extractMajCount(msg, i);
+ i += AlarmTCPThread.ALARM_MSG_MAJOR_SIZE;
+ extractMinCount(msg, i);
+
+ }
+
+ public byte[] getSrcIPByte(){
+ byte[] ip = new byte[AlarmTCPThread.ALARM_MSG_SRC_IP_SIZE];
+
+ StringTokenizer st = new StringTokenizer(source_ip, ".");
+ if(st.countTokens() != 4){
+ System.out.println("Error on getSrcIPByte: ip token count");
+ return null;
+ }
+ else{
+ int i = 0;
+ while (st.hasMoreTokens()) {
+ ip[i++] = (byte) Integer.parseInt(st.nextToken());
+ }
+ }
+ return ip;
+ }
+
+ public byte getSrcTypeByte(){
+ byte type = (byte)0xFF;
+ if(source_type.equals("ViperCell"))
+ type = AlarmStatusData.ALARM_SRC_TYPE_VC;
+ else if(source_type.equals("ViperBase"))
+ type = AlarmStatusData.ALARM_SRC_TYPE_VB;
+ return type;
+ }
+
+ public int extractSrcType(byte[] msg, int i){
+ switch(msg[i]){
+ case AlarmStatusData.ALARM_SRC_TYPE_VC:
+ this.source_type = new String("ViperCell");
+ break;
+ case AlarmStatusData.ALARM_SRC_TYPE_VB:
+ this.source_type = new String("ViperBase");
+ break;
+ default:
+ this.source_type = new String("Unknown");
+ }
+ return (int)msg[i];
+ }
+
+ public void extractSrcIP(byte[] msg, int i) {
+ int h1 = (int)msg[i] & 0x00FF;
+ int h2 = (int)msg[i+1] & 0x00FF;
+ int h3 = (int)msg[i+2] & 0x00FF;
+ int h4 = (int)msg[i+3] & 0x00FF;
+ this.source_ip = "" + (new Integer(h1)).toString() +
+ "." + (new Integer(h2)).toString() +
+ "." + (new Integer(h3)).toString() +
+ "." + (new Integer(h4)).toString();
+ }
+
+ public void extractSrcName(byte[] msg, int i){
+ byte[] name = new byte[AlarmTCPThread.ALARM_MSG_SRC_NAME_SIZE];
+ for(int j=0; j<AlarmTCPThread.ALARM_MSG_SRC_NAME_SIZE; j++)
+ name[j] = msg[i+j];
+ this.source_name = (new String(name)).trim();
+ }
+
+ public void extractCriCount(byte[] msg, int i){
+ this.critical = (new Integer((int)msg[i] & 0x00FF)).toString();
+ }
+
+ public void extractMajCount(byte[] msg, int i){
+ this.major = (new Integer((int)msg[i] & 0x00FF)).toString();
+ }
+
+ public void extractMinCount(byte[] msg, int i){
+ this.minor = (new Integer((int)msg[i] & 0x00FF)).toString();
+ }
+
+ public void dump(){
+ System.out.println("*****************************");
+ System.out.println("Source Type : " + source_type);
+ System.out.println("Source IP : " + source_ip);
+ System.out.println("Source Name : " + source_name);
+ System.out.println("Critical Count: " + critical);
+ System.out.println("Major Count : " + major);
+ System.out.println("Minor Count : " + minor);
+ System.out.println("*****************************");
+ }
+
+ public static void main(String[] argv){
+ byte[] msg = { (byte)128, 1, 0, 48, 10, 1, 2, (byte)250,
+ (byte)'V', (byte)'i', (byte)'p', (byte)'e', (byte)'r', (byte)'1', 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3 };
+ AlarmStatusData data = new AlarmStatusData(msg);
+ data.dump();
+ }
+
+}
+
diff --git a/data/mnet/Common/Java/AlarmApplet/AlarmStatusPanel.java b/data/mnet/Common/Java/AlarmApplet/AlarmStatusPanel.java
new file mode 100644
index 0000000..c4c0efd
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/AlarmStatusPanel.java
@@ -0,0 +1,53 @@
+/*
+ * AlarmStatusPanel.java
+ * Kevin Lim
+ * 03/20/00
+ */
+
+
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.table.*;
+import java.awt.event.*;
+import javax.swing.text.Document;
+import javax.swing.event.*;
+import java.net.UnknownHostException;
+import java.awt.*;
+import java.util.*;
+
+public class AlarmStatusPanel{
+ static String host = null;
+ AlarmStatusTable alarmStatusTable = null;
+ JLabel statLabel = null;
+
+ public AlarmStatusPanel(){
+ }
+
+ public JPanel createPanel(JApplet applet){
+ JPanel panel = new JPanel();
+ panel.setBorder(new EmptyBorder(5, 5, 5, 5));
+ panel.setLayout(new BorderLayout());
+ AlarmStatusTableModel model = new AlarmStatusTableModel();
+ alarmStatusTable = new AlarmStatusTable(model, applet);
+ JScrollPane scroller= new JScrollPane( alarmStatusTable,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ panel.add(scroller, BorderLayout.CENTER);
+ statLabel = new JLabel("Server Status");
+ panel.add(statLabel, BorderLayout.SOUTH);
+ return panel;
+ }
+
+ public void addEvent(AlarmStatusData alarm){
+ alarmStatusTable.setAlarmStatusData(alarm);
+ }
+
+ public void dispStatus(String status){
+ statLabel.setText(status);
+ }
+
+ public void clearEvents() {
+ alarmStatusTable.RemoveAll();
+ }
+}
+
diff --git a/data/mnet/Common/Java/AlarmApplet/AlarmStatusTable.java b/data/mnet/Common/Java/AlarmApplet/AlarmStatusTable.java
new file mode 100644
index 0000000..ec23f91
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/AlarmStatusTable.java
@@ -0,0 +1,221 @@
+/*
+ * AlarmStatusTable
+ * Kevin Lim
+ * 03/20/00
+ */
+
+
+
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.JTable;
+import javax.swing.table.*;
+import javax.swing.event.*;
+import java.util.Hashtable;
+import java.awt.*;
+import java.io.*;
+import java.net.*;
+import java.applet.*;
+import com.jetcell.MibWM.Util;
+// Shrinivas 23rd Apr 01
+import java.util.*;
+// Shrinivas end
+public class AlarmStatusTable extends JTable {
+
+ DefaultTableModel model;
+ JPopupMenu popupMenu = null;
+ JApplet applet = null;
+ // Shrinivas 23rd Apr 01
+ //Alarm alarm = null;
+ static Vector alarmSrcIpList = null;
+ // Shrinivas end
+ final int [] columnMinWidth = { 30, 60, 30, 30, 30, 0};
+ final int [] columnMaxWidth = {200, 150, 150, 150, 150, 0};
+ Hashtable alarmHashTable = null;
+
+ public AlarmStatusTable(DefaultTableModel model, JApplet applet){
+ super(model);
+ // Shrinivas 23rd Apr 01
+ alarmSrcIpList = new Vector(8,3);
+ // Shrinivas end
+ popupMenu = AlarmStatusTablePopupMenu.getPopupMenu();
+ this.applet = applet;
+
+ addMouseListener(new MouseHandler(this));
+ alarmHashTable = new Hashtable();
+ for (int i=0; i < model.getColumnCount(); i++ )
+ setColumnWidth(i, columnMinWidth[i], columnMaxWidth[i]);
+ TableColumnModel colModel = getColumnModel();
+ colModel.getColumn(AlarmStatusTableModel.CRITICAL).setCellRenderer(new CountCellRenderer());
+ colModel.getColumn(AlarmStatusTableModel.MAJOR).setCellRenderer(new CountCellRenderer());
+ colModel.getColumn(AlarmStatusTableModel.MINOR).setCellRenderer(new CountCellRenderer());
+
+ setRowSelectionAllowed(true);
+ setColumnSelectionAllowed(false);
+ setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
+ setShowGrid(true);
+ setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
+ getTableHeader().setReorderingAllowed(false);
+ }
+
+ public void setColumnWidth(int columnIndex, int minWidth, int maxWidth){
+ TableColumn column = (TableColumn)getColumn(getColumnName(columnIndex));
+ column.setMinWidth(minWidth);
+ column.setMaxWidth(maxWidth);
+ }
+
+ public boolean isCellEditable(int i, int j){
+ return false;
+ }
+
+ public AlarmStatusData getAlarmStatusData(String source_ip){
+ if (alarmHashTable != null)
+ return (AlarmStatusData) alarmHashTable.get(source_ip);
+ return null;
+ }
+
+ public int rowAlarmStatusData(String source_ip){
+ int row_count = ((DefaultTableModel)getModel()).getRowCount();
+ for(int i=0; i<row_count; i++){
+ String ip = (String)getValueAt(i, AlarmStatusTableModel.SRC_IP);
+ if(ip.equals(source_ip))
+ return i;
+ }
+ return -1;
+ }
+
+ public void setAlarmStatusData(AlarmStatusData alarm){
+ int row_index;
+ if (getAlarmStatusData(alarm.source_ip) != null){
+ alarmHashTable.remove(alarm.source_ip);
+ alarmHashTable.put(alarm.source_ip, alarm);
+ row_index = rowAlarmStatusData(alarm.source_ip);
+ setValueAt(alarm.source_ip, row_index, AlarmStatusTableModel.SRC_IP);
+ setValueAt(alarm.source_name, row_index, AlarmStatusTableModel.SRC_NAME);
+ setValueAt(alarm.critical, row_index, AlarmStatusTableModel.CRITICAL);
+ setValueAt(alarm.major, row_index, AlarmStatusTableModel.MAJOR);
+ setValueAt(alarm.minor, row_index, AlarmStatusTableModel.MINOR);
+ }
+ else{
+ alarmHashTable.put(alarm.source_ip, alarm);
+ row_index = ((DefaultTableModel)getModel()).getRowCount();
+ Object [] row = new Object[AlarmStatusTableModel.NUM_COL];
+ row[AlarmStatusTableModel.SRC_IP] = alarm.source_ip;
+ row[AlarmStatusTableModel.SRC_NAME] = alarm.source_name;
+ row[AlarmStatusTableModel.CRITICAL] = alarm.critical;
+ row[AlarmStatusTableModel.MAJOR] = alarm.major;
+ row[AlarmStatusTableModel.MINOR] = alarm.minor;
+ ((DefaultTableModel)getModel()).insertRow(row_index, row);
+ }
+ }
+
+ // Shrinivas 23rd Apr 01
+ public static void removeAlarmSrcIp(String ip){
+ alarmSrcIpList.remove(ip);
+ }
+ // Shrinivas end
+ public void OpenEvent(){
+ int selectedRow = getSelectedRow();
+ if(selectedRow == -1){
+ System.out.println("Open Event: no selection made");
+ return;
+ }
+ String ip = (String)getValueAt(selectedRow, AlarmStatusTableModel.SRC_IP);
+ //System.out.println("Open Event: " +ip);
+ // Shrinivas 23rd Apr 01
+ if(alarmSrcIpList.contains(ip)){
+ return;
+ }
+ else{
+ alarmSrcIpList.add(ip);
+ }
+ Alarm alarmList = new Alarm(AlarmStatusApplet.ip, ip);
+ /*if (alarm == null){
+ alarm = new Alarm(AlarmStatusApplet.ip, ip);
+ }
+ else
+ alarm.start(ip); */
+ // Shrinivas end
+ } // end OpenEvent()
+
+ public void Remove(){
+ int selectedRow = getSelectedRow();
+ if(selectedRow == -1){
+ System.out.println("Remove Event: no selection made");
+ return;
+ }
+ String ip = (String)getValueAt(selectedRow, AlarmStatusTableModel.SRC_IP);
+ System.out.println("Remove Event: " +ip);
+ AlarmStatusData data = getAlarmStatusData(ip);
+ if(data == null){
+ System.out.println("Remove Event: data not found");
+ }
+ else{
+ alarmHashTable.remove(ip);
+ int row_index = rowAlarmStatusData(ip);
+ ((DefaultTableModel)getModel()).removeRow(row_index);
+ }
+ ((AlarmStatusApplet)applet).sendRemoveReq(data);
+ }
+
+ public void RemoveAll(){
+ int row_count = ((DefaultTableModel)getModel()).getRowCount();
+ while(row_count != 0){
+ String ip = (String)getValueAt(0, AlarmStatusTableModel.SRC_IP);
+ alarmHashTable.remove(ip);
+ ((DefaultTableModel)getModel()).removeRow(0);
+ row_count = ((DefaultTableModel)getModel()).getRowCount();
+ }
+ }
+
+ public void Refresh(){
+ ((AlarmStatusApplet)applet).sendUpdateReq();
+ }
+
+
+ class MouseHandler extends MouseAdapter{
+ public AlarmStatusTable table;
+
+ public MouseHandler(AlarmStatusTable table){
+ this.table = table;
+ }
+
+ public void mouseReleased(MouseEvent e){
+ if (e.getClickCount() == 2 ){
+ OpenEvent();
+ }
+
+ if ( e.isPopupTrigger()){
+ // changes by Shrinivas on 17th Oct 2k
+ System.out.println("Event : Popup menu");
+ int selectedRow = rowAtPoint(new Point(e.getX(),e.getY()));
+ setRowSelectionInterval(selectedRow,selectedRow);
+ // end of changes
+ popupMenu.show(table, e.getX(), e.getY());
+ }
+ }
+ }
+
+ class CountCellRenderer extends JLabel implements TableCellRenderer{
+ Font defaultFont = new Font("Helvetica", Font.BOLD,12);
+ Font empFont = new Font("TimesRoman", Font.BOLD,18);
+
+ public CountCellRenderer(){
+ super("Unknown");
+ setHorizontalAlignment(JLabel.CENTER);
+ }
+
+ public Component getTableCellRendererComponent( JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column ){
+ setText((String)value);
+
+ return this;
+ }
+ }
+
+}
+
diff --git a/data/mnet/Common/Java/AlarmApplet/AlarmStatusTableModel.java b/data/mnet/Common/Java/AlarmApplet/AlarmStatusTableModel.java
new file mode 100644
index 0000000..85aa726
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/AlarmStatusTableModel.java
@@ -0,0 +1,34 @@
+/*
+ * AlarmStatusTableModel.java
+ * Kevin Lim
+ * 03/20/00
+ */
+
+
+
+import javax.swing.*;
+import javax.swing.table.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+public class AlarmStatusTableModel extends DefaultTableModel
+
+
+{
+ final static int SRC_IP = 0;
+ final static int SRC_NAME = 1;
+ final static int CRITICAL = 2;
+ final static int MAJOR = 3;
+ final static int MINOR = 4;
+
+ static String ColumnTitle[] = {"Source IP", "Source Name", "Critical Alarm", "Major Alarm", "Minor Alarm"};
+ final static int NUM_COL = ColumnTitle.length;
+
+ public AlarmStatusTableModel()
+ {
+ super(ColumnTitle, 0);
+ }
+}
+
+
diff --git a/data/mnet/Common/Java/AlarmApplet/AlarmStatusTablePopupMenu.java b/data/mnet/Common/Java/AlarmApplet/AlarmStatusTablePopupMenu.java
new file mode 100644
index 0000000..e91f3f4
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/AlarmStatusTablePopupMenu.java
@@ -0,0 +1,126 @@
+/*
+ * AlarmStatusTablePopupMenu.java
+ * Kevin Lim
+ * 03/20/00
+ */
+
+
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.text.*;
+
+public class AlarmStatusTablePopupMenu extends JPopupMenu implements ActionListener{
+ static JMenuItem openMenuItem;
+ static JMenuItem removeMenuItem;
+ static JMenuItem refreshMenuItem;
+ static boolean iconsLoaded = false;
+ protected static AlarmStatusTablePopupMenu popupMenu = new AlarmStatusTablePopupMenu();
+ static AlarmStatusTable invoker ;
+ static int x;
+ static int y;
+
+
+ /**
+ * You cannot instantiate this class. Use getPopupMenu() to get
+ * a shared instance!
+ */
+ protected AlarmStatusTablePopupMenu(){
+
+ openMenuItem = new JMenuItem(new String("Open Alarm"));
+ openMenuItem.setMnemonic('O');
+ openMenuItem.registerKeyboardAction(null, KeyStroke.getKeyStroke('O', Event.ALT_MASK, false),
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+ openMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ openMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ openMenuItem.addActionListener(this);
+ add(openMenuItem);
+
+ removeMenuItem = new JMenuItem(new String("Remove"));
+ removeMenuItem.setMnemonic('m');
+ removeMenuItem.registerKeyboardAction(null, KeyStroke.getKeyStroke('m', Event.ALT_MASK, false),
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+ removeMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ removeMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ removeMenuItem.addActionListener(this);
+ add(removeMenuItem);
+
+ // Shrinivas 20th Apr 01
+ /*refreshMenuItem = new JMenuItem(new String("Refresh"));
+ refreshMenuItem.setMnemonic('R');
+ refreshMenuItem.registerKeyboardAction(null, KeyStroke.getKeyStroke('R', Event.ALT_MASK, false),
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+ refreshMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ refreshMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ refreshMenuItem.addActionListener(this);
+ add(refreshMenuItem);*/
+ // Shrinivas end
+ }
+
+
+ /**
+ * returns shared instance of popupMenu
+ */
+ public static AlarmStatusTablePopupMenu getPopupMenu(){
+ return popupMenu;
+ }
+
+
+ /**
+ * update to use difference icons later!
+ */
+ void loadIcons(){
+ }
+
+
+ /**
+ * update to use shared clipboard access later
+ */
+ public void actionPerformed(ActionEvent e){
+ Object obj = e.getSource();
+ String selection = null;
+
+ if (obj == openMenuItem) {
+ invoker.OpenEvent();
+ }
+ else if (obj == removeMenuItem) {
+ invoker.Remove();
+ }
+ else if (obj == refreshMenuItem) {
+ invoker.Refresh();
+ }
+ }
+
+
+ /**
+ * force JTable only later
+ */
+ public void show(Component c, int x, int y){
+ invoker = (AlarmStatusTable)c;
+
+ Point p = new Point(x,y);
+ int row = invoker.rowAtPoint(p);
+ int col = invoker.columnAtPoint(p);
+
+ this.x = x;
+ this.y = y;
+ super.show(c,x,y);
+ }
+
+
+ void disableMenu() {
+ openMenuItem.setEnabled(false);
+ removeMenuItem.setEnabled(false);
+ refreshMenuItem.setEnabled(false);
+ }
+
+
+ void enableMenu(){
+ openMenuItem.setEnabled(true);
+ removeMenuItem.setEnabled(true);
+ refreshMenuItem.setEnabled(true);
+ }
+}
+
diff --git a/data/mnet/Common/Java/AlarmApplet/AlarmTCPThread.java b/data/mnet/Common/Java/AlarmApplet/AlarmTCPThread.java
new file mode 100644
index 0000000..3a4ed0d
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/AlarmTCPThread.java
@@ -0,0 +1,469 @@
+
+/*
+ * AlarmTCPThread.java
+ * Kevin Lim
+ * 03/21/00
+ */
+
+
+
+import java.net.*;
+import java.io.*;
+import javax.swing.*;
+import javax.swing.*;
+import javax.swing.text.Document;
+import javax.swing.event.*;
+import com.jetcell.MibWM.*;
+
+public class AlarmTCPThread extends Thread{
+
+ static private boolean FILTER = false;
+ private String filterVipercellIp = null;
+
+ static final int MAX_IN_BUF_SIZE = 4096;
+ static final int MAX_MSG_BUF_SIZE = 1024;
+ static final int ALARM_HEAD_SRC_TYPE_POS = 0;
+ static final int ALARM_HEAD_MSG_TYPE_POS = 1;
+ static final int ALARM_HEAD_MSG_SIZE_POS = 2;
+ static final int ALARM_MSG_HEADER_LEN = 4;
+ static final int ALARM_MSG_SRC_IP_SIZE = 4;
+ static final int ALARM_MSG_SRC_NAME_SIZE = 41;
+ static final int ALARM_MSG_CRITICAL_SIZE = 1;
+ static final int ALARM_MSG_MAJOR_SIZE = 1;
+ static final int ALARM_MSG_MINOR_SIZE = 1;
+
+ static final byte ALARM_MSG_TYPE_UPDATE_REQ = 1;
+ static final byte ALARM_MSG_TYPE_UPDATE_RSP = 2;
+ static final byte ALARM_MSG_TYPE_REMOVE_REQ = 3;
+ static final byte ALARM_MSG_TYPE_EVENT_REQ = 4;
+ static final byte ALARM_MSG_TYPE_EVENT_RSP = 5;
+ static final byte ALARM_MSG_TYPE_ACK = 6;
+
+ static final byte ALARM_MSG_SRC_TYPE_APPLET = (byte)0xFF;
+
+static final int MAX_MODULE_SPECIC_ALARM = 0xFFFF;
+ static final int ALARM_CRITICAL_START_POINT = 0x0001;
+ static final int ALARM_MAJOR_START_POINT = 0x0100;
+ static final int ALARM_MINOR_START_POINT = 0x0800;
+ static final int ALARM_INFO_START_POINT = 0x1000;
+ static final int ALARM_CRITICAL = 0;
+ static final int ALARM_MAJOR = 1;
+ static final int ALARM_MINOR = 2;
+ static final int ALARM_INFO = 3;
+ public static String user = null;
+
+ Socket socket;
+ String host;
+ int port;
+ int appletVipercellIp = 0;
+ int msgVipercellIp = 0;
+ AlarmStatusPanel panel = null;
+ AlarmPanel alarmPanel = null;
+ AlarmData alarmData = null;
+ BufferedInputStream in = null;
+ InputStreamReader isr = null;
+ public static BufferedOutputStream out = null;
+ boolean running;
+
+ public AlarmTCPThread(String host, int port) {
+ this.host = host;
+ this.port = port;
+ System.out.println("Connecting to the Server " + host + " at port " + port);
+ try {
+ socket = new Socket(host, port);
+ } catch(IOException e) {
+ System.out.println("Could not connect to the Server");
+ socket = null;
+ }
+ if(socket != null){
+ try {
+ in = new BufferedInputStream(socket.getInputStream()); // reading is done to byte arrays
+ out = new BufferedOutputStream(socket.getOutputStream()); // writing is done from byte arrays
+ out.flush();
+ } catch(IOException e) {
+ System.out.println("IO exception in AlarmTCPThread: ");
+ close_socket();
+ }
+ }
+ }
+
+ public void sendRemoveReq(AlarmStatusData data)
+ {
+ if(out == null) return;
+ try {
+ byte[] msg = {ALARM_MSG_SRC_TYPE_APPLET,
+ ALARM_MSG_TYPE_REMOVE_REQ,
+ 0, 5, 0, 0, 0, 0, 0};
+ int i = AlarmTCPThread.ALARM_MSG_HEADER_LEN;
+ byte[] ip_addr = data.getSrcIPByte();
+ if(ip_addr == null){
+ System.out.println("Error on sendRemoveReq: getSrcIPByte failed");
+ return;
+ }
+ for(int j=0; j<AlarmTCPThread.ALARM_MSG_SRC_IP_SIZE; j++){
+ msg[i++] = ip_addr[j];
+ System.out.println("ip_addr "+ip_addr[j]);
+ }
+ byte type = data.getSrcTypeByte();
+ if(type == (byte)0xFF){
+ System.out.println("Error on sendRemoveReq: getSrcTypeByte returned unknown");
+ return;
+ }
+ msg[i++] = type;
+ out.write(msg, 0, i);
+ out.flush();
+ } catch(IOException ioe) {
+ System.out.println("IO exception in AlarmTCPThread:send "+ioe);
+ }
+ }
+
+ public void sendUpdateReq(){
+ if(out == null) return;
+ try {
+ byte[] msg = {ALARM_MSG_SRC_TYPE_APPLET,
+ ALARM_MSG_TYPE_UPDATE_REQ,
+ 0, 0};
+ out.write(msg, 0, ALARM_MSG_HEADER_LEN);
+ out.flush();
+ } catch(IOException ioe) {
+ System.out.println("IO exception in AlarmTCPThread:send "+ioe);
+ }
+ }
+
+ // send alarm event msg update request to AlarmServer
+ static public void sendEventReq(String vipercellIp){
+ int index = 0;
+ String tmpStr = vipercellIp;
+ String valueStr;
+ Short [] ip = new Short[4];
+ if (out == null)
+ return;
+
+ // converting IP string into 4 octets
+ for (int i = 0; i < 4; i++){
+ index = tmpStr.indexOf(".");
+ valueStr = i == 3 ? tmpStr : tmpStr.substring(0, index);
+ ip[i] = new Short(valueStr);
+ tmpStr = tmpStr.substring(index + 1);
+ }
+
+ try {
+ byte[] msg = {ALARM_MSG_SRC_TYPE_APPLET,
+ ALARM_MSG_TYPE_EVENT_REQ,
+ 0x00, 0x04, // length of data
+ ip[0].byteValue(), ip[1].byteValue(), ip[2].byteValue(),
+ ip[3].byteValue()};
+ out.write(msg, 0, ALARM_MSG_HEADER_LEN + 4);
+ out.flush();
+ }
+ catch(IOException ioe) {
+ System.out.println("IO exception in AlarmTCPThread:send "+ioe);
+ }
+ FILTER = false;
+ }
+
+ public static void sendAck(String srcIp,String alarmId,String recordNum){
+ int index = 0;
+ String tmpStr = srcIp;
+ String valueStr;
+ Short [] ip = new Short[4];
+
+ byte aid[] = new byte[4];
+ byte rec[] = new byte[4];
+
+
+ // converting IP string into 4 octets
+ for (int i = 0; i < 4; i++){
+ index = tmpStr.indexOf(".");
+ valueStr = i == 3 ? tmpStr : tmpStr.substring(0, index);
+ ip[i] = new Short(valueStr);
+ tmpStr = tmpStr.substring(index + 1);
+ }
+
+ // converting alarmID to bytes
+ aid = AlarmTCPThread.extractBytes(alarmId);
+ rec = AlarmTCPThread.extractBytes(recordNum);
+
+ try {
+ byte[] msg = {ALARM_MSG_SRC_TYPE_APPLET,
+ ALARM_MSG_TYPE_ACK,
+ 0x00, 0x0c, // length of data
+ ip[0].byteValue(), ip[1].byteValue(), ip[2].byteValue(),
+ ip[3].byteValue(),
+ aid[3],aid[2],aid[1],aid[0],
+ rec[3],rec[2],rec[1],rec[0]};
+ out.write(msg, 0, msg.length);
+ out.flush();
+ }
+ catch(IOException ioe) {
+ AlarmStatusApplet.logDM("IO exception in AlarmTCPThread: ack "+ioe);
+ }
+ }
+
+ public static byte[] extractBytes(String s){
+
+ byte store[] = new byte[4];
+ int intValue = Integer.parseInt(s);
+
+ store[0] = (byte)(intValue & 0x000000ff);
+ store[1] = (byte)((intValue >> 8) & 0x000000ff);
+ store[2] = (byte)((intValue >> 16) & 0x000000ff);
+ store[3] = (byte)((intValue >> 24) & 0x000000ff);
+
+ return store;
+ }
+
+ public void alarmMsgHandler(byte[] msg) {
+ int index = AlarmTCPThread.ALARM_HEAD_MSG_TYPE_POS;
+ switch(msg[index]){
+ case ALARM_MSG_TYPE_UPDATE_RSP:
+ if (panel != null)
+ {
+ AlarmStatusData alarm = new AlarmStatusData(msg);
+ panel.addEvent(alarm);
+ }
+ break;
+ case ALARM_MSG_TYPE_EVENT_RSP:
+ if (alarmPanel != null)
+ {
+ try {
+ alarmData = new AlarmData(parseEventData(msg));
+ }
+ catch(Exception e) {}
+ if (appletVipercellIp == msgVipercellIp){
+ alarmPanel.addEvent(alarmData);
+ }
+ }
+ break;
+ default:
+ System.out.println("Unknown message received "+(int)msg[index]);
+ int size = 0x00FF & (int)msg[AlarmTCPThread.ALARM_HEAD_MSG_SIZE_POS];
+ size = (size << 8) | (0x00FF & (int)msg[AlarmTCPThread.ALARM_HEAD_MSG_SIZE_POS+1]);
+ size += AlarmTCPThread.ALARM_MSG_HEADER_LEN;
+ if(size > AlarmTCPThread.MAX_MSG_BUF_SIZE) size = AlarmTCPThread.MAX_MSG_BUF_SIZE;
+ for(int i=0; i<size; i++) System.out.print(" " + (int)(msg[i] & 0x00FF));
+ System.out.println(" ");
+ }
+ }
+
+ public void close_socket() {
+ if(socket != null){
+ try {
+ socket.close();
+ System.out.println("closing socket at third window level...");
+ }
+ catch(IOException e) {
+ System.out.println("Couldn't close socket " + e);
+ }
+ }
+ }
+
+ public void reconnect() {
+ boolean done = false;
+ while(!done){
+ try {
+ if (panel != null)
+ panel.dispStatus("Attempting to reconnect to the Server...");
+ socket = new Socket(host, port);
+ done = true;
+ if (panel != null)
+ panel.dispStatus("Server on-line");
+ }
+ catch(IOException e) {
+ if (panel != null)
+ panel.dispStatus("Server off-line");
+ }
+ try {
+ sleep(1000);
+ }
+ catch (InterruptedException ie) {
+ System.out.println(" Interrupted Excution = " + ie);
+ }
+ }
+ if(socket != null){
+ try {
+ in = new BufferedInputStream(socket.getInputStream()); // reading is done to byte arrays
+ out = new BufferedOutputStream(socket.getOutputStream()); // writing is done from byte arrays
+ out.flush();
+ if (panel != null) {
+ panel.clearEvents();
+ sendUpdateReq();
+ }
+ }
+ catch(IOException e) {
+ System.out.println("IO exception in AlarmTCPThread: ");
+ close_socket();
+ }
+ }
+ }
+
+ public void run() {
+ // Shrinivas 01 June 01
+ if(socket == null && running ) reconnect();
+ byte[] buf = new byte[AlarmTCPThread.MAX_IN_BUF_SIZE];
+ byte[] msg = new byte[AlarmTCPThread.MAX_MSG_BUF_SIZE];
+ running = true;
+ int readBytes;
+ int index;
+ int msg_size;
+ int header_size = AlarmTCPThread.ALARM_MSG_HEADER_LEN;
+ while(running){
+ try {
+ readBytes = in.read(buf, 0, AlarmTCPThread.MAX_IN_BUF_SIZE);
+ if(readBytes == -1){
+ System.out.println("End of stream reached!");
+ close_socket();
+ // Shrinivas 01 June 01'
+ if(running){
+ reconnect();
+ }
+ // Shrinivas end
+ }
+ index = 0;
+ while ((index + header_size) <= readBytes){ // while there are msg at least size of header
+ msg_size = 0x00FF & (int)buf[index+AlarmTCPThread.ALARM_HEAD_MSG_SIZE_POS];
+ msg_size = (msg_size << 8)
+ | (0x00FF & (int)buf[index+AlarmTCPThread.ALARM_HEAD_MSG_SIZE_POS+1]);
+ if((header_size + msg_size) <= (readBytes - index)){ // about to copy msg within valid range
+ for(int i=0; i<(header_size + msg_size); i++){
+ msg[i] = buf[index++];
+ }
+ AlarmStatusApplet.logDM("Received msg with length: " + msg_size);
+ alarmMsgHandler(msg);
+ }
+ else{
+ System.out.println("Length Err. Msg Length specified : "+msg_size);
+ System.out.println("Length Err. Bytes left in read buf: "+(readBytes - index));
+ index = readBytes; // finish while
+ }
+ }
+ }
+ catch(IOException e) {
+ close_socket();
+ if(running != false){
+ reconnect();
+ }
+ System.out.println("Stopping thread.");
+ }
+ }
+ }
+
+ public void startReadThread(AlarmStatusPanel panel){
+ this.panel = panel;
+ start();
+ panel.dispStatus("Server on-line");
+ sendUpdateReq();
+ }
+
+ public void startReadThread(AlarmPanel panel, String vipercellIp, boolean startThread){
+ alarmPanel = panel;
+ alarmPanel.removeAllEvents();
+ setAppletVipercellIp(vipercellIp);
+ if (startThread)
+ start();
+ this.filterVipercellIp = vipercellIp;
+ sendEventReq(vipercellIp);
+ }
+
+ public void finishReadThread(){
+ System.out.println("TCP thread is being shutdown");
+ running = false;
+ close_socket();
+ stop();
+ }
+
+ private void setAppletVipercellIp(String vipercellIp){
+ String valueStr;
+ Short octetVal;
+ String tmpStr = vipercellIp;
+ int index = 0;
+ appletVipercellIp = 0;
+ for (int i = 0; i < 4; i++)
+ {
+ index = tmpStr.indexOf(".");
+ valueStr = i == 3 ? tmpStr : tmpStr.substring(0, index);
+ if (i > 1) // we use only last two octets
+ {
+ octetVal = new Short(valueStr);
+ if (i == 2)
+ appletVipercellIp = octetVal.shortValue() << 8;
+ else
+ appletVipercellIp += octetVal.shortValue();
+ }
+ tmpStr = tmpStr.substring(index + 1);
+ }
+ }
+
+ private int extractNumber(byte[] msg, int pos){
+ return ((msg[pos] << 24 & 0xff000000) +
+ (msg[pos+1] << 16 & 0xff0000) +
+ (msg[pos+2] << 8 & 0xff00) +
+ (msg[pos+3] & 0xff));
+ }
+
+ private int extractIp(byte[] msg, int pos){
+ // for now, we are only extracting last 2 octets of an IP address
+ return((msg[pos+2] << 8 & 0xff00) + (msg[pos+3] & 0xff));
+ }
+
+ public String extractSrcIP(byte[] msg, int i){
+ int h1 = (int)msg[i] & 0x00FF;
+ int h2 = (int)msg[i+1] & 0x00FF;
+ int h3 = (int)msg[i+2] & 0x00FF;
+ int h4 = (int)msg[i+3] & 0x00FF;
+ String source_ip = "" + (new Integer(h1)).toString() +
+ "." + (new Integer(h2)).toString() +
+ "." + (new Integer(h3)).toString() +
+ "." + (new Integer(h4)).toString();
+
+ return source_ip;
+ }
+
+ private int getSeverity(int errorCode){
+ int severity;
+
+ if (errorCode == 0)
+ return ALARM_INFO;
+
+ int tmp = (errorCode & MAX_MODULE_SPECIC_ALARM);
+ if (tmp < ALARM_MAJOR_START_POINT)
+ {
+ severity = ALARM_CRITICAL;
+ } else if (tmp < ALARM_MINOR_START_POINT) {
+ severity = ALARM_MAJOR;
+ } else if (tmp < ALARM_INFO_START_POINT) {
+ severity = ALARM_MINOR;
+ } else {
+ severity = ALARM_INFO;
+ }
+ return severity;
+ }
+
+ private String parseEventData(byte[] msg) {
+ int id = extractNumber(msg, 4);
+ int code = extractNumber(msg, 8);
+ int severity = getSeverity(code);
+ int timestamp = extractNumber(msg, 12);
+ int srcIp = extractIp(msg, 16);
+
+ String srcIpString = extractSrcIP(msg, 16);
+
+ if (0 == appletVipercellIp){
+ appletVipercellIp = srcIp;
+ msgVipercellIp = srcIp;
+ }
+ else
+ msgVipercellIp = srcIp;
+ int srcModule = extractNumber(msg, 64);
+ int opt1 = extractNumber(msg, 68);
+ int opt2 = extractNumber(msg, 72);
+ int ack = extractNumber(msg,76);
+ int recNumber = extractNumber(msg,80);
+ String srcName = new String(msg, 20, 41);
+ srcName = srcName.trim();
+ String eventData = new String(id+"|"+timestamp+"|"+severity+"|"+srcModule+"|"+
+ srcName+"|"+code+"|"+opt1+"|"+opt2+"|"+srcIpString+"|"+ack+"|"+recNumber+"|");
+ return eventData;
+ }
+}
+
diff --git a/data/mnet/Common/Java/AlarmApplet/FilterFrame.java b/data/mnet/Common/Java/AlarmApplet/FilterFrame.java
new file mode 100644
index 0000000..c130ca4
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/FilterFrame.java
@@ -0,0 +1,337 @@
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+import javax.swing.UIManager.*;
+import java.net.*;
+
+import com.jetcell.MibWM.*;
+
+ public class FilterFrame extends JFrame{
+
+ final FilterFrame ff = this;
+
+ Container contentPane = null;
+ JPanel centerPanel = null;
+ JPanel southPanel = null;
+
+ // Labels
+ JLabel alarms = null;
+ JLabel time = null;
+ JLabel severity = null;
+ JLabel acknowledge = null;
+
+ // Combo Boxes
+ JComboBox alarmCombo = new JComboBox();
+ JComboBox timeCombo = new JComboBox();
+ JComboBox severityCombo = new JComboBox();
+ JComboBox acknowledgeCombo = new JComboBox();
+
+ // Reference to "AlarmPanel"
+ AlarmPanel alarmPanel = null;
+
+ public static FilterObject filterObject = null;
+ public static FilterObject tempFilterObject = null;
+
+ public FilterFrame(){
+ if(Util.applet == null){
+ setIconImage(Toolkit.getDefaultToolkit().getImage("../Images/app_icon.gif"));
+ }
+ else{
+ String iconPath = Util.applet.getCodeBase().toString();
+ iconPath += "Images/app_icon.gif";
+ URL iconPathURL = null;
+ try{
+ iconPathURL = new URL(iconPath);
+ }
+ catch(MalformedURLException exc){
+ System.out.println("Bad URL.");
+ }
+ System.out.println(iconPathURL);
+ setIconImage(Toolkit.getDefaultToolkit().getImage(iconPathURL));
+ }
+ }
+
+ public FilterFrame(AlarmPanel panel){
+ this.alarmPanel = panel;
+ if(tempFilterObject == null)
+ tempFilterObject = filterObject;
+ try{
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ }
+ catch(Exception ex){
+ System.out.println("Error setting Look and Feel for Filter frame");
+ }
+ if(Util.applet == null){
+ setIconImage(Toolkit.getDefaultToolkit().getImage("../Images/app_icon.gif"));
+ }
+ else{
+ String iconPath = Util.applet.getCodeBase().toString();
+ iconPath += "Images/app_icon.gif";
+ URL iconPathURL = null;
+ try{
+ iconPathURL = new URL(iconPath);
+ }
+ catch(MalformedURLException exc){
+ System.out.println("Bad URL.");
+ }
+ System.out.println(iconPathURL);
+ setIconImage(Toolkit.getDefaultToolkit().getImage(iconPathURL));
+ }
+ JButton ok = new JButton(" OK ");
+ JButton cancel = new JButton("CANCEL");
+ JButton saveDefault = new JButton("Save As Default");
+ contentPane = getContentPane();
+ getCenterPanel(tempFilterObject);
+ if(tempFilterObject != null){
+ mapFilterOnFrame(tempFilterObject);
+ }
+ southPanel = new JPanel();
+ southPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
+ southPanel.add(ok);
+ southPanel.add(cancel);
+ if(Util.applet == null){
+ southPanel.add(saveDefault);
+ }
+
+ contentPane.add(centerPanel,BorderLayout.CENTER);
+ contentPane.add(southPanel,BorderLayout.SOUTH);
+ setSize(400,200);
+ addWindowListener(new windowListener());
+
+ ok.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent evt){
+ AlarmStatusApplet.logDM("Handle filter selection");
+ handleFilterSave();
+ }
+ });
+
+ cancel.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent evt){
+ dispose();
+ AlarmStatusApplet.logDM("No filter selection");
+ }
+ });
+
+ saveDefault.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent evt){
+ handleFilterSave();
+ filterObject = tempFilterObject;
+
+ }
+ });
+
+ }
+
+ public void handleFilterSave(){
+
+ // alarms selected
+ tempFilterObject = new FilterObject();
+ String alarms = (String)alarmCombo.getSelectedItem();
+ if(alarms.equals("All")){
+ tempFilterObject.NUM_ALARMS = FilterObject.NONE;
+ }
+ else{
+ try{
+ tempFilterObject.NUM_ALARMS = Integer.parseInt(alarms);
+ }
+ catch(NumberFormatException nfex){
+ JOptionPane.showMessageDialog(ff,"Bad Alarm number criteria.Default value assumed. ","Invalid number",JOptionPane.ERROR_MESSAGE);
+ tempFilterObject.NUM_ALARMS = FilterObject.NONE;
+ }
+ }
+
+ // time selected
+ int timeIndex = timeCombo.getSelectedIndex();
+
+ if(timeIndex == 1){
+ tempFilterObject.TIME = FilterObject.MIN_15;
+ }
+ else if(timeIndex == 2){
+ tempFilterObject.TIME = FilterObject.HR_1;
+ }
+ else if(timeIndex == 3){
+ tempFilterObject.TIME = FilterObject.HR_12;
+ }
+ else if(timeIndex == 4){
+ tempFilterObject.TIME = FilterObject.HR_24;
+ }
+ else
+ tempFilterObject.TIME = FilterObject.NONE;
+
+ // severity selected
+ int severityIndex = severityCombo.getSelectedIndex();
+
+ if(severityIndex == 1){
+ tempFilterObject.SEVERITY = FilterObject.CRITICAL;
+ }
+ else if(severityIndex == 2){
+ tempFilterObject.SEVERITY = FilterObject.MAJOR;
+ }
+ else if(severityIndex == 3){
+ tempFilterObject.SEVERITY = FilterObject.MINOR;
+ }
+ else
+ tempFilterObject.SEVERITY = FilterObject.NULL;
+
+ // acknowledge selected
+ int ackIndex = acknowledgeCombo.getSelectedIndex();
+ if(ackIndex == 1){
+ tempFilterObject.ACKNOWLEDGE = FilterObject.ALL_ACK;
+ }
+ else if(ackIndex == 2){
+ tempFilterObject.ACKNOWLEDGE = FilterObject.NO_ACK;
+ }
+ else
+ tempFilterObject.ACKNOWLEDGE = FilterObject.NONE;
+ this.dispose();
+ // Ananth
+ /*if (tempFilterObject.NUM_ALARMS == FilterObject.NONE &&
+ tempFilterObject.SEVERITY == FilterObject.NULL &&
+ tempFilterObject.TIME == FilterObject.NONE &&
+ tempFilterObject.ACKNOWLEDGE == FilterObject.NONE){
+ Util.setBorderTitle("Alarm List");
+ }
+ else{
+ Util.setBorderTitle("Alarm List (Filtered)");
+ }*/
+
+ if(alarmPanel!=null){
+ alarmPanel.handleFilterEvent(tempFilterObject);
+ alarmPanel.getAlarmTable().Refresh();
+ }
+ else{
+ filterObject = tempFilterObject;
+ }
+
+ }
+
+ private void mapFilterOnFrame(FilterObject tempFilterObject){
+
+ if(tempFilterObject.NUM_ALARMS != FilterObject.NONE){
+ String alarms = Integer.toString(tempFilterObject.NUM_ALARMS);
+ alarmCombo.getEditor().setItem(alarms);
+ }
+ else{
+ alarmCombo.setSelectedIndex(0);
+ }
+
+ if(tempFilterObject.TIME != FilterObject.NONE){
+
+ if(tempFilterObject.TIME == FilterObject.MIN_15)
+ timeCombo.setSelectedIndex(1);
+ else if(tempFilterObject.TIME == FilterObject.HR_1)
+ timeCombo.setSelectedIndex(2);
+ else if(tempFilterObject.TIME == FilterObject.HR_12)
+ timeCombo.setSelectedIndex(3);
+ else if(tempFilterObject.TIME == FilterObject.HR_24)
+ timeCombo.setSelectedIndex(4);
+ }
+ else{
+ timeCombo.setSelectedIndex(0);
+ }
+
+ if(!tempFilterObject.SEVERITY.equals(FilterObject.NULL)){
+
+ if(tempFilterObject.SEVERITY.equals(FilterObject.CRITICAL))
+ severityCombo.setSelectedIndex(1);
+ else if(tempFilterObject.SEVERITY.equals(FilterObject.MAJOR))
+ severityCombo.setSelectedIndex(2);
+ else if(tempFilterObject.SEVERITY.equals(FilterObject.MINOR))
+ severityCombo.setSelectedIndex(3);
+ }
+ else{
+ severityCombo.setSelectedIndex(0);
+ }
+
+ if(tempFilterObject.ACKNOWLEDGE != FilterObject.NONE){
+
+ if(tempFilterObject.ACKNOWLEDGE == FilterObject.ALL_ACK)
+ acknowledgeCombo.setSelectedIndex(1);
+ else if(tempFilterObject.ACKNOWLEDGE == FilterObject.NO_ACK)
+ acknowledgeCombo.setSelectedIndex(2);
+ }
+ else{
+ acknowledgeCombo.setSelectedIndex(0);
+ }
+ }
+
+ public JPanel getCenterPanel(FilterObject filterObj){
+
+ centerPanel = Util.makeBorderPanel("Filter Screen");
+ centerPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
+ alarms = new JLabel(" Alarms ");
+ alarms.setToolTipText("Check to set Alarm filter / Uncheck to set Default (All)");
+ time = new JLabel(" Time ");
+ time.setToolTipText("Check to set Time filter / Uncheck to set Default(All)");
+ severity = new JLabel(" Severity ");
+ severity.setToolTipText("Check to set Severity filter / Uncheck to set Default (All)");
+ acknowledge = new JLabel(" Acknowledge ");
+ acknowledge.setToolTipText("Check to set Acknowledge filter / Uncheck to set Default (All)");
+
+ // Alarms
+ alarmCombo.setPreferredSize(new Dimension(50,20));
+ alarmCombo.setEditable(true);
+ alarmCombo.addItem("All");
+ for(int i=1;i<=20;i++){
+ alarmCombo.addItem(Integer.toString(i));
+ }
+
+ // Time
+ timeCombo.addItem("All");
+ timeCombo.addItem("15 mins");
+ timeCombo.addItem("1 hour");
+ timeCombo.addItem("12 hours");
+ timeCombo.addItem("24 hours");
+
+ // Severity
+ severityCombo.addItem("All");
+ severityCombo.addItem("Critical");
+ severityCombo.addItem("Critical-Major");
+ severityCombo.addItem("Critical-Minor");
+
+ // Acknowledge
+ acknowledgeCombo.addItem("All");
+ acknowledgeCombo.addItem("Acknowledged");
+ acknowledgeCombo.addItem("Unacknowledged");
+
+ // Alarms
+ final JPanel p1 = new JPanel();
+ p1.setLayout(new FlowLayout(FlowLayout.LEFT));
+ p1.add(alarms);
+ p1.add(alarmCombo);
+ p1.add(acknowledge);
+ p1.add(acknowledgeCombo);
+
+
+ // Time
+ final JPanel p2 = new JPanel();
+ p2.setLayout(new FlowLayout(FlowLayout.LEFT));
+ p2.add(severity);
+ p2.add(severityCombo);
+ p2.add(time);
+ p2.add(timeCombo);
+
+ // Severity
+
+ // Acknowledge
+
+
+ centerPanel.add(p1);
+
+ centerPanel.add(p2);
+
+ if(filterObj != null){
+ mapFilterOnFrame(filterObj);
+ }
+ return centerPanel;
+ }
+
+
+ class windowListener extends WindowAdapter{
+ public void windowClosing(WindowEvent evt){
+ dispose();
+ AlarmStatusApplet.logDM("Closing Filter Screen");
+ }
+ }
+
+ }
diff --git a/data/mnet/Common/Java/AlarmApplet/FilterObject.java b/data/mnet/Common/Java/AlarmApplet/FilterObject.java
new file mode 100644
index 0000000..dc7f403
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/FilterObject.java
@@ -0,0 +1,35 @@
+import java.io.Serializable;
+
+public class FilterObject implements Serializable{
+
+ // filter criteria
+ public int NUM_ALARMS;
+ public int TIME;
+ public String SEVERITY;
+ public int ACKNOWLEDGE;
+
+ public static int NONE = 0;
+
+ // Alarm number constants
+ public static int N1 = 2;
+ public static int N2 = 4;
+ public static int N3 = 6;
+ public static int N4 = 8;
+
+ // Severtiy constants
+ public static String CRITICAL = "CRITICAL";
+ public static String MAJOR = "MAJOR";
+ public static String MINOR = "MINOR";
+ public static String WARNING = "WARNING";
+ public static String NULL = "NULL";
+
+ // Ack constants
+ public static int NO_ACK = 1;
+ public static int ALL_ACK = 2;
+
+ // Time stamp constants
+ public static int MIN_15 = 1;
+ public static int HR_1 = 2;
+ public static int HR_12 = 3;
+ public static int HR_24 = 4;
+}
diff --git a/data/mnet/Common/Java/AlarmApplet/Makefile b/data/mnet/Common/Java/AlarmApplet/Makefile
new file mode 100644
index 0000000..24ded19
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/Makefile
@@ -0,0 +1,41 @@
+####################################################################
+#
+# FILE NAME: Makefile
+#
+# DESCRIPTION: This makefile creates the vipercell related class
+# files
+# COMPONENTS:
+#
+#
+# NOTES:
+#
+# (C) Copyright 1999 JetCell Inc., CA, USA http://www.jetcell.com/
+#
+# REVISION HISTORY
+#__________________________________________________________________
+#----------+--------+----------------------------------------------
+# Name | Date | Reason
+#----------+--------+----------------------------------------------
+# Kevin Lim|03/28/00| Initial Draft
+#----------+--------+----------------------------------------------
+####################################################################
+#/
+
+CODEBASE = ..
+ALARMARCH = $(CODEBASE)\Java\AlarmStatus.jar
+
+include $(CODEBASE)\java.mk
+
+
+all: $(CLASS_LIST) $(ALARMARCH)
+
+$(ALARMARCH):
+ $(JAR) cvf $@ *.class com\jetcell\MibWM\*.class
+
+clean:
+ -$(RM) *.class
+
+cleanall:
+ -$(RM) *.class
+ -$(RM) $(ALARMARCH)
+
diff --git a/data/mnet/Common/Java/AlarmApplet/com/jetcell/MibWM/Makefile b/data/mnet/Common/Java/AlarmApplet/com/jetcell/MibWM/Makefile
new file mode 100644
index 0000000..e8c30ce
--- /dev/null
+++ b/data/mnet/Common/Java/AlarmApplet/com/jetcell/MibWM/Makefile
@@ -0,0 +1,40 @@
+####################################################################
+#
+# FILE NAME: Makefile
+#
+# DESCRIPTION: This makefile creates the vipercell related class
+# files
+# COMPONENTS:
+#
+#
+# NOTES:
+#
+# (C) Copyright 1999 JetCell Inc., CA, USA http://www.jetcell.com/
+#
+# REVISION HISTORY
+#__________________________________________________________________
+#----------+--------+----------------------------------------------
+# Name | Date | Reason
+#----------+--------+----------------------------------------------
+# Bhawani |11/28/99| Initial Draft
+#----------+--------+----------------------------------------------
+####################################################################
+#/
+
+CODEBASE = ../../../../
+
+
+include $(CODEBASE)/java.mk
+
+
+all: $(CLASS_LIST)
+
+
+clean:
+ -$(RM) *.java
+ -$(RM) *.class
+
+cleanall:
+ -$(RM) *.java
+ -$(RM) *.class
+
diff --git a/data/mnet/Common/Java/Images/Jetcelllogo.jpg b/data/mnet/Common/Java/Images/Jetcelllogo.jpg
new file mode 100644
index 0000000..dc936c9
--- /dev/null
+++ b/data/mnet/Common/Java/Images/Jetcelllogo.jpg
Binary files differ
diff --git a/data/mnet/Common/Java/Images/app_icon.GIF b/data/mnet/Common/Java/Images/app_icon.GIF
new file mode 100644
index 0000000..cee2081
--- /dev/null
+++ b/data/mnet/Common/Java/Images/app_icon.GIF
Binary files differ
diff --git a/data/mnet/Common/Java/Images/app_icon2.GIF b/data/mnet/Common/Java/Images/app_icon2.GIF
new file mode 100644
index 0000000..7f57c5b
--- /dev/null
+++ b/data/mnet/Common/Java/Images/app_icon2.GIF
Binary files differ
diff --git a/data/mnet/Common/Java/Images/cisco.JPG b/data/mnet/Common/Java/Images/cisco.JPG
new file mode 100644
index 0000000..a844554
--- /dev/null
+++ b/data/mnet/Common/Java/Images/cisco.JPG
Binary files differ
diff --git a/data/mnet/Common/Java/Images/cisco2.JPG b/data/mnet/Common/Java/Images/cisco2.JPG
new file mode 100644
index 0000000..510359d
--- /dev/null
+++ b/data/mnet/Common/Java/Images/cisco2.JPG
Binary files differ
diff --git a/data/mnet/Common/Java/Images/ciscologo.jpg b/data/mnet/Common/Java/Images/ciscologo.jpg
new file mode 100644
index 0000000..dc936c9
--- /dev/null
+++ b/data/mnet/Common/Java/Images/ciscologo.jpg
Binary files differ
diff --git a/data/mnet/Common/Java/Images/clear.gif b/data/mnet/Common/Java/Images/clear.gif
new file mode 100644
index 0000000..2664824
--- /dev/null
+++ b/data/mnet/Common/Java/Images/clear.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/cowbell.wav b/data/mnet/Common/Java/Images/cowbell.wav
new file mode 100644
index 0000000..425bfdb
--- /dev/null
+++ b/data/mnet/Common/Java/Images/cowbell.wav
Binary files differ
diff --git a/data/mnet/Common/Java/Images/critical.gif b/data/mnet/Common/Java/Images/critical.gif
new file mode 100644
index 0000000..5a5e633
--- /dev/null
+++ b/data/mnet/Common/Java/Images/critical.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/filler.gif b/data/mnet/Common/Java/Images/filler.gif
new file mode 100644
index 0000000..b169fb1
--- /dev/null
+++ b/data/mnet/Common/Java/Images/filler.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/gmc.jpg b/data/mnet/Common/Java/Images/gmc.jpg
new file mode 100644
index 0000000..4ce4188
--- /dev/null
+++ b/data/mnet/Common/Java/Images/gmc.jpg
Binary files differ
diff --git a/data/mnet/Common/Java/Images/grey.gif b/data/mnet/Common/Java/Images/grey.gif
new file mode 100644
index 0000000..62f0955
--- /dev/null
+++ b/data/mnet/Common/Java/Images/grey.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/indeterminate.gif b/data/mnet/Common/Java/Images/indeterminate.gif
new file mode 100644
index 0000000..fa6781d
--- /dev/null
+++ b/data/mnet/Common/Java/Images/indeterminate.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/indeterminate2.gif b/data/mnet/Common/Java/Images/indeterminate2.gif
new file mode 100644
index 0000000..62f0955
--- /dev/null
+++ b/data/mnet/Common/Java/Images/indeterminate2.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/information.gif b/data/mnet/Common/Java/Images/information.gif
new file mode 100644
index 0000000..8b4657e
--- /dev/null
+++ b/data/mnet/Common/Java/Images/information.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/line-01.gif b/data/mnet/Common/Java/Images/line-01.gif
new file mode 100644
index 0000000..691a18d
--- /dev/null
+++ b/data/mnet/Common/Java/Images/line-01.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/line-02.gif b/data/mnet/Common/Java/Images/line-02.gif
new file mode 100644
index 0000000..a40c5a7
--- /dev/null
+++ b/data/mnet/Common/Java/Images/line-02.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/logo.gif b/data/mnet/Common/Java/Images/logo.gif
new file mode 100644
index 0000000..2356666
--- /dev/null
+++ b/data/mnet/Common/Java/Images/logo.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/logo.jpg b/data/mnet/Common/Java/Images/logo.jpg
new file mode 100644
index 0000000..dc936c9
--- /dev/null
+++ b/data/mnet/Common/Java/Images/logo.jpg
Binary files differ
diff --git a/data/mnet/Common/Java/Images/logo1.gif b/data/mnet/Common/Java/Images/logo1.gif
new file mode 100644
index 0000000..2356666
--- /dev/null
+++ b/data/mnet/Common/Java/Images/logo1.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/major.gif b/data/mnet/Common/Java/Images/major.gif
new file mode 100644
index 0000000..97257cd
--- /dev/null
+++ b/data/mnet/Common/Java/Images/major.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/minor.gif b/data/mnet/Common/Java/Images/minor.gif
new file mode 100644
index 0000000..8855fde
--- /dev/null
+++ b/data/mnet/Common/Java/Images/minor.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/minus.gif b/data/mnet/Common/Java/Images/minus.gif
new file mode 100644
index 0000000..5442059
--- /dev/null
+++ b/data/mnet/Common/Java/Images/minus.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/normal.gif b/data/mnet/Common/Java/Images/normal.gif
new file mode 100644
index 0000000..2664824
--- /dev/null
+++ b/data/mnet/Common/Java/Images/normal.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/notify.wav b/data/mnet/Common/Java/Images/notify.wav
new file mode 100644
index 0000000..726bc0d
--- /dev/null
+++ b/data/mnet/Common/Java/Images/notify.wav
Binary files differ
diff --git a/data/mnet/Common/Java/Images/plus.gif b/data/mnet/Common/Java/Images/plus.gif
new file mode 100644
index 0000000..91c5db9
--- /dev/null
+++ b/data/mnet/Common/Java/Images/plus.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/scritical.gif b/data/mnet/Common/Java/Images/scritical.gif
new file mode 100644
index 0000000..5a5e633
--- /dev/null
+++ b/data/mnet/Common/Java/Images/scritical.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/sinformation.gif b/data/mnet/Common/Java/Images/sinformation.gif
new file mode 100644
index 0000000..8b4657e
--- /dev/null
+++ b/data/mnet/Common/Java/Images/sinformation.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/smajor.gif b/data/mnet/Common/Java/Images/smajor.gif
new file mode 100644
index 0000000..97257cd
--- /dev/null
+++ b/data/mnet/Common/Java/Images/smajor.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/sminor.gif b/data/mnet/Common/Java/Images/sminor.gif
new file mode 100644
index 0000000..8855fde
--- /dev/null
+++ b/data/mnet/Common/Java/Images/sminor.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/undrkunstrukson.gif b/data/mnet/Common/Java/Images/undrkunstrukson.gif
new file mode 100644
index 0000000..99e41a3
--- /dev/null
+++ b/data/mnet/Common/Java/Images/undrkunstrukson.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/vipercell.gif b/data/mnet/Common/Java/Images/vipercell.gif
new file mode 100644
index 0000000..129d52a
--- /dev/null
+++ b/data/mnet/Common/Java/Images/vipercell.gif
Binary files differ
diff --git a/data/mnet/Common/Java/Images/wireless.jpg b/data/mnet/Common/Java/Images/wireless.jpg
new file mode 100644
index 0000000..cea2d88
--- /dev/null
+++ b/data/mnet/Common/Java/Images/wireless.jpg
Binary files differ
diff --git a/data/mnet/Common/Java/Images/wireless1.JPG b/data/mnet/Common/Java/Images/wireless1.JPG
new file mode 100644
index 0000000..5f28e19
--- /dev/null
+++ b/data/mnet/Common/Java/Images/wireless1.JPG
Binary files differ
diff --git a/data/mnet/Common/Java/Java/AlarmApplet.java b/data/mnet/Common/Java/Java/AlarmApplet.java
new file mode 100644
index 0000000..9d4e171
--- /dev/null
+++ b/data/mnet/Common/Java/Java/AlarmApplet.java
@@ -0,0 +1,177 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : AlarmApplet
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package Java;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.util.Calendar;
+import java.lang.String;
+import javax.swing.*;
+import javax.swing.text.Document;
+import javax.swing.event.*;
+import java.net.UnknownHostException;
+import com.jetcell.MibWM.*;
+
+public class AlarmApplet extends JApplet implements DocumentListener
+{
+ public static String ip = null;
+ JTextField eventField = null;
+ AlarmPanel alarmPanel = null;
+ JFrame f = null;
+ AlarmCommThread commObj;
+ public final static short TCP_SERVER_PORT = 10977;
+
+
+
+ public void init()
+ {
+ Util.applet = this;
+ Util.debug = true;
+ eventField = new JTextField();
+ Document doc = eventField.getDocument();
+ doc.addDocumentListener(this);
+
+ /*
+ setBrokerOptions();
+ Broker.addMagicMarkup("QSEvent", "java.lang.String", false);
+ RlBeanProperty beanProp = Broker.wrapBeanProperty(eventField, "text", java.lang.String.class);
+ Broker.bindMarkupToBeanProperty("QSEvent", "", null, beanProp, true, false, true, null);
+ */
+
+ if(getParameter("TEST") != null)
+ {
+ String event1="1111|123456789|0|123|RRM|0|op1|op2";
+ String event2="1111|4321999|1|123|RRM|1|op1";
+ String event3="1111|3432213|3|123|RRM|2";
+ eventField.setText(event1);
+ eventField.setText(event2);
+ eventField.setText(event3);
+ } else {
+ commObj = new AlarmCommThread(getCodeBase().getHost(), TCP_SERVER_PORT);
+ commObj.startReadThread(eventField);
+ }
+
+ alarmPanel = new AlarmPanel();
+ String newin = getParameter("NEWINDOW");
+ if (f != null)
+ {
+ f.setVisible(true);
+ }
+ else {
+ if (newin != null)
+ {
+ System.out.println("NEWINDOW VALUE = " +newin);
+ if(newin.equals("FALSE") || newin.equals("false"))
+ {
+ getContentPane().setLayout(new BorderLayout());
+ getContentPane().setBackground(Color.white);
+ setBackground(Color.white);
+ getContentPane().add(alarmPanel.createPanel(),BorderLayout.CENTER);
+ }
+ else {
+ f = new JFrame("Alarm List for ViperCell: "+ip);
+ f.getContentPane().setLayout(new BorderLayout());
+ f.getContentPane().add(alarmPanel.createPanel());
+ f.setBounds(0,0, 720,400);
+ f.setVisible(true);
+ }
+ }
+ else {
+ System.out.println("Please set NEWINDOW parameter to TRUE or FALSE");
+ }
+ }
+
+ try
+ {
+ getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
+ UIManager.setLookAndFeel( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+ SwingUtilities.updateComponentTreeUI(this);
+ }
+ catch(Exception ex)
+ {
+ //Util.showDialog(f, ex.toString(), "Error", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ public void start()
+ {
+ }
+
+ public void stop()
+ {
+ }
+
+ public void destroy()
+ {
+ commObj.finishReadThread();
+ System.out.println("Destroy method has been called");
+ }
+
+ public void changedUpdate(DocumentEvent e)
+ {
+ }
+
+ public void insertUpdate(DocumentEvent e)
+ {
+ /*
+ System.out.println("insertUpdate");
+ java.util.Random r = new java.util.Random();
+ Calendar d = Calendar.getInstance();
+ */
+ String alarmId = eventField.getText();
+ System.out.println("Receiving Alarm: "+alarmId);
+
+ // for test only. -gz
+ /*
+ int eventId = Integer.parseInt(alarmId.substring(alarmId.indexOf('r')+2, alarmId.length()));
+
+ String severity = null;
+
+ try {
+ d.add(Calendar.SECOND, java.lang.Math.abs(r.nextInt()));
+ if (eventId-eventId/3*3 == 0)
+ severity = new String("Critical");
+ else if (eventId-eventId/3*3 == 1)
+ severity = new String("Minor");
+ else if (eventId - eventId/3*3 == 2)
+ severity = new String("Info");
+ String date = d.getTime().toString();
+ String object = "Object_"+String.valueOf(java.lang.Math.abs(r.nextInt()));
+ String message = eventField.getText();
+
+ //AlarmData alarm = new AlarmData(String.valueOf(eventId), date, severity, null, object, message, null);
+
+ AlarmData alarm = new AlarmData(alarmId);
+ alarmPanel.addEvent(alarm);
+ Thread.sleep(1000);
+ System.out.println("Event: " +alarmId);
+ }
+ catch(Exception ex)
+ {
+ System.out.println(ex);
+ ex.printStackTrace();
+ }
+ */
+
+ if(!alarmId.startsWith("Event Number"))
+ {
+ try {
+ AlarmData alarm = new AlarmData(alarmId);
+ alarmPanel.addEvent(alarm);
+ }
+ catch(Exception ex) {}
+ }
+ }
+
+ public void removeUpdate(DocumentEvent e)
+ {
+ }
+}
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/Java/AlarmCommThread.java b/data/mnet/Common/Java/Java/AlarmCommThread.java
new file mode 100644
index 0000000..cd9721b
--- /dev/null
+++ b/data/mnet/Common/Java/Java/AlarmCommThread.java
@@ -0,0 +1,121 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// FILE NAME: AlarmCommThread.java
+//
+// DESCRIPTION: This file contains a class that allow the applet to
+// communicate with the Tcp Server at the ViperCell
+// COMPONENTS:
+//
+//
+// NOTES:
+//
+// (C) Copyright 1999 JetCell Inc., CA, USA http://www.jetcell.com/
+//
+// REVISION HISTORY
+//__________________________________________________________________
+//----------+--------+----------------------------------------------
+// Name | Date | Reason
+//----------+--------+----------------------------------------------
+// Bhawani |2/08/00 | Initial Draft
+//----------+--------+----------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+//
+
+package Java;
+
+import java.net.*;
+import java.io.*;
+import javax.swing.*;
+import javax.swing.*;
+import javax.swing.text.Document;
+import javax.swing.event.*;
+
+
+
+public class AlarmCommThread extends Thread {
+ private Socket socket;
+ private BufferedReader in;
+ private PrintWriter out;
+ private JTextField p_eventField;
+ private boolean running;
+
+ public AlarmCommThread(String addr, short port) {
+ System.out.println("Initializing TCP/Ip socket environment");
+ try {
+ socket = new Socket(addr, port);
+ } catch(IOException e) {
+ // If the creation of the socket fails,
+ // nothing needs to be cleaned up.
+ System.out.println("Could not connect to the Server" + addr + "at port " + port + ": " + socket);
+ }
+ try {
+ in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ // Enable auto-flush:
+ out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
+ // register client's message group
+ out.print("AlarmAsyncUpdate");
+ out.flush();
+
+ // digest the hello message
+ String str = in.readLine();
+ System.out.println("Server's Greeting: " + str);
+ } catch(IOException e) {
+ // The socket should be closed on any
+ // failures other than the socket
+ // constructor:
+ System.out.println("IO error in AlarmCommThread: ");
+ try {
+ socket.close();
+ } catch(IOException e2) {}
+ }
+ // Otherwise the socket will be closed by
+ // the run() method of the thread.
+ }
+
+ public void send(String str)
+ {
+ out.print(str);
+ out.flush();
+ }
+
+ public void startReadThread(JTextField eventField)
+ {
+
+ p_eventField = eventField;
+ start();
+ }
+ public void run() {
+ try {
+ running = true;
+ while (running) {
+ if(in.ready())
+ {
+ String str = in.readLine();
+ this.p_eventField.setText(str);
+ } else {
+ try {
+ this.sleep(100);
+ } catch (InterruptedException ie) {
+ System.out.println(" Interrupted Excution = " + ie);
+ }
+ }
+ }
+ } catch(IOException e3) {
+ System.out.println(" IO expection at read thread" + e3 );
+ } finally {
+ // Always close it:
+ try {
+ System.out.println("Socket is closing");
+ socket.close();
+ } catch(IOException e) {}
+ // Ending this thread
+ }
+ }
+
+ public void finishReadThread()
+ {
+ System.out.println("The read thread is being shutdown");
+ running = false;
+ }
+}
+
diff --git a/data/mnet/Common/Java/Java/ConfigApplet.java b/data/mnet/Common/Java/Java/ConfigApplet.java
new file mode 100644
index 0000000..2b82c7e
--- /dev/null
+++ b/data/mnet/Common/Java/Java/ConfigApplet.java
@@ -0,0 +1,53 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : ConfigApplet
+// Desc :
+// Author : George Zhao
+// Hist : 08/25/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package Java;
+
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.event.*;
+import java.util.Hashtable;
+import java.awt.*;
+import com.jetcell.MibWM.*;
+import com.jetcell.MibWM.ViperBase.*;
+
+public class ConfigApplet extends JApplet
+{
+
+ public void init()
+ {
+ try {
+ String host = getParameter("HOST");
+ int port = Integer.parseInt(getParameter("PORT"));
+ Configuration base = new Configuration(host, port);
+ getContentPane().setLayout(new BorderLayout());
+ getContentPane().setBackground(Color.white);
+ setBackground(Color.white);
+ getContentPane().add(base.mainPanel,BorderLayout.CENTER);
+ }
+ catch(Exception e)
+ {
+ System.out.println("Exception : "+ e.toString());
+ }
+ }
+
+ public void start()
+ {
+ }
+
+ public void stop()
+ {
+ }
+
+ public void destroy()
+ {
+ }
+}
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/Java/ConfigAppletBeanInfo.java b/data/mnet/Common/Java/Java/ConfigAppletBeanInfo.java
new file mode 100644
index 0000000..dc23ed8
--- /dev/null
+++ b/data/mnet/Common/Java/Java/ConfigAppletBeanInfo.java
@@ -0,0 +1,70 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// Class : ConfigAppletBeanInfo
+// Desc :
+// Author : George Zhao
+// Hist : 08/27/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package Java;
+
+import java.beans.*;
+import java.beans.SimpleBeanInfo;
+
+public class ConfigAppletBeanInfo extends java.beans.SimpleBeanInfo
+{
+ public ConfigAppletBeanInfo()
+ {
+ }
+
+ /**
+ * Gets a BeanInfo for the superclass of this bean.
+ * @return BeanInfo[] containing this bean's superclass BeanInfo
+ */
+ public BeanInfo[] getAdditionalBeanInfo()
+ {
+ try
+ {
+ BeanInfo[] bi = new BeanInfo[1];
+ bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
+ return bi;
+ }
+ catch (IntrospectionException e)
+ {
+ throw new Error(e.toString());
+ }
+ }
+
+ /**
+ * Gets the BeanDescriptor for this bean.
+ * @return an object of type BeanDescriptor
+ * @see java.beans.BeanDescriptor
+ */
+ public BeanDescriptor getBeanDescriptor()
+ {
+ BeanDescriptor bd = new BeanDescriptor(beanClass);
+ return bd;
+ }
+
+ /**
+ * Gets an image that may be used to visually represent this bean
+ * (in the toolbar, on a form, etc).
+ * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
+ * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
+ * @return an image for this bean
+ * @see BeanInfo#ICON_MONO_16x16
+ * @see BeanInfo#ICON_COLOR_16x16
+ * @see BeanInfo#ICON_MONO_32x32
+ * @see BeanInfo#ICON_COLOR_32x32
+ */
+ public java.awt.Image getIcon(int nIconKind)
+ {
+ java.awt.Image img = null;
+ return img;
+ }
+
+ private final Class beanClass = ConfigApplet.class;
+}
+
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/Java/Makefile b/data/mnet/Common/Java/Java/Makefile
new file mode 100644
index 0000000..b1ea6c2
--- /dev/null
+++ b/data/mnet/Common/Java/Java/Makefile
@@ -0,0 +1,69 @@
+####################################################################
+#
+# FILE NAME: Makefile
+#
+# DESCRIPTION: This makefile creates the common class files and the
+# common jar file.
+#
+# COMPONENTS:
+#
+#
+# NOTES:
+#
+# (C) Copyright 1999 JetCell Inc., CA, USA http://www.jetcell.com/
+#
+# REVISION HISTORY
+#__________________________________________________________________
+#----------+--------+----------------------------------------------
+# Name | Date | Reason
+#----------+--------+----------------------------------------------
+# Bhawani |11/28/99| Initial Draft
+# Kevin Lim|03/28/00| add AlarmStatus.jar
+#----------+--------+----------------------------------------------
+####################################################################
+#/
+
+CODEBASE = ..
+include $(CODEBASE)/java.mk
+
+MIBWMPATH = $(CODEBASE)/com/jetcell/MibWM
+VIPERCELL = $(MIBWMPATH)
+VIPERBASE = $(MIBWMPATH)/ViperBase
+ALARMPATH = $(CODEBASE)/AlarmApplet
+
+MIBWM = ./MibWM.jar
+ALARMARCH = ./AlarmStatus.jar
+
+
+VIPERCELL_JAVA = $(wildcard $(VIPERCELL)/*.java)
+VIPERCELL_CLASS = $(subst /,/, $(VIPERCELL_JAVA:.java=.class))
+
+VIPERBASE_JAVA = GudbData.java EncodeMessage.java \
+ Configuration.java RoamingNumberTable.java
+
+VIPERBASE_TMP = $(VIPERBASE_JAVA:.java=.class)
+VIPERBASE_CLASS = $(foreach file, $(VIPERBASE_TMP), $(VIPERBASE)/$(file))
+
+all: $(MIBWM) $(CLASS_LIST) $(ALARMARCH)
+
+
+$(MIBWM): $(VIPERCELL_CLASS) $(VIPERBASE_CLASS)
+ @$(RM) $@
+ $(MAKE) -C $(CODEBASE) mibwm
+
+$(ALARMARCH): $(ALARMPATH)/*.class
+ @$(RM) $@
+ $(MAKE) -C $(CODEBASE) alarm
+
+viperCell:
+ $(MAKE) -C $(VIPERCELL) all
+
+viperBase:
+ $(MAKE) -C $(VIPERBASE) all
+
+cleanall:
+ -$(RM) $(subst /,\, $(VIPERBASE)/*.class)
+ -$(RM) $(subst /,\, $(MIBWM) $(CLASS_LIST))
+
+
+
diff --git a/data/mnet/Common/Java/Java/SubscriberApplet.java b/data/mnet/Common/Java/Java/SubscriberApplet.java
new file mode 100644
index 0000000..8f7aedc
--- /dev/null
+++ b/data/mnet/Common/Java/Java/SubscriberApplet.java
@@ -0,0 +1,58 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : SubscriberApplet
+// Desc :
+// Author : George Zhao
+// Hist : 08/25/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package Java;
+
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.event.*;
+import java.util.Hashtable;
+import java.awt.*;
+import com.jetcell.MibWM.*;
+import com.jetcell.MibWM.ViperBase.*;
+
+
+public class SubscriberApplet extends JApplet
+{
+
+
+ public void init()
+ {
+ try {
+ String host = getParameter("HOST");
+ int port = Integer.parseInt(getParameter("PORT"));
+ //test. -begin
+ Subscriber sub = new Subscriber(host, port);
+ //Subscriber sub = new Subscriber();
+ // test. -end.
+ getContentPane().setLayout(new BorderLayout());
+ getContentPane().setBackground(Color.white);
+ setBackground(Color.white);
+ getContentPane().add(((Subscriber)sub).mainPanel ,BorderLayout.CENTER);
+ }
+ catch(Exception e)
+ {
+ System.out.println("Exception : " +e.toString());
+ }
+ }
+
+ public void start()
+ {
+ }
+
+ public void stop()
+ {
+ }
+
+ public void destroy()
+ {
+ }
+}
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/Java/SubscriberAppletBeanInfo.java b/data/mnet/Common/Java/Java/SubscriberAppletBeanInfo.java
new file mode 100644
index 0000000..0386ffb
--- /dev/null
+++ b/data/mnet/Common/Java/Java/SubscriberAppletBeanInfo.java
@@ -0,0 +1,69 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// Class : SubscriberAppletBeanInfo
+// Desc :
+// Author : George Zhao
+// Hist : 08/27/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package Java;
+
+import java.beans.*;
+import java.beans.SimpleBeanInfo;
+
+public class SubscriberAppletBeanInfo extends java.beans.SimpleBeanInfo
+{
+ public SubscriberAppletBeanInfo()
+ {
+ }
+
+ /**
+ * Gets a BeanInfo for the superclass of this bean.
+ * @return BeanInfo[] containing this bean's superclass BeanInfo
+ */
+ public BeanInfo[] getAdditionalBeanInfo()
+ {
+ try
+ {
+ BeanInfo[] bi = new BeanInfo[1];
+ bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
+ return bi;
+ }
+ catch (IntrospectionException e)
+ {
+ throw new Error(e.toString());
+ }
+ }
+
+ /**
+ * Gets the BeanDescriptor for this bean.
+ * @return an object of type BeanDescriptor
+ * @see java.beans.BeanDescriptor
+ */
+ public BeanDescriptor getBeanDescriptor()
+ {
+ BeanDescriptor bd = new BeanDescriptor(beanClass);
+ return bd;
+ }
+
+ /**
+ * Gets an image that may be used to visually represent this bean
+ * (in the toolbar, on a form, etc).
+ * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
+ * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
+ * @return an image for this bean
+ * @see BeanInfo#ICON_MONO_16x16
+ * @see BeanInfo#ICON_COLOR_16x16
+ * @see BeanInfo#ICON_MONO_32x32
+ * @see BeanInfo#ICON_COLOR_32x32
+ */
+ public java.awt.Image getIcon(int nIconKind)
+ {
+ java.awt.Image img = null;
+ return img;
+ }
+
+ private final Class beanClass = SubscriberApplet.class;
+}
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/Makefile b/data/mnet/Common/Java/Makefile
new file mode 100644
index 0000000..2e8b2bb
--- /dev/null
+++ b/data/mnet/Common/Java/Makefile
@@ -0,0 +1,58 @@
+####################################################################
+#
+# FILE NAME: Makefile
+#
+# DESCRIPTION: This is root make file that genetates java classes
+# and jar file.
+#
+# COMPONENTS:
+#
+#
+# NOTES:
+#
+# (C) Copyright 1999 JetCell Inc., CA, USA http://www.jetcell.com/
+#
+# REVISION HISTORY
+#__________________________________________________________________
+#----------+--------+----------------------------------------------
+# Name | Date | Reason
+#----------+--------+----------------------------------------------
+# Bhawani |11/28/99| Iniitial Draft
+# Kevin Lim|03/28/00| added AlarmStatusApplet
+#----------+--------+----------------------------------------------
+####################################################################
+
+CODEBASE = .
+include $(CODEBASE)/java.mk
+VIPERCELL = $(MIBWMPATH)
+VIPERBASE = $(MIBWMPATH)/ViperBase
+PACKPATH = $(ALARMAPPLETDIR)\com\jetcell\MibWM
+
+MIBWM = ./Java/MibWM.jar
+ALARMARCH = ./Java/AlarmStatus.jar
+
+all:
+ $(CP) $(MIBWMPATH)\*.java $(PACKPATH)
+
+ $(MAKE) -C $(ALARMAPPLETDIR) all
+
+alarm: $(ALARMARCH)
+
+$(ALARMARCH):
+ $(CP) AlarmApplet\AlarmStatus.jar Java\AlarmStatus.jar
+
+# mibwm: $(MIBWM)
+
+$(MIBWM): ./Java/AlarmCommThread.class
+# $(JAR) cvf $@ $(VIPERCELL)/*.class $(VIPERBASE)/*.class ./Java/AlarmCommThread.class
+ $(JAR) cvf $@ $(VIPERCELL)/*.class ./Java/AlarmCommThread.class
+
+
+cleanall:
+ $(MAKE) -C $(ALARMAPPLETDIR) cleanall
+ $(MAKE) -C $(PACKPATH) cleanall
+ $(MAKE) -C $(COMMON) cleanall
+
+
+
+
diff --git a/data/mnet/Common/Java/Text/AlarmCode.English b/data/mnet/Common/Java/Text/AlarmCode.English
new file mode 100644
index 0000000..8f79150
--- /dev/null
+++ b/data/mnet/Common/Java/Text/AlarmCode.English
@@ -0,0 +1,154 @@
+// AlarmCode.English
+// Copyright (C) 2000 Cisco Systems, Inc.
+// All rights reserved
+// WARNING: This file is automatically generated by an AlarmCode tool
+// Any changes made to this file will be overwritten by
+// subsequent uses of the tool.
+//
+// ALARM_ERROR_CODE | "ALARM_SYNOPSIS" | "ALARM_DETAIL_MESSAGE"
+ 0 | Module alarm with ID %2 has cleared | The alarm ID %2 (error code %1) was cleared by module %module. The operational state of GSM Port depends on alarm status from all modules.
+ 131074 | First DSP/FPGA Hardware Failure | Bit clock at the first DSP/Fpga is not functioning. GSM Port must be rebooted to recover from this situation.
+ 131075 | Second DSP/FPGA Hardware Failure | Bit clock at the second DSP/Fpga is not functioning. GSM Port must be rebooted to recover from this situation.
+ 131076 | First DSP not responding | Link between RM and first DSP is broken. GSM Port must be rebooted to recover from this situation.
+ 131077 | Second DSP not responding | Link between RM and second DSP is broken. GSM Port can function in a reduced-Capacity mode if the first DSP can function properly. GSM Port must be rebooted to recover from this situation.
+ 131078 | Cell Broadcast Channel unusable | Cell broadcast channel initialization failed. Cell broadcast will not be supported until the next reboot. This channel, however, does not affect the operational state of the GSM Port.
+ 131079 | No usable traffic channel | Initialization of all the traffic channels failed. Please unlock them if they are locked. If the their admin state is already unlocked, please reboot the system.
+ 131080 | No TRX enabled | Initialization of both TRX failed. Please unlock them if they are locked. If the their admin state is already unlocked, please reboot the system.
+ 131081 | Illegal Configuration - No BCCH Channel | No BCCH channel combination is specified in the MIB. Please check the first TRX configuration through GP Manager.
+ 131082 | Illegal Configuration - Unsupported Channel | Unsupported channel combination is detected in the MIB. Please check both first and second TRX configuration through GP Manager
+ 131083 | Illegal Configuration - Two BCCH Channel | Only one BCCH channel is supported at this time but two BCCH channel configuration found. Please correct this problem through GP Manager.
+ 131084 | Illegal Configuration - Too many Channel Combination I | Too many channel combination I configuration found. Please correct this problem through GP Manager.
+ 131085 | Illegal Configuration - Multiple BCCH Channels | Only one BCCH channel is supported at this time but more than two BCCH channels have been configured. Please correct this problem through GP Manager.
+ 131086 | System Call Failure - Watchdog timer create | RM module detects failure in creating WatchDog Timer which is essential for proper software operation. GSM Port must be rebooted to recover from this situation.
+ 131087 | System Call Failure - Message queue receive | RM module encountered failure in receiving message. GSM Port must be rebooted to recover from this situation.
+ 131088 | OAM Api Failure | Could not set a field of a MIB table entry.
+ 131089 | Oam Api Failure | Could not set a MIB integer variable.
+ 131090 | RF board not detected | Failed to detect RF board. Please check if it is there.
+ 135169 | GSM Port Locked | The GSM Port was locked successfully. Existing calls (if any) were aborted. No new calls can be made through GSM Port.
+ 135170 | GSM Port Unlocked | The GSM Port was unlocked successfully. GSM Port can accept new calls if its operational state is enabled.
+ 135171 | GSM Port Shutting Down | The GSM Port is being shutdown. No new calls can be made through GSM Port. Existing calls are maintained until terminates normally.
+ 135172 | First TRX Locked | The first TRX was locked successfully. Locking of first TRX is equivalent of locking of GSM Port. Existing calls (if any) were aborted. No new calls can be made through GSM Port.
+ 135173 | Second TRX Locked | The second TRX was locked successfully. Existing calls (if any) were aborted. No new calls will be made through this TRX.
+ 135174 | First TRX Unlocked | The first TRX was unlocked successfully. New calls can be made through this TRX.
+ 135175 | Second TRX Unlocked | The second TRX was unlocked successfully. New calls can be made through this TRX.
+ 135176 | First TRX shutting down | The first TRX is being shutting down. Shutting down first TRX is equivalent of shutting down GSM Port. No new calls can be made through GSM Port. Existing calls are maintained until terminates normally.
+ 135177 | Second TRX shutting down | The second TRX is being shutting down. No new calls can be made through this TRX. Existing calls are maintained until terminates normally.
+ 135178 | First TRX Time Slot 0 locked | Locking of Time Slot 0 of first TRX is equivalent of locking GSM Port. Existing calls (if any) were aborted. No new calls can be made through GSM Port.
+ 135179 | First TRX Time Slot 1 locked | Time slot 1 of the first TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135180 | First TRX Time Slot 2 locked | Time slot 2 of the first TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135181 | First TRX Time Slot 3 locked | Time slot 3 of the first TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135182 | First TRX Time Slot 4 locked | Time slot 4 of the first TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135183 | First TRX Time Slot 5 locked | Time slot 5 of the first TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135184 | First TRX Time Slot 6 locked | Time slot 6 of the first TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135185 | First TRX Time Slot 7 locked | Time slot 7 of the first TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135186 | Second TRX Time Slot 0 locked | Time slot 0 of the second TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135187 | Second TRX Time Slot 1 locked | Time slot 1 of the second TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135188 | Second TRX Time Slot 2 locked | Time slot 2 of the second TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135189 | Second TRX Time Slot 3 locked | Time slot 3 of the second TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135190 | Second TRX Time Slot 4 locked | Time slot 4 of the second TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135191 | Second TRX Time Slot 5 locked | Time slot 5 of the second TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135192 | Second TRX Time Slot 6 locked | Time slot 6 of the second TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135193 | Second TRX Time Slot 7 locked | Time slot 7 of the second TRX was locked successfully. Existing call (if any) was aborted. No new call can be made through this time slot.
+ 135194 | First TRX Time Slot 0 Unlocked | Time slot 0 of the first TRX was unlocked successfully. New calls can be made through this time slot.
+ 135195 | First TRX Time Slot 1 Unlocked | Time slot 1 of the first TRX was unlocked successfully. New calls can be made through this time slot.
+ 135196 | First TRX Time Slot 2 Unlocked | Time slot 2 of the first TRX was unlocked successfully. New calls can be made through this time slot.
+ 135197 | First TRX Time Slot 3 Unlocked | Time slot 3 of the first TRX was unlocked successfully. New calls can be made through this time slot.
+ 135198 | First TRX Time Slot 4 Unlocked | Time slot 4 of the first TRX was unlocked successfully. New calls can be made through this time slot.
+ 135199 | First TRX Time Slot 5 Unlocked | Time slot 5 of the first TRX was unlocked successfully. New calls can be made through this time slot.
+ 135200 | First TRX Time Slot 6 Unlocked | Time slot 6 of the first TRX was unlocked successfully. New calls can be made through this time slot.
+ 135201 | First TRX Time Slot 7 Unlocked | Time slot 7 of the first TRX was unlocked successfully. New calls can be made through this time slot.
+ 135202 | Second TRX Time Slot 0 Unlocked | Time slot 0 of the second TRX was unlocked successfully. New calls can be made through this time slot.
+ 135203 | Second TRX Time Slot 1 Unlocked | Time slot 1 of the second TRX was unlocked successfully. New calls can be made through this time slot.
+ 135204 | Second TRX Time Slot 2 Unlocked | Time slot 2 of the second TRX was unlocked successfully. New calls can be made through this time slot.
+ 135205 | Second TRX Time Slot 3 Unlocked | Time slot 3 of the second TRX was unlocked successfully. New calls can be made through this time slot.
+ 135206 | Second TRX Time Slot 4 Unlocked | Time slot 4 of the second TRX was unlocked successfully. New calls can be made through this time slot.
+ 135207 | Second TRX Time Slot 5 Unlocked | Time slot 5 of the second TRX was unlocked successfully. New calls can be made through this time slot.
+ 135208 | Second TRX Time Slot 6 Unlocked | Time slot 6 of the second TRX was unlocked successfully. New calls can be made through this time slot.
+ 135209 | Second TRX Time Slot 7 Unlocked | Time slot 7 of the second TRX was unlocked successfully. New calls can be made through this time slot.
+ 135210 | First TRX Time Slot 0 shutting down | Time slot 0 of the first TRX is being shutdown. Shutting down Time Slot 0 of First TRX is equivalent of shutting down GSM Port. Existing calls will be maintained until terminate normally. No new calls can be made through GSM Port.
+ 135211 | First TRX Time Slot 1 shutting down | Time slot 1 of the first TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135212 | First TRX Time Slot 2 shutting down | Time slot 2 of the first TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135213 | First TRX Time Slot 3 shutting down | Time slot 3 of the first TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135214 | First TRX Time Slot 4 shutting down | Time slot 4 of the first TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135215 | First TRX Time Slot 5 shutting down | Time slot 5 of the first TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135216 | First TRX Time Slot 6 shutting down | Time slot 6 of the first TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135217 | First TRX Time Slot 7 shutting down | Time slot 7 of the first TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135218 | Second TRX Time Slot 0 shutting down | Time slot 0 of the second TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135219 | Second TRX Time Slot 1 shutting down | Time slot 1 of the second TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135220 | Second TRX Time Slot 2 shutting down | Time slot 2 of the second TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135221 | Second TRX Time Slot 3 shutting down | Time slot 3 of the second TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135222 | Second TRX Time Slot 4 shutting down | Time slot 4 of the second TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135223 | Second TRX Time Slot 5 shutting down | Time slot 5 of the second TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135224 | Second TRX Time Slot 6 shutting down | Time slot 6 of the second TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135225 | Second TRX Time Slot 7 shutting down | Time slot 7 of the second TRX is being shutdown. Existing call (if any) will be maintained until terminate normally. No new call can be made through this time slot.
+ 135226 | Radio for the first TRX is off | Radio for the first TRX is off
+ 135227 | Radio for the second TRX is off | Radio for the second TRX is off
+ 135228 | RM detects corrupted Layer 1 message | RM module detected a corrupted message from Layer 1.
+ 327681 | LAPDm Internal Failure | Data corruption in the LAPDm Layer software. The system needs a reboot
+ 327936 | LAPDm Resource Exhausted | LAPDm Layer ran out of available frame buffer. This is most likely caused by radio link problem with MS.
+ 462848 | (Re)Load MIB | New MIB have been loaded on %1. You most likely need to reboot the GSM Port
+ 462850 | MIB save option Change - Timer enabled | MIB save timer has been disabled on %1.
+ 462849 | MIB save option Change - Timer disabled | MIB save timer has been disabled on %1.
+ 462851 | MIB Option Change - Duplicate save allowed | MIB save option change on %1.
+ 462852 | MIB option change - Duplicate save not allowed | Duplicate saving of the MIB is now disabled. This will improve the response time of the set operation at GP Manager
+ 458753 | GSM Port Operator-Initiated Reboot | The operator has initiated a reboot on %1. GSM Port will reboot within a few seconds.
+ 524289 | GMC Link Down | Detected link lost to GMC. Please check the operational status of GMC and the physical network connectivity between GMC and GSM Port.
+ 917505 | MPC SRAM test failure | MCH Module's Test results indicates that there was a failure in MPC SRAM Test.
+ 917506 | DSP0 internal data RAM test failure | MCH Module's Post Test results indicates that there was a failure in DSP0's internal data RAM Test.
+ 917507 | DSP1 internal data RAM test failure | MCH Module's Post Test results indicates that there was a failure in DSP1's internal data RAM Test.
+ 917508 | DSP0 internal program RAM test failure | MCH Module's Post Test results indicates that there was a failure in DSP0's internal program RAM Test.
+ 917509 | DSP1 internal program RAM test failure | MCH Module's Post Test results indicates that there was a failure in DSP1's internal program RAM Test.
+ 917510 | DSP0 external RAM test failure | MCH Module's Post Test results indicates that there was a failure in DSP0's external RAM Test.
+ 917511 | DSP1 external RAM test failure | MCH Module's Post Test results indicates that there was a failure in DSP1's external RAM Test.
+ 917512 | FPGA0 test failure | MCH Module's Post Test results indicates that there was a failure in FPGA0 Test.
+ 917513 | FPGA1 test failure | MCH Module's Post Test results indicates that there was a failure in FPGA1 Test.
+ 917514 | I2C test failure | MCH Module's Post Test results indicates that there was a failure in I2C Test.
+ 917515 | ViperTask startup delay detected | One or more ViperTask has a delay on startup, reporting readiness late.
+ 917516 | SysCommand_xxx symbol not found | One or more module's SysCommand_xxx() function symbol is not found. Check module loading logs.
+ 917517 | Critical Task suspension detected | Critical Task suspension from ModuleId %1 detected.
+ 917518 | Critical exit abnormally detected | Critical Task abnormally exited from ModuleID %1 detected.
+ 917519 | LoadModule failure | Loading module object codes had problems. Check startup logs.
+ 917761 | Non-Critical Task suspension detected | Non-Critical Task suspension from ModuleId %1 detected.
+ 917762 | Non-Critical exit abnormally detected | Non-Critical Task abnormally exited from ModuleID %1 detected.
+ 16711681 | Module booting up | Module %module is booting up now
+ 16711682 | Module shutting down | Module %module is shutting down now
+ 16711683 | Out of Internal Memory Error | The GSM Port ran out of memory. Module %module did not complete its intended operation. GSM Port must be rebooted to recover from this situation.
+ 16711684 | System Internal Error | GSM Port software system encountered an unexpected error, which resulted in data corruption. GSM Port must be rebooted to recover from this situation.
+ 16711685 | Reboot Started | The GSM Port is rebooting now.
+ 17039362 | GMC Link Down | Could not get a list of active GP10s from GMC. The link is down. Please verify if the GMC is up and running at the localhost
+ 17039617 | CBC Index File Read Failure | Either CBC index file is missing or it is not readable.
+ 17039618 | CBC Message File Read Failure | CBC message file could not be completely read and decoded. Some of the previously scheduled messages may have been lost.
+ 17236226 | ITP link is down | Verify: 1) network connection to ITP; 2) whether ITP is running
+ 17236227 | Roaming number not available | Add more roaming numbers
+ 17236229 | Can't save config file | Check available space on hard drive
+ 17236230 | Can't open config file | jcvbase.dat is missing or damaged. Note: created after first configuration changes
+ 17236228 | Duplicated GP CellID | Two GPs with the same CellID. Change CellID on GP. Check the error logs for details.
+ 17235970 | Internal failure to initialize | GMC can't initialize. Try power off reboot first. See error log for more details
+ 17236231 | GP Disconnected | Check GP status and network connection
+ 17236232 | Can't open translations data file for reading | Check if vnxlndb.dat is missing or has wrong permissions. vnxlndb.dat file is not needed if no previous translations data exists. It will be created after the first changes.
+ 17236233 | Error during translations data file read | vnxlndb.dat may be corrupted. Try to import a known good ASCII translations data file, if available, through the Translations Manager.
+ 17236234 | Can't open translations data file for writing | Check if vnxlndb.dat has wrong permissions. If not, try rebooting the GMC.
+ 17236235 | Can't save translations data file changes | Check available space on the hard drive. Try to export current data to an ASCII translations data file from the Translations Manager for backup. Try rebooting GMC if this failure is repeated. Try importing the backed up ASCII file after GMC reboot.
+ 17235971 | Can't get OS resources for Translations | Try rebooting the GMC.
+ 17236236 | IN link down | Check that the IN server and connectivity are Ok
+ 17236237 | No Heartbeat on IN link | Check that the IN server is OK
+ 17367042 | Tones&Announcements Application failed to initialize | Validate the configuration information for the Tones & Announcements.
+ 17367298 | Announcements configuration problem for Tones&Announcements. | (Either) no announcements are configured (or) Configuration data is incorrect. Ensure the name & presence of announcement files in the right directory(/sd0/gmc/IVR)
+ 17432578 | CDR Server failed to start off. | Ensure that SNMP daemon is running and initialized
+ 17432834 | CCS did not recognize CDR Server name. | Add this CDR/MNET name to CCS config file(cdr2.conf) and restart CCS.
+ 17432835 | The communication between CDR Server and CCS is lost. | Ensure that CCS is running.
+ 17436674 | File Tranmission problem between CDR Server and CCS.Retramsmitting file. | No correction mechanism required.
+ 17301506 | APM Server failed to start off. | Ensure that SNMP daemon is running and initialized
+ 17301762 | APM Server name not recognized by CAPS. | Add this APM/MNET name to CAPS through the CAM.
+ 17498113 | ViperTask startup delay detected | One or more ViperTask has a delay on startup, reporting readiness late.
+ 17498114 | SysCommand_xxx symbol not found | One or more module's SysCommand_xxx() function symbol is not found. Check module loading logs.
+ 17498115 | Critical Task suspension detected | Critical Task suspension from ModuleId %1 detected.
+ 17498116 | Critical exit abnormally detected | Critical Task abnormally exited from ModuleID %1 detected.
+ 17498117 | LoadModule failure | Loading module object codes had problems. Check startup logs.
+ 17498369 | Non-Critical Task suspension detected | Non-Critical Task suspension from ModuleId %1 detected.
+ 17498370 | Non-Critical exit abnormally detected | Non-Critical Task abnormally exited from ModuleID %1 detected.
+ 33488897 | Module booting up | Module %module is booting up now
+ 33488898 | Module shutting down | Module %module is shutting down now
+ 33488899 | Out of Internal Memory Error | The GSM Port ran out of memory. Module %module did not complete its intended operation. GSM Port must be rebooted to recover from this situation.
+ 33488900 | System Internal Error | GSM Port software system encountered an unexpected error, which resulted in data corruption. GSM Port must be rebooted to recover from this situation.
+ 33488901 | Reboot Started | The GSM Port is rebooting now. \ No newline at end of file
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/AlarmData.java b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmData.java
new file mode 100644
index 0000000..403a8bb
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmData.java
@@ -0,0 +1,216 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : AlarmData
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import javax.swing.*;
+import javax.swing.table.*;
+import java.awt.event.*;
+import java.text.*;
+import java.awt.*;
+import java.util.*;
+public class AlarmData
+{
+ static int AlarmIndex = 0;
+
+ String alarmId;
+ String timestamp;
+ String severity;
+ String objectId;
+ String object;
+ String errorNo;
+ String subject;
+ String message;
+ Integer alarmIndex;
+ String optional1;
+ String optional2;
+ String acknowledge;
+ String recordNumber;
+ String srcIp;
+ static int NUM_REQUIRED_FIELDS = 8;
+ static int NUM_OPTIONAL_FIELDS = 3;
+ static int OP1 = 6;
+ static int OP2 = 7;
+ static int SRCIP = 8;
+ static int ACK = 9;
+ static int REC_NUM = 10;
+ static final String OP1Field = "%1";
+ static final String OP2Field = "%2";
+ static final String OPModule = "%module";
+ static String[] AlarmSeverity = { "Critical",
+ "Major",
+ "Minor",
+ "Information"
+ };
+
+ public static SimpleDateFormat formatter = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss z" );
+
+ public static SimpleDateFormat myFormatter = new SimpleDateFormat("dd.MM.yyyy/HH:mm:ss");
+
+ static final char dilim = '|';
+
+ public AlarmData( String alarmId, String timestamp, String severity,
+ String objectId, String object, String subject, String message)
+ {
+ this.alarmId = alarmId;
+ this.timestamp = timestamp;
+ this.severity = severity;
+ this.objectId = objectId;
+ this.object = object;
+ this.subject = subject;
+ this.message = message;
+ }
+
+ public AlarmData(String event) throws Exception
+ {
+ // event are in the format of:
+ // eventId|timestamp|severity|objectid|object name|event no |optional 1 |optional 2 | optional 3
+ String[] values = new String[NUM_REQUIRED_FIELDS+NUM_OPTIONAL_FIELDS];
+
+
+ int index = 0;
+ int pos = 0;
+ int i = 0;
+ boolean end = false;
+ while(!end)
+ {
+ index = event.indexOf(dilim, pos);
+ if (index == -1)
+ {
+ index = event.length();
+ end = true;
+ continue;
+ }
+ values[i++] = event.substring(pos,index);
+ pos = index+1;
+ }
+
+ try {
+ alarmId = values[0].trim();
+
+ timestamp = formatter.format(new Date(1000*Long.parseLong(Util.trimSpaces(values[1]))));
+ //timestamp = Util.trimSpaces(values[1]);
+ if(Util.debug)
+ {
+ System.out.println("values[1] " + values[1]);
+ System.out.println("Util.trimSpaces(values[1])) " + Util.trimSpaces(values[1]));
+ System.out.println("Long.parseLong(Util.trimSpaces(values[1])) " + Long.parseLong(Util.trimSpaces(values[1])));
+ Date d = new Date(1000*Long.parseLong(Util.trimSpaces(values[1])));
+ System.out.println("date " + d.toString());
+ System.out.println("date.gettime() "+d.getTime());
+ }
+
+ severity = AlarmSeverity[Integer.parseInt(Util.trimSpaces(values[2]))];
+ objectId = values[3].trim();
+ object = values[4];
+ errorNo = values[5].trim();
+ int error = Integer.parseInt(errorNo);
+ Vector alarmMsg = AlarmMessageMap.Get(error);
+ subject = (String) alarmMsg.elementAt(AlarmMessageMap.SUBJECT);
+ message = (String) alarmMsg.elementAt(AlarmMessageMap.MESSAGE);
+ alarmIndex = new Integer(AlarmIndex++);
+ subject = Replace(subject, object, OPModule);
+ message = Replace(message, object, OPModule);
+
+ optional1 = values[OP1].trim();
+ optional2 = values[OP2].trim();
+ srcIp = values[SRCIP].trim();
+ acknowledge = values[ACK].trim();
+ recordNumber = values[REC_NUM].trim();
+
+ if(values[OP1] != null)
+ {
+ optional1 = values[OP1];
+ subject = Replace(subject, optional1, OP1Field);
+ message = Replace(message, optional1, OP1Field);
+ }
+
+ if(values[OP2] != null)
+ {
+ optional2 = values[OP2];
+ subject = Replace(subject, optional2, OP2Field);
+ message = Replace(message, optional2, OP2Field);
+ }
+ }
+ catch(Exception e)
+ {
+ System.out.println("Invalid error No. " +errorNo);
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+
+ public Object getValueAt(int column)
+ {
+ switch (column)
+ {
+ case AlarmTableModel.ALARMID:
+ return alarmId;
+ case AlarmTableModel.TIMESTAMP:
+ return timestamp;
+ case AlarmTableModel.SEVERITY:
+ return severity;
+ case AlarmTableModel.OBJECT:
+ return object;
+ case AlarmTableModel.SUBJECT:
+ return subject;
+ default:
+ return "Unknown";
+ }
+ }
+
+ public void dump()
+ {
+ if(Util.debug)
+ {
+ System.out.println("Alarm ID : " +alarmId);
+ System.out.println("Timestamp : " +timestamp);
+ System.out.println("Severity : " +severity);
+ System.out.println("Object ID : " +objectId);
+ System.out.println("Object : " +object);
+ System.out.println("Error No : " +errorNo);
+ System.out.println("Subject : " +subject);
+ System.out.println("Message : " +message);
+ System.out.println("Optional1 : " +optional1);
+ System.out.println("Optional2 : " +optional2);
+ System.out.println("Index: " +alarmIndex);
+ }
+ }
+
+ String Replace(String field, String opfield, String op)
+ {
+ String message = null;
+ int pos = field.indexOf(op);
+ if(pos != -1) message = field.substring(0, pos) + opfield + field.substring(pos+op.length(), field.length());
+ else message = field;
+ return message;
+ }
+
+ public static void main(String[] argv)
+ {
+ // alarmId|timestamp|severity|objectId|objectName|error code|op 1| op 2
+ String event1="12323|10:23:34 1999|Critical|123|RRM|0|op1|op2";
+ String event2="12323|10:23:34 1999|Critical|123|RRM|1|op1";
+ String event3="12323|10:23:34 1999|Critical|123|RRM|2";
+
+ try {
+ AlarmData data = new AlarmData(event1);
+ data.dump();
+ data = new AlarmData(event2);
+ data.dump();
+ data = new AlarmData(event3);
+ data.dump();
+ }
+ catch(Exception e) {}
+ }
+
+}
+
+//$History:$
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/AlarmMessageMap.java b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmMessageMap.java
new file mode 100644
index 0000000..939f006
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmMessageMap.java
@@ -0,0 +1,131 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : AlarmMessageMap
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+import java.io.*;
+import java.net.URL;
+import Java.AlarmApplet;
+
+abstract class AlarmMessageMap
+{
+ static String file = "Text/AlarmCode.English";
+ static String Comments = "//";
+ static String delim = "|";
+ static Hashtable alarmTable = null;
+ static final int SUBJECT = 0;
+ static final int MESSAGE = 1;
+ static final int VECTOR_SIZE= 2;
+ static final int LENGTH = 3;
+ static boolean readfile = false;
+
+ static String[] ErrorCode = {
+ "0|subect for alarm code 0| detail message for alarm code 0 wdsdsa fdsafdsafs adfdsa fdsafsad fsaf sadfdsaf sadfdsfsa fds dfsa asfa sfasf asdf sadfasfadf sa fasf asfa dsaf asasfdsafa a afasdfdsaf dsafds afitsdfsfdsafsdfsafjksa;lkfjsalkfjsaf;lksajfsaklfsa;lkfasjfa;lksjfsadlkfjas;lkfjsfalksfjsa;lkfjsafkljdsfkldsafjdskfjflksajflksfj;safjas;lfjsafjsaklfsajflkdsafjsalkfah optional field %1",
+ "1|subect for alarm code 1| detail message for alarm code 1 ddsfsdfsafsfaskf;lsjflsfskdl fjsalkfsaflksafwith optional field %1",
+ "2|subect for alarm code 2| detail message for alarm code 2 with optional field %1"
+ };
+
+
+ static Vector Get(long errorNo)
+ {
+ if (alarmTable == null)
+ {
+ Init();
+ }
+
+ Vector object = (Vector) alarmTable.get(new Long(errorNo));
+ if (object == null)
+ {
+ object = new Vector();
+ object.addElement(new String("No entry for data file for error code " +errorNo));
+ object.addElement(new String("No entry for data file for error code " +errorNo));
+ }
+ return object;
+ }
+
+ static void Init()
+ {
+ alarmTable = new Hashtable();
+ URL cfg_url;
+
+ try {
+ if(Util.applet != null) {
+ System.out.println("Running applet");
+ System.out.println("codebase : " + Util.applet.getCodeBase());
+ System.out.println("documentbase : " + Util.applet.getDocumentBase());
+ System.out.println("file : " + Util.applet.getCodeBase().getFile());
+ //BufferedReader in = new BufferedReader(new FileReader(new File(Util.applet.getDocumentBase().getFile(), file)));
+ cfg_url = new URL(Util.applet.getCodeBase()+file);
+ //cfg_url = new URL("http://"+ ((AlarmApplet)Util.applet).ip+"/"+file);
+ }
+ else {
+ System.out.println("Running application");
+ String sep = System.getProperty("file.separator");
+ String pwd = "file:"+".."+sep+"Text"+sep+"AlarmCode.English";
+ cfg_url = new URL(pwd);
+ }
+ System.out.println("Open File: " +cfg_url);
+ BufferedReader in = new BufferedReader(new InputStreamReader(cfg_url.openStream()));
+ String line = null;
+ while( (line = in.readLine()) != null)
+ {
+ ProcessErrorCode(line);
+ readfile = true;
+ }
+ }
+ catch(FileNotFoundException e)
+ {
+ System.out.println(e.toString());
+ System.out.println("Cannot open alarm code file " + file);
+ }
+ catch(IOException ex)
+ {
+ System.out.println("IO Exception: " + ex.toString());
+ }
+
+ if(!readfile)
+ {
+ for(int i=0; i< ErrorCode.length; i++)
+ {
+ ProcessErrorCode(ErrorCode[i]);
+ }
+ }
+ }
+
+ static void ProcessErrorCode(String line)
+ {
+ if(line.startsWith(Comments)) return;
+
+ StringTokenizer token = new StringTokenizer(line, delim);
+ if(token.countTokens() != LENGTH)
+ {
+ return;
+ }
+
+ Long errorNo = new Long(Util.trimSpaces(token.nextToken(delim)));
+ Vector alarmMsg = new Vector(VECTOR_SIZE);
+ alarmMsg.insertElementAt(token.nextToken(delim), SUBJECT);
+ alarmMsg.insertElementAt(token.nextToken(delim), MESSAGE);
+
+ alarmTable.put(errorNo, alarmMsg);
+ }
+
+ static void dump()
+ {
+ if(Util.debug)
+ for (Enumeration e = alarmTable.elements() ; e.hasMoreElements() ;) {
+ System.out.println(e.nextElement());
+ }
+ }
+
+}
+//$History:$
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/AlarmPanel.java b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmPanel.java
new file mode 100644
index 0000000..192f3f0
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmPanel.java
@@ -0,0 +1,467 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : AlarmPanel
+// Desc :
+// Author : George Zhao
+// Hist : 04/27/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import javax.swing.*;
+import javax.swing.table.*;
+import java.awt.event.*;
+import javax.swing.text.Document;
+import javax.swing.event.*;
+import java.net.UnknownHostException;
+import java.awt.*;
+import java.util.*;
+import rl.clbroker.Broker;
+import rl.clbroker.RlBeanProperty;
+import rl.clbroker.RlError;
+
+import FilterObject;
+import FilterFrame;
+import java.text.*;
+import AlarmStatusApplet;
+
+public class AlarmPanel implements DocumentListener,Cloneable{
+ static String host = null;
+ JPanel mainPanel = null;
+ AlarmTable alarmTable = null;
+
+ FilterObject filterObject = null;
+ int alarmFilterCount = 0;
+ Date filterDate = null;
+ Date alarmDate = null;
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z");
+ String viperCellIp = null; // gp10 ip for this panel.
+
+ private static JTextField eventField = null;
+
+ public AlarmPanel(){
+ filterObject = FilterFrame.filterObject;
+ AlarmMessageMap.Init();
+ /*
+ Thread t = new LoadFileThread();
+ t.start();
+ */
+ if(Util.applet == null)
+ {
+ System.out.println("Running as application");
+ Document doc = eventField.getDocument();
+ doc.addDocumentListener(this);
+ }
+ }
+
+ // Instantiated from another applet
+ public AlarmPanel(String viperbaseIp){
+ filterObject = FilterFrame.filterObject;
+ host = viperbaseIp;
+ AlarmMessageMap.Init();
+ }
+ public void setViperCellIp(String viperCell){
+ this.viperCellIp = viperCell;
+ alarmTable.setViperCellIp(viperCell);
+ }
+
+ public AlarmTable getAlarmTable(){
+ return alarmTable;
+ }
+ public JPanel createPanel(){
+ JPanel panel;
+ panel = Util.makeBorderPanel("Alarm List");
+ //Ananth
+ /*if (filterObject.NUM_ALARMS == FilterObject.NONE &&
+ filterObject.SEVERITY == FilterObject.NULL &&
+ filterObject.TIME == FilterObject.NONE &&
+ filterObject.ACKNOWLEDGE == FilterObject.NONE){
+ panel = Util.makeBorderPanel("Alarm List");
+ }
+ else{
+ panel = Util.makeBorderPanel("Alarm List (Filtered)");
+ }*/
+ panel.setLayout(new BorderLayout());
+ AlarmTableModel model = new AlarmTableModel();
+ alarmTable = new AlarmTable(model);
+ alarmTable.setViperCellIp(viperCellIp);
+ JScrollPane scroller= new JScrollPane( alarmTable,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ panel.add(scroller, BorderLayout.CENTER);
+
+ if (host == null) // applet is run against GP10 instead of GMC
+ alarmTable.Refresh();
+ return panel;
+ }
+
+ public void removeRows(int start,int end){
+ DefaultTableModel model = (DefaultTableModel)alarmTable.getSorter().getModel();
+ AlarmTableSorter sorter = alarmTable.getSorter();
+ int row = 0;
+ int indexAtRow = 0;
+ AlarmStatusApplet.logDM("Row : " + row + " Index : " + indexAtRow);
+
+ for(int i = 0;i < (end-start); i++){
+ row = model.getRowCount();
+ indexAtRow = alarmTable.getSorter().getIndexAtRow(row-1);
+ AlarmStatusApplet.logDM("Row : " + row + " Index : " + indexAtRow);
+ sorter.filteredRemoveRow(row-1);
+ }
+ }
+
+
+ public void handleFilterEvent(FilterObject filter){
+
+ DefaultTableModel model = (DefaultTableModel)alarmTable.getModel();
+ AlarmTableSorter sorter = alarmTable.getSorter();
+ this.filterObject = filter;
+ int rowCount = model.getRowCount();
+ String severity = null;
+ String date = null;
+ Boolean acknowledge = null;
+
+ // filtering num of Alarms
+ if(filterObject.NUM_ALARMS != FilterObject.NONE){
+ AlarmStatusApplet.logDM("Filtering num: of Alarms");
+ if(rowCount > filterObject.NUM_ALARMS){
+ AlarmStatusApplet.logDM("Filtering no: of Alarms");
+ removeRows(filterObject.NUM_ALARMS,rowCount);
+ }
+ }
+
+ int newRowCount = model.getRowCount();
+ MyCalendar myCalendar = new MyCalendar();
+ filterDate = myCalendar.calculateDate();
+
+
+ for(int i=0;i<newRowCount;i++){
+ // filtering Severity
+ if(!filterObject.SEVERITY.equals(FilterObject.NULL)){
+ AlarmStatusApplet.logDM("Filtering severity");
+ severity = (String)model.getValueAt(i,AlarmTableModel.SEVERITY);
+ if(filterObject.SEVERITY.equals(FilterObject.CRITICAL)){
+ if(!severity.toUpperCase().equals(filterObject.CRITICAL)){
+ sorter.filteredRemoveRow(i);
+ i--;
+ newRowCount--;
+ continue;
+ }
+ }
+ else if(filterObject.SEVERITY.equals(FilterObject.MAJOR)){
+ if(!(severity.toUpperCase().equals(filterObject.CRITICAL)
+ || severity.toUpperCase().equals(filterObject.MAJOR))){
+ sorter.filteredRemoveRow(i);
+ i--;
+ newRowCount--;
+ continue;
+ }
+ }
+ else if(filterObject.SEVERITY.equals(FilterObject.MINOR)){
+ if(!(severity.toUpperCase().equals(filterObject.CRITICAL)
+ || severity.toUpperCase().equals(filterObject.MAJOR)
+ || severity.toUpperCase().equals(filterObject.MINOR))){
+ sorter.filteredRemoveRow(i);
+ i--;
+ newRowCount--;
+ continue;
+ }
+ }
+
+ }
+
+ // filtering Date/Time
+ if(!(filterObject.TIME == FilterObject.NONE)){
+ AlarmStatusApplet.logDM("Checking timestamp");
+ date = (String)model.getValueAt(i,AlarmTableModel.TIMESTAMP);
+ try{
+ alarmDate = formatter.parse(date);
+ }
+ catch(ParseException ex){
+ System.out.println("Cudn't parse date ...");
+ }
+ if(!alarmDate.after(filterDate)){
+ sorter.filteredRemoveRow(i);
+ i--;
+ newRowCount--;
+ continue;
+ }
+ }
+
+ // filtering Ack
+ if(!(filterObject.ACKNOWLEDGE == FilterObject.NONE)){
+ AlarmStatusApplet.logDM("Filtering ack");
+ acknowledge = (Boolean)model.getValueAt(i,AlarmTableModel.ACK);
+ if(filterObject.ACKNOWLEDGE == FilterObject.NO_ACK){
+ if(acknowledge.booleanValue()){
+ sorter.filteredRemoveRow(i);
+ i--;
+ newRowCount--;
+ }
+ continue;
+ }
+ else if(filterObject.ACKNOWLEDGE == FilterObject.ALL_ACK){
+ if(!acknowledge.booleanValue()){
+ sorter.filteredRemoveRow(i);
+ i--;
+ newRowCount--;
+ }
+ continue;
+ }
+ }
+ } // end "for loop"
+
+ // addEvent(alarm);
+ }
+
+ public void addEvent(AlarmData alarm){
+ String severity;
+ Boolean acknowledge;
+ int ack;
+ String date;
+ DefaultTableModel model = (DefaultTableModel)alarmTable.getModel();
+
+ if(filterObject != null){
+
+ // filtering Severity
+ if(!filterObject.SEVERITY.equals(FilterObject.NULL)){
+ AlarmStatusApplet.logDM("Filtering severity");
+ severity = alarm.severity;
+ if(filterObject.SEVERITY.equals(FilterObject.CRITICAL)){
+ if(!severity.toUpperCase().equals(filterObject.CRITICAL)){
+ return;
+ }
+ }
+ else if(filterObject.SEVERITY.equals(FilterObject.MAJOR)){
+ if(!(severity.toUpperCase().equals(filterObject.CRITICAL)
+ || severity.toUpperCase().equals(filterObject.MAJOR))){
+ return;
+ }
+ }
+ else if(filterObject.SEVERITY.equals(FilterObject.MINOR)){
+ if(!(severity.toUpperCase().equals(filterObject.CRITICAL)
+ || severity.toUpperCase().equals(filterObject.MAJOR)
+ || severity.toUpperCase().equals(filterObject.MINOR))){
+ return;
+ }
+ }
+ }
+
+ // filtering Ack
+ ack = Integer.parseInt(alarm.acknowledge);
+ if(ack == 0){
+ acknowledge = new Boolean(false);
+ }
+ else{
+ acknowledge = new Boolean(true);
+ }
+ if(!(filterObject.ACKNOWLEDGE == FilterObject.NONE)){
+ AlarmStatusApplet.logDM("Filtering ack");
+ if(filterObject.ACKNOWLEDGE == FilterObject.NO_ACK){
+ if(acknowledge.booleanValue()){
+ return;
+ }
+ }
+ else if(filterObject.ACKNOWLEDGE == FilterObject.ALL_ACK){
+ if(!acknowledge.booleanValue()){
+ return;
+ }
+ }
+ }
+
+ // filtering Date/Time
+ MyCalendar myCalendar = new MyCalendar();
+ filterDate = myCalendar.calculateDate();
+
+ if(!(filterObject.TIME == FilterObject.NONE)){
+
+ AlarmStatusApplet.logDM("Checking timestamp");
+ date = alarm.timestamp;
+ try{
+ alarmDate = formatter.parse(date);
+ }
+ catch(ParseException ex){
+ System.out.println("Cudn't parse date ...");
+ }
+ if(!alarmDate.after(filterDate)){
+ return;
+ }
+ }
+
+ // Shrinivas 05 jun 01'
+ // filtering NUM_ALARMS
+ if(filterObject.NUM_ALARMS != FilterObject.NONE){
+ int rowCount = model.getRowCount();
+ AlarmStatusApplet.logDM("Filtering num: of Alarms");
+ if(rowCount > filterObject.NUM_ALARMS-1){
+ AlarmStatusApplet.logDM("Filtering no: of Alarms");
+ removeRows(filterObject.NUM_ALARMS-1,rowCount);
+ }
+ }
+ // Shrinivas end
+ }
+
+
+ Object [] row = new Object[AlarmTableModel.NUM_COL];
+ row[AlarmTableModel.INDEX] = alarm.alarmIndex;
+ row[AlarmTableModel.READ] = new Boolean(false);
+ row[AlarmTableModel.ALARMID] = alarm.alarmId;
+ row[AlarmTableModel.TIMESTAMP] = alarm.timestamp;
+ row[AlarmTableModel.SEVERITY] = alarm.severity;
+ row[AlarmTableModel.OBJECT] = alarm.object;
+ row[AlarmTableModel.SUBJECT] = alarm.subject;
+
+ if(Integer.parseInt(alarm.acknowledge) == 0)
+ row[AlarmTableModel.ACK] = new Boolean(false);
+ else
+ row[AlarmTableModel.ACK] = new Boolean(true);
+
+ ((DefaultTableModel)alarmTable.getModel()).insertRow(0, row);
+ alarmTable.setAlarmData(alarm);
+
+ }
+
+ public void removeAllEvents()
+ {
+ while (((DefaultTableModel)alarmTable.getModel()).getRowCount() > 0)
+ ((DefaultTableModel)alarmTable.getModel()).removeRow(0);
+ }
+
+ static public void main(String[] argv)
+ {
+ eventField = new JTextField();
+ host = argv[0];
+ try
+ {
+ boolean useTCP = true;
+ int portNum = 80;
+ int maxLen = 4096;
+
+ System.out.println("Connect to " + host + " prot " +portNum);
+ Broker.setOptions(host, portNum, maxLen, useTCP);
+
+ }
+ catch(UnknownHostException e) { e.printStackTrace(); }
+ Broker.addMagicMarkup("QSEvent", "java.lang.String", false);
+ RlBeanProperty beanProp = Broker.wrapBeanProperty(eventField, "text", java.lang.String.class);
+ Broker.bindMarkupToBeanProperty("QSEvent", "", null, beanProp, true, false, true, null);
+ Broker.start();
+ JFrame f = new JFrame("ViperCell Event List");
+ f.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e)
+ {
+ System.exit(1);
+ }
+ });
+ f.getContentPane().setLayout(new BorderLayout());
+ AlarmPanel base = new AlarmPanel();
+ f.getContentPane().add(base.createPanel());
+ f.setBounds(0,0, 720,400);
+ try
+ {
+ UIManager.setLookAndFeel( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+ SwingUtilities.updateComponentTreeUI(f);
+ }
+ catch(Exception ex)
+ {
+ Util.showDialog(f, ex.toString(), "Error", JOptionPane.ERROR_MESSAGE);
+ }
+ f.setVisible(true);
+
+ /*
+ Random r = new Random();
+ Calendar d = Calendar.getInstance();
+
+ String severity = null;
+
+ for(int i=0; i<20; i++)
+ {
+ try {
+ d.add(Calendar.SECOND, java.lang.Math.abs(r.nextInt()));
+ if (i-i/3*3 == 0)
+ severity = new String("Critical");
+ else if (i-i/3 == 1)
+ severity = new String("Minor");
+ else if (i - i/3*3 == 2)
+ severity = new String("Info");
+ String date = d.getTime().toString();
+ String object = "Object_"+String.valueOf(java.lang.Math.abs(r.nextInt()));
+ String message = " Event messages ....";
+
+ AlarmData alarm = new AlarmData(String.valueOf(i), date, severity, null, object, message, null);
+ base.addEvent(alarm);
+ Thread.sleep(10000);
+ System.out.println("Event: " +i);
+ }
+ catch(Exception e)
+ {}
+ }
+ */
+
+
+ }
+
+ public void changedUpdate(DocumentEvent e)
+ {
+ }
+
+ public void insertUpdate(DocumentEvent e)
+ {
+ String alarmId = eventField.getText();
+ alarmId.trim();
+ System.out.println("Receiving Alarm: " + alarmId);
+
+ if(!alarmId.startsWith("Event Number"))
+ {
+ try {
+ AlarmData alarm = new AlarmData(alarmId);
+ addEvent(alarm);
+ }
+ catch(Exception ex) {}
+ }
+ }
+
+ public void removeUpdate(DocumentEvent e)
+ {
+ }
+
+ class LoadFileThread extends Thread
+ {
+ public void run()
+ {
+ AlarmMessageMap.Init();
+ }
+ }
+
+ class MyCalendar extends GregorianCalendar{
+
+ public Date calculateDate(){
+
+ MyCalendar myCalen = new MyCalendar();
+ long currentMillis = myCalen.getTimeInMillis();
+ long temp;
+ Date pDate = null;
+
+ if(filterObject.TIME == FilterObject.MIN_15){
+ temp = 15 * 60 * 1000;
+ pDate = new Date(currentMillis - temp);
+ }
+ else if(filterObject.TIME == FilterObject.HR_1){
+ temp = 60 * 60 * 1000;
+ pDate = new Date(currentMillis - temp);
+ }
+ else if(filterObject.TIME == FilterObject.HR_12){
+ temp = (12 * 60 ) * 60 * 1000;
+ pDate = new Date(currentMillis - temp);
+ }
+ else if(filterObject.TIME == FilterObject.HR_24){
+ temp = (24 * 60 ) * 60 * 1000;
+ pDate = new Date(currentMillis - temp);
+ }
+ return pDate;
+ }
+ }
+}
+
+//$History:$
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTable.java b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTable.java
new file mode 100644
index 0000000..1e5490d
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTable.java
@@ -0,0 +1,588 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : AlarmTable
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import javax.swing.event.*;
+import java.util.Hashtable;
+import java.awt.*;
+import java.io.*;
+import java.awt.image.*;
+import java.net.*;
+import AlarmTCPThread;
+
+public class AlarmTable extends JTable {
+
+ DefaultTableModel model;
+ JPopupMenu popupMenu = null;
+
+ final int [] columnMinWidth = {25, 30, 150, 50, 80, 250, 0,25};
+ final int [] columnMaxWidth = {40, 60, 200, 100, 150, 800, 0,40};
+
+ AlarmTableSorter sorter = null;
+ Hashtable alarmHashTable = null;
+ DetailFrame detailFrame = new DetailFrame();
+ String viperCellIp = null;
+
+ public AlarmTable(DefaultTableModel model)
+ {
+ super(model);
+ popupMenu = AlarmTablePopupMenu.getPopupMenu();
+
+ sorter = new AlarmTableSorter(model);
+ super.setModel( sorter );
+ addMouseListener(new MouseHandler(this));
+ alarmHashTable = new Hashtable();
+ for (int i=0; i < model.getColumnCount(); i++ )
+ setColumnWidth(i, columnMinWidth[i], columnMaxWidth[i]);
+ TableColumnModel colModel = getColumnModel();
+ colModel.getColumn(AlarmTableModel.READ).setCellRenderer(new ReadCellRenderer());
+ colModel.getColumn(AlarmTableModel.SEVERITY).setCellRenderer(new SeverityRenderer());
+ colModel.getColumn(AlarmTableModel.ACK).setCellRenderer(new ReadCellRenderer());
+
+ setRowSelectionAllowed(true);
+ setColumnSelectionAllowed(false);
+ setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
+ setShowGrid(true);
+ setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
+ setShowVerticalLines(false);
+ setGridColor(new Color(153,153,255));
+ }
+
+
+ public AlarmTableSorter getSorter(){
+ return this.sorter;
+ }
+ public void setViperCellIp(String viperCell){
+ this.viperCellIp = viperCell;
+ }
+
+ public void setColumnWidth(int columnIndex, int minWidth, int maxWidth)
+ {
+ TableColumn column = (TableColumn)getColumn(getColumnName(columnIndex));
+
+ column.setMinWidth(minWidth);
+ column.setMaxWidth(maxWidth);
+ }
+
+ public boolean isCellEditable(int i, int j)
+ {
+ return false;
+ }
+
+
+ public AlarmData getAlarmData(Integer index)
+ {
+ if (alarmHashTable != null)
+ return (AlarmData) alarmHashTable.get(index);
+ return null;
+ }
+
+ public void setAlarmData(AlarmData alarmdata){
+ if(AlarmMessageMap.readfile){
+ alarmHashTable.put(alarmdata.alarmIndex, alarmdata);
+ }
+ }
+
+ public void OpenEvent()
+ {
+ Integer index = (Integer)getValueAt(getSelectedRow(), AlarmTableModel.INDEX);
+ System.out.println("Open Event: " +index);
+ AlarmData data = (AlarmData) alarmHashTable.get(index);
+ data.dump();
+ detailFrame.setData(data);
+ Dimension d = new JFrame().getToolkit().getScreenSize();
+ detailFrame.setLocation(d.width/4,d.height/3);
+ detailFrame.setResizable(false);
+ if(Util.applet == null){
+ detailFrame.setIconImage(Toolkit.getDefaultToolkit().getImage("../Images/app_icon.gif"));
+ }
+ else{
+ String iconPath = Util.applet.getCodeBase().toString();
+ iconPath += "Images/app_icon.gif";
+ URL iconPathURL = null;
+ try{
+ iconPathURL = new URL(iconPath);
+ }
+ catch(MalformedURLException exc){
+ System.out.println("Bad URL.");
+ }
+ System.out.println(iconPathURL);
+ detailFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(iconPathURL));
+ }
+ //detailFrame.setIconImage(Toolkit.getDefaultToolkit().getImage("../Images/app_icon.gif"));
+ detailFrame.setVisible(true);
+ setValueAt(new Boolean(true), getSelectedRow(), AlarmTableModel.READ);
+ }
+
+ public void RemoveAllEvents()
+ {
+ System.out.println("Remove All");
+ while( getRowCount()> 0)
+ {
+ ((DefaultTableModel) getModel()).removeRow(0);
+ }
+ }
+
+ public void RemoveInfoEvents()
+ {
+ System.out.println("Remvoe Info");
+ sorter.reallocateIndexes();
+ sorter.sortByColumn(AlarmTableModel.ALARMID, false);
+ for (int i=0; i< getRowCount(); i++)
+ {
+ if (((String) getValueAt(i, AlarmTableModel.SEVERITY)).equals("Info"))
+ {
+ System.out.println("removing row " + i);
+ ((DefaultTableModel) getModel()).removeRow(i);
+ }
+ }
+ }
+
+ public void RemoveReadEvents()
+ {
+ System.out.println("RemoveRead");
+ sorter.reallocateIndexes();
+ sorter.sortByColumn(AlarmTableModel.READ, false);
+ for (int i=0; i< getRowCount(); i++)
+ {
+ if (((Boolean) getValueAt(i, AlarmTableModel.READ)).booleanValue())
+ {
+ System.out.println("removing row " + i);
+ ((DefaultTableModel) getModel()).removeRow(i);
+ i--;
+ }
+ }
+ }
+
+ public void RemoveEvent()
+ {
+ String alarmId = (String)getValueAt(getSelectedRow(), AlarmTableModel.INDEX);
+ System.out.println("Remove Event: " +alarmId);
+ sorter.reallocateIndexes();
+ sorter.sortByColumn(AlarmTableModel.ALARMID, false);
+ for (int i=0; i< getRowCount(); i++)
+ {
+ if (((String) getValueAt(i, AlarmTableModel.INDEX)).equals(alarmId))
+ {
+ System.out.println("removing row " + i);
+ ((DefaultTableModel) getModel()).removeRow(i);
+ break;
+ }
+ }
+ }
+
+
+ public void Refresh(){
+ RemoveAllEvents();
+ java.net.URL cfg_url = null;
+
+ // Shrinivas Feb 28th
+ AlarmTCPThread.sendEventReq(viperCellIp);
+
+ /*if(Util.applet == null){
+ AlarmTCPThread.sendEventReq(viperCellIp);
+ }
+ // original applet code : Refresh logic as it was before
+ else{
+ try {
+ if(Util.applet != null)
+ cfg_url = new java.net.URL(Util.applet.getDocumentBase()+"Text/alarm.log");
+ else
+ cfg_url = new java.net.URL("http://"+AlarmPanel.host+"/Text/alarm.log");
+ System.out.println("Open File: " +cfg_url);
+ java.io.BufferedReader in = new java.io.BufferedReader(new InputStreamReader(cfg_url.openStream()));
+ String line = null;
+ while( (line = in.readLine()) != null){
+ try {
+ System.out.println("Line : " +line);
+ AlarmData alarm = new AlarmData(line);
+ setAlarmData(alarm);
+ Object [] row = new Object[AlarmTableModel.NUM_COL];
+ row[AlarmTableModel.INDEX] = alarm.alarmIndex;
+ row[AlarmTableModel.READ] = new Boolean(false);
+ row[AlarmTableModel.ALARMID] = alarm.alarmId;
+ row[AlarmTableModel.TIMESTAMP] = alarm.timestamp;
+ row[AlarmTableModel.SEVERITY] = alarm.severity;
+ row[AlarmTableModel.OBJECT] = alarm.object;
+ row[AlarmTableModel.SUBJECT] = alarm.subject;
+
+ ((DefaultTableModel)getModel()).insertRow(0, row);
+ }
+ catch(Exception ex) {}
+ }
+ }
+ catch(FileNotFoundException e){
+ System.out.println(e.toString());
+ System.out.println("Cannot open alarm code file Text/alarm.log");
+ }
+ catch(IOException ex){
+ System.out.println("IO Exception: " + ex.toString());
+ }
+ }*/
+
+ // Shrinivas end
+ }
+
+ public void Acknowledge(){
+ Integer index = (Integer)getValueAt(getSelectedRow(), AlarmTableModel.INDEX);
+ AlarmData data = (AlarmData) alarmHashTable.get(index);
+ if(data == null)
+ System.out.println("unable to get Alarm data");
+ AlarmTCPThread.sendAck(data.srcIp,data.alarmId,data.recordNumber);
+ setValueAt(new Boolean(true), getSelectedRow(), AlarmTableModel.ACK);
+ }
+
+ class MouseHandler extends MouseAdapter
+ {
+ AlarmTable holder = null;
+ public MouseHandler(AlarmTable table){
+ this.holder = table;
+ }
+ public void mouseReleased(MouseEvent e){
+ if (e.getClickCount() == 2 )
+ {
+ System.out.println("Process Double click");
+ OpenEvent();
+ }
+
+ if ( e.isPopupTrigger()){
+ int selectedRow = rowAtPoint(new Point(e.getX(),e.getY()));
+ setRowSelectionInterval(selectedRow,selectedRow);
+
+ popupMenu.show(holder, e.getX(), e.getY());
+ }
+ }
+ }
+
+ class ReadCellRenderer extends JCheckBox implements TableCellRenderer
+ {
+ Color mHighlightedBackground = (Color) (new Color(0, 0, 255)).darker().darker();
+ Color mDefaultBackground = SystemColor.window;
+ public ReadCellRenderer()
+ {
+ setBackground(Color.white);
+ setHorizontalAlignment(JLabel.CENTER);
+ }
+
+ public Component getTableCellRendererComponent( JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column )
+ {
+ Boolean b = (Boolean) value;
+
+ if(b != null){
+ setSelected(b.booleanValue());
+
+ }
+
+ return this;
+ }
+ }
+
+ class SeverityRenderer extends JLabel implements TableCellRenderer
+ {
+ Color mHighlightedBackground = (Color) (new Color(0, 0, 255)).darker().darker();
+ Color mDefaultBackground = SystemColor.window;
+ Font defaultFont = new Font("Helvetica", Font.BOLD,12);
+ Font empFont = new Font("TimesRoman", Font.BOLD,18);
+ ImageIcon severityIcon = null;
+ ImageIcon criticalIcon = null;
+ ImageIcon majorIcon = null;
+ ImageIcon minorIcon = null;
+ ImageIcon infoIcon = null;
+
+ public SeverityRenderer(){
+ super("");
+ loadIcons();
+ setHorizontalAlignment(JLabel.CENTER);
+ }
+
+ private void loadIcons(){
+ String fileSep = System.getProperty("file.separator");
+ String codeBase = null;
+ String imagePath = "file:" +".."+fileSep+"Images"+fileSep;
+ String imageFile = null;
+ if(Util.applet != null){
+ codeBase = Util.applet.getCodeBase().toString();
+ System.out.println(codeBase);
+ }
+ try{
+ if(Util.applet != null){
+ imageFile = codeBase + "Images/scritical.gif";
+ }
+ else{
+ imageFile = imagePath+"scritical.gif";
+ }
+ criticalIcon = new ImageIcon(new URL(imageFile));
+
+ if(Util.applet != null){
+ imageFile = codeBase + "Images/smajor.gif";
+ }
+ else
+ imageFile = imagePath+"smajor.gif";
+ majorIcon = new ImageIcon(new URL(imageFile));
+
+ if(Util.applet != null){
+ imageFile = codeBase + "Images/sminor.gif";
+ }
+ else
+ imageFile = imagePath+"sminor.gif";
+ minorIcon = new ImageIcon(new URL(imageFile));
+
+ if(Util.applet != null){
+ imageFile = codeBase + "Images/sinformation.gif";
+ }
+ else
+ imageFile = imagePath + "sinformation.gif";
+ infoIcon = new ImageIcon(new URL(imageFile));
+ }
+ catch(MalformedURLException malEx){
+ System.out.println("Bad URL");
+ }
+ }
+
+ public Component getTableCellRendererComponent( JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column ){
+
+ String severity = (String) value;
+
+ if(value != null){
+ if(severity.equals(AlarmData.AlarmSeverity[0])) {
+ setIcon(criticalIcon);
+ criticalIcon.setImageObserver(new CellImageObserver(table, row, column));
+ }
+ else if(severity.equals(AlarmData.AlarmSeverity[1])){
+ setIcon(majorIcon);
+ majorIcon.setImageObserver(new CellImageObserver(table, row, column));
+ }
+ else if (severity.equals(AlarmData.AlarmSeverity[2])){
+ setIcon(minorIcon);
+ minorIcon.setImageObserver(new CellImageObserver(table, row, column));
+ }
+ else if (severity.equals(AlarmData.AlarmSeverity[3])){
+ setIcon(infoIcon);
+ infoIcon.setImageObserver(new CellImageObserver(table, row, column));
+ }
+ }
+
+ if (isSelected){
+ setBackground(mHighlightedBackground);
+ }
+ else{
+ setBackground(mDefaultBackground);
+ }
+
+ return this;
+ }
+ }
+
+ class CellImageObserver implements ImageObserver {
+ JTable table;
+ int row;
+ int col;
+
+ CellImageObserver(JTable table,int row, int col) {
+ this.table = table;
+ this.row = row;
+ this.col = col;
+ }
+
+ public boolean imageUpdate(Image img, int flags,int x, int y, int w, int h){
+ if ((flags & (FRAMEBITS|ALLBITS)) != 0) {
+ Rectangle rect = table.getCellRect(row,col,false);
+ table.repaint(rect);
+ }
+ return (flags & (ALLBITS|ABORT)) == 0;
+ }
+ }
+
+
+ class DetailFrame extends JFrame implements ActionListener
+ {
+ JPanel mainPanel = null;
+ final int WIDTH = 520;
+ final int HEIGHT = 360;
+ final int rows = 4;
+ final int columns = 40;
+
+ JTextField alarmIdField = Util.makeTextField(false);
+ JTextField severityField = Util.makeTextField(false);
+ JTextField timestampField = Util.makeTextField(false);
+ JTextField objectField = Util.makeTextField(false);
+ JTextField subjectField = Util.makeTextField(false);
+ JTextArea messageArea = Util.makeTextArea(rows, columns, false);
+ JButton closeButton = new JButton("Close");
+
+ public DetailFrame ()
+ {
+ mainPanel = createPanel();
+ getContentPane().add(mainPanel, BorderLayout.CENTER);
+ pack();
+ setSize(getPreferredSize());
+ addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e)
+ {
+ close();
+ }
+ });
+ closeButton.addActionListener(this);
+ try
+ {
+ UIManager.setLookAndFeel( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+ SwingUtilities.updateComponentTreeUI(this);
+ }
+ catch(Exception ex)
+ {
+ Util.showDialog(this, ex.toString(), "Error", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ public JPanel createPanel()
+ {
+ JPanel panel = Util.makeBorderPanel();
+ panel.setLayout(new BorderLayout(0, 0));
+ panel.add(makeDetailPanel(), BorderLayout.CENTER);
+ panel.add(makeMessagePanel(), BorderLayout.SOUTH);
+ return panel;
+ }
+
+ JPanel makeDetailPanel()
+ {
+ JPanel panel = Util.makeBorderPanel("Event Data");
+ GridBagConstraints gbc;
+ GridBagLayout gridbag = new GridBagLayout();
+ gbc = new GridBagConstraints();
+ JLabel label;
+ panel.setLayout(gridbag);
+
+ label = new JLabel("Event ID ", JLabel.RIGHT);
+ label.setToolTipText("Alarm ID");
+ Util.constrain(label, panel, gbc, 0,0,1,1,
+ GridBagConstraints.VERTICAL,GridBagConstraints.WEST,
+ 0.0,0.0,0,5,5,0);
+
+ Util.constrain(alarmIdField, panel, gbc, 1,0,1,1,
+ GridBagConstraints.HORIZONTAL,GridBagConstraints.WEST,
+ 100.0,100.0,0,5,5,0);
+
+ label = new JLabel("Severity ",JLabel.RIGHT);
+ label.setToolTipText("Severity of the Event");
+ Util.constrain(label, panel, gbc, 2,0,1,1,
+ GridBagConstraints.VERTICAL,GridBagConstraints.WEST,
+ 0.0,0.0,0,5,5,0);
+
+ Util.constrain(severityField, panel, gbc, 3,0,1,1,
+ GridBagConstraints.HORIZONTAL,GridBagConstraints.WEST,
+ 100.0,100.0,0,5,5,0);
+
+ label = new JLabel("Time Stamp ",JLabel.RIGHT);
+ label.setToolTipText("Event time stamp");
+ Util.constrain(label, panel, gbc, 0,1,1,1,
+ GridBagConstraints.VERTICAL,GridBagConstraints.WEST,
+ 0.0,0.0,0,5,5,0);
+
+ Util.constrain(timestampField, panel, gbc, 1,1,1,1,
+ GridBagConstraints.HORIZONTAL,GridBagConstraints.WEST,
+ 100.0,100.0,0,5,5,0);
+
+ label = new JLabel("Object ",JLabel.RIGHT);
+ label.setToolTipText("Name of the object that generated this event");
+ Util.constrain(label, panel, gbc, 2,1,1,1,
+ GridBagConstraints.VERTICAL,GridBagConstraints.WEST,
+ 0.0,0.0,0,5,5,0);
+
+ Util.constrain(objectField, panel, gbc, 3,1,1,1,
+ GridBagConstraints.HORIZONTAL,GridBagConstraints.WEST,
+ 100.0,100.0,0,5,5,0);
+
+ label = new JLabel("Subject ",JLabel.RIGHT);
+ label.setToolTipText("Subject of the Event");
+ Util.constrain(label, panel, gbc, 0,2,1,1,
+ GridBagConstraints.VERTICAL,GridBagConstraints.WEST,
+ 0.0,0.0,0,5,5,0);
+
+ Util.constrain(subjectField, panel, gbc, 1,2,3,1,
+ GridBagConstraints.HORIZONTAL,GridBagConstraints.WEST,
+ 100.0,100.0,0,5,5,0);
+
+
+ return panel;
+ }
+
+ JPanel makeMessagePanel()
+ {
+ JPanel panel = Util.makeEmptyBorderPanel();
+ panel.setLayout(new BorderLayout(0,0));
+ panel.add(messageAreaPanel(), BorderLayout.CENTER);
+ panel.add(makeButtonPanel(), BorderLayout.SOUTH);
+ return panel;
+ }
+
+ JPanel messageAreaPanel()
+ {
+ JPanel panel = Util.makeBorderPanel("Message");
+ panel.setLayout(new BorderLayout(0,0));
+ messageArea.setLineWrap(true);
+ messageArea.setWrapStyleWord(true);
+ JScrollPane scroller = new JScrollPane(messageArea);
+ panel.add(scroller, BorderLayout.CENTER);
+ return panel;
+ }
+
+ JPanel makeButtonPanel()
+ {
+ JPanel panel = new JPanel();
+ panel.setLayout(new FlowLayout());
+ panel.add(closeButton);
+ return panel;
+ }
+
+ public Dimension getPreferredSize()
+ {
+ return new Dimension(WIDTH, HEIGHT);
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+
+ Object obj = event.getSource();
+ if (obj == closeButton)
+ close();
+ }
+
+ public void close()
+ {
+ setVisible(false);
+ }
+
+ public void setData(AlarmData data)
+ {
+ setTitle("Event Detail for Event Id: " +data.alarmId);
+ alarmIdField.setText(data.alarmId);
+ severityField.setText(data.severity);
+ timestampField.setText(data.timestamp);
+ objectField.setText(data.object);
+ subjectField.setText(data.subject);
+ messageArea.setText(data.message);
+ }
+ }
+
+}
+//$History:$
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTableModel.java b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTableModel.java
new file mode 100644
index 0000000..0123885
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTableModel.java
@@ -0,0 +1,43 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : AlarmTableModel
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import javax.swing.*;
+import javax.swing.table.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.util.*;
+
+public class AlarmTableModel extends DefaultTableModel
+
+
+{
+ final static int INDEX = 6;
+ final static int READ = 0;
+ final static int ALARMID = 1;
+ final static int TIMESTAMP = 2;
+ final static int SEVERITY = 3;
+ final static int OBJECT = 4;
+ final static int SUBJECT = 5;
+ final static int MESSAGE = 6;
+ final static int ACK = 7;
+
+
+ static String ColumnTitle[] = {"Read", "Alarm ID", "Time Stamp", "Severity", "Object", "Message Subject", "","Ack"};
+ final static int NUM_COL = ColumnTitle.length;
+
+ public AlarmTableModel()
+ {
+ super(ColumnTitle, 0);
+ }
+}
+
+
+//$History:$
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTablePopupMenu.java b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTablePopupMenu.java
new file mode 100644
index 0000000..4002b40
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTablePopupMenu.java
@@ -0,0 +1,218 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : AlarmTablePopupMenu
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.table.*;
+
+public class AlarmTablePopupMenu extends JPopupMenu implements ActionListener
+{
+ static JMenuItem openMenuItem;
+ static JMenuItem removeMenuItem;
+ static JMenuItem removeAllMenuItem;
+ static JMenuItem removeReadMenuItem;
+ static JMenuItem removeInfoMenuItem;
+ static JMenuItem refreshMenuItem;
+ static JMenuItem acknowledgeMenuItem;
+
+ static boolean iconsLoaded = false;
+ protected static AlarmTablePopupMenu popupMenu = new AlarmTablePopupMenu();
+
+ static AlarmTable invoker ;
+
+ static int x;
+ static int y;
+
+
+ /**
+ * You cannot instantiate this class. Use getPopupMenu() to get
+ * a shared instance!
+ */
+ protected AlarmTablePopupMenu()
+ {
+ openMenuItem = Util.makeMenuItem("Open Event",'O');
+ openMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ openMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ openMenuItem.addActionListener(this);
+ add(openMenuItem);
+ addSeparator();
+
+
+ /*
+ removeMenuItem = Util.makeMenuItem("Remove Event",'R');
+ removeMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ removeMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ removeMenuItem.addActionListener(this);
+ add(removeMenuItem);
+ addSeparator();
+
+ removeAllMenuItem = Util.makeMenuItem("Remove All Events", 'A');
+ removeAllMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ removeAllMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ removeAllMenuItem.addActionListener(this);
+ add(removeAllMenuItem);
+
+ removeReadMenuItem = Util.makeMenuItem("Remove Read Events", 'E');
+ removeReadMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ removeReadMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ removeReadMenuItem.addActionListener(this);
+ add(removeReadMenuItem);
+
+ removeInfoMenuItem = Util.makeMenuItem("Remove Clear Events", 'C');
+ removeInfoMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ removeInfoMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ removeInfoMenuItem.addActionListener(this);
+ add(removeInfoMenuItem);*/
+
+ // Shrinivas 20th Apr 01
+ /*addSeparator();
+ refreshMenuItem = Util.makeMenuItem("Refresh", 'R');
+ refreshMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ refreshMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ refreshMenuItem.addActionListener(this);
+ add(refreshMenuItem);*/
+ // Shrinivas 20th Apr 01
+
+ addSeparator();
+ addSeparator();
+ acknowledgeMenuItem = Util.makeMenuItem("Acknowledge", 'A');
+ acknowledgeMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ acknowledgeMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ acknowledgeMenuItem.addActionListener(this);
+ add(acknowledgeMenuItem);
+ }
+
+
+ /**
+ * returns shared instance of popupMenu
+ */
+ public static AlarmTablePopupMenu getPopupMenu()
+ {
+ return popupMenu;
+ }
+
+
+ /**
+ * update to use difference icons later!
+ */
+ void loadIcons()
+ {
+ openMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("opengray.gif")));
+ removeAllMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("delete.gif")));
+ removeReadMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("delete.gif")));
+ removeInfoMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("delete.gif")));
+ refreshMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("reset.gif")));
+ }
+
+
+ /**
+ * update to use shared clipboard access later
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ Object obj = e.getSource();
+ String selection = null;
+
+ if (obj == openMenuItem)
+ {
+ invoker.OpenEvent();
+ }
+ else if (obj == removeMenuItem)
+ {
+ invoker.RemoveEvent();
+ }
+ else if (obj == removeAllMenuItem)
+ {
+ invoker.RemoveAllEvents();
+ }
+ else if (obj == removeReadMenuItem)
+ {
+ invoker.RemoveReadEvents();
+ }
+ else if (obj == removeInfoMenuItem)
+ {
+ invoker.RemoveInfoEvents();
+ }
+ else if (obj == refreshMenuItem){
+ invoker.Refresh();
+ }
+ else if (obj == acknowledgeMenuItem){
+ invoker.Acknowledge();
+ }
+
+ }
+
+
+ /**
+ * force JTable only later
+ */
+ public void show(Component c, int x, int y)
+ {
+ invoker = (AlarmTable)c;
+ /*
+ if (iconsLoaded == false)
+ {
+ loadIcons();
+ iconsLoaded = true;
+ }
+ */
+
+
+ Point p = new Point(x,y);
+ int row = invoker.rowAtPoint(p);
+ int col = invoker.columnAtPoint(p);
+
+ /*
+ if ((row >= 0) && (col >= 0))
+ enableMenu();
+ else
+ {
+ disableMenu();
+ return;
+ }
+ */
+
+ DefaultTableModel model = (DefaultTableModel)invoker.getModel();
+ Boolean acknowledge = (Boolean) model.getValueAt(row,AlarmTableModel.ACK);
+ if(acknowledge.booleanValue()){
+ acknowledgeMenuItem.setEnabled(false);
+ }
+ else{
+ acknowledgeMenuItem.setEnabled(true);
+ }
+ this.x = x;
+ this.y = y;
+ super.show(c,x,y);
+ }
+
+
+ void disableMenu()
+ {
+ openMenuItem.setEnabled(false);
+ removeAllMenuItem.setEnabled(false);
+ removeReadMenuItem.setEnabled(false);
+ removeInfoMenuItem.setEnabled(false);
+ }
+
+
+ void enableMenu()
+ {
+ openMenuItem.setEnabled(true);
+ removeAllMenuItem.setEnabled(true);
+ removeReadMenuItem.setEnabled(true);
+ removeInfoMenuItem.setEnabled(true);
+ }
+}
+
+//$History:$
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTableSorter.java b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTableSorter.java
new file mode 100644
index 0000000..ead2e89
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/AlarmTableSorter.java
@@ -0,0 +1,97 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : AlarmTableSorter
+// Desc : table sorter for Order explorer request table.
+// Author : George Zhao
+// Hist : June 18, 1999
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.table.*;
+
+
+
+class AlarmTableSorter extends TableSorter
+{
+ public AlarmTableSorter (TableModel model)
+ {
+ super (model);
+ }
+
+ public int compareRowsByColumn(int row1, int row2, int column)
+ {
+ TableModel data = model;
+
+ // Check for nulls
+
+ Object o1 = data.getValueAt(row1, column);
+ Object o2 = data.getValueAt(row2, column);
+
+ // If both values are null return 0
+ if (o1 == null && o2 == null) {
+ return 0;
+ }
+ else if (o1 == null) { // Define null less than everything.
+ return -1;
+ }
+ else if (o2 == null) {
+ return 1;
+ }
+
+ try {
+ if (column == AlarmTableModel.ALARMID ) {
+
+ float id1 = (new Float (((String)data.getValueAt(row1, AlarmTableModel.ALARMID)).trim())).floatValue();
+ float id2 = (new Float (((String)data.getValueAt(row2, AlarmTableModel.ALARMID)).trim())).floatValue();
+
+
+ if (id1 < id2)
+ return -1;
+ else if (id1 > id2)
+ return 1;
+ else
+ return 0;
+ }
+ else if (column == AlarmTableModel.READ)
+ {
+ boolean b1 = ((Boolean) data.getValueAt(row1, column)).booleanValue();
+ boolean b2 = ((Boolean) data.getValueAt(row2, column)).booleanValue();
+
+ if(b1 && !b2) return -1;
+ else if(!b1 && b2) return 1;
+ else return 0;
+ }
+ else if (column == AlarmTableModel.ACK)
+ {
+ boolean b1 = ((Boolean) data.getValueAt(row1, column)).booleanValue();
+ boolean b2 = ((Boolean) data.getValueAt(row2, column)).booleanValue();
+
+ if(b1 && !b2) return -1;
+ else if(!b1 && b2) return 1;
+ else return 0;
+ }
+ else {
+ String s1 = (String)data.getValueAt(row1, column);
+ String s2 = (String)data.getValueAt(row2, column);
+ int result = s1.compareTo(s2);
+
+ if (result < 0)
+ return -1;
+ else if (result > 0)
+ return 1;
+ else return 0;
+ }
+ }
+ catch (NumberFormatException e)
+ {
+ System.out.println(e);
+ }
+
+ return 0;
+ }
+}
+//$History:$
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/BaseTable.java b/data/mnet/Common/Java/com/jetcell/MibWM/BaseTable.java
new file mode 100644
index 0000000..c9559f3
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/BaseTable.java
@@ -0,0 +1,312 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : BaseTable
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.table.*;
+import javax.swing.event.*;
+
+public class BaseTable extends JTable
+{
+ static final int KEY_UP = 1;
+ static final int KEY_DOWN = 2;
+ static final int KEY_HOME = 3;
+ static final int KEY_END = 4;
+ static final int KEY_PGUP = 5;
+ static final int KEY_PGDN = 6;
+
+ JTableHeader tableHeader;
+ TableModel model;
+ TableSorter sorter;
+ static JPopupMenu popupMenu;
+
+ public BaseTable()
+ {
+ super();
+ modTable();
+ }
+
+ public BaseTable(Object[][] data, Object[] cols)
+ {
+ super(data,cols);
+ modTable();
+
+ }
+
+ public BaseTable(TableModel dm)
+ {
+ super();
+ model = dm;
+ modTable();
+ }
+
+
+ public BaseTable(TableModel dm, TableColumnModel cm)
+ {
+ super(dm, cm);
+ model = dm;
+ modTable();
+ }
+
+
+ public BaseTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
+ {
+ super(dm, cm, sm);
+ model = dm;
+ modTable();
+ }
+
+
+ public BaseTable(int numRows, int numColumns)
+ {
+ super(numRows, numColumns);
+ modTable();
+ }
+
+
+ public BaseTable(Vector rowData, Vector columnNames)
+ {
+ super(rowData, columnNames);
+ modTable();
+ }
+
+ public void setPopupMenu (JPopupMenu popupMenu)
+ {
+ this.popupMenu = popupMenu;
+ }
+
+ public JPopupMenu getPopupMenu()
+ {
+ return popupMenu;
+ }
+
+
+ void modTable()
+ {
+ addKeyboardHooks();
+ addHeaderHooks();
+
+ popupMenu = TablePopupMenu.getPopupMenu();
+ add(popupMenu);
+ addMouseListener(new MouseHandler() );
+ }
+
+
+ void addHeaderHooks()
+ {
+ if( model != null )
+ {
+ sorter = new TableSorter( model );
+ sorter.addMouseListenerToHeaderInTable( this );
+ super.setModel( sorter );
+ }
+
+ }
+
+ public boolean isCellEditable(int i, int j)
+ {
+ return false;
+ }
+
+ public void makeCurrentRowVisible()
+ {
+ scrollRectToVisible(getCellRect(getSelectedRow(),0 , true));
+ }
+
+ public void selectFirstRow()
+ {
+ getSelectionModel().setSelectionInterval(0,0);
+ }
+
+ void addKeyboardHooks()
+ {
+ //debug("adding table hooks");
+ int criteria;
+ criteria = WHEN_IN_FOCUSED_WINDOW;
+ //criteria = WHEN_FOCUSED;
+ registerKeyboardAction(new TableKeyboardHandler(KEY_UP) , KeyStroke.getKeyStroke(KeyEvent.VK_UP,0), criteria);
+ registerKeyboardAction(new TableKeyboardHandler(KEY_DOWN), KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,0), criteria);
+ registerKeyboardAction(new TableKeyboardHandler(KEY_HOME), KeyStroke.getKeyStroke(KeyEvent.VK_HOME,0), criteria);
+ registerKeyboardAction(new TableKeyboardHandler(KEY_END) , KeyStroke.getKeyStroke(KeyEvent.VK_END,0), criteria);
+ registerKeyboardAction(new TableKeyboardHandler(KEY_PGUP), KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP,0), criteria);
+ registerKeyboardAction(new TableKeyboardHandler(KEY_PGDN), KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN,0), criteria);
+ }
+
+ class TableKeyboardHandler extends AbstractAction
+ {
+ int key;
+ int pageInc = 5; // fix later to found out number of visible rows!
+ int row;
+ int lastRow;
+
+ public TableKeyboardHandler(int key)
+ {
+ this.key = key;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ switch(key)
+ {
+ case KEY_UP :
+ //debug("Up arrow");
+ row = getSelectedRow();
+ if (row <= 0)
+ getToolkit().beep();
+ else
+ {
+ row=row-1;
+ setRowSelectionInterval (row,row);
+ updateUI();
+ }
+ break;
+
+ case KEY_DOWN :
+ //debug("Down arrow");
+ row = getSelectedRow();
+ if ((row == getRowCount()-1) || (row < 0))
+ getToolkit().beep();
+ else
+ {
+ row++;
+ setRowSelectionInterval (row,row);
+ updateUI();
+ }
+ break;
+
+ case KEY_HOME :
+ //debug("Home key");
+ row = getSelectedRow();
+ if (row <= 0)
+ getToolkit().beep();
+ else
+ {
+ setRowSelectionInterval (0,0);
+ updateUI();
+ }
+ break;
+
+ case KEY_END :
+ //debug("End key");
+ lastRow = getRowCount()-1;
+ row = getSelectedRow();
+ if ((row == lastRow) || (row < 0))
+ getToolkit().beep();
+ else
+ {
+ setRowSelectionInterval (lastRow,lastRow);
+ updateUI();
+ }
+ break;
+
+ case KEY_PGUP :
+ //debug("Page up");
+ row = getSelectedRow();
+ if (row <= 0)
+ getToolkit().beep();
+ else if (row-pageInc <= 0)
+ {
+ setRowSelectionInterval (0,0);
+ updateUI();
+ }
+ else
+ {
+ row=row-pageInc;
+ setRowSelectionInterval (row,row);
+ updateUI();
+ }
+ break;
+
+ case KEY_PGDN :
+ //debug("Page down");
+ int lastRow = getRowCount()-1;
+ row = getSelectedRow();
+ if ((row == lastRow) || (row < 0))
+ getToolkit().beep();
+ else if (row+pageInc >= lastRow)
+ {
+ setRowSelectionInterval (lastRow,lastRow);
+ updateUI();
+ }
+ else
+ {
+ row+=pageInc;
+ setRowSelectionInterval (row,row);
+ updateUI();
+ }
+ break;
+
+ default :
+ System.out.println("Key not handled " + key);
+ break;
+ }
+
+ makeCurrentRowVisible();
+ }
+
+ }
+
+
+ class MouseHandler extends MouseAdapter
+ {
+ public void mouseReleased(MouseEvent e)
+ {
+ if ( e.isPopupTrigger())
+ {
+ popupMenu.show(BaseTable.this, e.getX(), e.getY());
+ }
+ }
+ }
+
+ public void setScrollPane(JScrollPane p)
+ {
+ // only here for compatibility with drop1 code. remove later!
+ }
+
+ public void setColumnWidth(int columnIndex, int minWidth, int maxWidth)
+ {
+ TableColumn column = (TableColumn) getColumn( getColumnName( columnIndex ) );
+
+ column.setMinWidth(minWidth);
+ column.setMaxWidth(maxWidth);
+ }
+
+ public String getDataFromTable( int col )
+ {
+ if ( getRowCount() > 0 )
+ {
+ int row = getSelectedRow();
+
+ if (row < 0)
+ {
+ setRowSelectionInterval(0,0);
+ row = getSelectedRow();
+ }
+
+ return (String) getModel().getValueAt( row, col );
+ }
+ else
+ return "";
+ }
+
+ public void setColumnHeaderTitle( int column, String value )
+ {
+ DefaultTableColumnModel cm = (DefaultTableColumnModel)getColumnModel();
+ TableColumn tc = cm.getColumn( column );
+ tc.setHeaderValue( value );
+ }
+
+
+}
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/ImageLoader.java b/data/mnet/Common/Java/com/jetcell/MibWM/ImageLoader.java
new file mode 100644
index 0000000..62111f2
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/ImageLoader.java
@@ -0,0 +1,136 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : ImageLoader
+// Desc : Use to load images from the Images directory.
+// Author : George Zhao
+// History: April 22, 1999 Intial Creation.
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.awt.*;
+import java.net.*;
+import java.util.*;
+import javax.swing.*;
+import com.jetcell.MibWM.Images.ImageStub;
+
+public class ImageLoader
+{
+ private static Hashtable imageCache = new Hashtable();
+
+
+ /**
+ * load image from com/jetcell/MibWM/Images
+ */
+ public synchronized static Image loadImage(String filename)
+ {
+ Image image = null;
+
+ /*
+ if (ImageLoader.imageInCache(filename))
+ image = ImageLoader.getImageFromCache(filename);
+ else*/
+ {
+ if ( Util.applet != null )
+ {
+
+ /**
+ * load using applet method
+ */
+
+ try {
+ URL url = new URL(Util.applet.getCodeBase()+ "com/jetcell/MibWM/Images/" + filename);
+ image = Util.applet.getImage(url);
+ }
+ catch(Exception e) {}
+ //image = Util.applet.getImage(Util.applet.getCodeBase(), "com/jetcell/MibWM/Images/" + filename);
+
+
+ if (image == null) System.out.println("Image is NULL: " +filename);
+ }
+ else
+ {
+ /**
+ * load using application method
+ */
+
+ URL url = new ImageStub().getClass().getResource(filename);
+
+ Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
+
+ try
+ {
+ image = tk.createImage((java.awt.image.ImageProducer) url.getContent());
+ }
+ catch (java.io.IOException e)
+ {
+ System.out.println("[ImageLoader] " + e.toString());
+ }
+ }
+
+ /**
+ * block while waiting for image to load
+ */
+
+ if (image != null)
+ {
+ MediaTracker tracker = new MediaTracker(new Component() {} );
+ tracker.addImage(image, 0);
+ try
+ {
+ tracker.waitForID(0);
+ }
+ catch (InterruptedException e)
+ {
+ System.out.println("[ImageLoader] " + e.toString());
+ }
+
+ /**
+ * add to cache
+ */
+ ImageLoader.putImageInCache(filename, image);
+ }
+ }
+
+ return image;
+ }
+
+
+ /**
+ * load icon from com/mci/vdds/Images
+ */
+ public synchronized static ImageIcon loadIcon(String filename)
+ {
+ return new ImageIcon(loadImage(filename));
+ }
+
+ private static boolean imageInCache(String filename)
+ {
+ if (imageCache.containsKey(filename))
+ return true;
+ else
+ return false;
+ }
+
+ private static Image getImageFromCache(String filename)
+ {
+ return (Image)imageCache.get(filename);
+ }
+
+ private static void putImageInCache(String filename, Image image)
+ {
+ imageCache.put(filename, image);
+ }
+
+ public static void main(String argv[])
+ {
+ JFrame f = new JFrame();
+ ImageIcon icon = ImageLoader.loadIcon("closed.gif");
+ JButton b = new JButton(icon);
+ System.out.println("after new messagepanel");
+ f.setBounds(0,0,100,100);
+ f.getContentPane().add(b);
+ f.setVisible(true);
+ }
+}
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/Makefile b/data/mnet/Common/Java/com/jetcell/MibWM/Makefile
new file mode 100644
index 0000000..2bf2ffa
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/Makefile
@@ -0,0 +1,38 @@
+####################################################################
+#
+# FILE NAME: Makefile
+#
+# DESCRIPTION: This makefile creates the vipercell related class
+# files
+# COMPONENTS:
+#
+#
+# NOTES:
+#
+# (C) Copyright 1999 JetCell Inc., CA, USA http://www.jetcell.com/
+#
+# REVISION HISTORY
+#__________________________________________________________________
+#----------+--------+----------------------------------------------
+# Name | Date | Reason
+#----------+--------+----------------------------------------------
+# Bhawani |11/28/99| Initial Draft
+#----------+--------+----------------------------------------------
+####################################################################
+#/
+
+CODEBASE = ../../..
+
+
+include $(CODEBASE)/java.mk
+
+
+all: $(CLASS_LIST)
+
+
+clean:
+ $(RM) *.class
+
+cleanall:
+ $(RM) *.class
+
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/TableMap.java b/data/mnet/Common/Java/com/jetcell/MibWM/TableMap.java
new file mode 100644
index 0000000..cdbb4e3
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/TableMap.java
@@ -0,0 +1,104 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : TableMap
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+ * based on Sun TableMap. -gz
+ * @version 1.4 12/17/97
+ * @author Philip Milne */
+
+package com.jetcell.MibWM;
+
+import javax.swing.table.*;
+import javax.swing.event.TableModelListener;
+import javax.swing.event.TableModelEvent;
+
+public class TableMap extends DefaultTableModel implements TableModelListener
+{
+ protected TableModel model;
+
+ public TableModel getModel() {
+ return model;
+ }
+
+ public void setModel(TableModel model) {
+ this.model = model;
+ model.addTableModelListener(this);
+ }
+
+ // By default, Implement TableModel by forwarding all messages
+ // to the model.
+
+ public Object getValueAt(int aRow, int aColumn) {
+ return model.getValueAt(aRow, aColumn);
+ }
+
+ public void setValueAt(Object aValue, int aRow, int aColumn) {
+ model.setValueAt(aValue, aRow, aColumn);
+ }
+
+ public int getRowCount() {
+ return (model == null) ? 0 : model.getRowCount();
+ }
+
+ public int getColumnCount() {
+ return (model == null) ? 0 : model.getColumnCount();
+ }
+
+ public String getColumnName(int aColumn) {
+ return model.getColumnName(aColumn);
+ }
+
+ public Class getColumnClass(int aColumn)
+ {
+ if (model.getColumnCount() == 0)
+ return model.getColumnClass(aColumn);
+
+ Object value = model.getValueAt(0,aColumn);
+ return value == null ? Object.class : value.getClass();
+ }
+
+ public boolean isCellEditable(int row, int column) {
+ return model.isCellEditable(row, column);
+ }
+
+ public void addColumn(Object col)
+ {
+ if ( model instanceof DefaultTableModel )
+ ( (DefaultTableModel)model).addColumn( col );
+ else
+ throw new RuntimeException("ERROR: Subclass of DefaultTableModel required.");
+
+ }
+
+
+ public void addRow(Object rowData[])
+ {
+ ( (DefaultTableModel)model).addRow( rowData );
+ }
+
+ public void removeRow(int rowIndex)
+ {
+ ( (DefaultTableModel)model).removeRow( rowIndex );
+ }
+
+ //
+ // Implementation of the TableModelListener interface,
+ //
+
+ // By default forward all events to all the listeners.
+ public void tableChanged(TableModelEvent e) {
+ fireTableChanged(e);
+ }
+
+ public void insertRow(int row, Object rowData[])
+ {
+ ( (DefaultTableModel)model).insertRow(row, rowData);
+ }
+}
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/TablePopupMenu.java b/data/mnet/Common/Java/com/jetcell/MibWM/TablePopupMenu.java
new file mode 100644
index 0000000..2df4e3e
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/TablePopupMenu.java
@@ -0,0 +1,195 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : TablePopupMenu
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.text.*;
+
+public class TablePopupMenu extends JPopupMenu implements ActionListener
+{
+ static JMenuItem copyCellMenuItem;
+ static JMenuItem copyRowMenuItem;
+ static JMenuItem copyColumnMenuItem;
+ static JMenuItem copyTableMenuItem;
+
+ static boolean iconsLoaded = false;
+ static JTable invoker ;
+
+ static int x;
+ static int y;
+
+ protected static TablePopupMenu popupMenu = new TablePopupMenu();
+
+
+ /**
+ * You cannot instantiate this class. Use getPopupMenu() to get
+ * a shared instance!
+ */
+ protected TablePopupMenu()
+ {
+ copyCellMenuItem = Util.makeMenuItem("Copy Cell",'C');
+ copyCellMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ copyCellMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ copyCellMenuItem.addActionListener(this);
+ add(copyCellMenuItem);
+
+ copyRowMenuItem = Util.makeMenuItem("Copy Row", 'R');
+ copyRowMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ copyRowMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ copyRowMenuItem.addActionListener(this);
+ add(copyRowMenuItem);
+
+ copyColumnMenuItem = Util.makeMenuItem("Copy Column", 'L');
+ copyColumnMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ copyColumnMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ copyColumnMenuItem.addActionListener(this);
+ add(copyColumnMenuItem);
+
+ copyTableMenuItem = Util.makeMenuItem("Copy Table", 'T');
+ copyTableMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ copyTableMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ copyTableMenuItem.addActionListener(this);
+ add(copyTableMenuItem);
+ }
+
+
+ /**
+ * returns shared instance of popupMenu
+ */
+ public static TablePopupMenu getPopupMenu()
+ {
+ return popupMenu;
+ }
+
+
+ /**
+ * update to use difference icons later!
+ */
+ void loadIcons()
+ {
+ if(Util.applet == null)
+ {
+ copyCellMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("copy.gif")));
+ copyRowMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("copy.gif")));
+ copyColumnMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("copy.gif")));
+ copyTableMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("copy.gif")));
+ }
+ }
+
+
+ /**
+ * update to use shared clipboard access later
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ Object obj = e.getSource();
+
+ Point p = new Point(x,y);
+ int row = invoker.rowAtPoint(p);
+ int col = invoker.columnAtPoint(p);
+
+ String selection = null;
+
+ if (obj == copyCellMenuItem)
+ {
+ selection = invoker.getValueAt(row,col).toString();
+ }
+ else if (obj == copyRowMenuItem)
+ {
+ for(int i=0; i < invoker.getColumnCount(); i++)
+ {
+ Object cell = invoker.getValueAt(row,i);
+ if (cell != null)
+ selection += cell.toString() + " ";
+ }
+ }
+ else if (obj == copyColumnMenuItem)
+ {
+ for(int i=0; i < invoker.getRowCount(); i++)
+ {
+ Object cell = invoker.getValueAt(i,col);
+ if (cell != null)
+ selection += cell.toString() + " ";
+ }
+ }
+ else if (obj == copyTableMenuItem)
+ {
+ for(int i=0; i < invoker.getRowCount(); i++)
+ {
+ for(int j=0; j < invoker.getColumnCount(); j++)
+ {
+ Object cell = invoker.getValueAt(i,j);
+ if (cell != null)
+ selection += cell.toString() + " ";
+ }
+
+ selection += "\n";
+ }
+ }
+
+
+ TextClipboard.setText(selection);
+
+ }
+
+
+ /**
+ * force JTable only later
+ */
+ public void show(Component c, int x, int y)
+ {
+ invoker = (JTable)c;
+
+ if (iconsLoaded == false)
+ {
+ loadIcons();
+ iconsLoaded = true;
+ }
+
+ Point p = new Point(x,y);
+ int row = invoker.rowAtPoint(p);
+ int col = invoker.columnAtPoint(p);
+
+ if ((row >= 0) && (col >= 0))
+ enableMenu();
+ else
+ {
+ disableMenu();
+ return;
+ }
+
+ this.x = x;
+ this.y = y;
+ super.show(c,x,y);
+ }
+
+
+ void disableMenu()
+ {
+ copyCellMenuItem.setEnabled(false);
+ copyRowMenuItem.setEnabled(false);
+ copyColumnMenuItem.setEnabled(false);
+ copyTableMenuItem.setEnabled(false);
+ }
+
+
+ void enableMenu()
+ {
+ copyCellMenuItem.setEnabled(true);
+ copyRowMenuItem.setEnabled(true);
+ copyColumnMenuItem.setEnabled(true);
+ copyTableMenuItem.setEnabled(true);
+ }
+}
+
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/TableSorter.java b/data/mnet/Common/Java/com/jetcell/MibWM/TableSorter.java
new file mode 100644
index 0000000..51324bb
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/TableSorter.java
@@ -0,0 +1,360 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : TableSorter
+// Desc :
+// Author : George Zhao
+// Hist : 06/17/1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+ * based on Sun TableSorter. -gz
+ * @version 1.5 12/17/97
+ * @author Philip Milne
+ */
+
+package com.jetcell.MibWM;
+
+import java.util.*;
+
+import javax.swing.table.TableModel;
+import javax.swing.event.TableModelEvent;
+
+// Imports for picking up mouse events from the JTable.
+
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.InputEvent;
+import javax.swing.JTable;
+import javax.swing.table.JTableHeader;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+
+public class TableSorter extends TableMap
+{
+ int indexes[];
+ Vector sortingColumns = new Vector();
+ boolean ascending = true;
+ int compares;
+ int sortByColumnInd = 1;
+
+ public TableSorter()
+ {
+ indexes = new int[0]; // For consistency.
+ }
+
+ public TableSorter(TableModel model)
+ {
+ setModel(model);
+ }
+
+ public void setModel(TableModel model) {
+ super.setModel(model);
+ reallocateIndexes();
+ }
+
+ public int compareRowsByColumn(int row1, int row2, int column)
+ {
+ Class type = model.getColumnClass(column);
+
+ TableModel data = model;
+
+ // Check for nulls
+
+ Object o1 = data.getValueAt(row1, column);
+ Object o2 = data.getValueAt(row2, column);
+
+ // If both values are null return 0
+ if (o1 == null && o2 == null) {
+ return 0;
+ }
+ else if (o1 == null) { // Define null less than everything.
+ return -1;
+ }
+ else if (o2 == null) {
+ return 1;
+ }
+
+/* We copy all returned values from the getValue call in case
+an optimised model is reusing one object to return many values.
+The Number subclasses in the JDK are immutable and so will not be used in
+this way but other subclasses of Number might want to do this to save
+space and avoid unnecessary heap allocation.
+*/
+ if (type.getSuperclass() == java.lang.Number.class)
+ {
+ Number n1 = (Number)data.getValueAt(row1, column);
+ double d1 = n1.doubleValue();
+ Number n2 = (Number)data.getValueAt(row2, column);
+ double d2 = n2.doubleValue();
+
+ if (d1 < d2)
+ return -1;
+ else if (d1 > d2)
+ return 1;
+ else
+ return 0;
+ }
+ else if (type == java.util.Date.class)
+ {
+ Date d1 = (Date)data.getValueAt(row1, column);
+ long n1 = d1.getTime();
+ Date d2 = (Date)data.getValueAt(row2, column);
+ long n2 = d2.getTime();
+
+ if (n1 < n2)
+ return -1;
+ else if (n1 > n2)
+ return 1;
+ else return 0;
+ }
+ else if (type == String.class)
+ {
+ String s1 = (String)data.getValueAt(row1, column);
+ String s2 = (String)data.getValueAt(row2, column);
+ int result = s1.compareTo(s2);
+
+ if (result < 0)
+ return -1;
+ else if (result > 0)
+ return 1;
+ else return 0;
+ }
+ else if (type == Boolean.class)
+ {
+ Boolean bool1 = (Boolean)data.getValueAt(row1, column);
+ boolean b1 = bool1.booleanValue();
+ Boolean bool2 = (Boolean)data.getValueAt(row2, column);
+ boolean b2 = bool2.booleanValue();
+
+ if (b1 == b2)
+ return 0;
+ else if (b1) // Define false < true
+ return 1;
+ else
+ return -1;
+ }
+ else
+ {
+ Object v1 = data.getValueAt(row1, column);
+ String s1 = v1.toString();
+ Object v2 = data.getValueAt(row2, column);
+ String s2 = v2.toString();
+ int result = s1.compareTo(s2);
+
+ if (result < 0)
+ return -1;
+ else if (result > 0)
+ return 1;
+ else return 0;
+ }
+ }
+
+ public int compare(int row1, int row2)
+ {
+ compares++;
+ for(int level = 0; level < sortingColumns.size(); level++)
+ {
+ Integer column = (Integer)sortingColumns.elementAt(level);
+ int result = compareRowsByColumn(row1, row2, column.intValue());
+ if (result != 0)
+ return ascending ? result : -result;
+ }
+ return 0;
+ }
+
+ public void reallocateIndexes()
+ {
+ int rowCount = model.getRowCount();
+ // Set up a new array of indexes with the right number of elements
+ // for the new data model.
+ indexes = new int[rowCount];
+
+ // Initialise with the identity mapping.
+ for(int row = 0; row < rowCount; row++)
+ indexes[row] = row;
+ }
+
+ public void tableChanged(TableModelEvent e)
+ {
+ reallocateIndexes();
+ super.tableChanged(e);
+ sortByColumnInd();
+ }
+
+ public void checkModel()
+ {
+ if ( indexes.length == 0 )
+ reallocateIndexes();
+
+ if (indexes.length != model.getRowCount()) {
+ System.out.println("Sorter not informed of a change in model.");
+ }
+ }
+
+ public void sort(Object sender)
+ {
+ checkModel();
+
+ compares = 0;
+ // n2sort();
+ // qsort(0, indexes.length-1);
+ shuttlesort((int[])indexes.clone(), indexes, 0, indexes.length);
+ }
+
+ public void n2sort() {
+ for(int i = 0; i < getRowCount(); i++) {
+ for(int j = i+1; j < getRowCount(); j++) {
+ if (compare(indexes[i], indexes[j]) == -1) {
+ swap(i, j);
+ }
+ }
+ }
+ }
+
+ // This is a home-grown implementation which we have not had time
+ // to research - it may perform poorly in some circumstances. It
+ // requires twice the space of an in-place algorithm and makes
+ // NlogN assigments shuttling the values between the two
+ // arrays. The number of compares appears to vary between N-1 and
+ // NlogN depending on the initial order but the main reason for
+ // using it here is that, unlike qsort, it is stable.
+ public void shuttlesort(int from[], int to[], int low, int high) {
+ if (high - low < 2) {
+ return;
+ }
+ int middle = (low + high)/2;
+ shuttlesort(to, from, low, middle);
+ shuttlesort(to, from, middle, high);
+
+ int p = low;
+ int q = middle;
+
+ /* This is an optional short-cut; at each recursive call,
+ check to see if the elements in this subset are already
+ ordered. If so, no further comparisons are needed; the
+ sub-array can just be copied. The array must be copied rather
+ than assigned otherwise sister calls in the recursion might
+ get out of sinc. When the number of elements is three they
+ are partitioned so that the first set, [low, mid), has one
+ element and and the second, [mid, high), has two. We skip the
+ optimisation when the number of elements is three or less as
+ the first compare in the normal merge will produce the same
+ sequence of steps. This optimisation seems to be worthwhile
+ for partially ordered lists but some analysis is needed to
+ find out how the performance drops to Nlog(N) as the initial
+ order diminishes - it may drop very quickly. */
+
+ if (high - low >= 4 && compare(from[middle-1], from[middle]) <= 0) {
+ for (int i = low; i < high; i++) {
+ to[i] = from[i];
+ }
+ return;
+ }
+
+ // A normal merge.
+
+ for(int i = low; i < high; i++) {
+ if (q >= high || (p < middle && compare(from[p], from[q]) <= 0)) {
+ to[i] = from[p++];
+ }
+ else {
+ to[i] = from[q++];
+ }
+ }
+ }
+
+ public void swap(int i, int j) {
+ int tmp = indexes[i];
+ indexes[i] = indexes[j];
+ indexes[j] = tmp;
+ }
+
+ public boolean getAscending()
+ {
+ return ascending;
+ }
+
+ // The mapping only affects the contents of the data rows.
+ // Pass all requests to these rows through the mapping array: "indexes".
+
+ public Object getValueAt(int aRow, int aColumn)
+ {
+ checkModel();
+ if (aRow >= 0 && aRow <model.getRowCount())
+ return model.getValueAt(indexes[aRow], aColumn);
+ return null;
+ }
+
+ public void setValueAt(Object aValue, int aRow, int aColumn)
+ {
+ checkModel();
+ model.setValueAt(aValue, indexes[aRow], aColumn);
+ }
+
+ public void sortByColumn(int column) {
+ sortByColumn(column, true);
+ }
+
+ public void sortByColumn(int column, boolean ascending) {
+ this.ascending = ascending;
+ sortingColumns.removeAllElements();
+ sortingColumns.addElement(new Integer(column));
+ sort(this);
+ super.tableChanged(new TableModelEvent(this));
+ }
+
+ // There is no-where else to put this.
+ // Add a mouse listener to the Table to trigger a table sort
+ // when a column heading is clicked in the JTable.
+ public void addMouseListenerToHeaderInTable(JTable table) {
+ final TableSorter sorter = this;
+ final JTable tableView = table;
+ tableView.setColumnSelectionAllowed(false);
+ MouseAdapter listMouseListener = new MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ TableColumnModel columnModel = tableView.getColumnModel();
+ int viewColumn = columnModel.getColumnIndexAtX(e.getX());
+ sortByColumnInd = tableView.convertColumnIndexToModel(viewColumn);
+ if(e.getClickCount() == 1 && sortByColumnInd != -1) {
+ int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
+ //boolean ascending = (shiftPressed == 0);
+ boolean ascending = getAscending();
+ sorter.sortByColumn(sortByColumnInd, ascending);
+ }
+ }
+ };
+ JTableHeader th = tableView.getTableHeader();
+ th.addMouseListener(listMouseListener);
+ }
+
+ public void sortByColumnInd(){
+ sortByColumn(sortByColumnInd);
+ }
+ public void filteredRemoveRow(int row){
+ checkModel();
+ super.removeRow(indexes[row]);
+ }
+
+ public int getIndexAtRow(int row){
+ return indexes[row];
+ }
+}
+
+
+// $Log: TableSorter.java,v $
+// Revision 1.2 1999-12-21 13:35:06-08 klim
+// Fixes sorting reset problem
+//
+// Revision 1.1 1999-11-28 22:51:20-08 bsapkota
+// Initial revision
+//
+//
+// Rev 1.6 Jun 23 1998 12:13:00 GZHAO
+//add boundary check.
+//
+// Rev 1.5 Jun 02 1998 14:11:22 GZHAO
+//toggle the ascending for table sort.
+//
+// Rev 1.4 Jun 02 1998 12:52:10 GZHAO
+//modify System.out to Debug.out.
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/TextClipboard.java b/data/mnet/Common/Java/com/jetcell/MibWM/TextClipboard.java
new file mode 100644
index 0000000..a7876db
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/TextClipboard.java
@@ -0,0 +1,80 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : TextClipboard
+// Desc : Clipboard abstraction for working in both applet and application
+// Author : George Zhao
+// Created: 6/8/98
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.io.*;
+import java.awt.*;
+import java.awt.datatransfer.*;
+
+public abstract class TextClipboard
+{
+ private static String clipboard;
+
+ private static ClipboardOwner defaultClipboardOwner = new ClipboardObserver();
+
+ static class ClipboardObserver implements ClipboardOwner
+ {
+ public void lostOwnership(Clipboard clipboard, Transferable contents)
+ {
+ }
+ }
+
+
+ /**
+ * Set the value of the clipboard
+ * @param s string value
+ */
+ public static synchronized void setText(String s)
+ {
+ if (s == null)
+ s = "";
+
+ if (Util.applet != null)
+ clipboard = s;
+ else
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(s), defaultClipboardOwner);
+ }
+
+
+ /**
+ * Get the string contents of the clipboard
+ */
+ public static synchronized String getText()
+ {
+ if (Util.applet != null)
+ return clipboard;
+ else
+ {
+ String s = null;
+ Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(defaultClipboardOwner);
+ if (t == null)
+ return "";
+ else
+ try
+ {
+ s = (String)(t.getTransferData(DataFlavor.stringFlavor));
+ }
+ catch (UnsupportedFlavorException e)
+ {
+ System.out.println(e);
+ }
+ catch (IOException e)
+ {
+ System.out.println(e);
+ }
+ finally
+ {
+ return s;
+ }
+ }
+ }
+}
+
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/TextComponentPopupMenu.java b/data/mnet/Common/Java/com/jetcell/MibWM/TextComponentPopupMenu.java
new file mode 100644
index 0000000..a653722
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/TextComponentPopupMenu.java
@@ -0,0 +1,280 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : TextComponentPopupMenu
+// Desc : Specialized popup menu for subclasses of JTextComponent
+// Author : George Zhao
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.text.*;
+
+/**
+ * Custom popup menu for subclasses of JTextComponent. Includes cut,copy,paste,
+ * paste recent, and delete.
+ *
+ * @see VDDSTextField
+ * @version 1.0
+ * @author Semir Patel
+ */
+
+public class TextComponentPopupMenu extends JPopupMenu implements ActionListener
+{
+ /**
+ * Maximum number of elements in Paste Recent submenu
+ */
+ static final int RECENT_LIST_SIZE = 4;
+
+
+ /**
+ * Popup menu items
+ */
+ static JMenuItem cutMenuItem;
+ static JMenuItem copyMenuItem;
+ static JMenuItem pasteMenuItem;
+ static JMenu pasteRecentMenu;
+ static JMenuItem deleteMenuItem;
+ static JMenuItem descriptionMenuItem;
+
+ static boolean iconsLoaded = false;
+
+ /**
+ * JTextComponent that invokes this popup menu
+ */
+ static JTextComponent invoker;
+
+
+ /**
+ * Starting and ending selection indices for the text component
+ */
+ static int start;
+ static int end;
+
+ /**
+ * shared instance of popup menu
+ */
+ protected static TextComponentPopupMenu popupMenu = new TextComponentPopupMenu();
+
+
+ private TextComponentPopupMenu()
+ {
+ cutMenuItem = Util.makeMenuItem("Cut",'t');
+ cutMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ cutMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ cutMenuItem.addActionListener(this);
+ add(cutMenuItem);
+
+ copyMenuItem = Util.makeMenuItem("Copy",'C');
+ copyMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ copyMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ copyMenuItem.addActionListener(this);
+ add(copyMenuItem);
+
+ pasteMenuItem = Util.makeMenuItem("Paste",'P');
+ pasteMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ pasteMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ pasteMenuItem.addActionListener(this);
+ add(pasteMenuItem);
+
+ pasteRecentMenu = new JMenu("Paste Recent");
+ pasteRecentMenu.setHorizontalTextPosition(SwingConstants.RIGHT);
+ pasteRecentMenu.setHorizontalAlignment(SwingConstants.LEFT);
+ pasteRecentMenu.registerKeyboardAction(null, KeyStroke.getKeyStroke('R',java.awt.Event.ALT_MASK,false),
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+ add(pasteRecentMenu);
+
+ deleteMenuItem = Util.makeMenuItem("Delete",'D');
+ deleteMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ deleteMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ deleteMenuItem.addActionListener(this);
+ add(deleteMenuItem);
+
+ addSeparator();
+ descriptionMenuItem = Util.makeMenuItem("Description", 'P');
+ descriptionMenuItem.setHorizontalTextPosition(SwingConstants.RIGHT);
+ descriptionMenuItem.setHorizontalAlignment(SwingConstants.LEFT);
+ descriptionMenuItem.addActionListener(this);
+ add(descriptionMenuItem);
+ }
+
+
+ /**
+ * accessor for shared instance of popup menu
+ */
+ public static TextComponentPopupMenu getPopupMenu()
+ {
+ return popupMenu;
+ }
+
+ void loadIcons()
+ {
+ cutMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("cut.gif")));
+ copyMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("copy.gif")));
+ pasteMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("paste.gif")));
+ pasteRecentMenu.setIcon(new ImageIcon(ImageLoader.loadImage("pasterecent.gif")));
+ deleteMenuItem.setIcon(new ImageIcon(ImageLoader.loadImage("delete.gif")));
+ }
+
+ /**
+ * Action listener for menu items
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getSource() == cutMenuItem)
+ {
+ invoker.select(start,end);
+ TextClipboard.setText(invoker.getSelectedText());
+ invoker.replaceSelection("");
+ }
+ else if (e.getSource() == copyMenuItem)
+ {
+ invoker.select(start,end);
+ TextClipboard.setText(invoker.getSelectedText());
+ }
+ else if (e.getSource() == pasteMenuItem)
+ {
+ invoker.replaceSelection(TextClipboard.getText());
+ }
+ else if (e.getSource() == deleteMenuItem)
+ {
+ invoker.select(start,end);
+ invoker.replaceSelection("");
+ }
+ else if (e.getSource() == descriptionMenuItem)
+ {
+ /*
+ JOptionPane.showMessageDialog(Util.browser,
+ "Description of this field, range, detail meaning etc goes here.",
+ "Description", JOptionPane.INFORMATION_MESSAGE);
+ */
+ }
+ else if (e.getSource() instanceof JMenuItem)
+ {
+ invoker.select(start,end);
+ invoker.replaceSelection(((JMenuItem)e.getSource()).getText());
+ }
+
+ }
+
+ /**
+ * Shows popup menu at specified coords with text component selection info
+ * @param c Invoker
+ * @param x Absolute x location
+ * @param y Absolute y location
+ * @param start Start index of selection
+ * @param end End index of selection
+ */
+ public void show(Component c, int x, int y, int start, int end)
+ {
+ this.start = start;
+ this.end = end;
+ show(c,x,y);
+ }
+
+ public void show(Component c, int x, int y)
+ {
+ if (iconsLoaded == false)
+ {
+ loadIcons();
+ iconsLoaded = true;
+ }
+
+ if (c instanceof JTextComponent)
+ {
+ invoker = (JTextComponent)c;
+ int len = invoker.getText().length();
+ if (!invoker.isEditable())
+ {
+ cutMenuItem.setEnabled(false);
+ pasteMenuItem.setEnabled(false);
+ pasteRecentMenu.setEnabled(false);
+ deleteMenuItem.setEnabled(false);
+
+ if (len > 0)
+ copyMenuItem.setEnabled(true);
+ else
+ copyMenuItem.setEnabled(false);
+ }
+ else
+ {
+ if ((len > 0) && (start != end))
+ {
+ cutMenuItem.setEnabled(true);
+ copyMenuItem.setEnabled(true);
+ deleteMenuItem.setEnabled(true);
+ }
+ else
+ {
+ cutMenuItem.setEnabled(false);
+ copyMenuItem.setEnabled(false);
+ deleteMenuItem.setEnabled(false);
+ }
+
+ pasteMenuItem.setEnabled(true);
+
+ if (pasteRecentMenu.getMenuComponentCount() > 0)
+ pasteRecentMenu.setEnabled(true);
+ else
+ pasteRecentMenu.setEnabled(false);
+ }
+
+ super.show(invoker,x,y);
+ }
+ }
+
+ /**
+ * Adds entry to Paste Recent menu. List works like FIFO queue.
+ * @param s String to add to the paste recent menu
+ */
+ void addToMostRecentList(String s)
+ {
+ int cnt = pasteRecentMenu.getItemCount();
+
+ for (int i=0; i<cnt; i++)
+ if (pasteRecentMenu.getItem(i).getText().equals(s))
+ return;
+
+ if (cnt < RECENT_LIST_SIZE)
+ {
+ JMenuItem menuItem = Util.makeMenuItem();
+ pasteRecentMenu.add(menuItem);
+ menuItem.addActionListener(this);
+ cnt = pasteRecentMenu.getMenuComponentCount();
+
+ if (cnt == 1)
+ pasteRecentMenu.getItem(0).setText(s);
+ else
+ {
+ for (int i=cnt-1; i>=1; i--)
+ pasteRecentMenu.getItem(i).setText(pasteRecentMenu.getItem(i-1).getText());
+ pasteRecentMenu.getItem(0).setText(s);
+ }
+
+ }
+ else
+ {
+ for (int i=cnt-1; i>=1; i--)
+ pasteRecentMenu.getItem(i).setText(pasteRecentMenu.getItem(i-1).getText());
+ pasteRecentMenu.getItem(0).setText(s);
+ }
+ }
+
+ public void setVisible(boolean b)
+ {
+ /**
+ * Workaround for swing 0.7 bug.
+ * Get rid of visible submenu if showing
+ */
+ if (b == false)
+ pasteRecentMenu.setPopupMenuVisible(false);
+
+ super.setVisible(b);
+ }
+
+}
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/Util.java b/data/mnet/Common/Java/com/jetcell/MibWM/Util.java
new file mode 100644
index 0000000..9612b8e
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/Util.java
@@ -0,0 +1,779 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : Util
+// Desc : Utility class for MIB Web Management
+// Author : George Zhao
+// History: April 22, 1999
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.text.*;
+import javax.swing.event.*;
+
+import java.applet.*;
+import java.util.*;
+
+
+public abstract class Util
+{
+ public static TitledBorder titleBorder;
+ static JPanel p;
+ public static Applet applet = null;
+
+ //undo
+ public static boolean debug = false;
+
+ public static final int BORDER_INSET = 5;
+
+ public static final Border EMPTY_BORDER_STYLE = new EmptyBorder(BORDER_INSET, BORDER_INSET, BORDER_INSET, BORDER_INSET);
+ public static final Border BORDER_STYLE = new CompoundBorder(new EmptyBorder(BORDER_INSET, BORDER_INSET, BORDER_INSET, BORDER_INSET),
+ new CompoundBorder(new EtchedBorder(Color.gray, Color.white),
+ new EmptyBorder(BORDER_INSET, BORDER_INSET, BORDER_INSET, BORDER_INSET)));
+
+ static final int BUTTON_TOP = 1;
+ static final int BUTTON_BOTTOM = 1;
+ static final int BUTTON_LEFT = 1;
+ static final int BUTTON_RIGHT = 1;
+ /**
+ * The default number of characters for text field.
+ */
+ public static int TEXTFIELD_NUM_CHARS = 12;
+
+ /**
+ * The default number of characters for text field.
+ */
+ public static int DATEFIELD_NUM_CHARS = 10;
+
+ /**
+ * The default number of characters for text field.
+ */
+ public static int TIMEFIELD_NUM_CHARS = 12;
+
+ /**
+ * Creates a popup menu with items in an array of string.
+ * No action listener is to be added for this method.
+ * @param items an array of String for the menu items
+ */
+ public static PopupMenu makePopupMenu(String[] items)
+ {
+ PopupMenu popup = new PopupMenu();
+ for (int i=0; i < items.length; i++) {
+ popup.add(new MenuItem(items[i]));
+ }
+ MenuItem mItem = new MenuItem("Copy");
+ popup.add(mItem);
+ return popup;
+ }
+
+ /**
+ * Creates a menu with a name of your choice, items in an array of strings, acttionCommands being
+ * items with spaces trimmed, and an action listener for all items.
+ * @param menuName the name of the menu
+ * @param items an array of String for the items
+ * @param listener action listener
+ */
+ public static JMenu makeMenu(String menuName, char hotkey, String[] items, ActionListener listener)
+ {
+ JMenu menu = makeMenu(menuName, hotkey);
+ JMenu submenu = null;
+ JMenuItem menuItem = null;
+ String itemString;
+ String queryName;
+ String submenuItems;
+ int comma;
+
+ for (int i=0; i < items.length; i++) {
+ //parse the items string
+ int index;
+ if ( (index = items[i].indexOf(":")) >= 0 ) {
+ //has submenu
+ queryName = items[i].substring(0,index).trim();
+ submenu = makeMenu( queryName );
+ submenuItems = items[i].substring(index+1).trim();
+ while ( submenuItems.length() > 0 ) {
+ comma = submenuItems.indexOf(",");
+ if ( comma >= 0 ) {
+ itemString = submenuItems.substring(0, comma).trim();
+ submenuItems = submenuItems.substring(comma+1).trim();
+ } else {
+ itemString = submenuItems;
+ submenuItems = "";
+ }
+ menuItem = makeMenuItem(itemString);
+ menuItem.setActionCommand( trimSpaces(queryName + ":" + itemString) );
+ if ( listener != null ) {
+ menuItem.addActionListener( listener );
+ }
+ submenu.add(menuItem);
+ }
+ menu.add( submenu );
+ } else { //no submenu
+ menuItem = makeMenuItem(items[i]);
+ menuItem.setActionCommand( trimSpaces(items[i]) );
+ if ( listener != null ) {
+ menuItem.addActionListener( listener );
+ }
+ menu.add( menuItem );
+ }
+ }
+ return menu;
+ }
+
+ /**
+ * Creates a menu with a name of your choice, items and action commands in an array of strings,
+ * and an action listener for all items.
+ * @param menuName the name of the menu
+ * @param items an array of String for the items
+ * @param commands action commands in an array of strings
+ * @param listener action listener
+ */
+ public static JMenu makeMenu(String menuName, char hotkey, String[] items, String[] commands, ActionListener listener)
+ {
+ JMenu menu = makeMenu(menuName, hotkey);
+ int index;
+ for (int i=0; i < items.length; i++) {
+ if ( (index = items[i].indexOf("_") ) >= 0 ) {
+ JMenu subMenu = makeMenu(items[i].substring(0, index));
+ JMenuItem item = makeMenuItem(items[i].substring(index+1) );
+ if ( listener != null ) {
+ item.addActionListener( listener );
+ }
+ subMenu.add(item);
+ menu.add(subMenu);
+ } else {
+ JMenuItem menuItem = makeMenuItem(items[i]);
+ menuItem.setActionCommand( commands[i] );
+ if ( listener != null )
+ menuItem.addActionListener( listener );
+ menu.add( menuItem );
+ }
+ }
+ return menu;
+ }
+
+ public static JMenu makeMenu(String name)
+ {
+ JMenu menu = new JMenu(name);
+ return menu;
+ }
+
+ public static JMenu makeMenu (String name, char mnemonic)
+ {
+ JMenu menu = new JMenu(name);
+ menu.setMnemonic(mnemonic);
+
+ return menu;
+ }
+
+
+
+ /**
+ * Creates a Swing label with preferred size and Style Guide conforming attributes
+ * @param text the text of Label
+ */
+ public static JLabel makeLabel(String text)
+ {
+ JLabel label = new JLabel(text,JLabel.RIGHT);
+ //label.setSize(label.getPreferredSize());
+ label.setVerticalAlignment(SwingConstants.CENTER);
+ return label;
+ }
+
+ /**
+ * Creates a label with alignment
+ * @param text the text of Label
+ * @alignment alignment horizontal alignment - JLabel.{LEFT,RIGHT,CENTER}
+ */
+ public static JLabel makeLabel(String text, int alignment)
+ {
+ JLabel label = makeLabel(text);
+ label.setHorizontalAlignment(alignment);
+ return label;
+ }
+
+ public static JLabel makeLabel(String text, char hotkey)
+ {
+ JLabel label = makeLabel(text);
+ label.setDisplayedMnemonic(hotkey);
+ return label;
+ }
+
+ public static JLabel makeLabel(String text, char hotkey, int alignment)
+ {
+ JLabel label = makeLabel(text, alignment);
+ label.setDisplayedMnemonic(hotkey);
+ return label;
+ }
+
+ public static JLabel makeLabel(String text, char hotkey, Component target)
+ {
+ JLabel label = makeLabel(text, hotkey);
+ label.setLabelFor(target);
+ return label;
+ }
+
+ public static JLabel makeLabel(String text, char hotkey, Component target, int alignment)
+ {
+ JLabel label = makeLabel(text, hotkey, target);
+ label.setHorizontalAlignment(alignment);
+ return label;
+ }
+
+ public static JTextField makeTextField()
+ {
+ return makeTextField(TEXTFIELD_NUM_CHARS);
+ }
+
+ /**
+ * Creates an non-editable Swing text field for holding numChars characters
+ * @param numChars holding numChars characters in width
+ */
+ public static JTextField makeTextField(int numChars)
+ {
+ return makeTextField("", numChars, false);
+ }
+
+ /**
+ * Creates a non-editable Swing text field with content text and default width
+ * @param text the text of field
+ */
+ public static JTextField makeTextField(String text)
+ {
+ return makeTextField(text, TEXTFIELD_NUM_CHARS, false);
+ }
+
+ /**
+ * Creates a Swing text field with intial content text, numChars in width, editable as set
+ * @param text the text of field
+ * @param numChars holding numChars characters for width
+ * @param editable to set editable or not
+ */
+ public static JTextField makeTextField(String text, int numChars, boolean editable)
+ {
+ WMTextField textField = new WMTextField( text, numChars );
+ textField.setEditable(editable);
+ return textField;
+ }
+
+ /**
+ * Creates a Swing text field with intial content text, numChars in width, editable as set
+ * @param dateDocument the date formating document
+ * @param text the text of field
+ * @param numChars holding numChars characters for width
+ * @param editable to set editable or not
+ */
+ /*
+ public static JTextField makeTextField( Document dateDocument, String text, int numChars, boolean editable)
+ {
+ JTextField textField = new WMTextField( dateDocument, text, numChars);
+ textField.setEditable(editable);
+ return textField;
+ }
+ */
+
+ /**
+ * Creates a Swing non-editable text field with intial content text, numChars in width
+ * @param text the text of field
+ * @param numChars holding numChars characters for width
+ */
+ public static JTextField makeTextField(String text, int numChars)
+ {
+ return makeTextField(text, numChars, false);
+ }
+
+ /**
+ * Creates a Swing text field with editability settable
+ * @param editable to set editable or not
+ */
+ public static JTextField makeTextField(boolean editable)
+ {
+ return makeTextField("", TEXTFIELD_NUM_CHARS, editable);
+ }
+
+ public static JTextField makeTextField(boolean editable, String markup)
+ {
+ WMTextField field= (WMTextField) makeTextField("", TEXTFIELD_NUM_CHARS, editable);
+ field.setMagicMarkup(markup);
+ return field;
+ }
+
+ /**
+ * Creates a Swing text field with editability settable and with numChars in width
+ * @param numChars holding numChars characters for width
+ * @param editable to set editable or not
+ */
+ public static JTextField makeTextField(int numChars, boolean editable)
+ {
+ return makeTextField("", numChars, editable);
+ }
+
+
+ /**
+ * Creates a Swing button
+ * @param text the text on the button
+ */
+ public static JButton makeButton(String text)
+ {
+ JButton button = new JButton(text);
+ button.setMargin(new Insets(BUTTON_TOP,BUTTON_BOTTOM,BUTTON_LEFT,BUTTON_RIGHT));
+ return button;
+ }
+
+ /**
+ * Creates a Swing button with shortcut
+ * @param text the text on the button
+ * @param hotkey mnemonic character (underlined)
+ */
+ public static JButton makeButton(String text, char hotkey)
+ {
+ JButton button = makeButton(text);
+ button.registerKeyboardAction(null, KeyStroke.getKeyStroke(hotkey,java.awt.Event.ALT_MASK,false),
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+ button.setMnemonic(hotkey);
+ return button;
+ }
+
+ /**
+ * Creates a Swing button with shortcut and tooltip
+ * @param text the text on the button
+ * @param hotkey mnemonic character (underlined)
+ * @param tooltip text for the button's tooltip
+ */
+ public static JButton makeButton(String text, char hotkey, String tooltip)
+ {
+ JButton button = makeButton(text);
+ button.setMnemonic(hotkey);
+ button.setToolTipText(tooltip);
+ return button;
+ }
+
+
+ /**
+ * Creates a Swing button with shortcut, tooltip, and listener
+ * @param text the text on the button
+ * @param hotkey mnemonic character (underlined)
+ * @param tooltip text for the button's tooltip
+ * @param listener actionlistener
+ */
+ public static JButton makeButton(String text, char hotkey, String tooltip, ActionListener listener)
+ {
+ JButton button = makeButton(text, hotkey, tooltip);
+ button.addActionListener(listener);
+ return button;
+ }
+
+ /**
+ * Create a JButton with Icon
+ * @param text the text on the button
+ * @param icon the image on the button
+ */
+ public static JButton makeButton(String text, ImageIcon icon)
+ {
+ JButton button = new JButton(text, icon);
+ button.setMargin(new Insets(BUTTON_TOP,BUTTON_BOTTOM,BUTTON_LEFT,BUTTON_RIGHT));
+ return button;
+ }
+
+ /**
+ * create JButton with icon and hot key
+ */
+ public static JButton makeButton(String text, ImageIcon icon, char hotkey)
+ {
+ JButton button = makeButton(text, icon);
+ button.setMnemonic(hotkey);
+ return button;
+ }
+
+ /**
+ * create JButton with icon, hotkey and tooltip
+ * @param text
+ * @param icon
+ * @param hotkey
+ * @param tooltip
+ */
+ public static JButton makeButton(String text, ImageIcon icon, char hotkey, String tooltip)
+ {
+ JButton button = makeButton(text, icon, hotkey);
+ button.setToolTipText(tooltip);
+ return button;
+ }
+
+ /**
+ * create JButton with icon, hotkey and tooltip, and listener
+ * @param text
+ * @param icon
+ * @param hotkey
+ * @param tooltip
+ * @param listener
+ */
+ public static JButton makeButton(String text, ImageIcon icon, char hotkey, String tooltip, ActionListener listener)
+ {
+ JButton button = makeButton(text, icon, hotkey, tooltip);
+ button.addActionListener(listener);
+ return button;
+ }
+
+
+ /**
+ * create JButton with icon and tooltip
+ */
+ public static JButton makeButton(ImageIcon icon, String tooltip)
+ {
+ JButton button = new JButton(icon);
+ button.setMargin(new Insets(BUTTON_TOP,BUTTON_BOTTOM,BUTTON_LEFT,BUTTON_RIGHT));
+ button.setToolTipText(tooltip);
+ return button;
+ }
+
+ /**
+ * Creates a Swing panel
+ */
+ public static JPanel makePanel()
+ {
+ JPanel p = new JPanel();
+ return p;
+ }
+
+ /**
+ * Creates a panel with layout
+ */
+ public static JPanel makePanel(LayoutManager layout)
+ {
+ JPanel p = makePanel();
+ p.setLayout(layout);
+ return p;
+ }
+
+ /**
+ * Creates a Swing bordered panel
+ * @param title the title of the border
+ */
+ public static JPanel makeBorderPanel(String title)
+ {
+ p = makePanel();
+ p.setBorder(BORDER_STYLE);
+ titleBorder = new TitledBorder(p.getBorder(), title);
+ p.setBorder(titleBorder);
+ return p;
+ }
+ public static void setBorderTitle(String title){
+ System.out.println("setting title" + title);
+ titleBorder.setTitle(title);
+ p.validate();
+ }
+
+ public static String getBorderTitle(){
+ return titleBorder.getTitle();
+ }
+
+ /**
+ * Creates a Swing bordered panel with layout
+ * @param title the title of the border
+ * @param layout layout
+ */
+ public static JPanel makeBorderPanel(String title, LayoutManager layout)
+ {
+ JPanel p = makeBorderPanel(title);
+ p.setLayout(layout);
+ return p;
+ }
+
+
+ /**
+ * Creates a Swing bordered panel with no title
+ */
+ public static JPanel makeBorderPanel()
+ {
+ return makeBorderPanel("");
+ }
+
+
+ /**
+ * Creates a Swing bordered panel with NO border
+ * Why this ? to add the space of border to line up with other bordered panels
+ */
+ public static JPanel makeEmptyBorderPanel()
+ {
+ JPanel p = makePanel();
+ p.setBorder(EMPTY_BORDER_STYLE);
+ return p;
+ }
+
+ /**
+ * Creates a Swing bordered panel with NO border
+ * Is this different from makeEmptyBorderPanel ?
+ * To be answered....
+ */
+ public static JPanel makeHugeEmptyBorderPanel()
+ {
+ JPanel p = makePanel();
+ p.setBorder(new CompoundBorder(EMPTY_BORDER_STYLE,
+ EMPTY_BORDER_STYLE));
+ return p;
+ }
+
+ /**
+ * Remove all space characters in a given string.
+ * @param s the string to be trimmed
+ */
+ public static String trimSpaces(String s)
+ {
+ String r="";
+ if ( s == null )
+ return null;
+
+ for (int i=0; i < s.length(); i++)
+ if ( s.charAt(i) != ' ' )
+ r = r + s.charAt(i);
+
+ return r;
+ }
+
+
+ /**
+ * Makes a JRadioButton showing text with key as the accelerator
+ * @param text the text of the button
+ * @param key the accelerator key
+ */
+ public static JRadioButton makeRadioButton(String text, char key)
+ {
+ JRadioButton rb = new JRadioButton(text);
+ rb.setMnemonic(key);
+ return rb;
+ }
+
+
+ /**
+ * Makes a JRadioButton showing text without key accelerator
+ * @param text the text of the button
+ */
+ public static JRadioButton makeRadioButton(String text)
+ {
+ JRadioButton rb = new JRadioButton(text);
+ return rb;
+ }
+
+ public static JTextArea makeTextArea(int r, int c, boolean editable)
+ {
+ JTextArea area = new JTextArea(r,c);
+ area.setEditable(editable);
+
+ return area;
+ }
+
+
+ public static JTextArea makeTextArea()
+ {
+ return makeTextArea("");
+ }
+
+ /**
+ * Makes a text area with a populated string
+ * @param text populate area with string
+ */
+ public static JTextArea makeTextArea(String s)
+ {
+ return new JTextArea(s);
+ }
+
+ public static JComboBox makeComboBox(boolean editable)
+ {
+ JComboBox cb = new JComboBox();
+ cb.setEditable( editable );
+ return cb;
+ }
+
+
+ /**
+ * Makes a JComboBox with an array of String for items with default size
+ * @param items an array of strings
+ * @param selectedItemIndex the index of the item to be selected by default
+ * @param editable editable or not
+ */
+ public static JComboBox makeComboBox(String[] items, int selectedItemIndex,
+ boolean editable)
+ {
+ return makeComboBox(items, selectedItemIndex, editable, null);
+ }
+
+ /**
+ * Makes a JComboBox with an array of String for items
+ * @param items an array of strings
+ * @param selectedItemIndex the index of the item to be selected by default
+ * @param editable editable or not
+ * @param dimension the dimension of the box
+ */
+ public static JComboBox makeComboBox(String[] items, int selectedItemIndex,
+ boolean editable, Dimension dimension)
+ {
+ JComboBox cb = new JComboBox();
+ for (int i=0; i < items.length; i++)
+ cb.addItem(items[i]);
+
+ cb.setEditable( editable );
+ cb.setSelectedItem( items[selectedItemIndex] );
+ if ( dimension != null )
+ cb.setPreferredSize( dimension );
+
+ return cb;
+ }
+
+ /**
+ * Makes an empty menu item.
+ */
+ public static JMenuItem makeMenuItem()
+ {
+ return makeMenuItem("");
+ }
+
+ /**
+ * Makes a menu item with an icon.
+ * @param icon image icon
+ */
+ public static JMenuItem makeMenuItem(Icon icon)
+ {
+ JMenuItem m = makeMenuItem();
+ m.setIcon(icon);
+ return m;
+ }
+
+ /**
+ * Makes a menu item with a label and icon.
+ * @param text menu label
+ * @param icon image icon
+ */
+ public static JMenuItem makeMenuItem(String text,Icon icon)
+ {
+ JMenuItem m = makeMenuItem(text);
+ m.setIcon(icon);
+ return m;
+ }
+
+ /**
+ * Makes a menu item with a label and shortcut key.
+ * @param text menu label
+ * @param mnemonic underlined character in label
+ */
+ public static JMenuItem makeMenuItem(String text, char mnemonic)
+ {
+ JMenuItem m = makeMenuItem(text);
+ m.setMnemonic(mnemonic);
+ m.registerKeyboardAction(null, KeyStroke.getKeyStroke(mnemonic,java.awt.Event.ALT_MASK,false),
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+ return m;
+ }
+
+ /**
+ * Makes a menu item with a label
+ * @param text menu label
+ */
+ public static JMenuItem makeMenuItem(String text)
+ {
+ return new JMenuItem(text);
+ }
+
+ public static JMenuItem makeMenuItem(String text, Icon icon, char mnemonic)
+ {
+ JMenuItem m = new JMenuItem(icon);
+ m.setText(text);
+ m.setMnemonic(mnemonic);
+
+ return m;
+ }
+
+
+ /**
+ * Makes a text area that looks like a multiline
+ * wrapping label that word wraps
+ * @param initial value of textarea
+ */
+ public static JTextArea makeWrappingLabel(String s)
+ {
+ JTextArea ta = new JTextArea(s);
+ ta.setLineWrap(true);
+ //ta.setWrapStyleWord(true);
+ ta.setOpaque(false);
+ ta.setEditable(false);
+ ta.setBorder(new EmptyBorder(0,0,0,0));
+ ta.setSelectionColor(UIManager.getDefaults().getColor("Label.background"));
+ ta.setFont(UIManager.getDefaults().getFont("Label.font"));
+ return ta;
+ }
+
+ static public void constrain(Component component, Container container, GridBagConstraints gbc,
+ int grid_x, int grid_y, int grid_width, int grid_height,
+ int fill, int anchor, double weight_x, double weight_y,
+ int top, int left, int bottom, int right)
+ {
+ gbc.gridx = grid_x;
+ gbc.gridy = grid_y;
+ gbc.gridwidth = grid_width;
+ gbc.gridheight = grid_height;
+ gbc.fill = fill;
+ gbc.anchor = anchor;
+ gbc.weightx = weight_x;
+ gbc.weighty = weight_y;
+ if (top+bottom+left+right > 0)
+ gbc.insets = new Insets(top, left, bottom, right);
+
+ ((GridBagLayout)container.getLayout()).setConstraints(component, gbc);
+ container.add(component);
+ }
+
+ static public void showDialog(JFrame frame, String message, String title, int type)
+ {
+ JOptionPane.showMessageDialog(frame, message, title, type);
+ }
+
+ static public void showDialog(String message, String title)
+ {
+ showDialog(message, title, JOptionPane.INFORMATION_MESSAGE);
+ }
+
+ static public void showDialog(String message, String title, int type)
+ {
+ showDialog(new JFrame(), message, title, type);
+ }
+
+ static public void showDialog(String message)
+ {
+ showDialog(message, "");
+ }
+
+ static public void showDialog(Exception e)
+ {
+ showDialog(e.toString(), "Exception");
+ }
+
+ static public String average(Vector v)
+ {
+ int sum =0;
+ for(int i=0; i< v.size(); i++)
+ {
+ try {
+ sum += Integer.parseInt((String) v.elementAt(i));
+ }
+ catch(Exception e) {}
+
+ }
+
+ return String.valueOf(sum/v.size());
+ }
+
+ static public boolean IsDigit(String s)
+ {
+ for (int i=0; i< s.length(); i++)
+ {
+ if (!Character.isDigit(s.charAt(i)))
+ return false;
+ }
+ return true;
+ }
+}
+//$History:$
diff --git a/data/mnet/Common/Java/com/jetcell/MibWM/WMTextField.java b/data/mnet/Common/Java/com/jetcell/MibWM/WMTextField.java
new file mode 100644
index 0000000..ff7ca7e
--- /dev/null
+++ b/data/mnet/Common/Java/com/jetcell/MibWM/WMTextField.java
@@ -0,0 +1,156 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Class : WMTextField
+// Desc : TextField widget for Web Management Browser
+// Author : George Zhao
+// History: April 22, 1999 Initial Creation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+package com.jetcell.MibWM;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * Subclass of JTextfield that add a right mouse button triggered
+ * popupmenu for cut/copy/paste/delete functionality.
+ *
+ * @see TextComponentPopupMenu
+ * @version 1.0
+ * @author George Zhao
+ */
+
+public class WMTextField extends JTextField implements FocusListener
+{
+ static TextComponentPopupMenu popupMenu = TextComponentPopupMenu.getPopupMenu();
+
+ /**
+ * Previous value is tracked to make sure duplicates don't make it into
+ * the paste recent menu.
+ */
+ String previousValue="";
+ String magicMarkup = "";
+
+ public WMTextField()
+ {
+ super();
+ init();
+ }
+
+ public WMTextField(String text)
+ {
+ super(text);
+ init();
+ }
+
+ public WMTextField(int columns)
+ {
+ super(columns);
+ init();
+ }
+
+ public WMTextField(String text, int columns)
+ {
+ super(text,columns);
+ init();
+ }
+
+ /**
+ * Adds focusListener to textfield
+ */
+ void init()
+ {
+ addFocusListener(this);
+ //{{INIT_CONTROLS
+ //}}
+ }
+
+
+ public void focusGained(FocusEvent e) {};
+
+ /**
+ * Listens for focusLost event to trigger updates to
+ * the paste recent popup menu
+ * @param e FocusEvent
+ */
+ public void focusLost(FocusEvent e)
+ {
+ String value = getTrimmedText();
+ if ((value.length() > 0) && (!value.equals(previousValue)))
+ {
+ previousValue = value;
+ popupMenu.addToMostRecentList(value);
+ }
+ }
+
+ /**
+ * Captures right mouse button mouse events to invoke popup menu.
+ * @param e MouseEvent
+ */
+ public void processMouseEvent(MouseEvent e)
+ {
+ if (e.getModifiers() == InputEvent.BUTTON3_MASK)
+ {
+ if (e.isPopupTrigger())
+ {
+ popupMenu.show(e.getComponent(),
+ e.getX(),
+ e.getY(),
+ getSelectionStart(),
+ getSelectionEnd());
+ }
+ }
+ else
+ super.processMouseEvent(e);
+ }
+
+ /**
+ * Returns text without with leading and trailing spaces
+ */
+ public String getTrimmedText()
+ {
+ return getText().trim();
+ }
+
+ /**
+ * Sets the text. Keeps track of previous value.
+ */
+ public void setText(String s)
+ {
+ super.setText(s);
+ previousValue = s;
+ repaint();
+ }
+
+ /**
+ * Swing bug - force repaint on setEditable() to refresh color
+ */
+ public void setEditable(boolean b)
+ {
+ super.setEditable(b);
+ if(b) {
+ //setBackground(UIManager.getDefaults().getColor("TextField.background"));
+ setBackground(Color.white);
+ }
+ else {
+ //setBackground(UIManager.getDefaults().getColor("Label.background"));
+ setBackground(Color.lightGray);
+ }
+ repaint();
+ }
+
+ public void setMagicMarkup(String markup)
+ {
+ magicMarkup = markup;
+ }
+
+ public String getMagicMarkup()
+ {
+ return magicMarkup;
+ }
+}
+
+//$History:$ \ No newline at end of file
diff --git a/data/mnet/Common/Java/java.mk b/data/mnet/Common/Java/java.mk
new file mode 100644
index 0000000..7bf6cf7
--- /dev/null
+++ b/data/mnet/Common/Java/java.mk
@@ -0,0 +1,60 @@
+####################################################################
+#
+# FILE NAME: Java.mk
+#
+# DESCRIPTION: This file needs to be included by every makefile that
+# compiles Java source files.
+#
+# COMPONENTS:
+#
+#
+# NOTES:
+#
+# (C) Copyright 1999 JetCell Inc., CA, USA http://www.jetcell.com/
+#
+# REVISION HISTORY
+#__________________________________________________________________
+#----------+--------+----------------------------------------------
+# Name | Date | Reason
+#----------+--------+----------------------------------------------
+# Bhawani |11/28/99| Iniitial Draft
+#----------+--------+----------------------------------------------
+####################################################################
+#/
+
+# Hard-coded path should point to the network drive
+RLROOT = ..\..\..\THIRD_PARTY\OamTools
+RLROOT2 = ..\..\THIRD_PARTY\OamTools
+RLIROOT = $(RLROOT)\rl
+RLIROOT2 = $(RLROOT2)\rl
+JDKROOT = $(CODEBASE)\..\..\THIRD_PARTY\OamTools\jdk1.3
+
+RM = del
+CP = copy
+
+MIBWMPATH = $(CODEBASE)\com\jetcell\MibWM
+VIPERCELL = $(MIBWMPATH)
+VIPERBASE = $(MIBWMPATH)\ViperBase
+COMMON = $(CODEBASE)\Java
+OUTPUTDIR = $(CODEBASE)\..\..\GMC\GMCManager
+ALARMAPPLETDIR = $(CODEBASE)\AlarmApplet
+
+ifeq ($(SOURCE_LIST),)
+ SOURCE_LIST = $(wildcard *.java)
+
+endif
+
+CLASS_LIST = $(SOURCE_LIST:.java=.class)
+
+# java compiler and archive maker
+JAR = $(JDKROOT)\bin\jar.exe
+JAVAC = $(JDKROOT)\bin\javac.exe
+
+CLASSPATH = .;$(ALARMAPPLETDIR);$(CODEBASE);$(JDKROOT)/lib;$(JDKROOT)/lib/classes.zip;$(RLROOT);/$(RLIROOT)/jcit/symbeans.jar;$(RLIROOT)/jcit/Jars/Gauges.jar;$(RLIROOT)/jcit/Jars/RLBeans.jar
+
+
+# rule to compile Java source files
+%.class : %.java
+# - @ $(RM) $(subst /,$(DIRCHAR),$@)
+ $(JAVAC) -classpath $(CLASSPATH) $(subst /,\, $<)
+