com.bbn.openmap.event
Class ProjectionChangeVetoException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.bbn.openmap.event.ProjectionChangeVetoException
All Implemented Interfaces:
java.io.Serializable

public class ProjectionChangeVetoException
extends java.lang.RuntimeException

An exception used by PropertyChangeListeners on the MapBean to veto a projection change on the MapBean. Should be used by components that want to limit the range of projection changes allowed in a application, or during certain application conditions. These exceptions should be used by PropertyChangeListeners on the MapBean listening for MapBean.ProjectionProperty changes, because the MapBean notifies the PropertyChangeListeners of projection changes before it notifies the ProjectionListeners (the layers). If the MapBean catches one of these exceptions from a PropertyChangeListener, the projection parameters will be changed to the values provided, all of the PropertyChangeListeners will be notified again, and the layers will be finally be notified when the PropertyChangeListeners are happy. Only projection changes relating to scale, center and type can be vetoed. The size of the projection (pixel width and height) is dictated by the MapBean's parent.

Author:
dietrick
See Also:
Serialized Form

Field Summary
static java.lang.String CENTER
           
protected  java.util.Properties parameters
           
static java.lang.String PROJECTION_TYPE
           
static java.lang.String SCALE
           
 
Constructor Summary
ProjectionChangeVetoException()
          Constructs a new projection change veto exception with null as its detail message and no suggested changes.
ProjectionChangeVetoException(java.lang.String message)
          Constructs a new projection change veto exception with the specified detail message.
ProjectionChangeVetoException(java.lang.String message, java.lang.Class<? extends Proj> projectionType, java.awt.geom.Point2D center, java.lang.Number scale)
          Constructs a new projection change veto exception with the specified detail message and common parameter objects for OpenMap projections that can be cause for veto.
ProjectionChangeVetoException(java.lang.String message, java.util.Properties suggestedChanges)
          Constructs a new projection change veto exception with the specified detail message and a Properties object containing parameter objects representing new settings for the rejected projection.
 
Method Summary
 java.lang.Object getSuggested(java.lang.String parameter)
           
 void removeSuggested(java.lang.String parameter)
          Remove a suggested parameter from the event.
 java.lang.String toString()
           
 void updateWithParameters(MapBean mapBean)
          A helper function for the MapBean.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parameters

protected java.util.Properties parameters

CENTER

public static final java.lang.String CENTER
See Also:
Constant Field Values

SCALE

public static final java.lang.String SCALE
See Also:
Constant Field Values

PROJECTION_TYPE

public static final java.lang.String PROJECTION_TYPE
See Also:
Constant Field Values
Constructor Detail

ProjectionChangeVetoException

public ProjectionChangeVetoException()
Constructs a new projection change veto exception with null as its detail message and no suggested changes. The cause is not initialized, and may subsequently be initialized by a call to Throwable.initCause(java.lang.Throwable).


ProjectionChangeVetoException

public ProjectionChangeVetoException(java.lang.String message)
Constructs a new projection change veto exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to Throwable.initCause(java.lang.Throwable).

Parameters:
message - the detail message, with no suggested changes.

ProjectionChangeVetoException

public ProjectionChangeVetoException(java.lang.String message,
                                     java.lang.Class<? extends Proj> projectionType,
                                     java.awt.geom.Point2D center,
                                     java.lang.Number scale)
Constructs a new projection change veto exception with the specified detail message and common parameter objects for OpenMap projections that can be cause for veto. The Throwable cause object is not initialized, and may subsequently be initialized by a call to Throwable.initCause(java.lang.Throwable). The objects provided as arguments will be added to a Properties object set in the exception.

Parameters:
message - the detail message.
projectionType - set to null if the new projection class type is OK, otherwise set the projection class that should be used.
center - set to null of the new projection center is OK, otherwise set to the new center point of the projection.
scale - set to null if the new projection scale is OK, otherwise provide a new scale value.

ProjectionChangeVetoException

public ProjectionChangeVetoException(java.lang.String message,
                                     java.util.Properties suggestedChanges)
Constructs a new projection change veto exception with the specified detail message and a Properties object containing parameter objects representing new settings for the rejected projection. The Throwable cause object is not initialized, and may subsequently be initialized by a call to Throwable.initCause(java.lang.Throwable).

Parameters:
message - the detail message.
suggestedChanges - A Properties object holding CENTER, SCALE, PROJECTION_TYPE changes, or any other parameters that can be used by the event in the updateWithParameters method.
Method Detail

getSuggested

public java.lang.Object getSuggested(java.lang.String parameter)
Parameters:
parameter - the key for the projection parameter.
Returns:
the Object for the given key.

removeSuggested

public void removeSuggested(java.lang.String parameter)
Remove a suggested parameter from the event.

Parameters:
parameter -

updateWithParameters

public void updateWithParameters(MapBean mapBean)
A helper function for the MapBean. The Exception object can update the projection for a MapBean, and then call MapBean.setProjection() with the new settings. This method was intended to be called from the MapBean.fireProjectionChange() method after this Exception has been caught, and can be overridden for new/updated Projection types and for different suggestion parameters that may be contained in the Exception properties.

Parameters:
mapBean -

toString

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


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details