Class VisiConfig

java.lang.Object
   |
   +----VisiConfig

public class VisiConfig
extends Object
Class definition for a display configuration.

Version:
$Revision: 1.8 $, $Date: 2000/10/13 18:32:06 $
Author:
John Cavanaugh

Variable Index

 o AREA_TABLE_SIZE
 o areaTable
List of the areas.
 o configPos
Indicator showing whether nodes are to be positioned by their locations from the config file
 o modified
A flag indicating whether the configuration has been modified.
 o net
The network the configuration modifies.

Constructor Index

 o VisiConfig(Network)
Constructs a configuration.

Method Index

 o addArea(Area)
Add an area to the configuration.
 o addNode(Node)
Add a node to the configuation.
 o clear()
Clear the configuration.
 o clearSelectedArea()
Make sure no area is selected.
 o clearToDefault()
Set the configuration to a default.
 o countAreas()
Count the areas in the configuration.
 o draw(Graphics, ViewSettings)
Draw the areas of the configuration.
 o getAllowedArea(Node)
Finds the best area for a node.
 o getArea(Area)
Get an area in the configuration.
 o getArea(String)
Get an area in the configuration by name.
 o getAreaEnumeration()
Get an enumeration over the list of areas in the network.
 o getNodeArea(Node)
Find which area, if any, a node is in.
 o getSelectedArea()
Return the area in the network, if any, that is selected.
 o getSwitchArea(String)
Find which area a switch belongs in.
 o getSwitchMemberArea(Node)
Find which area a node is actually in.
 o isConfigPos()
Get the positioning mode.
 o isModified()
Get the configuration modification flag.
 o removeAllMembers()
Remove all member nodes from the configuration.
 o removeArea(Area)
Remove an area from the configuration.
 o removeNode(Node)
Remove a node from the configuration.
 o removeSelectedArea()
Remove the selected area from the configuration.
 o renameArea(Area, String)
Rename an area.
 o reposition(ViewSettings)
Set positions for the nodes within the areas of the configuration.
 o resetConfigPos(boolean)
Reset the positioning mode.
 o setConfigPos(boolean)
Set the positioning mode.
 o toString()
Return a string describing the configuration object.
 o whichArea(Point)
Find which area, if any, the cursor is on.

Variables

 o net
 private Network net
The network the configuration modifies.

 o areaTable
 private Hashtable areaTable
List of the areas.

 o AREA_TABLE_SIZE
 private static final int AREA_TABLE_SIZE
 o configPos
 private boolean configPos
Indicator showing whether nodes are to be positioned by their locations from the config file

 o modified
 private boolean modified
A flag indicating whether the configuration has been modified.

Constructors

 o VisiConfig
 public VisiConfig(Network net)
Constructs a configuration.

Methods

 o addNode
 public void addNode(Node node)
Add a node to the configuation.

Parameters:
node - the node to be added.
 o removeNode
 public void removeNode(Node node)
Remove a node from the configuration.

Parameters:
node - the node to be removed.
 o removeAllMembers
 public void removeAllMembers()
Remove all member nodes from the configuration.

 o getArea
 public Area getArea(Area area)
Get an area in the configuration.

Parameters:
area - the area to find.
Returns:
the area; null if it is not in the configurationt.
 o getArea
 public Area getArea(String name)
Get an area in the configuration by name.

Parameters:
name - the name of the area to find.
Returns:
the area; null if it is not in the configuration.
 o addArea
 public void addArea(Area area)
Add an area to the configuration.

Parameters:
area - the area to be added.
 o removeArea
 public void removeArea(Area area)
Remove an area from the configuration.

Parameters:
area - the area to be removed.
 o getSelectedArea
 public Area getSelectedArea()
Return the area in the network, if any, that is selected.

Returns:
the area that has been selected by the user; null if no area is currently selected.
 o clearSelectedArea
 public void clearSelectedArea()
Make sure no area is selected.

 o removeSelectedArea
 public void removeSelectedArea()
Remove the selected area from the configuration.

 o renameArea
 public void renameArea(Area area,
                        String name)
Rename an area.

Parameters:
area - the area to be renamed.
name - the new name for the area.
 o getNodeArea
 public Area getNodeArea(Node node)
Find which area, if any, a node is in.

Parameters:
node - the node to be found.
Returns:
the area the node is a member of; null if the node is not a member of any area.
 o getSwitchArea
 public Area getSwitchArea(String name)
Find which area a switch belongs in.

Parameters:
name - the name of the node to locate an area for.
Returns:
the area the switch belongs in; null if does not belong in any area.
 o getSwitchMemberArea
 public Area getSwitchMemberArea(Node node)
Find which area a node is actually in.

Parameters:
node - the node to find.
Returns:
the area the node is a member of; null if the node is not a member of any area.
 o getAreaEnumeration
 public Enumeration getAreaEnumeration()
Get an enumeration over the list of areas in the network.

Returns:
an Enumeration over the area table.
 o clearToDefault
 public void clearToDefault()
Set the configuration to a default. Clear the configuration, then add the nodes in the network to it.

 o clear
 public void clear()
Clear the configuration.

 o reposition
 public void reposition(ViewSettings view)
Set positions for the nodes within the areas of the configuration.

Parameters:
view - the display view settings.
 o draw
 public void draw(Graphics g,
                  ViewSettings view)
Draw the areas of the configuration.

Parameters:
g - the graphics context of the display window.
view - the display view settings.
 o whichArea
 public Area whichArea(Point cursorLoc)
Find which area, if any, the cursor is on.

Parameters:
cursorLoc - the location of the cursor.
Returns:
the area whose icon contains the cursor; null if the cursor is not on any area.
 o isConfigPos
 public boolean isConfigPos()
Get the positioning mode.

Returns:
true if display positions for network nodes are determined from the configuration file; false if positions are determined algorithmically.
 o setConfigPos
 public void setConfigPos(boolean configPos)
Set the positioning mode. Used when reading a new configuration, so no adjustment to nodes already in areas is done.

Parameters:
configPos - the positioning type. True if positions for network nodes are to be taken from the configuration; false if positions are to be determined algoritmically.
 o resetConfigPos
 public void resetConfigPos(boolean configPos)
Reset the positioning mode. Adjust the contents of the areas in the configuration as necessary to accomodate the new setting.

Parameters:
configPos - the new positioning type. True if positions for network nodes are to be taken from the configuration; false if positions are to be determined algoritmically.
 o getAllowedArea
 private Area getAllowedArea(Node node)
Finds the best area for a node. The area with the highest score from Area.isAllowed() is returned.

Parameters:
node - the node that needs an area.
Returns:
the area that suits the node best; null if the node isn't properly an area member.
 o isModified
 public boolean isModified()
Get the configuration modification flag.

Returns:
true if the configuration has been altered (for example, a user moved an area); false otherwise.
 o countAreas
 public int countAreas()
Count the areas in the configuration.

Returns:
the number of areas in the configuration.
 o toString
 public String toString()
Return a string describing the configuration object.

Returns:
a string describing the configuration object.
Overrides:
toString in class Object