jdraw.text_ui
Class TextMenu

java.lang.Object
  |
  +--mvp.View
        |
        +--jdraw.text_ui.TextMenu
All Implemented Interfaces:
java.util.Observer

public class TextMenu
extends mvp.View

Class TextMenu is the pulldown menu for the Text model. The TextMenu widget is a JMenu. Anonymous instances of JMenuItem are defined for each menu item.


Field Summary
protected  int currentFontGroup
          An int object to store the current font Group.
protected  int currentFontSize
          An int object to store the current font Size.
protected  int currentFontStyle
          An int object to store the current font Style.
protected  FontDialog fontDialog
          A FontDialog from which to select the current font.
protected  FontSizeDialog fontSizeDialog
          A FontSizeDialog from which to select the current font size.
protected  Text text
          A local reference to the Text model.
 
Fields inherited from class mvp.View
editable, model, screen, shown, widget, window
 
Constructor Summary
TextMenu(mvp.Screen screen, Text text, TextUI textUI)
          Construct the menu with the given Text model.
 
Method Summary
 java.awt.Component compose()
          Compose the menu items into the pulldown.
protected  javax.swing.JMenu composeFontSize()
          Menu Item Two is the Font Size Menu.
protected  javax.swing.JMenu composeFontStyle()
          Menu Item Three is the Font Style Menu.
protected  javax.swing.JMenuItem composeFontType()
          Menu Item One is the Font Type Menu.
 
Methods inherited from class mvp.View
getModel, getWidget, getWindow, hide, isEditable, isShown, run, setEditable, setModel, show, show, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

protected Text text
A local reference to the Text model.

currentFontGroup

protected int currentFontGroup
An int object to store the current font Group.

currentFontSize

protected int currentFontSize
An int object to store the current font Size.

currentFontStyle

protected int currentFontStyle
An int object to store the current font Style.

fontDialog

protected FontDialog fontDialog
A FontDialog from which to select the current font.

fontSizeDialog

protected FontSizeDialog fontSizeDialog
A FontSizeDialog from which to select the current font size.
Constructor Detail

TextMenu

public TextMenu(mvp.Screen screen,
                Text text,
                TextUI textUI)
Construct the menu with the given Text model. Set a local reference to the Text object and TextUI object.
Parameters:
screen - - The Screen object to be passed to parent constructor.
text - - The Text object to be set as this.text.
textUI - - The TextUI view object.
Method Detail

compose

public java.awt.Component compose()
Compose the menu items into the pulldown. Separator added after 'Undo.'
Overrides:
compose in class mvp.View

composeFontType

protected javax.swing.JMenuItem composeFontType()
Menu Item One is the Font Type Menu. This method composes it. The Font List is derived by retrieving the system fonts. The Fonts are then broken up into a list of FontGroup object to create a relationship between types and styles. All the Fonts are divided by their root type (e.g. Ariel, etc.) They are then set into FontGroup.bold, FontGroup.italic, FontGroup.boldItalic, or FontGroup.plain accordingly.

composeFontSize

protected javax.swing.JMenu composeFontSize()
Menu Item Two is the Font Size Menu. This method composes it.

composeFontStyle

protected javax.swing.JMenu composeFontStyle()
Menu Item Three is the Font Style Menu. This method composes it.