jview
Class AbstractTransferProxy

java.lang.Object
  extended by util.PropertyContainer
      extended by jview.AbstractTransferProxy
All Implemented Interfaces:
Cloneable, ViewportTransferring, Initializable, PropertyBearing
Direct Known Subclasses:
TransferX

public abstract class AbstractTransferProxy
extends PropertyContainer
implements ViewportTransferring

An abstract transfer proxy acts as the base class for a superior instance that keeps track of different JViewportCanvas' and knows how to transfer incoming zoom changes. Its concrete subclasses should be rather lightweight to allow easy incorporation within other objects, like display frames.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyContainer
PropertyContainer.URLResource
 
Field Summary
private  JViewportCanvas attached
          This is the viewport that should be served.
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR, KEY_NOINITONCREATE, KEY_RESOURCEBUNDLES
 
Fields inherited from interface util.PropertyBearing
CONFIG, KEY_CLASS, KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
protected AbstractTransferProxy(JViewportCanvas link)
          The only allowed construction is via the concrete canvas.
 
Method Summary
protected abstract  Rectangle2D getAttachedView(Object src, Rectangle2D view, JViewportCanvas on)
          This method calculates the zoom factor that should be applied on the attached viewport.
protected static VectorG getBottomRight(UserCoordinates src, Rectangle2D norm)
          Returns the bottom-right corner in user space of a normalized rectangle using the provided UserCoordinates.
protected static VectorG getUpLeft(UserCoordinates src, Rectangle2D norm)
          Returns the upper-left corner in user space of a normalized rectangle using the provided UserCoordinates.
 boolean transferViewport(Object from, Rectangle2D view)
          This method forks to getAttachedView(java.lang.Object, java.awt.geom.Rectangle2D, jview.JViewportCanvas) using my attached viewport as the argument.
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, clone, createFrom, createFrom, createFrom, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getLocalClassLoader, getLocalized, getLocalized, getLocalizedString, getLocalizedString, getProperties, getPropertiesToKey, getPropertiesToKey, getProperty, getResource, getResourceAsStream, getResourceFromKey, getResources, has, init, isNew, keyCreate, keyCreate, parseObject, reload, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attached

private JViewportCanvas attached
This is the viewport that should be served.

Constructor Detail

AbstractTransferProxy

protected AbstractTransferProxy(JViewportCanvas link)
The only allowed construction is via the concrete canvas.

Method Detail

getAttachedView

protected abstract Rectangle2D getAttachedView(Object src,
                                               Rectangle2D view,
                                               JViewportCanvas on)
This method calculates the zoom factor that should be applied on the attached viewport.


transferViewport

public boolean transferViewport(Object from,
                                Rectangle2D view)
This method forks to getAttachedView(java.lang.Object, java.awt.geom.Rectangle2D, jview.JViewportCanvas) using my attached viewport as the argument. If a non-null rectangle is returned, the attached viewport is zoomed accordingly. We return true if we can zoom and our attached canvas returns true, otherwise we return false.

Specified by:
transferViewport in interface ViewportTransferring

getUpLeft

protected static VectorG getUpLeft(UserCoordinates src,
                                   Rectangle2D norm)
Returns the upper-left corner in user space of a normalized rectangle using the provided UserCoordinates.


getBottomRight

protected static VectorG getBottomRight(UserCoordinates src,
                                        Rectangle2D norm)
Returns the bottom-right corner in user space of a normalized rectangle using the provided UserCoordinates.