siuying.gm.app.gmailer4j.model
Class MailboxTreeModel

java.lang.Object
  extended by siuying.gm.app.gmailer4j.model.MailboxTreeModel
All Implemented Interfaces:
javax.swing.tree.TreeModel

public class MailboxTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel

A tree model represent a tree that can cotains 3 views represent "Standard Box", "Labels" and "Searches"

Version:
0.1
Author:
siuying

Field Summary
static java.lang.String[] boxRoots
           
static int LIST_LABEL
           
static int LIST_SEARCH
           
static int LIST_STANDARD
           
static java.lang.String[] STD_BOX_KEY
           
 
Constructor Summary
MailboxTreeModel()
           
 
Method Summary
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
          addTreeModelListener
protected  void fireTreeNodesChanged(java.lang.Object root)
           
protected  void fireTreeNodesInserted(java.lang.Object root)
           
protected  void fireTreeNodesRemoved(java.lang.Object root)
           
protected  void fireTreeStructureChanged(java.lang.Object root)
           
 java.lang.Object getChild(java.lang.Object parent, int index)
          getChild
 int getChildCount(java.lang.Object parent)
          getChildCount
 int getCurrentRoot()
           
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          getIndexOfChild
 java.lang.Object getRoot()
          getRoot
 boolean isLeaf(java.lang.Object node)
          isLeaf
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
          removeTreeModelListener
 void setCurrentRoot(int current)
           
 java.lang.String toString()
           
 void updateLabel(java.util.Map labels)
          Update/add labels from the input labels data
 void updateSearches(java.util.Map searches)
           
 void updateStdBox(java.util.Map stdbox)
          Update standbox content from gminfo TreeMap
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
          valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

boxRoots

public static final java.lang.String[] boxRoots

STD_BOX_KEY

public static final java.lang.String[] STD_BOX_KEY

LIST_STANDARD

public static final int LIST_STANDARD
See Also:
Constant Field Values

LIST_LABEL

public static final int LIST_LABEL
See Also:
Constant Field Values

LIST_SEARCH

public static final int LIST_SEARCH
See Also:
Constant Field Values
Constructor Detail

MailboxTreeModel

public MailboxTreeModel()
Method Detail

getRoot

public java.lang.Object getRoot()
getRoot

Specified by:
getRoot in interface javax.swing.tree.TreeModel
Returns:
Object

getChildCount

public int getChildCount(java.lang.Object parent)
getChildCount

Specified by:
getChildCount in interface javax.swing.tree.TreeModel
Parameters:
parent - Object
Returns:
int

isLeaf

public boolean isLeaf(java.lang.Object node)
isLeaf

Specified by:
isLeaf in interface javax.swing.tree.TreeModel
Parameters:
node - Object
Returns:
boolean

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener l)
addTreeModelListener

Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
l - TreeModelListener

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
removeTreeModelListener

Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
l - TreeModelListener

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
getChild

Specified by:
getChild in interface javax.swing.tree.TreeModel
Parameters:
parent - Object
index - int
Returns:
Object

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
getIndexOfChild

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel
Parameters:
parent - Object
child - Object
Returns:
int

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
valueForPathChanged

Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel
Parameters:
path - TreePath
newValue - Object

getCurrentRoot

public int getCurrentRoot()

setCurrentRoot

public void setCurrentRoot(int current)

updateStdBox

public void updateStdBox(java.util.Map stdbox)
Update standbox content from gminfo TreeMap

Parameters:
stdbox - TreeMap
To do:
assume no delete occurs, it will not remove disappeared nodes, this should be fixed

updateLabel

public void updateLabel(java.util.Map labels)
Update/add labels from the input labels data

Parameters:
labels - TreeMap
To do:
assume no delete occurs, it will not remove disappeared nodes, this should be fixed

updateSearches

public void updateSearches(java.util.Map searches)

fireTreeStructureChanged

protected void fireTreeStructureChanged(java.lang.Object root)

fireTreeNodesInserted

protected void fireTreeNodesInserted(java.lang.Object root)

fireTreeNodesRemoved

protected void fireTreeNodesRemoved(java.lang.Object root)

fireTreeNodesChanged

protected void fireTreeNodesChanged(java.lang.Object root)

toString

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