org.newsml.toolkit.explorer
Class ExplorerFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--org.newsml.toolkit.explorer.ExplorerFrame
All Implemented Interfaces:
Accessible, ActionListener, EventListener, ImageObserver, MenuContainer, RootPaneContainer, Serializable, WindowConstants

public class ExplorerFrame
extends JFrame
implements ActionListener

Application for viewing a NewsML package interactively.

This class sets up a frame containing a menu bar with commands linked to an ExplorerPanel. It is a nearly complete application, but requires that a DOMFactory be provided, usually in the application's static main method, so that it can create DOM trees (and thus, NewsML packages) from URL strings.

Version:
2.0
Author:
Reuters PLC
See Also:
ExplorerPanel, Serialized Form

Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ExplorerFrame(NewsMLFactory factory)
          Create a new, empty frame with the default title.
ExplorerFrame(NewsML newsml, NewsMLFactory factory)
          Create a new frame exploring the NewsML package provided.
ExplorerFrame(String title, NewsMLFactory factory)
          Create a new, empty frame with the specified title.
ExplorerFrame(String title, NewsML newsml, NewsMLFactory factory)
          Create a new frame with an explicit title and NewsML package.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Handle an action for the file menu.
 ExplorerPanel getExplorerPanel()
          Get the current explorer panel for this application.
 NewsMLFactory getNewsMLFactory()
          Get the current NewsMLFactory.
 Dimension getPreferredSize()
          Get the preferred size for this window.
 void readNewsML(File file)
          Load a NewsML package.
 void readNewsML(String url)
          Load a NewsML package.
 void setExplorerPanel(ExplorerPanel explorerPanel)
          Change the explorer panel.
 void setNewsMLFactory(NewsMLFactory factory)
          Set a new NewsMLFactory.
 void setPreferredSize(Dimension preferredSize)
          Set the preferred size for this window.
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setFont, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

ExplorerFrame

public ExplorerFrame(NewsMLFactory factory)
Create a new, empty frame with the default title.
Parameters:
DOMFactory - A factory for create a DOM tree from a URL.

ExplorerFrame

public ExplorerFrame(String title,
                     NewsMLFactory factory)
Create a new, empty frame with the specified title.
Parameters:
title - The title for the frame.
DOMFactory - A factory for create a DOM tree from a URL.

ExplorerFrame

public ExplorerFrame(NewsML newsml,
                     NewsMLFactory factory)
Create a new frame exploring the NewsML package provided.
Parameters:
newsml - The NewsML package to explore.
DOMFactory - A factory for create a DOM tree from a URL.

ExplorerFrame

public ExplorerFrame(String title,
                     NewsML newsml,
                     NewsMLFactory factory)
Create a new frame with an explicit title and NewsML package.
Parameters:
title - The title for the frame.
newsml - The NewsML package to explore.
DOMFactory - A factory for create a DOM tree from a URL.
Method Detail

getNewsMLFactory

public NewsMLFactory getNewsMLFactory()
Get the current NewsMLFactory.
Returns:
The current NewsMLFactory.

setNewsMLFactory

public void setNewsMLFactory(NewsMLFactory factory)
Set a new NewsMLFactory.
Parameters:
domFactory - The new NewsML factory.

getPreferredSize

public Dimension getPreferredSize()
Get the preferred size for this window.
Overrides:
getPreferredSize in class Container
Returns:
The current preferred size for the window (800x600 by default).

setPreferredSize

public void setPreferredSize(Dimension preferredSize)
Set the preferred size for this window.
Parameters:
preferredSize - The new preferred size for the window.

getExplorerPanel

public ExplorerPanel getExplorerPanel()
Get the current explorer panel for this application.
Returns:
The current explorer panel.

setExplorerPanel

public void setExplorerPanel(ExplorerPanel explorerPanel)
Change the explorer panel.
Parameters:
explorerPanel - The new explorer panel.

readNewsML

public void readNewsML(File file)
Load a NewsML package.
Parameters:
file - The new file to load.

readNewsML

public void readNewsML(String url)
Load a NewsML package.
Parameters:
url - The new URL to load.

actionPerformed

public void actionPerformed(ActionEvent e)
Handle an action for the file menu. This method allows the class to respond to menu events; it is not meant for other uses.
Specified by:
actionPerformed in interface ActionListener
Parameters:
command - The action command for the menu item.