antsnest.gui
Class MasterFrame

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 antsnest.gui.MasterFrame
All Implemented Interfaces:
ApplicationTasks, ClipboardOwner, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class MasterFrame
extends JFrame
implements ApplicationTasks, ClipboardOwner

The main frame that runs the program

Author:
Chris Clohosy
See Also:
Serialized Form

Nested Class Summary
 
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.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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 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
MasterFrame(AntsNestProperties properties, AntInfo antInfo, LevelManager levelManager, StartupManager startup)
          Constructs the new frame
 
Method Summary
 void addTaskDefinition()
          Adds a task definition to the Task Extension Model
 void copy()
          Tells the application to perform a copy
 void createNewProject()
          Creates a new project
 void cut()
          Tells the application to perform a cut
 void displayDoc(String taskName)
          Displays Ant documentation in an external window
 void displayHTML(URL url)
          Displays a web page in an external window
 AntInfo getAntInfo()
          Gets the Ant information object being used
 Component getLastFocused()
          Gets the last component to have the focus before the menu bars
 Component getMainComponent()
          Gets a component reference
 AntProject getProject()
          Gets the project being currently worked on
 AntsNestProperties getProperties()
          Gets the user's properties
 String getSingleLineString(String title)
          Gets a single line string from a specialist input window
 String getString(String title, String text)
          Gets a string from a specialist input window
 void loadBuildFile()
          Loads a build file
 void lostOwnership(Clipboard clipboard, Transferable contents)
          Notifies the frame that it's lost ownership of the clipboard contents
 void needsToBeSaved()
          Notifies the frame that the build file has been edited
 void paste()
          Tells the application to perform a paste
 void projectChanged(AntProject newProject)
          Informs the application that the project has changed
 void quickSave()
          Saves a build file using the current filename
 void redo()
          Tells the application to perform a redo
 void saveBuildFile()
          Saves a build file letting the user select a filename
 void shutdown()
          Responsible for a safe shutdown of the application
 void undo()
          Tells the application to perform an undo
 void useBean()
          Uses an Ant Bean
 
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, setIconImage, 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, 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, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, 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, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, 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, 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, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, 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
 

Constructor Detail

MasterFrame

public MasterFrame(AntsNestProperties properties,
                   AntInfo antInfo,
                   LevelManager levelManager,
                   StartupManager startup)
Constructs the new frame

Parameters:
properties - the properties Ant's Nest needs to function
antInfo - the Ant information object
levelManager - an object that manages the various levels
startup - the manager to notify when loading is complete
Method Detail

shutdown

public void shutdown()
Responsible for a safe shutdown of the application

Specified by:
shutdown in interface ApplicationTasks

createNewProject

public void createNewProject()
Creates a new project

Specified by:
createNewProject in interface ApplicationTasks

needsToBeSaved

public void needsToBeSaved()
Notifies the frame that the build file has been edited

Specified by:
needsToBeSaved in interface ApplicationTasks

displayDoc

public void displayDoc(String taskName)
Displays Ant documentation in an external window

Specified by:
displayDoc in interface ApplicationTasks
Parameters:
taskName - the name of the task to document

displayHTML

public void displayHTML(URL url)
Displays a web page in an external window

Specified by:
displayHTML in interface ApplicationTasks
Parameters:
url - the URL of the web page

loadBuildFile

public void loadBuildFile()
Loads a build file

Specified by:
loadBuildFile in interface ApplicationTasks

saveBuildFile

public void saveBuildFile()
Saves a build file letting the user select a filename

Specified by:
saveBuildFile in interface ApplicationTasks

quickSave

public void quickSave()
Saves a build file using the current filename

Specified by:
quickSave in interface ApplicationTasks

getProject

public AntProject getProject()
Gets the project being currently worked on

Specified by:
getProject in interface ApplicationTasks
Returns:
an AntProject, the project

getAntInfo

public AntInfo getAntInfo()
Gets the Ant information object being used

Specified by:
getAntInfo in interface ApplicationTasks
Returns:
an AntInfo, the information object being used

getProperties

public AntsNestProperties getProperties()
Gets the user's properties

Specified by:
getProperties in interface ApplicationTasks
Returns:
an AntsNestProperties, the user's properties

getString

public String getString(String title,
                        String text)
Gets a string from a specialist input window

Specified by:
getString in interface ApplicationTasks
Parameters:
title - the title of the specialist window
text - the text to display to start with
Returns:
a String, the string

getSingleLineString

public String getSingleLineString(String title)
Gets a single line string from a specialist input window

Specified by:
getSingleLineString in interface ApplicationTasks
Parameters:
title - the title of the specialist window
Returns:
a String, the string

projectChanged

public void projectChanged(AntProject newProject)
Informs the application that the project has changed

Specified by:
projectChanged in interface ApplicationTasks
Parameters:
newProject - the changed project

undo

public void undo()
Tells the application to perform an undo

Specified by:
undo in interface ApplicationTasks

redo

public void redo()
Tells the application to perform a redo

Specified by:
redo in interface ApplicationTasks

cut

public void cut()
Tells the application to perform a cut

Specified by:
cut in interface ApplicationTasks

copy

public void copy()
Tells the application to perform a copy

Specified by:
copy in interface ApplicationTasks

paste

public void paste()
Tells the application to perform a paste

Specified by:
paste in interface ApplicationTasks

getLastFocused

public Component getLastFocused()
Gets the last component to have the focus before the menu bars

Specified by:
getLastFocused in interface ApplicationTasks
Returns:
a Component, the last focused on component

addTaskDefinition

public void addTaskDefinition()
Adds a task definition to the Task Extension Model

Specified by:
addTaskDefinition in interface ApplicationTasks

getMainComponent

public Component getMainComponent()
Gets a component reference

Specified by:
getMainComponent in interface ApplicationTasks

useBean

public void useBean()
Uses an Ant Bean

Specified by:
useBean in interface ApplicationTasks

lostOwnership

public void lostOwnership(Clipboard clipboard,
                          Transferable contents)
Notifies the frame that it's lost ownership of the clipboard contents

Specified by:
lostOwnership in interface ClipboardOwner
Parameters:
clipboard - the clipboard
contents - the contents of the clipboard