blob: 0ec8003e30bbb517269fe85b7e6444db5573d9a8 (
plain)
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
|
package uk.org.ury.frontend;
import java.net.URL;
import javax.swing.JPanel;
import org.swixml.SwingEngine;
/**
* An extension of JPanel providing common functionality for user
* interface panels in the URY system frontend.
*
* @author Matt Windsor
*
*/
public class FrontendPanel extends JPanel
{
/**
*
*/
private static final long serialVersionUID = -4481079599056565279L;
protected FrontendMaster master;
/**
* Construct a new, blank FrontendPanel.
*
* @param master The FrontendMaster driving the frontend.
*/
public
FrontendPanel (FrontendMaster master)
{
super ();
this.master = master;
}
/**
* Construct a new FrontendPanel from an XML layout.
*
* This is the preferred means of constructing FrontendPanels, and
* uses SWIXml to construct the panel layout.
*
* @param xmlPath The path, relative from this source file, to the
* XML file from which this panel will read its
* layout.
*
* @param master The FrontendMaster driving the frontend.
*/
public
FrontendPanel (String xmlPath, FrontendMaster master)
{
super ();
this.master = master;
// Acquire path.
URL path = getClass ().getResource (xmlPath);
if (path == null)
FrontendError.reportFatal ("UI creation failure: XML layout "
+ xmlPath + " does not exist.", null);
SwingEngine se = new SwingEngine (this);
// Custom UI element tag registration.
se.getTaglib ().registerTag ("hint", HintField.class);
se.getTaglib ().registerTag ("subbanner", FrontendSubBanner.class);
// Read the XML.
try
{
se.insert (path, this);
}
catch (Exception e)
{
FrontendError.reportFatal ("UI creation failure: " + e.getMessage (), null);
}
}
}
|