Class CartoFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--CartoFrame
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class CartoFrame
extends javax.swing.JFrame
implements java.awt.event.ActionListener

The top level interface. This is the "Carto window" that the user sees when he opens Carto.

See Also:
Serialized Form

Field Summary
static java.lang.String ABOUT
           
static java.lang.String ADDCOMPOSITES
           
static java.lang.String ADDPAGE
           
static java.lang.String ADDSECTION
           
static java.lang.String ADDSEGMENT
           
static java.lang.String ADDSURVEY
           
(package private)  Carto carto
          The contents of the file that is being edited.
static java.lang.String CLEAN
           
static java.lang.String CLOSEDITS
           
static java.lang.String COMPWORD
           
static boolean cookonopen
          Recook all segments when opening files?
static java.lang.String DEBUG
           
static java.lang.String DELETE
           
static java.lang.String DELETECOMP
           
static java.lang.String DELETESECTION
           
static java.lang.String DELETESEG
           
static java.lang.String DELSHOT
           
static java.lang.String DELSTA
           
(package private)  javax.swing.JDesktopPane desk
          The desktop that contains all sub-windows.
 boolean dirty
          Has this file been changed?.
static java.lang.String DRAWING
           
static java.lang.String EDITCOMPOSITE
           
static java.lang.String EDITSECTION
           
static java.lang.String EDITSEGMENT
           
static java.lang.String ERROR
           
static java.lang.String ERRORFILE
           
(package private)  java.io.File file
          The name of the file being edited.
static java.lang.String FPREFS
           
static java.lang.String GC
           
static java.lang.String HARDRECOOK
           
static java.lang.String HELP
           
static java.lang.String HISTORY
           
static java.lang.String IMAGELOAD
           
static java.lang.String IMPORTCOMP
           
static java.lang.String IMPORTSECTION
           
static java.lang.String IMPORTSEG
           
static int initialheight
          Initial window height.
static int initialwidth
          Initial window width.
static int initialx
          Initial horizontal window position.
static int initialy
          Initial vertical window position.
static java.lang.String IPRINT
           
static java.lang.String JAR
           
static boolean lastopen
          Open last edited file when Carto opens?
 Editor lastselected
          The last editor in which a selection took place.
static java.lang.String LICENCE
           
static ThreadMessage message
          The progress message.
static java.lang.String NEW
           
static java.lang.String NEWER
           
static java.lang.String NEWPROJECT
           
static java.lang.String NEWTITLE
          The title to use when file is "New".
static java.lang.String OLDER
           
static java.lang.String OPEN
           
static boolean openeditormaximized
          Open new editors maximized?
static boolean openmaximized
          Deprecated. Dosn't work because Java has no maximizing API.
static java.lang.String PREFS
           
static java.lang.String PREVIEW
           
static java.lang.String PRINT
           
static java.lang.String PRINTSEL
           
static java.lang.String PRINTSETUP
           
static java.lang.String PURGESURVEY
           
static java.lang.String QUIT
           
static java.lang.String RECOOK
           
static boolean restoreplace
          Restore editors on open?
static java.lang.String SAVE
           
static java.lang.String SAVEAS
           
static boolean saveplace
          Save state of editors on save?
static java.lang.String SECTION
           
static java.lang.String SEGWORD
           
static java.lang.String STATS
           
(package private)  javax.swing.JPanel statusbar
          Status bar at bottom of window.
static java.lang.String STOPCOOK
           
static java.lang.String STOPPRINT
           
(package private)  javax.swing.JLabel surveylabel
          Displays name of current survey.
static CartoFrame topframe
          The last CartoFrame created.
 
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.Window
 
Fields inherited from class java.awt.Container
 
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, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CartoFrame(java.io.File startfile)
          Build a top level window with all its menus.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Called when a menu item is selected.
Decode the menu item and execute the command.
 Editor addEditor(Editable elem)
          Start a new Editor
Edits the given item.
 void addMenuItem(javax.swing.JMenu menu, java.lang.String comand)
          Add a menu item without a shortcut key.
 void addMenuItem(javax.swing.JMenu menu, java.lang.String comand, char mne)
          Add a menu item with a shortcut key.
 void addSurvey()
          Read a survey file
Creates or updates the survey.
static Element chooseFromList(java.util.List list, java.lang.String message, java.lang.String title)
          Pops up a dialog to choose an item from a list
Used when it only make sense to select at most one.
 void closeEditors()
          Close all editors.
 boolean closefile()
          Close the current .cto file
If it is dirty, give the user a chance to cancel or save.
 void deleteElement(java.lang.String typestring)
          Delete one or more elements of the given type
Pops up a dialog to choose which, then another to confirm.
 void editElement(java.lang.String typestring)
          Edit one or more elements of named type
(package private)  void forceReCook()
          Recook all segments.
 void importElement(java.lang.String word)
          Import elements of type given by word
Prompts for a file to read from, then pops up dialog to select which to import.
 boolean newFile()
          Create a new, empty, .cto file
 void open()
          Open a new .cto file
Closes the old one if needed.
 void open(java.io.File filename)
           
 void print()
          Print all pages.
 void printSelected()
          Print selected pages.
 boolean save(java.io.File savefile)
          Save the current file
If savefile is null, then do save-as, otherwise save to savefile if dirty.
static java.lang.Object[] selectFromList(java.util.List list, java.lang.String message, java.lang.String title)
          Pops up a dialog to choose items from a list
User may select more than one.
(package private)  void showname(java.io.File file)
          Update the displayed name of the current file
 void shutDown()
          Close Carto
 void stopPrint()
          Stop background printing, if any.
 void stopReCook()
          Stop background Cooking, if any.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, 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, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, isOpaque, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

carto

Carto carto
The contents of the file that is being edited.


desk

javax.swing.JDesktopPane desk
The desktop that contains all sub-windows.


SEGWORD

public static java.lang.String SEGWORD

COMPWORD

public static java.lang.String COMPWORD

SECTION

public static java.lang.String SECTION

DRAWING

public static java.lang.String DRAWING

NEWPROJECT

public static java.lang.String NEWPROJECT

NEW

public static java.lang.String NEW

OPEN

public static java.lang.String OPEN

SAVE

public static java.lang.String SAVE

QUIT

public static java.lang.String QUIT

PRINT

public static java.lang.String PRINT

PRINTSEL

public static java.lang.String PRINTSEL

IPRINT

public static java.lang.String IPRINT

PREVIEW

public static java.lang.String PREVIEW

PRINTSETUP

public static java.lang.String PRINTSETUP

STATS

public static java.lang.String STATS

SAVEAS

public static java.lang.String SAVEAS

PREFS

public static java.lang.String PREFS

FPREFS

public static java.lang.String FPREFS

EDITSEGMENT

public static java.lang.String EDITSEGMENT

EDITCOMPOSITE

public static java.lang.String EDITCOMPOSITE

EDITSECTION

public static java.lang.String EDITSECTION

ADDSEGMENT

public static java.lang.String ADDSEGMENT

ADDCOMPOSITES

public static java.lang.String ADDCOMPOSITES

ADDSECTION

public static java.lang.String ADDSECTION

ADDPAGE

public static java.lang.String ADDPAGE

ADDSURVEY

public static java.lang.String ADDSURVEY

PURGESURVEY

public static java.lang.String PURGESURVEY

DELETE

public static java.lang.String DELETE

RECOOK

public static java.lang.String RECOOK

HARDRECOOK

public static java.lang.String HARDRECOOK

IMAGELOAD

public static java.lang.String IMAGELOAD

STOPCOOK

public static java.lang.String STOPCOOK

STOPPRINT

public static java.lang.String STOPPRINT

DELETESEG

public static java.lang.String DELETESEG

IMPORTSEG

public static java.lang.String IMPORTSEG

IMPORTCOMP

public static java.lang.String IMPORTCOMP

IMPORTSECTION

public static java.lang.String IMPORTSECTION

DELETECOMP

public static java.lang.String DELETECOMP

DELETESECTION

public static java.lang.String DELETESECTION

OLDER

public static java.lang.String OLDER

HISTORY

public static java.lang.String HISTORY

NEWER

public static java.lang.String NEWER

DELSTA

public static java.lang.String DELSTA

DELSHOT

public static java.lang.String DELSHOT

DEBUG

public static java.lang.String DEBUG

GC

public static java.lang.String GC

ERROR

public static java.lang.String ERROR

CLEAN

public static java.lang.String CLEAN

CLOSEDITS

public static java.lang.String CLOSEDITS

JAR

public static java.lang.String JAR

ERRORFILE

public static java.lang.String ERRORFILE

HELP

public static java.lang.String HELP

ABOUT

public static java.lang.String ABOUT

LICENCE

public static java.lang.String LICENCE

cookonopen

public static boolean cookonopen
Recook all segments when opening files?


lastopen

public static boolean lastopen
Open last edited file when Carto opens?


openmaximized

public static boolean openmaximized
Deprecated. Dosn't work because Java has no maximizing API.

Open Carto maximized?.


openeditormaximized

public static boolean openeditormaximized
Open new editors maximized?


restoreplace

public static boolean restoreplace
Restore editors on open?


saveplace

public static boolean saveplace
Save state of editors on save?


initialx

public static int initialx
Initial horizontal window position.


initialy

public static int initialy
Initial vertical window position.


initialwidth

public static int initialwidth
Initial window width.


initialheight

public static int initialheight
Initial window height.


NEWTITLE

public static java.lang.String NEWTITLE
The title to use when file is "New".


topframe

public static CartoFrame topframe
The last CartoFrame created. Usually there is onlt one in the program anyway.


lastselected

public Editor lastselected
The last editor in which a selection took place. used to direct events that apply to editors but have no independant way to know which one. (A bit of a hack).


file

java.io.File file
The name of the file being edited. null if new.


message

public static ThreadMessage message
The progress message. Displayed at the bottom left of the window. Used by background job to tell the user about progress


surveylabel

javax.swing.JLabel surveylabel
Displays name of current survey. If there is one. Lower right corner of window.


statusbar

javax.swing.JPanel statusbar
Status bar at bottom of window.


dirty

public boolean dirty
Has this file been changed?. If so, make sure to give user a chance to save before closeing.

Constructor Detail

CartoFrame

public CartoFrame(java.io.File startfile)
Build a top level window with all its menus. Once it is shown it will be ready to edit.

Method Detail

addMenuItem

public void addMenuItem(javax.swing.JMenu menu,
                        java.lang.String comand,
                        char mne)
Add a menu item with a shortcut key.


addMenuItem

public void addMenuItem(javax.swing.JMenu menu,
                        java.lang.String comand)
Add a menu item without a shortcut key. The absence of a shortcut indecates that the function is not yet implemented.


importElement

public void importElement(java.lang.String word)
Import elements of type given by word
Prompts for a file to read from, then pops up dialog to select which to import.


chooseFromList

public static Element chooseFromList(java.util.List list,
                                     java.lang.String message,
                                     java.lang.String title)
Pops up a dialog to choose an item from a list
Used when it only make sense to select at most one.


selectFromList

public static java.lang.Object[] selectFromList(java.util.List list,
                                                java.lang.String message,
                                                java.lang.String title)
Pops up a dialog to choose items from a list
User may select more than one.


editElement

public void editElement(java.lang.String typestring)
Edit one or more elements of named type


addEditor

public Editor addEditor(Editable elem)
Start a new Editor
Edits the given item.


printSelected

public void printSelected()
Print selected pages.


print

public void print()
Print all pages.


addSurvey

public void addSurvey()
Read a survey file
Creates or updates the survey.


newFile

public boolean newFile()
Create a new, empty, .cto file


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Called when a menu item is selected.
Decode the menu item and execute the command.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

deleteElement

public void deleteElement(java.lang.String typestring)
Delete one or more elements of the given type
Pops up a dialog to choose which, then another to confirm. Closes any editors that are editing deleted items and uses recursiveDelete to fix dependencies.


closeEditors

public void closeEditors()
Close all editors.


shutDown

public void shutDown()
Close Carto


open

public void open()
Open a new .cto file
Closes the old one if needed.


open

public void open(java.io.File filename)

showname

void showname(java.io.File file)
Update the displayed name of the current file


closefile

public boolean closefile()
Close the current .cto file
If it is dirty, give the user a chance to cancel or save.


save

public boolean save(java.io.File savefile)
Save the current file
If savefile is null, then do save-as, otherwise save to savefile if dirty. If savefile is not null and the file is not dirty, the file is already saved, so do nothing.


stopReCook

public void stopReCook()
Stop background Cooking, if any.


stopPrint

public void stopPrint()
Stop background printing, if any.


forceReCook

void forceReCook()
Recook all segments. Cancel any cooking that was already running.