eTextReader.AnnotationListing
Class NotationListing

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by eTextReader.AnnotationListing.NotationListing
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ListSelectionListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class NotationListing
extends javax.swing.JFrame
implements java.awt.event.ActionListener, javax.swing.event.ListSelectionListener

A class to display annotations in a tabular form with the added abilities to sort and filter by various criteria. NotationListing delegates responsibility for obtaining the list of annotations to be displayed to two objects. The first, an implementation of the NotationProvider interface, determines the set of pages for which annotations should be shown. The second, an implementation of the NotationFilter interface, determines which annotations on the elibible pages should be displayed.

Version:
2.0
Author:
Chris Johnson, Ryan McFall
See Also:
Serialized Form

Nested Class Summary
private static class NotationListing.Arrow
          Creates small arrow-shaped icons to indicate sorting status in the column headers
 class NotationListing.MouseHandler
          A custom MouseAdapter (MouseListener) class providing the capability to resort the table simply by left or right clicking on column headers.
 class NotationListing.NotationCellEditor
          This class is used in place of the CellEditor typically used by JTable
 class NotationListing.NotationCellRenderer
          This class is used in place of the TableCellRenderer typically used by JTable facilitating the display of different notation types within the table.
 class NotationListing.NotationComparator
          A custom comparator class that facilitates sorting based on primary and secondary sorting criteria.
(package private)  class NotationListing.notationLoadingThread
          This class exists so that the process of loading notations can take place in a separate thread, allowing the event dispatch thread to continue to update the screen GUI
private  class NotationListing.SortableHeaderRenderer
          This class is used in place of the TableCellRenderer typically used by JTable facilitating the display of arrows in the column header to indicate sorting order(s).
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  java.util.ArrayList allNotations
           
private  OEBPackageFile book
           
private  javax.swing.Box bottomBox
           
private  javax.swing.Box buttonBox
           
private  DBClient client
           
private  javax.swing.JPanel column
           
private  java.util.ArrayList columnChecks
           
private  javax.swing.table.DefaultTableColumnModel columnModel
           
private  java.util.Vector<java.lang.String> columnNames
           
private  ViewingPrefs columnPrefs
           
private  ContentContainer container
           
private  NotationInfo currentInfo
           
private  CustomJTable display
           
private  java.util.ArrayList displayedNotations
           
private  javax.swing.table.DefaultTableModel displayModel
           
private  java.util.HashMap elementMap
           
private  java.lang.String endDate
           
private  javax.swing.JPanel filter
           
private  javax.swing.JPanel filterOptionsPanel
           
private  boolean filterOptionsVisible
          Keeps track of whether the filter options pane is currently visible
private  javax.swing.table.JTableHeader header
           
private  HTMLTitleHandler HTMLth
           
private  NotationListing.notationLoadingThread loadThread
           
private  eTextReader.loggingInterface.Logger logger
           
private  Browser.LogListener loglistener
           
private  javax.swing.JSplitPane mainSplit
           
private  NotationListing.NotationComparator nc
           
private  NotationFilter notationFilter
           
private  NotationProvider notationProvider
           
private  java.util.ArrayList prefsCheckboxes
           
private  boolean psortasc
           
private  java.util.HashMap removedColumns
           
private  ScrollingContentPane scrollNotationPane
           
private  java.util.HashMap<java.lang.String,java.lang.String> sortingStatus
          the primary and secondary sorting column names
private  java.util.HashMap<java.lang.String,java.lang.Integer> sortMap
           
private  java.util.Iterator spineIterator
           
private  boolean ssortasc
           
private  java.lang.String startDate
           
private  javax.swing.JButton toggleFilterButton
          controls whether or not the filterOptionsPanel is showing
private  java.lang.String userName
           
private  ViewingPrefs viewPrefs
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
NotationListing(Browser b, java.lang.String startDate, java.lang.String endDate, Browser.LogListener loglistener)
          Constructs a NotationListing object from the given parameters
NotationListing(ContentContainer _container, NotationProvider provider, NotationFilter filter, Browser.LogListener logListener)
           
NotationListing(ContentContainer _container, NotationProvider provider, NotationFilter filter, Browser.LogListener logListener, boolean showFilterOptionsInitially)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Performs all the actions associated with the diffent buttons and menus of this component
private  java.lang.String computeNetworkURL(java.lang.String url)
          This method computes what the correct URL would be to load a page associated with the given annotation URL.
private  javax.swing.Icon getHeaderRendererIcon(java.lang.String headerName, int size)
           
 NotationFilter getNotationFilter()
          Retrives the NotationFilter currently filtering the set of notations contained on the candidate pages
 NotationProvider getNotationProvider()
          Retrieves the NotationProvider currently supplying the set of candidate pages to this NotationListing
 void hideFilterOptions()
          Hides the annotation filtering options
 boolean isFilterOptionsVisible()
          Determines whether or not the filter options panel is currently visible
 void openNotation(int selectedRow)
           
private  void setAnnotations(boolean log)
           
private  void setFilterOptionsVisible(boolean filterOptionsVisible)
           
private  void setHeaderProperties()
           
 void setNotationFilter(NotationFilter notationFilter)
          Sets the NotationFilter object that will be used to filter out the set of annotations that are displayed from the pages identified by the NotationProvider
 void setNotationProvider(NotationProvider notationProvider)
          Sets the NotationProvider object that determines the set of pages for which annotations will be retrieved
 void setSelectedRow(int row)
          Selects the row specified by row
private  void setupBottomButtonPanel()
           
private  javax.swing.JPanel setupColumnBox()
           
private  void setupColumnModel()
           
private  javax.swing.JPanel setupFilterBox()
           
private  void setupSortFilterPanel()
           
 void showFilterOptions()
          Shows the annotation filtering options
private  void updateAnnotations()
           
 void valueChanged(javax.swing.event.ListSelectionEvent e)
          Method required by the ListSelectionListener interface
 void waitForLoadToComplete()
          This method waits for the notation loading thread to complete.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

viewPrefs

private ViewingPrefs viewPrefs

userName

private java.lang.String userName

loglistener

private Browser.LogListener loglistener

scrollNotationPane

private ScrollingContentPane scrollNotationPane

currentInfo

private NotationInfo currentInfo

column

private javax.swing.JPanel column

filter

private javax.swing.JPanel filter

filterOptionsPanel

private javax.swing.JPanel filterOptionsPanel

buttonBox

private javax.swing.Box buttonBox

bottomBox

private javax.swing.Box bottomBox

toggleFilterButton

private javax.swing.JButton toggleFilterButton
controls whether or not the filterOptionsPanel is showing


mainSplit

private javax.swing.JSplitPane mainSplit

client

private DBClient client

prefsCheckboxes

private java.util.ArrayList prefsCheckboxes

columnChecks

private java.util.ArrayList columnChecks

sortMap

private java.util.HashMap<java.lang.String,java.lang.Integer> sortMap

elementMap

private java.util.HashMap elementMap

spineIterator

private java.util.Iterator spineIterator

book

private OEBPackageFile book

HTMLth

private HTMLTitleHandler HTMLth

allNotations

private java.util.ArrayList allNotations

displayedNotations

private java.util.ArrayList displayedNotations

displayModel

private javax.swing.table.DefaultTableModel displayModel

columnModel

private javax.swing.table.DefaultTableColumnModel columnModel

display

private CustomJTable display

columnNames

private java.util.Vector<java.lang.String> columnNames

container

private ContentContainer container

startDate

private java.lang.String startDate

endDate

private java.lang.String endDate

logger

private eTextReader.loggingInterface.Logger logger

removedColumns

private java.util.HashMap removedColumns

columnPrefs

private ViewingPrefs columnPrefs

header

private javax.swing.table.JTableHeader header

filterOptionsVisible

private boolean filterOptionsVisible
Keeps track of whether the filter options pane is currently visible


sortingStatus

private java.util.HashMap<java.lang.String,java.lang.String> sortingStatus
the primary and secondary sorting column names


nc

private NotationListing.NotationComparator nc

psortasc

private boolean psortasc

ssortasc

private boolean ssortasc

notationProvider

private NotationProvider notationProvider

notationFilter

private NotationFilter notationFilter

loadThread

private NotationListing.notationLoadingThread loadThread
Constructor Detail

NotationListing

public NotationListing(ContentContainer _container,
                       NotationProvider provider,
                       NotationFilter filter,
                       Browser.LogListener logListener)

NotationListing

public NotationListing(Browser b,
                       java.lang.String startDate,
                       java.lang.String endDate,
                       Browser.LogListener loglistener)
Constructs a NotationListing object from the given parameters

Parameters:
b - the Browser window; it allows changes to be made in the ContentPane of the other window.
startDate - the date at which the displayed notations begin
endDate - the date at which the displayed notations end

NotationListing

public NotationListing(ContentContainer _container,
                       NotationProvider provider,
                       NotationFilter filter,
                       Browser.LogListener logListener,
                       boolean showFilterOptionsInitially)
Method Detail

hideFilterOptions

public void hideFilterOptions()
Hides the annotation filtering options


showFilterOptions

public void showFilterOptions()
Shows the annotation filtering options


setHeaderProperties

private void setHeaderProperties()

setupSortFilterPanel

private void setupSortFilterPanel()

setupBottomButtonPanel

private void setupBottomButtonPanel()

setupColumnBox

private javax.swing.JPanel setupColumnBox()

setupFilterBox

private javax.swing.JPanel setupFilterBox()

setupColumnModel

private void setupColumnModel()

getHeaderRendererIcon

private javax.swing.Icon getHeaderRendererIcon(java.lang.String headerName,
                                               int size)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Performs all the actions associated with the diffent buttons and menus of this component

Specified by:
actionPerformed in interface java.awt.event.ActionListener

setAnnotations

private void setAnnotations(boolean log)

updateAnnotations

private void updateAnnotations()

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent e)
Method required by the ListSelectionListener interface

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener

openNotation

public void openNotation(int selectedRow)

computeNetworkURL

private java.lang.String computeNetworkURL(java.lang.String url)
This method computes what the correct URL would be to load a page associated with the given annotation URL. It tries to look up the URL using lookupURLByPkgID; if this fails, then the URL is unchanged

Parameters:
url -
Returns:

setSelectedRow

public void setSelectedRow(int row)
Selects the row specified by row

Parameters:
row - the 0-based integer index identifying the row to be selected

getNotationFilter

public NotationFilter getNotationFilter()
Retrives the NotationFilter currently filtering the set of notations contained on the candidate pages

Returns:
the current NotationFilter

setNotationFilter

public void setNotationFilter(NotationFilter notationFilter)
Sets the NotationFilter object that will be used to filter out the set of annotations that are displayed from the pages identified by the NotationProvider

Parameters:
notationFilter - an object implementing the NotationFilter interface

getNotationProvider

public NotationProvider getNotationProvider()
Retrieves the NotationProvider currently supplying the set of candidate pages to this NotationListing

Returns:
the current NotationProvider

setNotationProvider

public void setNotationProvider(NotationProvider notationProvider)
Sets the NotationProvider object that determines the set of pages for which annotations will be retrieved

Parameters:
notationProvider - an object implementing the NotationProvider interface

waitForLoadToComplete

public void waitForLoadToComplete()
This method waits for the notation loading thread to complete. It is primarily useful when doing a performance analysis and you want to make sure that the whole process is given time to complete, but can be used any time you need to ensure notation loading has finished


isFilterOptionsVisible

public boolean isFilterOptionsVisible()
Determines whether or not the filter options panel is currently visible

Returns:
true if the filter options panel is visible, false otherwise

setFilterOptionsVisible

private void setFilterOptionsVisible(boolean filterOptionsVisible)
Parameters:
filterOptionsVisible -