mk.fsgrep.gui
Class RecentProfiles

java.lang.Object
  extended by mk.fsgrep.gui.RecentProfiles

public class RecentProfiles
extends java.lang.Object

A utility that keep a record of recently referenced scan profiles.

Author:
Murali Krishnan

Field Summary
protected static java.lang.String PERSISTENT_PREFIX
           
 
Constructor Summary
protected RecentProfiles()
           
 
Method Summary
 void add(java.lang.String entry, Finder pFinder)
          Add an entry to the (front of) list.
 boolean contains(java.lang.String key)
          Determine whether the given spec is on the list.
 Finder get(java.lang.String key)
          Lookup the Finder object for a given spec.
 java.lang.String getCurrent()
          Give the "currently selected spec" by giving the first one on the list.
protected  MRUList getList()
           
protected  java.util.Map<java.lang.String,Finder> getMap()
           
 boolean isEmpty()
          Determine whether the list of specs is empty.
 java.util.Iterator<java.lang.String> iterator()
           
 void keepFirst()
          Remove all items except the first one (current).
 void readData(Fsgrep model)
          Read the stored profiles from the persistent data.
protected  void refreshMap(Fsgrep model)
          Clear the map, then (re)populate it.
 void select(java.lang.String key)
          A callback function for the GUI that gets called when the user selects a spec from the list.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PERSISTENT_PREFIX

protected static final java.lang.String PERSISTENT_PREFIX
See Also:
Constant Field Values
Constructor Detail

RecentProfiles

protected RecentProfiles()
Method Detail

getList

protected MRUList getList()

getMap

protected java.util.Map<java.lang.String,Finder> getMap()

refreshMap

protected void refreshMap(Fsgrep model)
Clear the map, then (re)populate it.

Parameters:
model - The underlying model containing the data.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

add

public void add(java.lang.String entry,
                Finder pFinder)
Add an entry to the (front of) list. If it already exists, then just move it to the front. Also add the association to the map.

Parameters:
entry - The string spec.
pFinder - The associated Finder object.

get

public Finder get(java.lang.String key)
Lookup the Finder object for a given spec.

Parameters:
key - The string spec.
Returns:
The Finder object associated with the given spec.

select

public void select(java.lang.String key)
A callback function for the GUI that gets called when the user selects a spec from the list. The list gets reordered with the selected entry moved to the front, and then it is persisted.

Parameters:
key - The string spec chosen by the user.

getCurrent

public java.lang.String getCurrent()
Give the "currently selected spec" by giving the first one on the list.

Returns:
The String spec.

contains

public boolean contains(java.lang.String key)
Determine whether the given spec is on the list.

Parameters:
key - The String spec.
Returns:
boolean flag

isEmpty

public boolean isEmpty()
Determine whether the list of specs is empty.

Returns:
boolean flag

keepFirst

public void keepFirst()
Remove all items except the first one (current).


readData

public void readData(Fsgrep model)
Read the stored profiles from the persistent data. This will instantiate the Finder objects for each using the passed model.

Parameters:
model - The model object that the finder will reference.

iterator

public java.util.Iterator<java.lang.String> iterator()
Returns:
All the strings in order.


Copyright © 2009. All Rights Reserved.