org.ceryle.ui
Class BookmarksMenu
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JMenuItem
javax.swing.JMenu
org.ceryle.ui.BookmarksMenu
- All Implemented Interfaces:
- ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, MenuElement, SwingConstants
public class BookmarksMenu
- extends JMenu
Extends JMenu to add bookmark functionality, similar to a web browser
bookmark menu, i.e., a means of storing references to commonly-used
resources via URLs. Includes importing and exporting features using
the pseudo-HTML format of Netscape and Mozilla.
- Since:
- JDK1.3
- Version:
- $Id: BookmarksMenu.java,v 3.10 2007-06-20 01:28:15 altheim Exp $
- Author:
- Murray Altheim
- See Also:
- Serialized Form
|
Nested Class Summary |
protected class |
BookmarksMenu.LinkMenuItem
An inner class extension of JMenuItem that contains a LinkRef, so that
the menu item can have both a title and a URI reference. |
|
Field Summary |
protected static String |
bookmarkClose
A String used at the end of a bookmark file. |
protected static String |
bookmarkEntryEnd
A String used to search for the end of a entry in a bookmark file. |
protected static String |
bookmarkEntryKey
A String used to search for the beginning of a entry in a bookmark file. |
protected static String |
bookmarkKey
A String used to search for the beginning of a bookmark file. |
static int |
maxItemCount
The maximum number of bookmarks to be stored on the menu. |
| Fields inherited from class javax.swing.AbstractButton |
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
|
Method Summary |
void |
addBookmark()
Add the current URI of the location bar list to the bookmark list. |
void |
addBookmark(LinkRef linkref)
Add the URI uri to the bookmark list. |
void |
addBookmark(String s)
Add the String s to the bookmark list. |
void |
editBookmarks()
Edit the current bookmark list. |
boolean |
exportBookmarkFile(File file,
boolean asXHTML)
Displays a save file dialog, exporting the current
bookmarks to the chosen pathname. |
Iterator |
getBookmarks()
Return an iterator over the LinkMenuItems in the bookmark list as
LinkRefs, null if the list is empty. |
Iterator |
getBookmarksAsText(boolean browserStyle)
Return an iterator over the LinkMenuItems in the bookmark list as Strings,
null if the list is empty. |
Iterator |
importBookmarkFile()
Displays an open file dialog, importing the selected
bookmark file into a list of LinkRef objects, returned
as an Iterator. |
static LinkRef |
parseBookmarkEntry(String line)
Parses a line from a bookmark file, returning a LinkRef. |
void |
setBookmarks(Iterator list)
Sets the bookmark list to the contents of the Iterator list
(whose contents are expected to be LinkRefs), clearing the list if null. |
| Methods inherited from class javax.swing.JMenu |
add, add, add, add, add, addMenuListener, addSeparator, applyComponentOrientation, configurePropertiesFromAction, createActionChangeListener, createActionComponent, createWinListener, doClick, fireMenuCanceled, fireMenuDeselected, fireMenuSelected, getAccessibleContext, getComponent, getDelay, getItem, getItemCount, getMenuComponent, getMenuComponentCount, getMenuComponents, getMenuListeners, getPopupMenu, getPopupMenuOrigin, getSubElements, getUIClassID, insert, insert, insert, insertSeparator, isMenuComponent, isPopupMenuVisible, isSelected, isTearOff, isTopLevelMenu, menuSelectionChanged, paramString, processKeyEvent, remove, remove, remove, removeAll, removeMenuListener, setAccelerator, setComponentOrientation, setDelay, setMenuLocation, setModel, setPopupMenuVisible, setSelected, updateUI |
| Methods inherited from class javax.swing.JMenuItem |
addMenuDragMouseListener, addMenuKeyListener, createActionPropertyChangeListener, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getMenuDragMouseListeners, getMenuKeyListeners, init, isArmed, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setArmed, setEnabled, setUI |
| Methods inherited from class javax.swing.AbstractButton |
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createChangeListener, createItemListener, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
maxItemCount
public static int maxItemCount
- The maximum number of bookmarks to be stored on the menu.
bookmarkKey
protected static String bookmarkKey
- A String used to search for the beginning of a bookmark file.
bookmarkEntryKey
protected static String bookmarkEntryKey
- A String used to search for the beginning of a entry in a bookmark file.
bookmarkEntryEnd
protected static String bookmarkEntryEnd
- A String used to search for the end of a entry in a bookmark file.
bookmarkClose
protected static String bookmarkClose
- A String used at the end of a bookmark file.
BookmarksMenu
public BookmarksMenu(Desktop desktop)
- Constructor with parent Desktop desktop.
- Parameters:
desktop - the Desktop providing all the essentials
addBookmark
public void addBookmark()
- Add the current URI of the location bar list to the bookmark list.
addBookmark
public void addBookmark(String s)
- Add the String s to the bookmark list. If it contains
a space, assume all content following the space is the link text.
addBookmark
public void addBookmark(LinkRef linkref)
- Add the URI uri to the bookmark list.
getBookmarksAsText
public Iterator getBookmarksAsText(boolean browserStyle)
- Return an iterator over the LinkMenuItems in the bookmark list as Strings,
null if the list is empty. Backed by a TreeSet, duplicate URIs are
included only the first time they occur. If the boolean browserStyle
is true, use browser bookmark style notation.
getBookmarks
public Iterator getBookmarks()
- Return an iterator over the LinkMenuItems in the bookmark list as
LinkRefs, null if the list is empty. Backed by a TreeSet, duplicate
URIs are included only the first time they occur.
importBookmarkFile
public Iterator importBookmarkFile()
- Displays an open file dialog, importing the selected
bookmark file into a list of LinkRef objects, returned
as an Iterator. If for any reason this fails or the
iterator is empty, null is returned.
parseBookmarkEntry
public static LinkRef parseBookmarkEntry(String line)
- Parses a line from a bookmark file, returning a LinkRef.
exportBookmarkFile
public boolean exportBookmarkFile(File file,
boolean asXHTML)
- Displays a save file dialog, exporting the current
bookmarks to the chosen pathname. Returns true if
the file was exported. If asXHTML is true, exports
as valid XHTML rather than the Netscape pseudo-HTML notation.
editBookmarks
public void editBookmarks()
- Edit the current bookmark list.
setBookmarks
public void setBookmarks(Iterator list)
- Sets the bookmark list to the contents of the Iterator list
(whose contents are expected to be LinkRefs), clearing the list if null.
The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.