DisplayEntry.java
2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package com.sitech.ismp.ice.syslogd;
import java.awt.Dimension;
import java.awt.Point;
import com.sitech.ismp.ice.util.ClassUtilities;
public class
DisplayEntry
{
public static final String RCS_ID = "$Id: DisplayEntry.java,v 1.1.1.1 1998/02/22 05:47:54 time Exp $";
public static final String RCS_REV = "$Revision: 1.1.1.1 $";
public static final String RCS_NAME = "$Name: $";
private String name;
private String className;
private String title;
private int bufLength;
private int x;
private int y;
private int width;
private int height;
private String[] parameters;
private SyslogDisplayInterface display;
public
DisplayEntry(
String name, String className, String title,
int bufLength, int x, int y, int width, int height,
String[] parameters )
{
this.name = name;
this.title = title;
this.className = className;
this.bufLength = bufLength;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.display = null;
this.parameters = parameters;
}
public String
getName()
{
return this.name;
}
public String
getTitle()
{
return this.title;
}
public String
getClassName()
{
return this.className;
}
public Point
getLocation()
{
return new Point( this.x, this.y );
}
public Dimension
getSize()
{
return new Dimension( this.width, this.height );
}
public SyslogDisplayInterface
createDisplay()
{
String cName = this.className;
if ( cName.equals( "STD" ) )
cName = "com.sitech.ismp.ice.syslogd.StdDisplayFrame";
Class displayClass = null;
try {
displayClass = Class.forName( cName );
}
catch ( ClassNotFoundException ex )
{
System.err.println
( "ERROR failed loading class '"
+ cName + "':\n\t" + ex.getMessage() );
return null;
}
String interfaceName =
"com.sitech.ismp.ice.syslogd.SyslogDisplayInterface";
if ( ! ClassUtilities.implementsInterface
( displayClass, interfaceName ) )
{
System.err.println
( "ERROR class '" + cName
+ "' does not implement the interface '"
+ interfaceName + "'." );
return null;
}
SyslogDisplayInterface result = null;
try {
result =
(SyslogDisplayInterface)
displayClass.newInstance();
}
catch ( Exception ex )
{
System.err.println
( "ERROR failed instantiating object '"
+ cName + "':\n\t" + ex.getMessage() );
return null;
}
result.openDisplay
( this.title, this.bufLength,
this.x, this.y, this.width, this.height,
this.parameters );
return result;
}
}