diff options
author | Matt Windsor <mbw500@student.cs.york.ac.uk> | 2011-03-07 13:50:24 +0000 |
---|---|---|
committer | Matt Windsor <mbw500@student.cs.york.ac.uk> | 2011-03-07 13:50:24 +0000 |
commit | 9b4647f1ae8c3f41163d0d4053504dab861d0c94 (patch) | |
tree | b621e8c0b75a5cadd69f938116b1637f7ad0c94d /src/uk/org/ury/frontend/FrontendPanel.java | |
parent | c33f098de8a43a2df778d4d694e0c07bbde59828 (diff) |
Emergency impending hard drive failure dump - lots of changes on the frontend, but they're all potentially controversial so I'm not pushing to master yet. Beginnings of show viewer. Application now run through demo menu, which allows for the links between modules to be tested.
Diffstat (limited to 'src/uk/org/ury/frontend/FrontendPanel.java')
-rw-r--r-- | src/uk/org/ury/frontend/FrontendPanel.java | 84 |
1 files changed, 71 insertions, 13 deletions
diff --git a/src/uk/org/ury/frontend/FrontendPanel.java b/src/uk/org/ury/frontend/FrontendPanel.java index 6012f22..1617ab0 100644 --- a/src/uk/org/ury/frontend/FrontendPanel.java +++ b/src/uk/org/ury/frontend/FrontendPanel.java @@ -1,32 +1,90 @@ -/** - * - */ package uk.org.ury.frontend; +import java.net.URL; + import javax.swing.JPanel; +import org.swixml.SwingEngine; + + /** - * A frontend user interface panel. + * An extension of JPanel providing common functionality for user + * interface panels in the URY system frontend. * - * All frontend user interfaces should subclass this as their main - * interface space, so that frontend panels can include each other - * and panels can be embedded into application frames or applets. - * - * @author Matt Windsor + * @author Matt Windsor * */ -public abstract class FrontendPanel extends JPanel +public class FrontendPanel extends JPanel { /** * */ - - private static final long serialVersionUID = 5616222530691425635L; + private static final long serialVersionUID = -4481079599056565279L; + protected FrontendMaster master; + + /** + * Construct a new, blank FrontendPanel. + * + * @param master The FrontendMaster driving the frontend. + */ + public - FrontendPanel () + 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); + + + // Read the XML. + + try + { + se.insert (path, this); + } + catch (Exception e) + { + FrontendError.reportFatal ("UI creation failure: " + e.getMessage (), null); + } } } |