edu.umd.cs.jazz.util
Class ZViewport

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JViewport
                          |
                          +--edu.umd.cs.jazz.util.ZViewport
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ZViewport
extends javax.swing.JViewport

A subclass of JViewport that talks to the scroll director to negotiate the view positions and sizes.

Author:
Lance Good
See Also:
Serialized Form

Nested Class Summary
static class ZViewport.ZViewportLayout
          A simple layout manager to give the ZCanvas the same size as the Viewport
 
Nested classes inherited from class javax.swing.JViewport
javax.swing.JViewport.AccessibleJViewport, javax.swing.JViewport.ViewListener
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JViewport
backingStore, BACKINGSTORE_SCROLL_MODE, backingStoreImage, BLIT_SCROLL_MODE, isViewSizeSet, lastPaintPosition, scrollUnderway, SIMPLE_SCROLL_MODE
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ZViewport()
          Pass constructor info to super
 
Method Summary
protected  java.awt.LayoutManager createLayoutManager()
          Subclassers can override this to install a different layout manager (or null) in the constructor.
protected  ZScrollDirector createScrollDirector()
          Subclassers can override this to install a different scroll director in the constructor.
 void fireStateChanged()
          Notifies all ChangeListeners when the views size, position, or the viewports extent size has changed.
 ZScrollDirector getScrollDirector()
           
 java.awt.Point getViewPosition()
          Gets the view position from the scroll director based on the current extent size
 java.awt.Dimension getViewSize()
          Gets the view size from the scroll director based on the current extent size
 java.awt.Dimension getViewSize(java.awt.geom.Rectangle2D r)
          Gets the view size from the scroll director based on the specified extent size
 void setScrollDirector(ZScrollDirector scrollDirector)
          Set the scroll director on this viewport
 void setView(java.awt.Component view)
          Overridden to throw an exception if the view is not a ZCanvas
 void setViewPosition(java.awt.Point p)
          Sets the view coordinates that appear in the upper left hand corner of the viewport, does nothing if there's no view.
 
Methods inherited from class javax.swing.JViewport
addChangeListener, addImpl, computeBlit, createViewListener, firePropertyChange, getAccessibleContext, getChangeListeners, getExtentSize, getInsets, getInsets, getScrollMode, getUI, getUIClassID, getView, getViewRect, isBackingStoreEnabled, isOptimizedDrawingEnabled, paint, paramString, remove, removeChangeListener, repaint, reshape, scrollRectToVisible, setBackingStoreEnabled, setBorder, setExtentSize, setScrollMode, setUI, setViewSize, toViewCoordinates, toViewCoordinates, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZViewport

public ZViewport()
Pass constructor info to super

Method Detail

createLayoutManager

protected java.awt.LayoutManager createLayoutManager()
Subclassers can override this to install a different layout manager (or null) in the constructor. Returns a new ViewportLayout object.

Overrides:
createLayoutManager in class javax.swing.JViewport
Returns:
a LayoutManager

createScrollDirector

protected ZScrollDirector createScrollDirector()
Subclassers can override this to install a different scroll director in the constructor. Returns a new ZScrollDirector object.

Returns:
a ZScrollDirector

setScrollDirector

public void setScrollDirector(ZScrollDirector scrollDirector)
Set the scroll director on this viewport

Parameters:
scrollDirector - The new scroll director

getScrollDirector

public ZScrollDirector getScrollDirector()
Returns:
The scroll director on this viewport

setView

public void setView(java.awt.Component view)
Overridden to throw an exception if the view is not a ZCanvas

Overrides:
setView in class javax.swing.JViewport
Parameters:
view - The new view - it better be a ZCanvas!

setViewPosition

public void setViewPosition(java.awt.Point p)
Sets the view coordinates that appear in the upper left hand corner of the viewport, does nothing if there's no view.

Overrides:
setViewPosition in class javax.swing.JViewport
Parameters:
p - a Point object giving the upper left coordinates

getViewPosition

public java.awt.Point getViewPosition()
Gets the view position from the scroll director based on the current extent size

Overrides:
getViewPosition in class javax.swing.JViewport
Returns:
The new view position

getViewSize

public java.awt.Dimension getViewSize()
Gets the view size from the scroll director based on the current extent size

Overrides:
getViewSize in class javax.swing.JViewport
Returns:
The new view size

getViewSize

public java.awt.Dimension getViewSize(java.awt.geom.Rectangle2D r)
Gets the view size from the scroll director based on the specified extent size

Parameters:
r - The extent size from which the view is computed
Returns:
The new view size

fireStateChanged

public void fireStateChanged()
Notifies all ChangeListeners when the views size, position, or the viewports extent size has changed.

Overrides:
fireStateChanged in class javax.swing.JViewport


Copyright 2003 by University of Maryland, College Park, MD 20742, USA All rights reserved.