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
-
AREA_TABLE_SIZE
-
-
areaTable
- List of the areas.
-
configPos
- Indicator showing whether nodes are to be positioned by their
locations from the config file
-
modified
- A flag indicating whether the configuration has been modified.
-
net
- The network the configuration modifies.
-
VisiConfig(Network)
- Constructs a configuration.
-
addArea(Area)
- Add an area to the configuration.
-
addNode(Node)
- Add a node to the configuation.
-
clear()
- Clear the configuration.
-
clearSelectedArea()
- Make sure no area is selected.
-
clearToDefault()
- Set the configuration to a default.
-
countAreas()
- Count the areas in the configuration.
-
draw(Graphics, ViewSettings)
- Draw the areas of the configuration.
-
getAllowedArea(Node)
- Finds the best area for a node.
-
getArea(Area)
- Get an area in the configuration.
-
getArea(String)
- Get an area in the configuration by name.
-
getAreaEnumeration()
- Get an enumeration over the list of areas in the network.
-
getNodeArea(Node)
- Find which area, if any, a node is in.
-
getSelectedArea()
- Return the area in the network, if any, that is selected.
-
getSwitchArea(String)
- Find which area a switch belongs in.
-
getSwitchMemberArea(Node)
- Find which area a node is actually in.
-
isConfigPos()
- Get the positioning mode.
-
isModified()
- Get the configuration modification flag.
-
removeAllMembers()
- Remove all member nodes from the configuration.
-
removeArea(Area)
- Remove an area from the configuration.
-
removeNode(Node)
- Remove a node from the configuration.
-
removeSelectedArea()
- Remove the selected area from the configuration.
-
renameArea(Area, String)
- Rename an area.
-
reposition(ViewSettings)
- Set positions for the nodes within the areas of the
configuration.
-
resetConfigPos(boolean)
- Reset the positioning mode.
-
setConfigPos(boolean)
- Set the positioning mode.
-
toString()
- Return a string describing the configuration object.
-
whichArea(Point)
- Find which area, if any, the cursor is on.
net
private Network net
- The network the configuration modifies.
areaTable
private Hashtable areaTable
- List of the areas.
AREA_TABLE_SIZE
private static final int AREA_TABLE_SIZE
configPos
private boolean configPos
- Indicator showing whether nodes are to be positioned by their
locations from the config file
modified
private boolean modified
- A flag indicating whether the configuration has been modified.
VisiConfig
public VisiConfig(Network net)
- Constructs a configuration.
addNode
public void addNode(Node node)
- Add a node to the configuation.
- Parameters:
- node - the node to be added.
removeNode
public void removeNode(Node node)
- Remove a node from the configuration.
- Parameters:
- node - the node to be removed.
removeAllMembers
public void removeAllMembers()
- Remove all member nodes from the configuration.
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.
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.
addArea
public void addArea(Area area)
- Add an area to the configuration.
- Parameters:
- area - the area to be added.
removeArea
public void removeArea(Area area)
- Remove an area from the configuration.
- Parameters:
- area - the area to be removed.
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.
clearSelectedArea
public void clearSelectedArea()
- Make sure no area is selected.
removeSelectedArea
public void removeSelectedArea()
- Remove the selected area from the configuration.
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.
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.
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.
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.
getAreaEnumeration
public Enumeration getAreaEnumeration()
- Get an enumeration over the list of areas in the network.
- Returns:
- an Enumeration over the area table.
clearToDefault
public void clearToDefault()
- Set the configuration to a default. Clear the configuration,
then add the nodes in the network to it.
clear
public void clear()
- Clear the configuration.
reposition
public void reposition(ViewSettings view)
- Set positions for the nodes within the areas of the
configuration.
- Parameters:
- view - the display view settings.
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.
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.
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.
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.
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.
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.
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.
countAreas
public int countAreas()
- Count the areas in the configuration.
- Returns:
- the number of areas in the configuration.
toString
public String toString()
- Return a string describing the configuration object.
- Returns:
- a string describing the configuration object.
- Overrides:
- toString in class Object