edu.umd.cs.piccolo.examples
Class PrintExample.DocumentScrollDirector

java.lang.Object
  extended by edu.umd.cs.piccolox.swing.PDefaultScrollDirector
      extended by edu.umd.cs.piccolo.examples.PrintExample.DocumentScrollDirector
All Implemented Interfaces:
PScrollDirector, PropertyChangeListener, EventListener
Enclosing class:
PrintExample

public class PrintExample.DocumentScrollDirector
extends PDefaultScrollDirector

A modified scroll director that performs document based scroling rather than window based scrolling (ie. the scrollbars act in the inverse direction as normal)


Field Summary
 
Fields inherited from class edu.umd.cs.piccolox.swing.PDefaultScrollDirector
camera, root, scrollInProgress, scrollPane, view, viewPort
 
Constructor Summary
PrintExample.DocumentScrollDirector()
           
 
Method Summary
 Point getViewPosition(Rectangle2D viewBounds)
          Get the View position given the specified camera bounds - modified such that: Rather than finding the distance from the upper left corner of the window to the upper left corner of the document - we instead find the distance from the lower right corner of the window to the upper left corner of the document THEN we subtract that value from total document width so that the position is inverted
 void setViewPosition(double x, double y)
          We do the same thing we did in getViewPosition above to flip the document-window position relationship
 
Methods inherited from class edu.umd.cs.piccolox.swing.PDefaultScrollDirector
getViewSize, install, propertyChange, shouldRevalidateScrollPane, unInstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintExample.DocumentScrollDirector

public PrintExample.DocumentScrollDirector()
Method Detail

getViewPosition

public Point getViewPosition(Rectangle2D viewBounds)
Get the View position given the specified camera bounds - modified such that: Rather than finding the distance from the upper left corner of the window to the upper left corner of the document - we instead find the distance from the lower right corner of the window to the upper left corner of the document THEN we subtract that value from total document width so that the position is inverted

Specified by:
getViewPosition in interface PScrollDirector
Overrides:
getViewPosition in class PDefaultScrollDirector
Parameters:
viewBounds - The bounds for which the view position will be computed
Returns:
The view position

setViewPosition

public void setViewPosition(double x,
                            double y)
We do the same thing we did in getViewPosition above to flip the document-window position relationship

Specified by:
setViewPosition in interface PScrollDirector
Overrides:
setViewPosition in class PDefaultScrollDirector
Parameters:
x - The new x position
y - The new y position


Copyright © 1995-2011 Piccolo2D. All Rights Reserved.