jview
Class JOpenFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by jview.JExitFrame
                          extended by jview.JConfirmExitFrame
                              extended by jview.JBorderFrame
                                  extended by jview.JOpenFrame
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, BorderLabels, Displayable, Initializable, PropertyAware, PropertyComposed
Direct Known Subclasses:
JClientFrame, JFitsFrame, JStella

public abstract class JOpenFrame
extends JBorderFrame
implements ActionListener, PropertyComposed, Initializable, Displayable, BorderLabels

A generic class that is suitable for GUI that want to lay out their individual components in a BorderLayout with a menu bar.

See Also:
Serialized Form

Nested Class Summary
static class JOpenFrame.Show
          Class to create the frame and display it.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static String DEFFILEACTIONS
          The action commands used for identfiying file menu actions.
static String EMPTYACTION
          Identifier for empty action.
static String EXITACTION
          Identifier for exit action.
static String EXPORTACTION
          Identifier for print action.
static String KEY_FILEACTIONS
          The file menu items action commands.
static String KEY_FILEHOME
          The directory were we look for open/save files or rundir.
private  File lastfile
          We remeber file choses to restart in the same directory.
static String OPENACTION
          Identifier for open action.
static String PRINTACTION
          Identifier for print action.
static String SAVEACTION
          Identifier for save action.
 
Fields inherited from class jview.JBorderFrame
DATACLEANSE, KEY_ABOUTURL, KEY_ACTIONCLASS, KEY_AIPLOGO, KEY_BIGGERSTRUT, KEY_DATAANALYSER, KEY_EASTALIGNMENT, KEY_FITTERS, KEY_FITTERTIPS, KEY_HELPSIZE, KEY_LESSERSTRUT, KEY_NOLOGO, KEY_NORTHALIGNMENT, KEY_SOUTHALIGNMENT, KEY_WESTALIGNMENT, MODELFITTER
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, 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 jview.BorderLabels
KEY_ABOUT, KEY_ABOUTACC, KEY_FILEACCS, KEY_FILEITEMS, KEY_FILEMENU, KEY_FILEMNEMONIC, KEY_HELPMENU, KEY_HELPMNEMONIC, KEY_HELPTITLE, KEY_NOHELP, KEY_NOURLACCESS, KEY_TITLE
 
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
JOpenFrame(Map<String,String> prop)
          Constructs a generic peripheral from a property container.
JOpenFrame(PropertyBearing prop)
          Constructs a generic peripheral from a property container.
 
Method Summary
 void actionPerformed(ActionEvent ae)
          Trace actions delivered to this component.
static JCheckBoxMenuItem createCheckBoxMenuItem(String text, Icon icon, String acc, String command)
          Creates a new CeckBoxMenuItem with the given text and icon and sets an accelerator and a action command to it, if given.
 JCheckBoxMenuItem createLocalizedCheckBoxMenuItem(PropertyBearing info, String textkey, Icon icon, String acckey, String command)
          Creates a new localized JCeckBoxMenuItem from a pointer to the localized name and accelerator and an action command.
private static JMenuItem createMenuItem(String display, String keyacc, String message)
          Creates a new jmenuitem, set the action command and display text and adds an accelerator.
private  List<JMenuItem> createMenuItemList(List<String> names, List<String> acc, List<String> action)
          Takes a list of menu item names, accelerators and action commands and creates a list of jmenuitems out of it.
protected  void exportCenter()
          Exports the central component.
protected  Component getExportRepresentation()
          For saving, we return the central component.
protected  List<Action> getHelpActions()
          Returns the list of actions where the help menu items should be created from.
protected  List<JMenu> getMenus()
          Returns the list of menus that should be added to the menu bar.
protected  FileFilter getOpenFilter()
          If the file chooser shown on open should use a file-filter, override this method.
protected  Component getPrintRepresentation()
          For saving, we return the central component.
protected  FileFilter getSaveFilter()
          If the file chooser shown on save should use a file-filter, override this method.
protected  Component getSaveRepresentation()
          For saving, we return the central component.
 void init()
          Initializes the frame.
protected abstract  boolean openFile(File openit)
          This is tha abstract method called if the user selected a file for opening from the open menu.
protected  JMenu populateMenu(JMenu target, String namelist, String acclist, String actionlist)
          Adds new menu items to a given menu.
protected  void printCenter()
          Prints the central component.
protected  boolean saveFile(File saveas)
          Different to openFile(java.io.File) we have a default implementation, where we save to central component in the file.
 void setComposedProperties(PropertyBearing prop)
          Sets a PropertyBearing object as a composite of the canvas.
 
Methods inherited from class jview.JBorderFrame
analyserListenTo, createButton, createCheckBox, createDataAnalysers, createFitters, createHelp, createLabel, createLocalizedButton, createLocalizedCheckBox, createLocalizedHelp, createLocalizedLabel, createStatus, getAboutAction, getActiveFit, getBiggerStrut, getBottomItems, getComposedProperties, getDataAnalysers, getFitterButtonGroup, getFitterComboBox, getIcon, getLeftItems, getLesserStrut, getModelFittings, getRepresentation, getRightItems, getStatusField, getTopItems, hasFired, printAlignment, setAlignment, setFired
 
Methods inherited from class jview.JConfirmExitFrame
disposeAndExit
 
Methods inherited from class jview.JExitFrame
setVisible
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.PropertyComposed
getComposedProperties
 
Methods inherited from interface jview.Displayable
getIcon, getRepresentation
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

EMPTYACTION

public static final String EMPTYACTION
Identifier for empty action.

See Also:
Constant Field Values

OPENACTION

public static final String OPENACTION
Identifier for open action.

See Also:
Constant Field Values

SAVEACTION

public static final String SAVEACTION
Identifier for save action.

See Also:
Constant Field Values

EXITACTION

public static final String EXITACTION
Identifier for exit action.

See Also:
Constant Field Values

PRINTACTION

public static final String PRINTACTION
Identifier for print action.

See Also:
Constant Field Values

EXPORTACTION

public static final String EXPORTACTION
Identifier for print action.

See Also:
Constant Field Values

KEY_FILEACTIONS

public static final String KEY_FILEACTIONS
The file menu items action commands.

See Also:
Constant Field Values

KEY_FILEHOME

public static final String KEY_FILEHOME
The directory were we look for open/save files or rundir.

See Also:
Constant Field Values

DEFFILEACTIONS

private static final String DEFFILEACTIONS
The action commands used for identfiying file menu actions.

See Also:
Constant Field Values

lastfile

private File lastfile
We remeber file choses to restart in the same directory.

Constructor Detail

JOpenFrame

public JOpenFrame(Map<String,String> prop)
Constructs a generic peripheral from a property container.


JOpenFrame

public JOpenFrame(PropertyBearing prop)
Constructs a generic peripheral from a property container.

Method Detail

setComposedProperties

public void setComposedProperties(PropertyBearing prop)
Sets a PropertyBearing object as a composite of the canvas. Defaults the necessary parameter.

Specified by:
setComposedProperties in interface PropertyAware
Overrides:
setComposedProperties in class JBorderFrame

init

public void init()
Initializes the frame. At this stage, daughter classes must be able to deliver the central component they want to display. Additionally, subclasses that want to add menus to the menubar, should override the getMenus() method that in the basic version delivers a 'File' menu that allows connecting/disconnecting/save/print/exit. If additional help is needed, the getHelpActions() method must be overridn which delivers an empty list in the basic version. Right to the main area, where the #deliverComponent return is placed, the AIP-logo is displayed. Underneath the buttons are placed delivered by the #getRightActions method, which in the basic version returns an empty list.

Specified by:
init in interface Initializable
Overrides:
init in class JBorderFrame

actionPerformed

public void actionPerformed(ActionEvent ae)
Trace actions delivered to this component. If dialogs are displayed, they are modal, thus we can act on the event queue.

Specified by:
actionPerformed in interface ActionListener

getMenus

protected List<JMenu> getMenus()
Returns the list of menus that should be added to the menu bar. The default implementation returns a single 'File' menu that contains menu items for opening, saving, printing and exiting the frame. Daughters may override this method and add some further menus after calling the super method to the list returned. Note that the file menu is immutable.


populateMenu

protected JMenu populateMenu(JMenu target,
                             String namelist,
                             String acclist,
                             String actionlist)
Adds new menu items to a given menu. The first two strings are the references in the properties to lists of menu item names and accelerators, both are localized. The third string is the key to the actions that should be assigned to the menu items generated.

Empty entries are replaced with separators in the drop-down list.
If the given menu is null, a new menu is instanitatied.


getHelpActions

protected List<Action> getHelpActions()
Returns the list of actions where the help menu items should be created from.


getOpenFilter

protected FileFilter getOpenFilter()
If the file chooser shown on open should use a file-filter, override this method.


getSaveFilter

protected FileFilter getSaveFilter()
If the file chooser shown on save should use a file-filter, override this method.


openFile

protected abstract boolean openFile(File openit)
This is tha abstract method called if the user selected a file for opening from the open menu. Note that this method is called from within the event queue, thus it should return fast or spawn its own thread.


saveFile

protected boolean saveFile(File saveas)
Different to openFile(java.io.File) we have a default implementation, where we save to central component in the file.


getSaveRepresentation

protected Component getSaveRepresentation()
For saving, we return the central component.


getPrintRepresentation

protected Component getPrintRepresentation()
For saving, we return the central component.


getExportRepresentation

protected Component getExportRepresentation()
For saving, we return the central component.


printCenter

protected void printCenter()
Prints the central component.


exportCenter

protected void exportCenter()
Exports the central component.


createMenuItemList

private List<JMenuItem> createMenuItemList(List<String> names,
                                           List<String> acc,
                                           List<String> action)
Takes a list of menu item names, accelerators and action commands and creates a list of jmenuitems out of it. Menu items without a name prompt this method to insert a null item into the list returned. This can be used to identify separators in the menu drop-down list. The jmenuitems have their accelerator and special action commands set, if the second and third argument permits it. We add this class as the action listener to it, thus the menu-item actions must be distinguishable solely by their action command.


createMenuItem

private static JMenuItem createMenuItem(String display,
                                        String keyacc,
                                        String message)
Creates a new jmenuitem, set the action command and display text and adds an accelerator.


createLocalizedCheckBoxMenuItem

public JCheckBoxMenuItem createLocalizedCheckBoxMenuItem(PropertyBearing info,
                                                         String textkey,
                                                         Icon icon,
                                                         String acckey,
                                                         String command)
Creates a new localized JCeckBoxMenuItem from a pointer to the localized name and accelerator and an action command.


createCheckBoxMenuItem

public static JCheckBoxMenuItem createCheckBoxMenuItem(String text,
                                                       Icon icon,
                                                       String acc,
                                                       String command)
Creates a new CeckBoxMenuItem with the given text and icon and sets an accelerator and a action command to it, if given.