gishur.gui2.handler
Class ZoomHandler

java.lang.Object
  |
  +--gishur.gui2.DrawAtom
        |
        +--gishur.gui2.DrawObject
              |
              +--gishur.gui2.InputHandler
                    |
                    +--gishur.gui2.handler.ZoomHandler

public class ZoomHandler
extends InputHandler

An InputHandler to make screen zooms for zoom-operations.

Version:
1.0
Author:
Thomas Wolf

Fields inherited from class gishur.gui2.DrawAtom
BLOCK_REPAINT, MARK_RECALC, MARK_REPAINT, MARK_SIZE, REPAINT, UNBLOCK_REPAINT, USER_STATES_FIRST, USER_STATES_MASK
 
Constructor Summary
ZoomHandler()
          Default constructor.
 
Method Summary
 void add(Layer layer)
          Adds a Layer to the list of zoomed Layers.
 Stack history()
          Returns the zoom history of this ZoomHandler.
protected  void onConsumedEvent(java.awt.event.InputEvent e)
          Processes consumed InputEvents.
protected  void processMouseEvent(java.awt.event.MouseEvent e)
          Processes mouse events.
protected  void processMouseMotionEvent(java.awt.event.MouseEvent e)
          Processes mouse motion events.
protected  void recalculate(RenderContext context, PropertyStatusReader properties)
          Forces the DrawObject to recalculate its representation.
 void refresh()
          Refreshes the transformation list.
 void remove(Layer layer)
          Removes a Layer from the list of zoomed Layers.
 void setHistory(Stack history)
          Sets the zoom history.
 void setLayers(List layers)
          Sets the list of Layers to the given list.
 void setMaintainAspectRatio(boolean aspect)
          Sets the maintenance of the aspect ration of the screen (default: true).
 void setZoomInMouseButton(int button)
          Sets the button to drag the zoom-in area with (default: MouseEvent.BUTTON1_MASK).
 void setZoomOutMouseButton(int button)
          Sets the button to zoom back (default: MouseEvent.BUTTON3_MASK).
 
Methods inherited from class gishur.gui2.InputHandler
acceptConsumed, allButtons, disable, dispatchModifyEvent, enable, enabled, filterEvent, oneButton, preprocessEvent, processActionEvent, processAdjustmentEvent, processComponentEvent, processContainerEvent, processEvent, processFocusEvent, processItemEvent, processKeyEvent, processModifyEvent, processPaintEvent, processTextEvent, processWindowEvent, removeCursor, sendEvent, setAcceptConsumed, setCursor, setCursor
 
Methods inherited from class gishur.gui2.DrawObject
addDrawDependency, addPainter, blockRepaint, checkState, checkStateCleared, child, clear, clearCache, clearState, dependency, dirty, disableEvents, draw, draw, enableEvents, ensureRecalculate, findPainter, firstPainter, fullscreen, hide, hide, insert, levelMask, levelUsed, locate, makeDirty, makeDirty, next, next, nextPainter, parent, prepeareRenderContext, prev, prev, processDrawEvent, propertyReader, recalculate, remove, removeDrawDependency, repaint, screenTransformation, setFullscreen, setPaintBeforeMembers, setScreenTransformation, setState, show, show, state, state, unblockRepaint, unblockRepaint, visible
 
Methods inherited from class gishur.gui2.DrawAtom
addProperties, collectHits, dispatchEvent, displayManager, drawComponent, getBounds, getLocalProperty, getProperty, getProperty, getRequiredProperty, processMessage, properties, removeProperty, sendEvent, sendMessage, setBounds, setPropertiesTo, setProperty, setProperty, setProperty, setProperty, toString, toString, toStringDetail, toTreeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZoomHandler

public ZoomHandler()
Default constructor.
Method Detail

setZoomInMouseButton

public void setZoomInMouseButton(int button)
Sets the button to drag the zoom-in area with (default: MouseEvent.BUTTON1_MASK).
Parameters:
button - the button to drag the zoom-in area with.

setZoomOutMouseButton

public void setZoomOutMouseButton(int button)
Sets the button to zoom back (default: MouseEvent.BUTTON3_MASK).
Parameters:
button - the button to zoom back.

setMaintainAspectRatio

public void setMaintainAspectRatio(boolean aspect)
Sets the maintenance of the aspect ration of the screen (default: true).
Parameters:
aspect - if true, maintain aspect ratio.

setLayers

public void setLayers(List layers)
Sets the list of Layers to the given list. The list must contain ListItems, that can store a key and a value, as keys there must be the Layers. All ListItems, that contain no Layer as key will be removed.

add

public void add(Layer layer)
Adds a Layer to the list of zoomed Layers.
Parameters:
layer - new Layer

remove

public void remove(Layer layer)
Removes a Layer from the list of zoomed Layers.
Parameters:
layer - the Layer to remove

refresh

public void refresh()
Refreshes the transformation list. This method needs to be called, if the transformation of a zoomable layer has changed.

setHistory

public void setHistory(Stack history)
Sets the zoom history. The zoom history must be a Stack, storing Hashtables with ScreenTransformations as keys and their status-objects (see ScreenTransformation.saveStatus()) as values.
Parameters:
history - the zoom history to use.
See Also:
history()

history

public Stack history()
Returns the zoom history of this ZoomHandler. The zoom history is a Stack, storing Hashtables with ScreenTransformations as keys and their status-objects (see ScreenTransformation.saveStatus()) as values. On zooming in, an entry will be added to the history; on zooming out, an entry will be removed.
See Also:
setHistory(gishur.core.Stack)

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Processes mouse events.
Overrides:
processMouseEvent in class InputHandler
Parameters:
e - the event.

processMouseMotionEvent

protected void processMouseMotionEvent(java.awt.event.MouseEvent e)
Processes mouse motion events.
Overrides:
processMouseMotionEvent in class InputHandler
Parameters:
e - the event.

onConsumedEvent

protected void onConsumedEvent(java.awt.event.InputEvent e)
Processes consumed InputEvents. In order to process the events further, call InputHandler.sendEvent(java.awt.AWTEvent).
Overrides:
onConsumedEvent in class InputHandler
Parameters:
e - consumed InputEvent.

recalculate

protected void recalculate(RenderContext context,
                           PropertyStatusReader properties)
Forces the DrawObject to recalculate its representation. This method will only be called, if it became dirty via a call to the DrawObject.makeDirty(boolean) method or something has happened, that causes all DrawAtoms to recalculate their representation. This method should only be called by the render system.
Overrides:
recalculate in class InputHandler
Parameters:
context - the RenderContext to use
properties - the PropertyStatusReader to use for reading properties