com.jgoodies.uifextras.history
Class History<E>

java.lang.Object
  extended by com.jgoodies.binding.beans.Model
      extended by com.jgoodies.uifextras.history.History<E>
Type Parameters:
E - the type of the elements in this history
All Implemented Interfaces:
com.jgoodies.binding.beans.Observable, Serializable
Direct Known Subclasses:
HelpHistory

public class History<E>
extends com.jgoodies.binding.beans.Model

A class that provides the state and behavior for a back-next navigation.

Version:
$Revision: 1.22 $
Author:
Karsten Lentzsch
See Also:
Serialized Form

Field Summary
static String ACTION_GO_BACK
           
static String ACTION_GO_HOME
           
static String ACTION_GO_NEXT
           
static String PROPERTYNAME_HOME
           
static String PROPERTYNAME_SELECTION
           
 
Constructor Summary
History(int capacity)
          Constructs a History with the given maximum capacity.
History(int capacity, String goBackActionName, String goNextActionName, String goHomeActionName)
          Constructs a History with the given maximum capacity.
 
Method Summary
protected  String createToolTip(E element)
          Creates and returns a tool tip for the given object; clips the string's center, if it exceeds a maximum length.
 JPopupMenu getBackPopupMenu()
           
 Action getGoBackAction()
           
 Action getGoHomeAction()
           
 Action getGoNextAction()
           
 E getHome()
           
 JPopupMenu getNextPopupMenu()
           
 E getSelection()
           
 void goBack()
           
 void goHome()
           
 void goNext()
           
 void removeAll(E element)
          Removes all occurrences of element in this history.
 void removeAndGoBack(E element)
          Removes all occurrences of element and goes back to the previous element.
 void reset()
          Resets the history: clears the list, and disables all actions.
 void setHome(E newHome)
          Sets the given element as new home element.
 void setSelection(E newSelection)
          Sets the given element as new selection.
 
Methods inherited from class com.jgoodies.binding.beans.Model
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, equals, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTYNAME_HOME

public static final String PROPERTYNAME_HOME
See Also:
Constant Field Values

PROPERTYNAME_SELECTION

public static final String PROPERTYNAME_SELECTION
See Also:
Constant Field Values

ACTION_GO_BACK

public static final String ACTION_GO_BACK
See Also:
Constant Field Values

ACTION_GO_NEXT

public static final String ACTION_GO_NEXT
See Also:
Constant Field Values

ACTION_GO_HOME

public static final String ACTION_GO_HOME
See Also:
Constant Field Values
Constructor Detail

History

public History(int capacity)
Constructs a History with the given maximum capacity.

Parameters:
capacity - the maximum number of elements in the List.

History

public History(int capacity,
               String goBackActionName,
               String goNextActionName,
               String goHomeActionName)
Constructs a History with the given maximum capacity. Expects custom action resource keys that can be used to override the default action configuration.

Parameters:
capacity - the maximum number of elements in the List.
goBackActionName - the resource key for the go-back Action
goNextActionName - the resource key for the go-next Action
goHomeActionName - the resource key for the go-home Action
Method Detail

getHome

public E getHome()
Returns:
the element that has been set as home element, which becomes the new selection if the go-home operation is performed.
See Also:
setHome(Object)

setHome

public void setHome(E newHome)
Sets the given element as new home element. It is set when the go-home operation is performed.

Parameters:
newHome - the element to become the new home element

getSelection

public E getSelection()
Returns:
the current selection

setSelection

public void setSelection(E newSelection)
Sets the given element as new selection.

Parameters:
newSelection - the object to be set as new selection

removeAll

public void removeAll(E element)
Removes all occurrences of element in this history.

Parameters:
element - the element to be removed

removeAndGoBack

public void removeAndGoBack(E element)
Removes all occurrences of element and goes back to the previous element.

Parameters:
element - the element to be removed

reset

public void reset()
Resets the history: clears the list, and disables all actions.


goBack

@Action(name="history.goBack")
public void goBack()

goNext

@Action(name="history.goNext")
public void goNext()

goHome

@Action(name="history.goHome")
public void goHome()

getGoBackAction

public Action getGoBackAction()
Returns:
the Action that performs the goBack() operation

getGoNextAction

public Action getGoNextAction()
Returns:
the Action that performs the goNext() operation

getGoHomeAction

public Action getGoHomeAction()
Returns:
the Action that performs the goHome() operation

getBackPopupMenu

public JPopupMenu getBackPopupMenu()
Returns:
the popup menu that consists of menu items for back operations

getNextPopupMenu

public JPopupMenu getNextPopupMenu()
Returns:
the popup menu that consists of menu items for next operations

createToolTip

protected String createToolTip(E element)
Creates and returns a tool tip for the given object; clips the string's center, if it exceeds a maximum length.

Parameters:
element - the object to extract the tooltip text from
Returns:
the tooltip string extracted from the given target


Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.