JAPI 0.9.0
Yet another Java API
API Documentation

net.sf.japi.swing.bookmarks
Class BookmarkManager.Bookmark

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by net.sf.japi.swing.bookmarks.BookmarkManager.Bookmark
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action, MutableTreeNode, TreeNode
Direct Known Subclasses:
BookmarkManager.BookmarkFolder, BookmarkManager.BookmarkItem, BookmarkManager.BookmarkSeparator
Enclosing class:
BookmarkManager

public abstract static class BookmarkManager.Bookmark
extends AbstractAction
implements MutableTreeNode

Base class for bookmarks. There are two kinds of bookmarks:

Version:
$Id: BookmarkManager.java,v 1.2 2006/03/26 15:22:16 christianhujer Exp $
Author:
Christian Hujer
See Also:
Serialized Form

Field Summary
protected  BookmarkManager.BookmarkFolder folder
          The folder (parent) of this bookmark.
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
protected BookmarkManager.Bookmark(String title)
          Create a Bookmark.
 
Method Summary
 Enumeration<BookmarkManager.Bookmark> children()
          Returns the children of the receiver as an Enumeration.
abstract  JMenuItem createMenu()
          Create a MenuItem for this Bookmark
 boolean getAllowsChildren()
          Returns true if the receiver allows children.
 BookmarkManager.Bookmark getChildAt(int childIndex)
          Returns the child TreeNode at index childIndex.
 int getChildCount()
          Returns the number of children TreeNodes the receiver contains.
 BookmarkManager.BookmarkFolder getFolder()
          Get the folder (parent) of this bookmark.
 int getIndex(TreeNode node)
          Returns the index of node in the receivers children.
 BookmarkManager.BookmarkFolder getParent()
          Returns the parent TreeNode of the receiver.
 String getTitle()
          Get this Bookmark's title.
 void insert(MutableTreeNode child, int index)
          Adds child to the receiver at index.
 boolean isLeaf()
          Returns true if the receiver is a leaf.
 void remove(int index)
          Removes the child at index from the receiver.
 void remove(MutableTreeNode child)
          Removes node from the receiver.
 void removeFromParent()
          Removes the receiver from its parent.
 void setFolder(BookmarkManager.BookmarkFolder folder)
          Set the folder (parent) of this bookmark.
 void setParent(MutableTreeNode newParent)
          Sets the parent of the receiver to newParent.
 void setTitle(String title)
          Set this Bookmark's title.
 void setUserObject(Object object)
          Resets the user object of the receiver to object.
abstract  void store(Node n)
          Store bookmarks in an XML Document.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Field Detail

folder

protected BookmarkManager.BookmarkFolder folder
The folder (parent) of this bookmark.

Constructor Detail

BookmarkManager.Bookmark

protected BookmarkManager.Bookmark(String title)
Create a Bookmark. You must not forget to invoke #setFolder(BookmarkFolder) in order to make getParent() for JTrees working.

Parameters:
title - title for Bookmark
Method Detail

toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class Object
Returns:
title of this Bookmark

getFolder

public BookmarkManager.BookmarkFolder getFolder()
Get the folder (parent) of this bookmark.

Returns:
folder (parent) of this bookmark

setFolder

public void setFolder(BookmarkManager.BookmarkFolder folder)
Set the folder (parent) of this bookmark.

Parameters:
folder - parent folder of this bookmark

setTitle

public void setTitle(String title)
Set this Bookmark's title.

Parameters:
title - new title for this Bookmark

createMenu

public abstract JMenuItem createMenu()
Create a MenuItem for this Bookmark

Returns:
MenuItem for this Bookmark

getTitle

public String getTitle()
Get this Bookmark's title.

Returns:
Bookmark title

store

public abstract void store(Node n)
Store bookmarks in an XML Document.

Parameters:
n - Node (Element or Document) to attach to

children

public Enumeration<BookmarkManager.Bookmark> children()
Returns the children of the receiver as an Enumeration.

Specified by:
children in interface TreeNode

getAllowsChildren

public boolean getAllowsChildren()
Returns true if the receiver allows children.

Specified by:
getAllowsChildren in interface TreeNode

getChildAt

public BookmarkManager.Bookmark getChildAt(int childIndex)
Returns the child TreeNode at index childIndex.

Specified by:
getChildAt in interface TreeNode

getChildCount

public int getChildCount()
Returns the number of children TreeNodes the receiver contains.

Specified by:
getChildCount in interface TreeNode

getIndex

public int getIndex(TreeNode node)
Returns the index of node in the receivers children. If the receiver does not contain node, -1 will be returned.

Specified by:
getIndex in interface TreeNode

getParent

public BookmarkManager.BookmarkFolder getParent()
Returns the parent TreeNode of the receiver.

Specified by:
getParent in interface TreeNode

isLeaf

public boolean isLeaf()
Returns true if the receiver is a leaf.

Specified by:
isLeaf in interface TreeNode

insert

public void insert(MutableTreeNode child,
                   int index)
Adds child to the receiver at index. child will be messaged with setParent.

Specified by:
insert in interface MutableTreeNode

remove

public void remove(int index)
Removes the child at index from the receiver.

Specified by:
remove in interface MutableTreeNode

remove

public void remove(MutableTreeNode child)
Removes node from the receiver. setParent will be messaged on node.

Specified by:
remove in interface MutableTreeNode

removeFromParent

public void removeFromParent()
Removes the receiver from its parent.

Specified by:
removeFromParent in interface MutableTreeNode

setParent

public void setParent(MutableTreeNode newParent)
Sets the parent of the receiver to newParent.

Specified by:
setParent in interface MutableTreeNode

setUserObject

public void setUserObject(Object object)
Resets the user object of the receiver to object.

Specified by:
setUserObject in interface MutableTreeNode

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright