com.ca.directory.jxplorer
Class MainMenu

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JMenuBar
                          |
                          +--com.ca.directory.jxplorer.MainMenu
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.MenuElement, java.io.Serializable

public class MainMenu
extends javax.swing.JMenuBar

See Also:
Serialized Form

Nested Class Summary
 class MainMenu.myJMenuItem
          Extends JMenuItem to add a public string that can be used to store the name of the menu item.
 
Nested classes inherited from class javax.swing.JMenuBar
javax.swing.JMenuBar.AccessibleJMenuBar
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String fileURLPrefix
           
static java.lang.String localDir
           
static java.util.Properties myProperties
           
static java.lang.String propertyFile
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MainMenu(JXplorer jxplorer)
           
 
Method Summary
 void connect()
           
 void disconnect()
           
 void doSearch(java.lang.String name, java.lang.String filter)
          Runs the search.
protected  javax.swing.JScrollPane getScrollList(java.lang.Object[] items, java.lang.String[] toolTips, javax.swing.JMenu menuType)
          Sets up a scrollable list with given items and tooltips.
 void goToBookmark(java.lang.String dn, SmartTree tree)
          Tries to display the entry that the user asks for via a bookmark.
 void importFile()
           
 void ldifFullExport(SmartTree activeTree, boolean usingSearch)
           
 void ldifSubExport(SmartTree activeTree, boolean usingSearch)
           
 void print()
           
 void setBookmarksEnabled(boolean state)
          Enables or disables the bookmark menu items (not the add or edit items - just the actual saved bookmarks).
protected  void setCheckBoxMenu(javax.swing.JMenu menu, java.lang.String[][] menuItems, java.awt.event.ActionListener listener)
          Similar to @setMenu, but for checkboxes.
 void setConnected(boolean searchActive)
          Called by JX to turn appropriate buttons on.
 void setDisconnected()
           
 void setImageDirs()
          Sets the image & icon paths.
protected  void setMenu(javax.swing.JMenu menu, java.lang.String[][] menuItems, java.awt.event.ActionListener listener)
          Utility function; sets up a menu with a bunch of menu items defined as strings, with tooltips and enabled/disabled state.
protected  javax.swing.JMenuItem setMenuItem(javax.swing.JMenu menu, java.awt.event.ActionListener listener, java.lang.String[] menuItems)
          Sets up a menu item with a list of strings
protected  javax.swing.JMenuItem setMenuItem(javax.swing.JMenu menu, javax.swing.JMenuItem item, java.awt.event.ActionListener listener, java.lang.String[] menuItems)
          Sets up a menu item with a list of strings
protected  void setMenuItemState(javax.swing.JMenu menu, javax.swing.JMenuItem menuItem, java.lang.String mnemonic, java.lang.String toolTipText, boolean enabled)
          Takes a menu Item and sets up state information such as the mnemonic, the tool tip text and the enabled/disabled state.
 void setSearchEnabled(boolean state)
          Enables or disables the search menu items (below the separator).
protected  void setUpAdvancedOptions()
          Sets up the advanced options dialog (written so that it is set up when the user clicks on the menu item instead of being set up when JX starts.
protected  void setupBookmarkMenu(javax.swing.JMenu bookmarkMenu)
          Sets up the bookmark menu with menu items and listeners.
 void setupEditMenu(javax.swing.JMenu editMenu)
           
protected  void setupFileMenu(javax.swing.JMenu fileMenu)
           
protected  void setupHelpMenu(javax.swing.JMenu helpMenu)
           
 void setupLdifMenu(javax.swing.JMenu ldifMenu)
           
protected  void setupLookAndFeelMenu(javax.swing.JMenu lookAndFeelMenu)
          View menu setup.
protected  void setupOptionsMenu(javax.swing.JMenu optionsMenu)
          This is a bit evil - it links various options, saved in the dxconfig.txt java properties file, with user menu items.
protected  void setupSearchMenu(javax.swing.JMenu searchMenu)
          Sets up the search menu with menu items and listeners.
protected  void setupSSLMenu(javax.swing.JMenu sslMenu)
           
protected  void setupToolsMenu(javax.swing.JMenu toolsMenu)
           
 void showAboutMessage()
          Displays an about dialog in the center of JXplorer.
 void updateBookmarkMenu()
          Calls the set up for the bookmark menu.
 void updateSearchMenu()
          Calls the set up for the search menu.
 void viewOffline()
           
 
Methods inherited from class javax.swing.JMenuBar
add, addNotify, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getHelpMenu, getMargin, getMenu, getMenuCount, getSelectionModel, getSubElements, getUI, getUIClassID, isBorderPainted, isSelected, menuSelectionChanged, paintBorder, paramString, processKeyBinding, processKeyEvent, processMouseEvent, removeNotify, setBorderPainted, setHelpMenu, setMargin, setSelected, setSelectionModel, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myProperties

public static java.util.Properties myProperties

propertyFile

public static java.lang.String propertyFile

localDir

public static java.lang.String localDir

fileURLPrefix

public static java.lang.String fileURLPrefix
Constructor Detail

MainMenu

public MainMenu(JXplorer jxplorer)
Method Detail

setupFileMenu

protected void setupFileMenu(javax.swing.JMenu fileMenu)

connect

public void connect()

setConnected

public void setConnected(boolean searchActive)
Called by JX to turn appropriate buttons on.


disconnect

public void disconnect()

setDisconnected

public void setDisconnected()

print

public void print()

setupEditMenu

public void setupEditMenu(javax.swing.JMenu editMenu)

setupLdifMenu

public void setupLdifMenu(javax.swing.JMenu ldifMenu)

ldifFullExport

public void ldifFullExport(SmartTree activeTree,
                           boolean usingSearch)

ldifSubExport

public void ldifSubExport(SmartTree activeTree,
                          boolean usingSearch)

importFile

public void importFile()

viewOffline

public void viewOffline()

setupSearchMenu

protected void setupSearchMenu(javax.swing.JMenu searchMenu)
Sets up the search menu with menu items and listeners. Dynamically adds search filter names to the menu. If there is more than 15, these names are added to a scrollable list. A search is conducted if a user selects one of these names.

Parameters:
searchMenu - the actual search menu that needs to be set up.

doSearch

public void doSearch(java.lang.String name,
                     java.lang.String filter)
Runs the search. Uses the saved search params from the property file if there is any.

Parameters:
name - the name of the saved filter.
filter - the LDAP filter.

setSearchEnabled

public void setSearchEnabled(boolean state)
Enables or disables the search menu items (below the separator).

Parameters:
state - disabled if false, enabled if true.

updateSearchMenu

public void updateSearchMenu()
Calls the set up for the search menu. Used to dynamically update the filter names within the search menu.


getScrollList

protected javax.swing.JScrollPane getScrollList(java.lang.Object[] items,
                                                java.lang.String[] toolTips,
                                                javax.swing.JMenu menuType)
Sets up a scrollable list with given items and tooltips. Adds a listener to each list item.

Parameters:
items - an array of things (usually strings that are added to the list.
toolTips - and array of strings used as the tooltips for the items (i.e. tooltip[x] goes with item[x]).
menuType - the menu that the listener is reponding to (either the search menu or the bookmark menu).
Returns:
the scroll pane with the list and listeners added.

setupBookmarkMenu

protected void setupBookmarkMenu(javax.swing.JMenu bookmarkMenu)
Sets up the bookmark menu with menu items and listeners. Dynamically adds bookmark names to the menu. If there is more than 15, these names are added to a scrollable list. If a user selects one of these names, the tree jumps to that entry.

Parameters:
bookmarkMenu - the bookmark menu.

setBookmarksEnabled

public void setBookmarksEnabled(boolean state)
Enables or disables the bookmark menu items (not the add or edit items - just the actual saved bookmarks).

Parameters:
state - disabled if false, enabled if true.

updateBookmarkMenu

public void updateBookmarkMenu()
Calls the set up for the bookmark menu. Used to dynamically update the bookmark names within the bookmark menu.


goToBookmark

public void goToBookmark(java.lang.String dn,
                         SmartTree tree)
Tries to display the entry that the user asks for via a bookmark. It tries to expand the children of all the parents instead of just displaying the direct parents of the entry in question.

Parameters:
dn - the dn of the entry that is to be opened.
tree - the tree that holds all the entries.

setupLookAndFeelMenu

protected void setupLookAndFeelMenu(javax.swing.JMenu lookAndFeelMenu)
View menu setup. Adds two check boxes; the first is for displaying the button bar and the second is for displaying the search bar in JX.


setupOptionsMenu

protected void setupOptionsMenu(javax.swing.JMenu optionsMenu)
This is a bit evil - it links various options, saved in the dxconfig.txt java properties file, with user menu items. To do this requires a few quick utility classes derived from menu items, which automatically read and set various properties.


setUpAdvancedOptions

protected void setUpAdvancedOptions()
Sets up the advanced options dialog (written so that it is set up when the user clicks on the menu item instead of being set up when JX starts. The problem with advanced options being set up when JX starts (or really when MainMenu is set up) is that it forces CBHelpSystem to over ride the Thread priority so that a Help Set is supplied.


setupSSLMenu

protected void setupSSLMenu(javax.swing.JMenu sslMenu)

setupToolsMenu

protected void setupToolsMenu(javax.swing.JMenu toolsMenu)

setupHelpMenu

protected void setupHelpMenu(javax.swing.JMenu helpMenu)

showAboutMessage

public void showAboutMessage()
Displays an about dialog in the center of JXplorer.


setMenu

protected void setMenu(javax.swing.JMenu menu,
                       java.lang.String[][] menuItems,
                       java.awt.event.ActionListener listener)
Utility function; sets up a menu with a bunch of menu items defined as strings, with tooltips and enabled/disabled state.

... assumes listeners will be created for them elsewhere, and registered here.

Parameters:
menu - the menu object to add this menu item to
menuItems - an array of string arrays defining the various menu items:
each string array should have 4 elements: {"item name", "mnemonic", "tool tip text", enabled/disabled state ("E"/"D")}
listener - - a thingumy to monitor the menu item, and do something if it's checked.

setMenuItem

protected javax.swing.JMenuItem setMenuItem(javax.swing.JMenu menu,
                                            java.awt.event.ActionListener listener,
                                            java.lang.String[] menuItems)
Sets up a menu item with a list of strings

Parameters:
menu - the menu to add this menu item to
menuItems - - an array of 4 strings; the name, the hot key, the tip, and a single letter 'E' or 'D' for enabled/disabled
listener - an action listener for this menu item.
Returns:
the created menu item

setMenuItem

protected javax.swing.JMenuItem setMenuItem(javax.swing.JMenu menu,
                                            javax.swing.JMenuItem item,
                                            java.awt.event.ActionListener listener,
                                            java.lang.String[] menuItems)
Sets up a menu item with a list of strings

Parameters:
menu - the menu to add this menu item to
menuItems - - an array of 4 strings; the name, the hot key, the tip, and a single letter 'E' or 'D' for enabled/disabled
listener - an action listener for this menu item.
Returns:
the created menu item

setCheckBoxMenu

protected void setCheckBoxMenu(javax.swing.JMenu menu,
                               java.lang.String[][] menuItems,
                               java.awt.event.ActionListener listener)
Similar to @setMenu, but for checkboxes. Note arguments; the string array is an element longer (to allow setting of check box state).

Parameters:
menu - the menu object to add this menu item to
menuItems - an array of string arrays defining the various menu items:
each string array should have 5 elements: {"item name", "mnemonic", "tool tip text", enabled/disabled state ("E"/"D"), and checked/unchecked state ("C"/"U") }
listener - - a thingumy to monitor the menu item, and do something if it's checked.

setMenuItemState

protected void setMenuItemState(javax.swing.JMenu menu,
                                javax.swing.JMenuItem menuItem,
                                java.lang.String mnemonic,
                                java.lang.String toolTipText,
                                boolean enabled)
Takes a menu Item and sets up state information such as the mnemonic, the tool tip text and the enabled/disabled state.

Parameters:
menu - the parent menu.
menuItem - the menu item being modified
mnemonic - the hot key (alt-'key', or prefixed with "ctr"+'key')
toolTipText - text displayed when the mouse hovers over component
enabled - whether the menu item is active, or greyed out.

setImageDirs

public void setImageDirs()
Sets the image & icon paths.