com.elixirtech.glint.viewer
Class TextCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JEditorPane
                      extended by com.elixirtech.glint.viewer.TextCanvas
All Implemented Interfaces:
IViewerCanvas, com.elixirtech.ui.INavigation, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable

public class TextCanvas
extends javax.swing.JEditorPane
implements IViewerCanvas

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
 
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.JEditorPane
HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TextCanvas()
           
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener cl)
          Register interest in changes to the viewer.
 void first()
           
 javax.swing.JComponent getCanvasComponent()
          Get the component that shows the view.
 int getPageCount()
          Get the number of pages in the model
 int getPageNo()
          Get the current page number
 java.lang.String getStatus()
           
 boolean gotoPage(int index)
           
 void last()
           
 boolean next()
           
 boolean previous()
           
 void read(java.io.File f)
          Read the model from a file
 void read(java.io.InputStream is)
          Read the model from a stream
 void removeChangeListener(javax.swing.event.ChangeListener cl)
          Remove the change listener
 void setObject(java.lang.Object o)
          Set an object as the model for the viewer.
 void setPageNo(int no)
          Show a specific page (in the range 1<=no<=getPageCount())
 void update()
          Recalculates the dimensions of the view and repaints.
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getText, getUIClassID, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, replaceSelection, scrollToReference, setContentType, setEditorKit, setEditorKitForContentType, setPage, setPage, setText
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, 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, 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
 
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, 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, 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, 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

TextCanvas

public TextCanvas()
Method Detail

setObject

public void setObject(java.lang.Object o)
Description copied from interface: IViewerCanvas
Set an object as the model for the viewer. The kind of object supported varies with each implementation of the interface

Specified by:
setObject in interface IViewerCanvas
Parameters:
o - The object to view

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener cl)
Description copied from interface: IViewerCanvas
Register interest in changes to the viewer. This includes changes to the current page

Specified by:
addChangeListener in interface IViewerCanvas
Parameters:
cl - The change listener

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener cl)
Description copied from interface: IViewerCanvas
Remove the change listener

Specified by:
removeChangeListener in interface IViewerCanvas
Parameters:
cl - The change listener

read

public void read(java.io.File f)
          throws java.io.IOException
Description copied from interface: IViewerCanvas
Read the model from a file

Specified by:
read in interface IViewerCanvas
Parameters:
f - The file to read
Throws:
java.io.IOException - if the file is invalid for this viewer, or doesn't exist

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
Parameters:
is - The input stream
Throws:
java.io.IOException - if the stream is invalid for this viewer

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

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
Returns:
The number of pages in the model

setPageNo

public void setPageNo(int no)
Description copied from interface: IViewerCanvas
Show a specific page (in the range 1<=no<=getPageCount())

Specified by:
setPageNo in interface IViewerCanvas
Parameters:
no - The page to show (1-based)

getPageNo

public int getPageNo()
Description copied from interface: IViewerCanvas
Get the current page number

Specified by:
getPageNo in interface IViewerCanvas
Specified by:
getPageNo in interface com.elixirtech.ui.INavigation
Returns:
The current page (in the range 1<=no<=getPageCount())

getCanvasComponent

public javax.swing.JComponent getCanvasComponent()
Description copied from interface: IViewerCanvas
Get the component that shows the view. Wrap this with a scrollpane if you want it scrollable.

Specified by:
getCanvasComponent in interface IViewerCanvas
Returns:
the component that shows the view

getStatus

public java.lang.String getStatus()

first

public void first()
Specified by:
first in interface com.elixirtech.ui.INavigation

previous

public boolean previous()
Specified by:
previous in interface com.elixirtech.ui.INavigation

next

public boolean next()
Specified by:
next in interface com.elixirtech.ui.INavigation

last

public void last()
Specified by:
last in interface com.elixirtech.ui.INavigation

gotoPage

public boolean gotoPage(int index)
Specified by:
gotoPage in interface com.elixirtech.ui.INavigation