com.elixirtech.glint.viewer
Class GlintCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.elixirtech.glint.viewer.ViewerCanvas
                  extended by com.elixirtech.glint.viewer.GlintCanvas
All Implemented Interfaces:
IViewerCanvas, Zoomable, com.elixirtech.ui.INavigation, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Pageable, java.awt.print.Printable, java.io.Serializable

public class GlintCanvas
extends ViewerCanvas
implements com.elixirtech.print.Printable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GlintCanvas()
          Constructor
 
Method Summary
 com.elixirtech.glint.IEye getEye()
          Gets the model object
 int getNumberOfPages()
           
 int getPageCount()
          Get the number of pages in the model
 java.awt.print.PageFormat getPageFormat(int pageNo)
          Part of the printing API, so be careful as this is zero-based, not one-based.
 java.awt.print.Printable getPrintable(int pageNo)
           
 com.elixirtech.glint.g2d.URLMap getURLMap()
          Get the URLMap that identifies the location of URL hotspots on the current page.
 boolean isHighlightURLs()
          Returns whether the HighlightURLs flag is true
 boolean isScrolled()
          Returns whether the Scrolled flag is true
 void paintComponent(java.awt.Graphics g)
           
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageNo)
          Part of the printing API, so be careful as this is zero-based, not one-based.
 void read(java.io.InputStream is)
          Read the model from a stream
 void setEye(com.elixirtech.glint.IEye eye)
          Sets the model object to an IEye object which contains the glint pages
 void setHighlightURLs(boolean b)
          Sets a flag to control whether URLs embedded in the glint should be highlighted.
 void setObject(java.lang.Object o)
          Sets the model object to an IEye object which contains the glint pages
 void setScrolled(boolean b)
          Sets a flag to indicate whether this object is embedded in a scrollpane.
 void update()
          Recalculates the dimensions of the view and repaints.
 
Methods inherited from class com.elixirtech.glint.viewer.ViewerCanvas
addChangeListener, first, getBackgroundColor, getCanvasComponent, getMaximumSize, getMinimumSize, getPageNo, getPreferredSize, getZoomPercent, gotoPage, isBitmapZoom, last, next, previous, read, removeChangeListener, setBackgroundColor, setBitmapZoom, setPageNo, setZoomPercent
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GlintCanvas

public GlintCanvas()
Constructor

Method Detail

setObject

public void setObject(java.lang.Object o)
Sets the model object to an IEye object which contains the glint pages

Specified by:
setObject in interface IViewerCanvas
Specified by:
setObject in class ViewerCanvas
Parameters:
o - The Glint IEye model

read

public void read(java.io.InputStream is)
          throws java.io.IOException
Description copied from interface: IViewerCanvas
Read the model from a stream

Specified by:
read in interface IViewerCanvas
Specified by:
read in class ViewerCanvas
Parameters:
is - The input stream
Throws:
java.io.IOException - if the stream is invalid for this viewer

setEye

public void setEye(com.elixirtech.glint.IEye eye)
Sets the model object to an IEye object which contains the glint pages

Parameters:
eye - The Glint IEye model

getEye

public com.elixirtech.glint.IEye getEye()
Gets the model object

Returns:
The Glint IEye model

setScrolled

public void setScrolled(boolean b)
Sets a flag to indicate whether this object is embedded in a scrollpane. This enables the canvas to notify the scrollpane when it's size changes. Turn this on so that when zooming or showing pages of different sizes the scrollpane reflects the true size of the canvas immediately.

Parameters:
b - True if this control is wrapped with a scrollpane

isScrolled

public boolean isScrolled()
Returns whether the Scrolled flag is true

Returns:
True if the Scrolled flag is true

setHighlightURLs

public void setHighlightURLs(boolean b)
Sets a flag to control whether URLs embedded in the glint should be highlighted.

Parameters:
b - True to enable URL highlighting

isHighlightURLs

public boolean isHighlightURLs()
Returns whether the HighlightURLs flag is true

Returns:
True if the HighlightURLs flag is true

getPageCount

public int getPageCount()
Description copied from interface: IViewerCanvas
Get the number of pages in the model

Specified by:
getPageCount in interface IViewerCanvas
Specified by:
getPageCount in interface com.elixirtech.ui.INavigation
Specified by:
getPageCount in class ViewerCanvas
Returns:
The number of pages in the model

getNumberOfPages

public int getNumberOfPages()
Specified by:
getNumberOfPages in interface java.awt.print.Pageable

update

public void update()
Description copied from interface: IViewerCanvas
Recalculates the dimensions of the view and repaints. This should be called after any changes to the model, eg. calls to setObject(...) or read(...) when ready to display.

Specified by:
update in interface IViewerCanvas
Specified by:
update in class ViewerCanvas

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class ViewerCanvas

getPageFormat

public java.awt.print.PageFormat getPageFormat(int pageNo)
Part of the printing API, so be careful as this is zero-based, not one-based. Gets the page format of the current page. A glint model may contain multiple pages with different orientations and sizes.

Specified by:
getPageFormat in interface java.awt.print.Pageable
Parameters:
pageNo - The page number to query (zero-based)
Returns:
The page format of the chosen page

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pf,
                 int pageNo)
Part of the printing API, so be careful as this is zero-based, not one-based. Print a specified page, using a given page format on to a Graphics.

Specified by:
print in interface java.awt.print.Printable
Parameters:
g - The graphics to draw on
pf - The page format of the chosen page
pageNo - The page to render (zero-based)

getPrintable

public java.awt.print.Printable getPrintable(int pageNo)
Specified by:
getPrintable in interface java.awt.print.Pageable

getURLMap

public com.elixirtech.glint.g2d.URLMap getURLMap()
Get the URLMap that identifies the location of URL hotspots on the current page.

Returns:
The URLMap of hotspots.