org.gjt.universe.gui.tree
Class TVFilter

java.lang.Object
  |
  +--org.gjt.universe.gui.tree.TVFilter

public class TVFilter
extends java.lang.Object


Field Summary
protected  boolean showAnnotated
           
protected  boolean showOrdered
           
protected  boolean[] showPlayer
           
protected  boolean showUpdatedForward
           
protected  int updatedTurn
           
 
Constructor Summary
TVFilter(int nplayers)
          Create a TVFilter.
 
Method Summary
 void filter(javax.swing.tree.DefaultMutableTreeNode root)
          Filter the tree, starting at the node given and working through all of the tree's children.
protected  void filterIterator(TVData tvd)
          Logic that, based upon filter paramters, decide if a node should be hidden or not.
 void filterSingle(javax.swing.tree.DefaultMutableTreeNode item)
          Applies a filter to a single item; useful if an item is changed or added; thus we don't have to refilter the entire tree.
 int getUpdatedTurn()
          Returns the turn number we use for filtering.
 boolean isOnlyShowAnnotated()
          Returns true if we are only to show nodes with annotations.
 boolean isOnlyShowOrderedUnits()
          Returns true if only nodes with orders should be displayed.
 boolean isShowForward()
          returns true if we are showing turns after the UpdatedTurn int, or false if we are showing turns before.
 boolean isShowPlayer(int id)
          Returns if we are showing a particular player.
 void setOnlyShowAnnotated(boolean value)
          Set if we should display nodes with or without annotations.
 void setOnlyShowOrderedUnits(boolean value)
          Sets if nodes with orders should be displayed.
 void setShowPlayer(int id, boolean value)
          Set which players are to be shown.
 void setShowUpdated(int turn, boolean forward)
          Show units updated before (forward = false) or after (forward = true) the specified turn number.
static void unFilter(javax.swing.tree.DefaultMutableTreeNode root)
          UnFilter the tree, starting at the node given and working through all of the tree's children.
static void unfilterSingle(javax.swing.tree.DefaultMutableTreeNode item)
          UnFilter analog of filterSingle()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

showPlayer

protected boolean[] showPlayer

showAnnotated

protected boolean showAnnotated

showOrdered

protected boolean showOrdered

showUpdatedForward

protected boolean showUpdatedForward

updatedTurn

protected int updatedTurn
Constructor Detail

TVFilter

public TVFilter(int nplayers)
Create a TVFilter.

Parameters:
nplayers - The number of players in the game.
Method Detail

setShowPlayer

public void setShowPlayer(int id,
                          boolean value)
Set which players are to be shown. Player 0 is the first player, and player -1 is the "unknown" or "no" player.


isShowPlayer

public boolean isShowPlayer(int id)
Returns if we are showing a particular player.


setOnlyShowOrderedUnits

public void setOnlyShowOrderedUnits(boolean value)
Sets if nodes with orders should be displayed.


isOnlyShowOrderedUnits

public boolean isOnlyShowOrderedUnits()
Returns true if only nodes with orders should be displayed.


setOnlyShowAnnotated

public void setOnlyShowAnnotated(boolean value)
Set if we should display nodes with or without annotations.


isOnlyShowAnnotated

public boolean isOnlyShowAnnotated()
Returns true if we are only to show nodes with annotations.


setShowUpdated

public void setShowUpdated(int turn,
                           boolean forward)
Show units updated before (forward = false) or after (forward = true) the specified turn number. If turn number is <= 0, we do not apply this to the filter.


isShowForward

public boolean isShowForward()
returns true if we are showing turns after the UpdatedTurn int, or false if we are showing turns before.


getUpdatedTurn

public int getUpdatedTurn()
Returns the turn number we use for filtering.


unFilter

public static void unFilter(javax.swing.tree.DefaultMutableTreeNode root)
UnFilter the tree, starting at the node given and working through all of the tree's children. All data is displayed, regardless of which filter is currently selected or defined.

If root is the actual root of the JTree, then the entire tree is filtered.


filter

public void filter(javax.swing.tree.DefaultMutableTreeNode root)
Filter the tree, starting at the node given and working through all of the tree's children.

If root is the actual root of the JTree, then the entire tree is filtered.


filterSingle

public void filterSingle(javax.swing.tree.DefaultMutableTreeNode item)
Applies a filter to a single item; useful if an item is changed or added; thus we don't have to refilter the entire tree.

This method should be called whenever an item is added or changed by TVModel.


unfilterSingle

public static void unfilterSingle(javax.swing.tree.DefaultMutableTreeNode item)
UnFilter analog of filterSingle()


filterIterator

protected void filterIterator(TVData tvd)
Logic that, based upon filter paramters, decide if a node should be hidden or not.



Copyright © 2001 Universe Dev Team All Rights Reserved.