edu.utk.cs.icl.rest.swing
Class LocInfo

java.lang.Object
  extended byedu.utk.cs.icl.rest.util.Location
      extended byedu.utk.cs.icl.rest.swing.LocInfo
All Implemented Interfaces:
Comparable, EventListener, PropertyChangeListener
Direct Known Subclasses:
InstallerLocInfo

public class LocInfo
extends Location
implements PropertyChangeListener

A swing wrapper around util.location to provide the appropriate icons for the current status.

Since:
1.0
Version:
$Revision: 1.27 $ $Date: 2005/01/31 21:47:19 $
Author:
Eric Meek (meek@cs.utk.edu)

Field Summary
static ImageIcon[] loc_icons
          Icons used by the status.
protected  SwingPropertyChangeSupport locChanged
           
 
Fields inherited from class edu.utk.cs.icl.rest.util.Location
actions, badLocation, changed, commThread, DEFAULT_AUTH_GRP_NAME, DEFAULT_LOGICAL_GRP_NAME, groups, loc, LOC_ERROR, LOC_FINISHED, LOC_GENERAL, LOC_PROGRESS, LOC_WARNING, locGrp, message, pwdGrp, removed, uname
 
Constructor Summary
LocInfo(String location)
          Creates a new instance of a location using the given string as the name.
 
Method Summary
 boolean addAction(PackageAction action)
          Add an action to be performed on this location
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a property change listener to this object.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Adds a PropertyChangeListener for a specific property.
static Color calcColor(String tmpName)
          Deprecated. No longer used in favor of cycling through the colors as suggested by David Rogers.
 void finalize()
          Cleanup any objects in the LocGroup that will not be automatically
 Color getBackground()
          Get the locations background color.
 Color getForeground()
          Get the foreground color.
 ImageIcon getIcon()
          Returns the icon associated with the given object.
 DisplayItem getIconDisplayItem()
          Get the current DisplayItem representing the status of this Location
 DisplayItem getIconDisplayItem(int which)
          Get the specified DisplayItem and must be one of the defined Location class statuses
 DisplayItem getTextDisplayItem()
          Get the Location toString() returned as a specified DisplayItem
 String getToolTipText()
          Getter for property toolTipText.
 boolean isEnabled()
          Getter for property enabled.
 boolean isOpaque()
          Getter for property opaque.
 void propertyChange(PropertyChangeEvent evt)
          Handle property changed events for this object on other objects this is a lister
 boolean removeAction(PackageAction action)
          Remove an action from being performed on this location
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Removes a PropertyChangeListener for a specific property.
 void setBackground(Color newColor)
          Sets the background color of the location
 void setBadLocation(boolean badLocation)
          Setter for property badLocation.
 void setChanged(boolean changed)
          Setter for property changed.
 void setCommThread(Thread commThread)
          Setter for property commThread.
 void setEnabled(boolean enabled)
          Setter for property enabled.
 void setForeground(Color newColor)
          Sets the foreground color of the location
static void setHeadless(boolean b)
           
 void setLocation(String location)
          Set the hostname of the location from the given string.
 void setLocGrp(LocationGroup group)
          Setter method for the locgrp field
 void setMessage(String message)
          Setter for property message.
 void setOpaque(boolean opaque)
          Setter for property opaque.
 void setPort(int port)
          Setter method for the port field
 void setPwdGrp(LocationGroup group)
          Setter method for the pwdgrp field
 void setRemoved(boolean removed)
          Setter for property removed.
 void setStatus(int status)
          Setter method for the location field.
 void setToolTipText()
          Setter for property toolTipText.
 void setUserName(String username)
          Setter method for the username field
 
Methods inherited from class edu.utk.cs.icl.rest.util.Location
compareTo, equals, getActions, getCommThread, getGroups, getLocation, getLocGrp, getMessage, getPort, getPwdGrp, getShortLocation, getStatus, getUserName, hashCode, isBadLocation, isChanged, isRemoved, setActions, setGroups, toExternalform, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

loc_icons

public static ImageIcon[] loc_icons
Icons used by the status. Indecies of the icons match the values of the corresponding status.

Since:
1.0

locChanged

protected SwingPropertyChangeSupport locChanged
Constructor Detail

LocInfo

public LocInfo(String location)
Creates a new instance of a location using the given string as the name. Defaults are

Parameters:
location - Name of the location
Since:
1.0
Method Detail

setBackground

public void setBackground(Color newColor)
Sets the background color of the location

Parameters:
newColor - New background

getBackground

public Color getBackground()
Get the locations background color. If in a group, this color should match the background of the group.

Returns:
Background color

setBadLocation

public void setBadLocation(boolean badLocation)
Setter for property badLocation.

Overrides:
setBadLocation in class Location
Parameters:
badLocation - New value of property badLocation.

setChanged

public void setChanged(boolean changed)
Setter for property changed.

Overrides:
setChanged in class Location
Parameters:
changed - New value of property changed.

setCommThread

public void setCommThread(Thread commThread)
Setter for property commThread.

Overrides:
setCommThread in class Location
Parameters:
commThread - New value of property commThread.

setEnabled

public void setEnabled(boolean enabled)
Setter for property enabled.

Parameters:
enabled - New value of property enabled.

setForeground

public void setForeground(Color newColor)
Sets the foreground color of the location

Parameters:
newColor - New foreground color

getForeground

public Color getForeground()
Get the foreground color. Useful to give feedback to the user

Returns:
Foreground color

setHeadless

public static void setHeadless(boolean b)

getIcon

public ImageIcon getIcon()
Returns the icon associated with the given object.

Returns:
Current status icon
Since:
1.0

getIconDisplayItem

public DisplayItem getIconDisplayItem()
Get the current DisplayItem representing the status of this Location

Returns:
The current DisplayItem representing the current Status

getIconDisplayItem

public DisplayItem getIconDisplayItem(int which)
Get the specified DisplayItem and must be one of the defined Location class statuses

Parameters:
which - Selected status of the DisplayItem
Returns:
Specified DisplayItem

setLocGrp

public void setLocGrp(LocationGroup group)
Setter method for the locgrp field

Overrides:
setLocGrp in class Location
Parameters:
group - New location group
Since:
1.0

setLocation

public void setLocation(String location)
Set the hostname of the location from the given string. This method will lookup the fully qualified domain name for the host before it is set and if the lookup fails will set this location as a bad location.

Overrides:
setLocation in class Location
Parameters:
location - Hostname or ipaddress of the location

setMessage

public void setMessage(String message)
Setter for property message.

Overrides:
setMessage in class Location
Parameters:
message - New value of property message.

setOpaque

public void setOpaque(boolean opaque)
Setter for property opaque.

Parameters:
opaque - New value of property opaque.

isOpaque

public boolean isOpaque()
Getter for property opaque.

Returns:
Value of property opaque.

setPort

public void setPort(int port)
Setter method for the port field

Overrides:
setPort in class Location
Parameters:
port - New port for the location
Since:
1.0

setPwdGrp

public void setPwdGrp(LocationGroup group)
Setter method for the pwdgrp field

Overrides:
setPwdGrp in class Location
Parameters:
group - New password group
Since:
1.0

setRemoved

public void setRemoved(boolean removed)
Setter for property removed.

Overrides:
setRemoved in class Location
Parameters:
removed - New value of property removed.

setStatus

public void setStatus(int status)
Setter method for the location field. It must be one of the status listed above. Currently supported status are

Overrides:
setStatus in class Location
Parameters:
status - new status of the location
Since:
1.0

getTextDisplayItem

public DisplayItem getTextDisplayItem()
Get the Location toString() returned as a specified DisplayItem

Returns:
DisplayItem representing the toString() object

setToolTipText

public void setToolTipText()
Setter for property toolTipText. Auto generates the tooltip text from the attributes of this location.


getToolTipText

public String getToolTipText()
Getter for property toolTipText.

Returns:
Value of property toolTipText.

setUserName

public void setUserName(String username)
Setter method for the username field

Overrides:
setUserName in class Location
Parameters:
username - New username
Since:
1.0

addAction

public boolean addAction(PackageAction action)
Add an action to be performed on this location

Overrides:
addAction in class Location
Parameters:
action - A new action to be performed on this location
Returns:
if the action was added

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this object. Mainly used for the UIResource class for LocGroup.java

Parameters:
listener - New listener

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Adds a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property.

If listener is null, no exception is thrown and no action is performed.

Parameters:
propertyName - the name of the property to listen on
listener - the PropertyChangeListener to be added

calcColor

public static Color calcColor(String tmpName)
Deprecated. No longer used in favor of cycling through the colors as suggested by David Rogers.

Calculate a color based on the name provided.

Parameters:
tmpName - Name to use to calculate the color
Returns:
New Color

isEnabled

public boolean isEnabled()
Getter for property enabled.

Returns:
Value of property enabled.

finalize

public void finalize()
              throws Throwable
Cleanup any objects in the LocGroup that will not be automatically

Throws:
Throwable - Required

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Handle property changed events for this object on other objects this is a lister

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - Event

removeAction

public boolean removeAction(PackageAction action)
Remove an action from being performed on this location

Overrides:
removeAction in class Location
Parameters:
action - Action to remove
Returns:
If the action was removed
See Also:
PackageAction

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - the PropertyChangeListener to be removed

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Removes a PropertyChangeListener for a specific property. If listener is null, no exception is thrown and no action is performed.

Parameters:
propertyName - the name of the property that was listened on
listener - the PropertyChangeListener to be removed