jdbreport.view
Class ReportPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by jdbreport.view.ReportPane
All Implemented Interfaces:
and.finder.Finder, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, TargetGrid, UndoListener, ReportListListener, HeighCalculator
Direct Known Subclasses:
ReportEditorPane

public class ReportPane
extends JPanel
implements ReportListListener, UndoListener, PropertyChangeListener, TargetGrid, HeighCalculator, and.finder.Finder

Version:
2.0 30.11.2011
Author:
Andrey Kholmanskih
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String CURRENT_DIRECTORY_PATH
           
static String CURRENT_FILE_FILTER
           
static String CURRENT_FILTER
           
static String CURRENT_IMAGE_PATH
           
static String EXCEL_COMMAND
           
protected  JPopupMenu gridMenu
           
static String JDBREPORT_CONF
           
static String LOOK_AND_FEEL
           
static String ODS_COMMAND
           
static String POS_X
           
static String POS_Y
           
protected  and.properties.XMLProperties properties
           
static String SIZE_HEIGHT
           
static String SIZE_WIDTH
           
static String WINDOW_STATE
           
 
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
ReportPane(and.properties.XMLProperties properties)
           
 
Method Summary
protected  void addGridListeners(JReportGrid grid)
           
protected  void addReportGrid(int index, ReportModel rm)
           
 void addReportGrid(JReportGrid grid, int index)
           
protected  void addReportGrid(ReportModel rm)
           
 int calcRowHeight(ReportModel model, Cell cell, int row, int column)
           
protected  boolean canShowGrid(ReportModel rm)
           
 void clear()
           
protected  ReportBook createDefaultReportBook()
           
protected  JFileChooser createFileChooser()
           
protected  JReportGrid createReportGrid(ReportModel rm)
           
 boolean find(and.finder.FindParams findParams)
           
protected  JReportGrid findReportGrid(int index)
          Find ReportGrid in tabbedPane
 String getCaption()
           
 Action getCopyAction()
           
 Action getCutAction()
           
protected  FileFilter getDefaultFilter(JFileChooser fileChooser)
          Returns default filter
 Action getDeleteAction()
           
static FileType getFileTypeClass(String className)
           
 Action getFindAction()
           
 JReportGrid getFocusedGrid()
           
protected  int getFocusedIndex()
           
protected  JPopupMenu getGridMenu()
           
protected  JFrame getParentFrame()
           
 Action getPasteAction()
           
 and.properties.XMLProperties getProperties()
           
 ReportAction.EditRedoAction getRedoAction()
           
 ReportBook getReportBook()
           
 File getReportFile()
           
 JReportGrid getReportGrid(int index)
           
 List<JReportGrid> getReportGridList()
           
 Action getSelectAllAction()
           
 StringMetrics getStringMetrics()
           
protected  Icon getTabbedIcon()
           
 JTabbedPane getTabbedPane()
           
 int getTabCount()
           
protected  JPopupMenu getTabMenu()
           
 ReportAction.EditUndoAction getUndoAction()
           
protected  LinkedList<UndoItem> getUndoStack()
           
 boolean hasRedo()
           
 boolean hasUndo()
           
 boolean incrementalFind(and.finder.FindParams findParams)
           
protected  int indexOfTabbed(JReportGrid grid)
           
protected  void initActions()
           
protected  void insertReportBook(ReportBook book)
           
 void insertReportGrid(int index, JReportGrid grid)
           
protected  void installListeners()
           
 boolean isDirty()
           
 boolean isModified()
           
 boolean loadSheet()
           
 boolean loadSheet(File file, ReportReader reader)
           
 boolean moveSheet(int fromIndex, int toIndex)
           
 void newReport()
           
protected  boolean open()
           
 boolean open(byte[] buf, String readerId)
           
 boolean open(File file)
           
 boolean open(File file, ReportReader reader)
           
protected  void preview()
           
 void print()
          Printing of all report
 boolean print(Component component, List<JReportGrid> grids, boolean showPrintDialog, boolean interactive)
          Printing of all report
 boolean print(Component component, List<JReportGrid> grids, boolean showPrintDialog, boolean interactive, int numPage)
          Printing of all report
 void printPdfDocument()
          Print pdf document
 void printSheet()
          Printing of the selected sheet
 void propertyChange(PropertyChangeEvent evt)
           
 void pushUndo(UndoEvent evt)
           
protected  void pushUndo(UndoItem undo)
           
 void redo()
           
protected  void removeGridListeners(JReportGrid grid)
           
 void removeReportGrid(JReportGrid grid)
           
 void reportAdded(ReportListEvent e)
          Tells listeners that a report was added to the list.
 void reportMoved(ReportListEvent e)
          Tells listeners that a row was repositioned.
 void reportRemoved(ReportListEvent e)
          Tells listeners that a report was removed from the list.
 void resetDirty()
           
protected  boolean save()
           
 boolean saveAs(File file)
           
 boolean saveQuestion()
           
 void saveSheet()
           
 void saveSheet(File file, ReportWriter writer)
           
protected  void setDirty()
           
 void setFocusedGrid(int index)
           
protected  void setGridMenu(JPopupMenu gridMenu)
           
protected  void setGridVisible(JReportGrid source, Boolean newValue)
           
 void setReportBook(ReportBook reportBook)
           
 void setTabMenu(JPopupMenu tabMenu)
           
protected  void setTitle(String caption)
           
protected  void showFindPanel()
           
 void undo()
           
protected  void uninstallListeners()
           
 void unionUndo(UndoEvent evt)
           
protected  void updateCaption()
           
protected  void updateSheetActions()
           
protected  void updateUndoRedoState()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ODS_COMMAND

public static final String ODS_COMMAND
See Also:
Constant Field Values

EXCEL_COMMAND

public static final String EXCEL_COMMAND
See Also:
Constant Field Values

LOOK_AND_FEEL

public static final String LOOK_AND_FEEL
See Also:
Constant Field Values

CURRENT_FILE_FILTER

public static final String CURRENT_FILE_FILTER
See Also:
Constant Field Values

WINDOW_STATE

public static final String WINDOW_STATE
See Also:
Constant Field Values

JDBREPORT_CONF

public static final String JDBREPORT_CONF
See Also:
Constant Field Values

POS_X

public static final String POS_X
See Also:
Constant Field Values

POS_Y

public static final String POS_Y
See Also:
Constant Field Values

SIZE_WIDTH

public static final String SIZE_WIDTH
See Also:
Constant Field Values

SIZE_HEIGHT

public static final String SIZE_HEIGHT
See Also:
Constant Field Values

properties

protected and.properties.XMLProperties properties

gridMenu

protected JPopupMenu gridMenu

CURRENT_FILTER

public static String CURRENT_FILTER

CURRENT_DIRECTORY_PATH

public static String CURRENT_DIRECTORY_PATH

CURRENT_IMAGE_PATH

public static String CURRENT_IMAGE_PATH
Constructor Detail

ReportPane

public ReportPane(and.properties.XMLProperties properties)
Method Detail

getProperties

public and.properties.XMLProperties getProperties()

calcRowHeight

public int calcRowHeight(ReportModel model,
                         Cell cell,
                         int row,
                         int column)
Specified by:
calcRowHeight in interface HeighCalculator

getStringMetrics

public StringMetrics getStringMetrics()
Specified by:
getStringMetrics in interface HeighCalculator

addReportGrid

protected void addReportGrid(ReportModel rm)

addReportGrid

protected void addReportGrid(int index,
                             ReportModel rm)

addReportGrid

public void addReportGrid(JReportGrid grid,
                          int index)

addGridListeners

protected void addGridListeners(JReportGrid grid)

removeGridListeners

protected void removeGridListeners(JReportGrid grid)

createReportGrid

protected JReportGrid createReportGrid(ReportModel rm)

canShowGrid

protected boolean canShowGrid(ReportModel rm)

removeReportGrid

public void removeReportGrid(JReportGrid grid)

getFocusedGrid

public JReportGrid getFocusedGrid()
Specified by:
getFocusedGrid in interface TargetGrid

getReportBook

public ReportBook getReportBook()
Returns:
the reportBook.

getGridMenu

protected JPopupMenu getGridMenu()

setGridMenu

protected void setGridMenu(JPopupMenu gridMenu)

moveSheet

public boolean moveSheet(int fromIndex,
                         int toIndex)

setFocusedGrid

public void setFocusedGrid(int index)

getFocusedIndex

protected int getFocusedIndex()

getReportGridList

public List<JReportGrid> getReportGridList()

resetDirty

public void resetDirty()

isDirty

public boolean isDirty()

setDirty

protected void setDirty()

createDefaultReportBook

protected ReportBook createDefaultReportBook()

getTabbedPane

public JTabbedPane getTabbedPane()

getTabbedIcon

protected Icon getTabbedIcon()

getTabMenu

protected JPopupMenu getTabMenu()

setTabMenu

public void setTabMenu(JPopupMenu tabMenu)

getReportGrid

public JReportGrid getReportGrid(int index)

reportAdded

public void reportAdded(ReportListEvent e)
Description copied from interface: ReportListListener
Tells listeners that a report was added to the list.

Specified by:
reportAdded in interface ReportListListener

reportMoved

public void reportMoved(ReportListEvent e)
Description copied from interface: ReportListListener
Tells listeners that a row was repositioned.

Specified by:
reportMoved in interface ReportListListener

reportRemoved

public void reportRemoved(ReportListEvent e)
Description copied from interface: ReportListListener
Tells listeners that a report was removed from the list.

Specified by:
reportRemoved in interface ReportListListener

findReportGrid

protected JReportGrid findReportGrid(int index)
Find ReportGrid in tabbedPane

Parameters:
index -
Returns:
JReportGrid

indexOfTabbed

protected int indexOfTabbed(JReportGrid grid)

insertReportBook

protected void insertReportBook(ReportBook book)

loadSheet

public boolean loadSheet(File file,
                         ReportReader reader)

print

public boolean print(Component component,
                     List<JReportGrid> grids,
                     boolean showPrintDialog,
                     boolean interactive)
              throws PrinterException,
                     HeadlessException
Printing of all report

Parameters:
showPrintDialog -
interactive -
Returns:
true if the print has been successful
Throws:
PrinterException
HeadlessException
Since:
2.0

print

public boolean print(Component component,
                     List<JReportGrid> grids,
                     boolean showPrintDialog,
                     boolean interactive,
                     int numPage)
              throws PrinterException,
                     HeadlessException
Printing of all report

Parameters:
showPrintDialog -
interactive -
numPage - default page
Returns:
true if the print has been successful
Throws:
PrinterException
HeadlessException
Since:
2.0

print

public void print()
Printing of all report

Since:
1.4

printPdfDocument

public void printPdfDocument()
                      throws IOException
Print pdf document

Throws:
IOException
Since:
1.4

printSheet

public void printSheet()
Printing of the selected sheet


preview

protected void preview()

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

setGridVisible

protected void setGridVisible(JReportGrid source,
                              Boolean newValue)

installListeners

protected void installListeners()

uninstallListeners

protected void uninstallListeners()

clear

public void clear()

saveSheet

public void saveSheet(File file,
                      ReportWriter writer)
               throws IOException
Throws:
IOException

newReport

public void newReport()

updateCaption

protected void updateCaption()

setTitle

protected void setTitle(String caption)

getCaption

public String getCaption()

setReportBook

public void setReportBook(ReportBook reportBook)

open

protected boolean open()

open

public boolean open(File file)

open

public boolean open(File file,
                    ReportReader reader)

updateSheetActions

protected void updateSheetActions()

open

public boolean open(byte[] buf,
                    String readerId)

saveAs

public boolean saveAs(File file)

getDefaultFilter

protected FileFilter getDefaultFilter(JFileChooser fileChooser)
Returns default filter

Parameters:
fileChooser -
Returns:
default FileFilter
Since:
1.3

getFileTypeClass

public static FileType getFileTypeClass(String className)

createFileChooser

protected JFileChooser createFileChooser()

saveSheet

public void saveSheet()

loadSheet

public boolean loadSheet()

save

protected boolean save()

getReportFile

public File getReportFile()

insertReportGrid

public void insertReportGrid(int index,
                             JReportGrid grid)

getTabCount

public int getTabCount()

initActions

protected void initActions()

getFindAction

public Action getFindAction()

getCutAction

public Action getCutAction()

getSelectAllAction

public Action getSelectAllAction()
Returns:
the selectAllAction

getDeleteAction

public Action getDeleteAction()
Returns:
the deleteAction

getPasteAction

public Action getPasteAction()
Returns:
the pasteAction

getCopyAction

public Action getCopyAction()
Returns:
the copyAction

getUndoAction

public ReportAction.EditUndoAction getUndoAction()
Returns:
the undoAction

getRedoAction

public ReportAction.EditRedoAction getRedoAction()
Returns:
the redoAction

showFindPanel

protected void showFindPanel()

find

public boolean find(and.finder.FindParams findParams)
Specified by:
find in interface and.finder.Finder

incrementalFind

public boolean incrementalFind(and.finder.FindParams findParams)
Specified by:
incrementalFind in interface and.finder.Finder

getUndoStack

protected LinkedList<UndoItem> getUndoStack()

pushUndo

public void pushUndo(UndoEvent evt)
Specified by:
pushUndo in interface UndoListener

pushUndo

protected void pushUndo(UndoItem undo)

unionUndo

public void unionUndo(UndoEvent evt)
Specified by:
unionUndo in interface UndoListener

undo

public void undo()

redo

public void redo()

hasUndo

public boolean hasUndo()

hasRedo

public boolean hasRedo()

isModified

public boolean isModified()

updateUndoRedoState

protected void updateUndoRedoState()

saveQuestion

public boolean saveQuestion()

getParentFrame

protected JFrame getParentFrame()