com.ca.directory.jxplorer
Class BookMarks

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
                          |
                          +--javax.swing.JDialog
                                |
                                +--com.ca.commons.cbutil.CBDialog
                                      |
                                      +--com.ca.directory.jxplorer.BookMarks
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class BookMarks
extends CBDialog

Opens a bookmark dialog that can be used to save, delete or update bookmarks. It uses a property file called 'bookmarks.txt' to store the bookmarks in the following format:

dn.name=something e.g: dn.DEMOCORP=o=DEMOCORP,c=AU
desc.name=something e.g: desc.DEMOCORP=A sample directory.

The name part (e.g: DEMOCORP) is used as the title of the bookmark in the combo box.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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
 
Fields inherited from class com.ca.commons.cbutil.CBDialog
buttonPanel, Cancel, display, Help, OK, owner
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
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, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BookMarks(JXplorer jx, DN dn)
          Constructor that sets up the GUI for the bookmark dialog.
 
Method Summary
protected  void addBookmark()
          Updates or adds a bookmark by saving the bookmark to the property file.
protected  boolean checkIfBookmarkExists(java.lang.String name)
          Returns true or false depending on if a bookmark exists in the property file 'bookmarks.txt'.
 boolean contains(CBJComboBox combo, java.lang.String item)
          Returns true if a combo box contains an item.
protected  void deleteBookmark()
          Deletes a bookmark from the combo box and from the property file: bookmarks.txt.
protected  void displayBookmarkDetails()
          Displays bookmark details such as it's DN and it's description of the bookmark that is displayed in the combo box.
 void doCancel()
          When the user hits 'cancel', the window shuts and the bookmark menu is updated.
 void doOK()
          Checks if the current bookmark has been saved, updates the bookmark menu then exits.
protected  java.lang.String getCurrentRDN(java.lang.String dn)
          Takes a DN and returns it's current lowest RDN.
protected  boolean isValidDN()
          Checks if the DN equals 'cn=no entries' or contains only spaces.
protected  boolean isValidName()
          Checks if the Name contains only spaces.
protected  void populateBookmarks()
          Populates the bookmark dialog by reading all the bookmarks from the property file bookmark.txt.
 
Methods inherited from class com.ca.commons.cbutil.CBDialog
add, addln, escKeyCheck, getDisplayPanel, makeHeavy, makeLight, makeWide, quit, setHelpLink, wasCancelled
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, 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.Dialog
addNotify, dispose, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
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, removeNotify, 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, remove, 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
 

Constructor Detail

BookMarks

public BookMarks(JXplorer jx,
                 DN dn)
Constructor that sets up the GUI for the bookmark dialog.

Parameters:
jx - jxplorer (parent component).
Method Detail

populateBookmarks

protected void populateBookmarks()
Populates the bookmark dialog by reading all the bookmarks from the property file bookmark.txt. It then adds the bookmark names to the combo box and sets the dn & description fields of the bookmark that is being display. If a user is adding a bookmark, this will be the one being displayed. Otherwise if the bookmarks are being editied a bookmark from the property file is displayed.


displayBookmarkDetails

protected void displayBookmarkDetails()
Displays bookmark details such as it's DN and it's description of the bookmark that is displayed in the combo box.


deleteBookmark

protected void deleteBookmark()
Deletes a bookmark from the combo box and from the property file: bookmarks.txt.


addBookmark

protected void addBookmark()
Updates or adds a bookmark by saving the bookmark to the property file.


isValidName

protected boolean isValidName()
Checks if the Name contains only spaces. A Name is considered invalid if this is the case therefore this method will return false. Otherwise true is returned. This method can be expanded to do other checking in the future.

Returns:
true if the Name doesn't contains only spaces, false otherwise.

isValidDN

protected boolean isValidDN()
Checks if the DN equals 'cn=no entries' or contains only spaces. A DN is considered invalid if this is the case therefore this method will return false. Otherwise true is returned. This method can be expanded to do other checking in the future.

Returns:
true if the DN doesn't equal 'cn=no entries' or doesn't contains only spaces, false otherwise.

contains

public boolean contains(CBJComboBox combo,
                        java.lang.String item)
Returns true if a combo box contains an item.

Parameters:
combo - the combo box that is to be checked.
item - the string that the combo box is being checked for.
Returns:
true if the item is in the combo box, false otherwise.

getCurrentRDN

protected java.lang.String getCurrentRDN(java.lang.String dn)
Takes a DN and returns it's current lowest RDN.

Parameters:
dn - the DN which we will get the RDN from.
Returns:
the RDN of the DN.

checkIfBookmarkExists

protected boolean checkIfBookmarkExists(java.lang.String name)
Returns true or false depending on if a bookmark exists in the property file 'bookmarks.txt'.

Parameters:
name - the name of the book mark which is part of the key (i.e. dn.name).
Returns:
true if the bookmark exists, false if not.

doOK

public void doOK()
Checks if the current bookmark has been saved, updates the bookmark menu then exits.

Overrides:
doOK in class CBDialog

doCancel

public void doCancel()
When the user hits 'cancel', the window shuts and the bookmark menu is updated.

Overrides:
doCancel in class CBDialog