|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcox.jmatt.java.MathTools.demo.URLLoaderPanel
public class URLLoaderPanel
This class wraps a simple GUI around an URLClassLoader. It provides a TextArea to list URLs, machinery to fetch these URLs as either an URL[] array or as a fully-instantiated ClassLoader, and a way to pick single URLs from a file or to load a list of them.
Originally a part of ScriptPanel, URLLoaderPanel was factored out to provide independent support to other classes that might need an URLClassLoader. In GUI construction this class fetches two Components from the CapCom Shelf: the Forward and Back buttons to flip among ScriptPanel's CardLayout. If this class is added to another application any Component can be added in their place. Simply CapCom.storeObject() these components prior to instantiation, using the keys URL_PANEL_EAST and URL_PANEL_WEST. URLLoaderPanel removes these from the Shelf so using more than one requires storing these items more than once!
URLLoaderPanel can be constructed with zero arguments but the URL panel will not have Buttons to pick a file URL or load a list of them. These functions require a FileDialog which requires instantiation around a Dialog or a Frame.
When the [Check URLs] button is clicked, the getURLS() method is called. Doing so parses the URLs individually, so any malformed URLs are reported at Error
level and then ignored: the other URLs are still parsed and added to the array. The getURLClassLoader() method also performs this check. Any time getURLS()
is called, it reports bad URLs at Error level and gives Info on how many were successfully loaded. Clicking the [Set MTCL] button creates a ClassLoader and
sends it to CapCom.setMathClassLoader()
. ScriptPanel does this automatically, the button is provided for subclasses or user-created apps that
do not rely on ScriptPanel to do such things.
The URLClassLoader is constructed using the URL[]-array constructor with nothing else. If more complexity is desired, subclass and add it or modify the ClassLoader after it has been created. Or call getURLS() and create your own!
Field Summary | |
---|---|
static java.lang.String |
URL_PANEL_EAST
Key used to store the EAST component on The Shelf. |
static java.lang.String |
URL_PANEL_WEST
Key used to store the WEST component on The Shelf. |
Constructor Summary | |
---|---|
URLLoaderPanel()
Default constructor. |
|
URLLoaderPanel(java.awt.Dialog pParent)
Constructor around a Dialog. |
|
URLLoaderPanel(java.awt.Frame pParent)
Constructor around a Frame. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent aev)
|
void |
addURL(java.lang.String pURL)
Add an URL to the list. |
protected java.awt.Panel |
getEastPanel()
This is the Panel placed at BorderLayout.EAST. |
java.lang.ClassLoader |
getURLClassLoader()
Create an URLClassLoader around the URLs listed. |
java.net.URL[] |
getURLS()
This method attempts to parse the URLs in the URL ClassLoader area into an URL[] array. |
protected java.awt.Panel |
getWestPanel()
This is the Panel placed at BorderLayout.WEST. |
void |
loadURLList()
Load a list of URLs into the TextArea. |
void |
pickURL()
Pick an URL using a FileDialog. |
void |
setMathClassLoader()
Call this method to create an URLClassLoader and send it to CapCom. |
java.awt.Panel |
standardGUI()
The Standard GUI builds the URLLoaderPanel's GUI per standard layout: title, URL List area, and buttons. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String URL_PANEL_EAST
public static final java.lang.String URL_PANEL_WEST
Constructor Detail |
---|
public URLLoaderPanel()
public URLLoaderPanel(java.awt.Frame pParent)
public URLLoaderPanel(java.awt.Dialog pParent)
Method Detail |
---|
public final java.awt.Panel standardGUI()
The Standard GUI builds the URLLoaderPanel's GUI per standard layout: title, URL List area, and buttons. This method does check CapCom's Shelf for components to add to the WEST and EAST parts of its BorderLayout. During construction, it checks the using the URL_PANEL_ keys and, if it receives a Component, adds it to the appropriate spot. URLLoaderPanel uses these with ScriptPanel to acquire the card Forward and Back buttons. If Components are found on the Shelf, they are removed.
Note: To instantiate and get the GUI in one fell swoop use the construct '(new URLLoaderPanel(?)).standardGUI();'.
protected java.awt.Panel getEastPanel()
protected java.awt.Panel getWestPanel()
public void actionPerformed(java.awt.event.ActionEvent aev)
actionPerformed
in interface java.awt.event.ActionListener
public void addURL(java.lang.String pURL)
public void pickURL()
public void loadURLList()
public final java.net.URL[] getURLS()
public java.lang.ClassLoader getURLClassLoader()
public void setMathClassLoader()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |