com.ibm.richtext.swingui
Class SwingMenuBuilder

java.lang.Object
  |
  +--com.ibm.richtext.uiimpl.MenuBuilder
        |
        +--com.ibm.richtext.swingui.SwingMenuBuilder

public final class SwingMenuBuilder
extends MenuBuilder

SwingMenuBuilder provides a method for creating a set of Swing menus for interacting with an MTextPanel. Future versions of this class may provide greater control over the menu contents.

See Also:
MTextPanel

Field Summary
static int ABOUT
          Id for a menu with an About item.
static int BIDI
          Id for a menu that sets the primary run direction for a paragraph.
static int EDIT
          Id for an Edit menu.
static int FLUSH
          Id for a paragraph alignment menu.
static int KEYMAP
          Id for a menu that sets the KeyRemap on an MTextPanel.
static int SIZE
          Id for the point sizes menu.
static int STYLE
          Id for a Style menu.
 
Fields inherited from class com.ibm.richtext.uiimpl.MenuBuilder
defaultMenus, fDialogParent, fTextPanel
 
Method Summary
protected  DialogItem.DialogFactory createAboutDialogFactory()
           
 void createMenus(javax.swing.JMenuBar menuBar, MTextPanel textPanel, java.awt.Frame frame)
          Add a standard set of menus to the given menu bar.
 void createMenus(javax.swing.JMenuBar menuBar, MTextPanel textPanel, java.awt.Frame frame, int[] menus)
          Add a set of menus to the given menu bar.
protected  DialogItem.DialogFactory createNumberDialogFactory(java.lang.String dialogTitle, java.lang.String dialogMessage, java.lang.Object key, boolean character)
           
protected  DialogItem.DialogFactory createObjectDialogFactory(java.lang.String dialogTitle, java.lang.String dialogMessage, java.lang.Object key, boolean character, java.lang.String[] names, java.lang.Object[] values)
           
static SwingMenuBuilder getInstance()
          Return an instance of SwingMenuBuilder.
protected  void handleAddMenu(java.lang.String key)
           
 
Methods inherited from class com.ibm.richtext.uiimpl.MenuBuilder
doCreateMenus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDIT

public static final int EDIT
Id for an Edit menu. The Edit menu has the following items:

SIZE

public static final int SIZE
Id for the point sizes menu. The menu has items that set the size of a character in a typeface.

STYLE

public static final int STYLE
Id for a Style menu. The Style menu has the following items:

FLUSH

public static final int FLUSH
Id for a paragraph alignment menu. The menu has the following items:

KEYMAP

public static final int KEYMAP
Id for a menu that sets the KeyRemap on an MTextPanel. The menu has the following items:

BIDI

public static final int BIDI
Id for a menu that sets the primary run direction for a paragraph. Run direction can be left-to-right, right-to-left, or can use the default run direction from the Unicode bidi algorithm.

ABOUT

public static final int ABOUT
Id for a menu with an About item. When selected, the item displays a Frame containing some self-promotional text.
Method Detail

getInstance

public static SwingMenuBuilder getInstance()
Return an instance of SwingMenuBuilder.

createMenus

public void createMenus(javax.swing.JMenuBar menuBar,
                        MTextPanel textPanel,
                        java.awt.Frame frame)
Add a standard set of menus to the given menu bar. The menus will interact with the given MTextPanel.
Parameters:
menuBar - the MenuBar to which menus are added
textPanel - the MTextPanel with which the menus interact
frame - a Frame to use as the parent of any dialogs created by a a menu item. If null, menu items which create dialogs will be omitted.

createMenus

public void createMenus(javax.swing.JMenuBar menuBar,
                        MTextPanel textPanel,
                        java.awt.Frame frame,
                        int[] menus)
Add a set of menus to the given menu bar. The menus will interact with the given MTextPanel.
Parameters:
menuBar - the MenuBar to which menus are added
textPanel - the MTextPanel with which the menus interact
frame - a Frame to use as the parent of any dialogs created by a a menu item. If null, menu items which create dialogs will be omitted.
menus - an array of integer menu id's. Each element of the array must be one of this class's menu id constants. If null, the default menus are created.

handleAddMenu

protected void handleAddMenu(java.lang.String key)
Overrides:
handleAddMenu in class MenuBuilder

createObjectDialogFactory

protected DialogItem.DialogFactory createObjectDialogFactory(java.lang.String dialogTitle,
                                                             java.lang.String dialogMessage,
                                                             java.lang.Object key,
                                                             boolean character,
                                                             java.lang.String[] names,
                                                             java.lang.Object[] values)
Overrides:
createObjectDialogFactory in class MenuBuilder

createNumberDialogFactory

protected DialogItem.DialogFactory createNumberDialogFactory(java.lang.String dialogTitle,
                                                             java.lang.String dialogMessage,
                                                             java.lang.Object key,
                                                             boolean character)
Overrides:
createNumberDialogFactory in class MenuBuilder

createAboutDialogFactory

protected DialogItem.DialogFactory createAboutDialogFactory()
Overrides:
createAboutDialogFactory in class MenuBuilder


Copyright (c) 2001 IBM Corporation and others.