sos.reports
Class JReportPane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--sos.reports.JReportPane
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable

public class JReportPane
extends javax.swing.JComponent
implements javax.accessibility.Accessible, javax.swing.Scrollable

A report renderer and editor. This Swing component is a combination of javax.swing.JTable and javax.swing.JTextPane. It displays and edits text and images in a report format but works with objects, renderers, and editors, rather than text.

The report pane internally maps the report's Element hierarchy to a View hierarchy, where each view is responsible for the rendering of a particular element. In most cases, clients need not worry about the View used to render an element. The methods in JReportPane take and return instances of Element.

Report Editor Kit

JReportPane gets some of its behavior from an instance of ReportEditorKit. The default editor kit is typically sufficient to handle most reports. However, if it does not suffice, clients should pass a custom editor kit into either the constructor or the setEditorKit method.

Element Traversal Order

To change the order in which report elements are selected when the Tab key is pressed, clients should supply the report pane with an instance of TraversalPolicy.

Text Highlighting

To highlight text, clients should get the TextHighlighter via getTextHighlighter and invoke addHighlight to

Drag 'n Drop and Cut 'n Paste

Right-Clicking

The report pane, by default, does not respond to right mouse clicks. To respond to right mouse clicks, add a mouse listener, find the report element at the cursor, and perform the action, as follows:

 reportPane.addMouseListener( new MouseAdapter() {
   public void mouseClicked( MouseEvent event )
   {
     if( !event.isPopupTrigger() )
       return;

     Element selectedElement = reportPane.getSelectionAt( event.getPoint() );
     if( selectedElement != null )
     {
       // perform the desired action
     }
     return;
   }
 } );
 

Since:
1.0

Nested Class Summary
protected  class JReportPane.AccessibleJReportPane
          A class that implements accessibility support for a JReportPane.
static interface JReportPane.HeaderFooterFactory
          An object that specifies page headers and footers.
 
Field Summary
static java.lang.String DRAG_ENABLED_PROPERTY
          Constant used by property change events to signal that the JReportPane's desire to edit by dragging has changed.
static java.lang.String EDITABLE_PROPERTY
          Constant used by property change events to signal that the JReportPane's desire to be edited has changed.
static java.lang.String EDITOR_KIT_PROPERTY
          Constant used by property change events to signal that the JReportPane's editor kit has changed.
static java.lang.String EDITOR_MODEL_PROPERTY
          Constant used by property change events to signal that the JReportPane's editor model has changed.
static java.lang.String MARGIN_PROPERTY
          Constant used by property change events to signal that the JReportPane's margins have changed.
static java.lang.String MOUSE_OVER_ENABLED_PROPERTY
          Constant used by property change events to signal that the JReportPane's desire to show mouse-over hints has changed.
static java.lang.String REPORT_PROPERTY
          Constant used by property change events to signal that the JReportPane's underlying report has changed.
static java.lang.String SELECTION_BACKGROUND_PROPERTY
          Constant used by property change events to signal that the JReportPane's preferred selection background color has changed.
static java.lang.String SELECTION_FOREGROUND_PROPERTY
          Constant used by property change events to signal that the JReportPane's preferred selection foreground color has changed.
static java.lang.String SELECTION_MODEL_PROPERTY
          Constant used by property change events to signal that the JReportPane's selection model has changed.
static java.lang.String TEXT_HIGHLIGHTER_PROPERTY
          Constant used by property change events to signal that the JReportPane's text highlighter has changed.
 
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
JReportPane()
          Creates a JReportPane with a default report and editor kit.
JReportPane(Report report)
          Creates a JReportPane with the specified report and a default editor kit.
JReportPane(Report report, ReportEditorKit editorKit)
          Creates a JReportPane with the specified report and editor kit.
 
Method Summary
 boolean changeSelection(Element element, boolean toggle, boolean extend)
          Changes the selection of report elements.
protected  ReportEditorKit createDefaultEditorKit()
          Creates a returns an editor kit to use if the client does not specify one.
protected  ReportEditorModel createDefaultEditorModel()
          Creates and returns an editor model to use if the client does not specify one.
protected  Report createDefaultReport()
          Creates and returns a report to render if the client does not specify one.
protected  ReportSelectionModel createDefaultSelectionModel()
          Creates and returns a selection model to use if the client does not specify one.
 boolean editElement(Element element, java.util.EventObject event)
          Attempts to edit the specified element as a result of the specified event.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this JReportPane.
 boolean getDragEnabled()
          Returns true if this report pane allows the dragging of its report contents to other components or applications.
 Element getEditingElement()
          Returns the element that is currently being edited.
 ElementEditor getEditor()
          Returns the editor in charge of the current editing.
 java.awt.Component getEditorComponent()
          Returns the editor component that is editing an element.
 ReportEditorKit getEditorKit()
          Returns the currently installed editor kit.
 ReportEditorModel getEditorModel()
          Returns the editor model that controls the editing of report elements.
 java.awt.Rectangle getElementRectangle(Element element)
          Returns the region occupied by the specified element.
 java.util.Set getElementsAt(java.awt.Point point)
          Returns a set of the elements being rendered at the specified point.
 TraversalPolicy getElementTraversalPolicy()
          Returns the policy that controls the tab order among elements.
 java.awt.print.Pageable getFittedPageable(java.awt.print.PageFormat pageFormat)
          Returns a Pageable that scales the report to fit the page width and then breaks the report into pages for printing.
 java.awt.print.Pageable getFittedPageable(java.awt.print.PageFormat pageFormat, JReportPane.HeaderFooterFactory headerFooterFactory, java.awt.Component underlaidWatermark, java.awt.Component overlaidWatermark)
          Returns a Pageable that scales the report to fit the page width and then breaks the report into stylized pages for printing.
 java.awt.Insets getMargin()
          Returns the amount of space between this report pane's border and report.
 java.awt.print.Pageable getPageable(java.awt.print.PageFormat pageFormat)
          Returns a Pageable that breaks the report into pages for printing.
 java.awt.print.Pageable getPageable(java.awt.print.PageFormat pageFormat, JReportPane.HeaderFooterFactory headerFooterFactory, java.awt.Component underlaidWatermark, java.awt.Component overlaidWatermark)
          Returns a Pageable that breaks the report into stylized pages for printing.
 java.awt.Dimension getPreferredScrollableViewportSize()
          Returns the preferred size of the viewport for a view component.
 Report getReport()
          Returns the report being rendered by this report pane.
 int getScrollableBlockIncrement(java.awt.Rectangle rectangle, int param, int param2)
          Returns the scrollable block increment.
 boolean getScrollableTracksViewportHeight()
          Returns true if a viewport should always force this component's height to match the height of the viewport.
 boolean getScrollableTracksViewportWidth()
          Returns true if a viewport should always force this component's width to match the width of the viewport.
 int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
          Returns the scrollable unit increment.
 Element getSelectionAt(java.awt.Point point)
          Returns the first selected element at the specified point.
 java.awt.Color getSelectionBackground()
          Returns the color to paint the background of selected elements, or null if no color is specified.
 java.awt.Color getSelectionForeground()
          Returns the color to use in the foreground of selected elements, or null if no color is specified.
 ReportSelectionModel getSelectionModel()
          Returns the model that controls the selection of report contents.
 boolean getSelectionNeededForDrag()
          Returns true if an element must be selected before the user can drag it.
 boolean getSurrendersFocusOnKeystroke()
          Returns true if this report pane should give up the focus and give it to the editor when a keystroke activates editing.
 TextHighlighter getTextHighlighter()
          Returns the object that controls text highlighting.
 java.lang.String getToolTipText(java.awt.event.MouseEvent event)
          Returns the string to be used as the tooltip for event.
 ReportPaneUI getUI()
          Returns the look and feel delegate that renders this report pane.
 java.lang.String getUIClassID()
          Returns the UIDefaults key used to look up the name of the swing.plaf.ComponentUI class that defines the look and feel for this component.
 boolean isEditable()
          Returns true if this report pane can be edited.
 boolean isEditing()
          Returns true if this report pane is currently editing its report contents.
 boolean isFocusable()
          Returns whether this component can be focused.
 boolean isMouseOverEnabled()
          Returns true if mouse-over hints are enabled.
 void mouseOver(java.awt.Point point)
          Informs this report pane that the mouse is over the specified point.
protected  boolean processKeyBinding(javax.swing.KeyStroke keyStroke, java.awt.event.KeyEvent event, int condition, boolean pressed)
          Invoked to process the key bindings for keyStroke as a result of the KeyEvent.
 void removeEditor()
          Cancels the current editing, if any.
 void removeNotify()
          Notifies this component that it no longer has a parent component.
 void scrollElementToVisible(Element element)
          Scrolls this report pane, as needed, to ensure that the specified element is visible.
 void setBounds(int x, int y, int width, int height)
          Moves and resizes this report pane.
 void setDragEnabled(boolean dragEnabled)
          Sets whether or not this report pane should allow dragging of its report contents to other components or applications.
 void setEditable(boolean editable)
          Sets whether or not this report pane can be edited.
 void setEditorKit(ReportEditorKit editorKit)
          Sets the editor kit.
 void setEditorModel(ReportEditorModel editorModel)
          Sets the editor model, which controls the editing of report elements.
 void setElementTraversalPolicy(TraversalPolicy traversalPolicy)
          Sets the policy that controls the tab order among elements.
 void setMargin(java.awt.Insets margin)
          Sets the amount of space between this report pane's border and report.
 void setMouseOverEnabled(boolean enabled)
          Sets whether this component should provide mouse-over hints.
 void setReport(Report report)
          Establishes the report that this report pane should render and edit.
 void setSelectionBackground(java.awt.Color color)
          Sets the selection background color.
 void setSelectionForeground(java.awt.Color color)
          Sets the selection foreground color.
 void setSelectionModel(ReportSelectionModel selectionModel)
          Sets the selection model, which governs how elements are selected.
 void setSelectionNeededForDrag(boolean selectionNeededForDrag)
          Sets if an element must be selected before the user can drag it.
 void setSurrendersFocusOnKeystroke(boolean surrendersFocusOnKeystroke)
          Sets whether editors get the focus after a keystroke activates editing.
 void setTextHighlighter(TextHighlighter textHighlighter)
          Sets the object that controls text highlighting.
 void setUI(ReportPaneUI newUI)
          Sets the look and feel delegate for this report pane.
 boolean stopEditing()
          Stops the editing of an element.
 void stopMouseOver()
          Hides any mouse-over hints that are being shown.
 void updateUI()
          Resets the UI property with the value from the current look and feel.
 
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, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, 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, addImpl, 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, 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, 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, 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
 

Field Detail

EDITABLE_PROPERTY

public static final java.lang.String EDITABLE_PROPERTY
Constant used by property change events to signal that the JReportPane's desire to be edited has changed.

See Also:
Constant Field Values

EDITOR_KIT_PROPERTY

public static final java.lang.String EDITOR_KIT_PROPERTY
Constant used by property change events to signal that the JReportPane's editor kit has changed.

See Also:
Constant Field Values

EDITOR_MODEL_PROPERTY

public static final java.lang.String EDITOR_MODEL_PROPERTY
Constant used by property change events to signal that the JReportPane's editor model has changed.

See Also:
Constant Field Values

DRAG_ENABLED_PROPERTY

public static final java.lang.String DRAG_ENABLED_PROPERTY
Constant used by property change events to signal that the JReportPane's desire to edit by dragging has changed.

See Also:
Constant Field Values

MARGIN_PROPERTY

public static final java.lang.String MARGIN_PROPERTY
Constant used by property change events to signal that the JReportPane's margins have changed.

See Also:
Constant Field Values

MOUSE_OVER_ENABLED_PROPERTY

public static final java.lang.String MOUSE_OVER_ENABLED_PROPERTY
Constant used by property change events to signal that the JReportPane's desire to show mouse-over hints has changed.

See Also:
Constant Field Values

REPORT_PROPERTY

public static final java.lang.String REPORT_PROPERTY
Constant used by property change events to signal that the JReportPane's underlying report has changed.

See Also:
Constant Field Values

SELECTION_BACKGROUND_PROPERTY

public static final java.lang.String SELECTION_BACKGROUND_PROPERTY
Constant used by property change events to signal that the JReportPane's preferred selection background color has changed.

See Also:
Constant Field Values

SELECTION_FOREGROUND_PROPERTY

public static final java.lang.String SELECTION_FOREGROUND_PROPERTY
Constant used by property change events to signal that the JReportPane's preferred selection foreground color has changed.

See Also:
Constant Field Values

SELECTION_MODEL_PROPERTY

public static final java.lang.String SELECTION_MODEL_PROPERTY
Constant used by property change events to signal that the JReportPane's selection model has changed.

See Also:
Constant Field Values

TEXT_HIGHLIGHTER_PROPERTY

public static final java.lang.String TEXT_HIGHLIGHTER_PROPERTY
Constant used by property change events to signal that the JReportPane's text highlighter has changed.

See Also:
Constant Field Values
Constructor Detail

JReportPane

public JReportPane()
Creates a JReportPane with a default report and editor kit.

See Also:
JReportPane(Report,ReportEditorKit)

JReportPane

public JReportPane(Report report)
Creates a JReportPane with the specified report and a default editor kit.

Parameters:
report - document to display and possibly edit
See Also:
JReportPane(Report,ReportEditorKit)

JReportPane

public JReportPane(Report report,
                   ReportEditorKit editorKit)
Creates a JReportPane with the specified report and editor kit.

Parameters:
report - document to display and possibly edit
editorKit - object that controls the editing of the report
Method Detail

changeSelection

public boolean changeSelection(Element element,
                               boolean toggle,
                               boolean extend)
Changes the selection of report elements. This implementation merely forward the request to the selection model.

This method is provided because javax.swing.JTable provides a similar method. To be consistent with JTable, whenever the UI or the editor kit changes the selection, it should use this method, thereby allowing a subclass to override this method and change the behavior of all selection changes.

Parameters:
element - report element on which the selection change is made
toggle - whether or not the selection should be toggled
extend - whether or not the selection should be extended to include the specified element
Returns:
true if the selection was changed (i.e. the underlying selection model did not throw a NotSelectableException)
Throws:
java.lang.NullPointerException - if element is null
See Also:
ReportSelectionModel.select(sos.reports.Element, boolean, boolean)

createDefaultEditorKit

protected ReportEditorKit createDefaultEditorKit()
Creates a returns an editor kit to use if the client does not specify one. This method is called from the constructor and allows subclasses to change the default editor kit.

Returns:
a default editor kit

createDefaultEditorModel

protected ReportEditorModel createDefaultEditorModel()
Creates and returns an editor model to use if the client does not specify one. This method is called from the constructor and allows subclasses to change the default editor model.

Returns:
a default editor model

createDefaultReport

protected Report createDefaultReport()
Creates and returns a report to render if the client does not specify one. This method is called from the constructor and allows subclasses to change the default report.

Returns:
a default report

createDefaultSelectionModel

protected ReportSelectionModel createDefaultSelectionModel()
Creates and returns a selection model to use if the client does not specify one. This method is called from the constructor and allows subclasses to change the default editor model.

Returns:
a default selection model

getPageable

public java.awt.print.Pageable getPageable(java.awt.print.PageFormat pageFormat)
Returns a Pageable that breaks the report into pages for printing. The pages will not have a header, footer, or watermark.

Parameters:
pageFormat - the page format to be used for all pages
Returns:
a Pageable that can print this JReportPane
Throws:
java.lang.NullPointerException - if pageFormat is null
See Also:
getPageable(PageFormat,JReportPane.HeaderFooterFactory,Component,Component)

getPageable

public java.awt.print.Pageable getPageable(java.awt.print.PageFormat pageFormat,
                                           JReportPane.HeaderFooterFactory headerFooterFactory,
                                           java.awt.Component underlaidWatermark,
                                           java.awt.Component overlaidWatermark)
Returns a Pageable that breaks the report into stylized pages for printing. The pages will have the specified header, footer, and watermarks.

Parameters:
pageFormat - the page format to be used for all pages
headerFooterFactory - an object that provides the page headers and footers (may be null)
underlaidWatermark - object that draws on the page background before the header, footer, and report pages are drawn (may be null)
overlaidWatermark - object that draws on the page after the header, footer, and report pages are drawn (may be null)
Returns:
a Pageable that can print this JReportPane
Throws:
java.lang.NullPointerException - if pageFormat is null
See Also:
getPageable(PageFormat)

getFittedPageable

public java.awt.print.Pageable getFittedPageable(java.awt.print.PageFormat pageFormat)
Returns a Pageable that scales the report to fit the page width and then breaks the report into pages for printing. If the report is smaller than the page width, then no scaling occurs.

The pages will not have a header, footer, or watermark.

Parameters:
pageFormat - the page format to be used for all pages
Returns:
a Pageable that can print this JReportPane
Throws:
java.lang.NullPointerException - if pageFormat is null
See Also:
getFittedPageable(PageFormat,JReportPane.HeaderFooterFactory,Component,Component)

getFittedPageable

public java.awt.print.Pageable getFittedPageable(java.awt.print.PageFormat pageFormat,
                                                 JReportPane.HeaderFooterFactory headerFooterFactory,
                                                 java.awt.Component underlaidWatermark,
                                                 java.awt.Component overlaidWatermark)
Returns a Pageable that scales the report to fit the page width and then breaks the report into stylized pages for printing. If the report is smaller than the page width, then no scaling occurs.

The pages will not have a header, footer, or watermark.

Parameters:
pageFormat - the page format to be used for all pages
headerFooterFactory - an object that provides the page headers and footers (may be null)
underlaidWatermark - object that draws on the page background before the header, footer, and report pages are drawn (may be null)
overlaidWatermark - object that draws on the page after the header, footer, and report pages are drawn (may be null)
Returns:
a Pageable that can print this JReportPane
Throws:
java.lang.NullPointerException - if pageFormat is null
See Also:
getFittedPageable(PageFormat)

editElement

public boolean editElement(Element element,
                           java.util.EventObject event)
Attempts to edit the specified element as a result of the specified event. Any current editing is halted.

Editing cannot start if any one of the following conditions holds:

Parameters:
element - element to edit
event - event to trigger the editing
Returns:
true if editing of element has successfully started
Throws:
java.lang.NullPointerException - if element is null
See Also:
CellEditor.stopCellEditing(), isEditable(), Component.isEnabled(), Report.isElementEditable(sos.reports.Element), ReportEditorModel.getEditor(sos.reports.Element), CellEditor.isCellEditable(java.util.EventObject)

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JReportPane.

Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class javax.swing.JComponent
Returns:
the AccessibleContext associated with this JReportPane

getDragEnabled

public boolean getDragEnabled()
Returns true if this report pane allows the dragging of its report contents to other components or applications.

Returns:
true if dragging is enabled
See Also:
setDragEnabled(boolean)

getEditingElement

public Element getEditingElement()
Returns the element that is currently being edited.

Returns:
the element being edited, or null, if none
See Also:
editElement(sos.reports.Element, java.util.EventObject), isEditing()

getEditor

public ElementEditor getEditor()
Returns the editor in charge of the current editing.

Returns:
the editor in charge of the editing or null, if no element is being edited
See Also:
editElement(sos.reports.Element, java.util.EventObject), isEditing(), getEditorComponent()

getEditorComponent

public java.awt.Component getEditorComponent()
Returns the editor component that is editing an element.

Returns:
the editor editing an element, or null, if no element is being edited
See Also:
editElement(sos.reports.Element, java.util.EventObject), isEditing(), getEditor()

getEditorKit

public ReportEditorKit getEditorKit()
Returns the currently installed editor kit.

Returns:
the editor kit overseeing the editing of the report (cannot be null)
See Also:
setEditorKit(sos.reports.ReportEditorKit)

getEditorModel

public ReportEditorModel getEditorModel()
Returns the editor model that controls the editing of report elements.

Returns:
the editor model
See Also:
setEditorModel(sos.reports.ReportEditorModel)

getElementRectangle

public java.awt.Rectangle getElementRectangle(Element element)
Returns the region occupied by the specified element.

Parameters:
element - report element for which the bounding area is requested
Returns:
the Rectangle containing element
Throws:
java.lang.IllegalArgumentException - if element is not being rendered by this report pane
java.lang.NullPointerException - if element is null

getElementTraversalPolicy

public TraversalPolicy getElementTraversalPolicy()
Returns the policy that controls the tab order among elements.

Returns:
the traversal policy
See Also:
setElementTraversalPolicy(sos.reports.TraversalPolicy)

getMargin

public java.awt.Insets getMargin()
Returns the amount of space between this report pane's border and report.

Returns:
the margins
See Also:
setMargin(java.awt.Insets)

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for a view component.

Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable
Returns:
the preferred size of a JViewport whose view is this Scrollable

getReport

public Report getReport()
Returns the report being rendered by this report pane.

Returns:
the report being rendered by this report pane
See Also:
setReport(sos.reports.Report)

getElementsAt

public java.util.Set getElementsAt(java.awt.Point point)
Returns a set of the elements being rendered at the specified point. If there are no elements at the point, the returned set is empty.

Parameters:
point - (x,y) position within this component at which to retrieve the elements
Returns:
an unmodifiable set of the elements at point
Throws:
java.lang.NullPointerException - if point is null

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle rectangle,
                                       int param,
                                       int param2)
Returns the scrollable block increment.

Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable
Parameters:
rectangle - The view area visible within the viewport
Returns:
The amount the viewport should scroll as a result of a "block" increment. It should be positive.

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Returns true if a viewport should always force this component's height to match the height of the viewport.

Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable
Returns:
true if a viewport should keep the container's height the same height of the viewport

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Returns true if a viewport should always force this component's width to match the width of the viewport.

Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable
Returns:
true if a viewport should keep the container's width the same width of the viewport

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Returns the scrollable unit increment.

Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable
Parameters:
orientation - The axis of the scrolling--either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL
direction - A negative number to indicate scrolling left or up, or a positive number to indicate scrolling right or down
Returns:
The amount the viewport should scroll as a result of a "unit" increment. It should be positive.

getSelectionAt

public Element getSelectionAt(java.awt.Point point)
Returns the first selected element at the specified point.

Parameters:
point - x,y coordinates at which the selected element is requested
Returns:
the first selected element at point, or null, if none selected

getSelectionBackground

public java.awt.Color getSelectionBackground()
Returns the color to paint the background of selected elements, or null if no color is specified.

Returns:
the background selection color
See Also:
setSelectionBackground(java.awt.Color)

getSelectionForeground

public java.awt.Color getSelectionForeground()
Returns the color to use in the foreground of selected elements, or null if no color is specified.

Returns:
the foreground selection color
See Also:
setSelectionForeground(java.awt.Color)

getSelectionModel

public ReportSelectionModel getSelectionModel()
Returns the model that controls the selection of report contents.

Returns:
the selection model

getSelectionNeededForDrag

public boolean getSelectionNeededForDrag()
Returns true if an element must be selected before the user can drag it. A value of false means the user can select and drag in one action.

Returns:
true if selection is needed in order to drag
See Also:
setSelectionNeededForDrag(boolean)

getSurrendersFocusOnKeystroke

public boolean getSurrendersFocusOnKeystroke()
Returns true if this report pane should give up the focus and give it to the editor when a keystroke activates editing.

Returns:
true if the editor should get the focus when keystrokes activate editing
See Also:
setSurrendersFocusOnKeystroke(boolean)

getTextHighlighter

public TextHighlighter getTextHighlighter()
Returns the object that controls text highlighting.

Returns:
the text highlighter
See Also:
setTextHighlighter(sos.reports.TextHighlighter)

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
Returns the string to be used as the tooltip for event. This implementation forwards the request to the look-and-feel delegate.

Overrides:
getToolTipText in class javax.swing.JComponent
See Also:
getUI()

getUI

public ReportPaneUI getUI()
Returns the look and feel delegate that renders this report pane.

Returns:
the UI for this report pane

getUIClassID

public java.lang.String getUIClassID()
Returns the UIDefaults key used to look up the name of the swing.plaf.ComponentUI class that defines the look and feel for this component.

Overrides:
getUIClassID in class javax.swing.JComponent
Returns:
the UIDefaults key for a ComponentUI subclass

isEditable

public boolean isEditable()
Returns true if this report pane can be edited.

See Also:
setEditable(boolean)

isEditing

public boolean isEditing()
Returns true if this report pane is currently editing its report contents.

Returns:
true if this report pane is allowing the user to edit a portion of the report

isFocusable

public boolean isFocusable()
Returns whether this component can be focused. This implementation always returns true.

Overrides:
isFocusable in class java.awt.Component
Returns:
true if this component is focusable; false otherwise

isMouseOverEnabled

public boolean isMouseOverEnabled()
Returns true if mouse-over hints are enabled.

Returns:
true if mouse-over hints are enabled
See Also:
setMouseOverEnabled(boolean)

mouseOver

public void mouseOver(java.awt.Point point)
               throws java.lang.NullPointerException
Informs this report pane that the mouse is over the specified point. If this report pane allows mouse-over hints, it will install hints appropriate for the specified point. It acquires the hints from its editor kit. If mouse-over hints are not enabled, the method does nothing.

Note that this report pane does not care if the mouse cursor is actually at the specified point.

Parameters:
point - x and y coordinates for which to provide hints
Throws:
java.lang.NullPointerException - if point is null
See Also:
isMouseOverEnabled(), stopMouseOver(), ReportEditorKit.getMouseOverComponent(sos.reports.View)

processKeyBinding

protected boolean processKeyBinding(javax.swing.KeyStroke keyStroke,
                                    java.awt.event.KeyEvent event,
                                    int condition,
                                    boolean pressed)
Invoked to process the key bindings for keyStroke as a result of the KeyEvent.

Overrides:
processKeyBinding in class javax.swing.JComponent
Parameters:
keyStroke - the KeyStroke queried
event - the KeyEvent
condition - one of the following values: JComponent.WHEN_FOCUSED, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, JComponent.WHEN_IN_FOCUSED_WINDOW
pressed - true if the key is pressed
Returns:
true if there was a binding to an action, and the action was enabled

removeEditor

public void removeEditor()
Cancels the current editing, if any.


removeNotify

public void removeNotify()
Notifies this component that it no longer has a parent component.

Overrides:
removeNotify in class javax.swing.JComponent

scrollElementToVisible

public void scrollElementToVisible(Element element)
                            throws java.lang.NullPointerException
Scrolls this report pane, as needed, to ensure that the specified element is visible.

Parameters:
element - element to make ensure visible
Throws:
java.lang.NullPointerException - if element is null

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Moves and resizes this report pane.

Overrides:
setBounds in class java.awt.Component
Parameters:
x - the new x-coordinate of this report pane
y - the new y-coordinate of this report pane
width - the new width of this report pane
height - the new height of thie report pane

setDragEnabled

public void setDragEnabled(boolean dragEnabled)
                    throws java.awt.HeadlessException
Sets whether or not this report pane should allow dragging of its report contents to other components or applications.

Parameters:
dragEnabled - true if dragging should be allowed
Throws:
java.awt.HeadlessException - if dragEnabled is true and GraphicsEnvironment.isHeadless returns true
See Also:
getDragEnabled()

setEditable

public void setEditable(boolean editable)
Sets whether or not this report pane can be edited.

Parameters:
editable - true if editing is allowed on this report pane
See Also:
isEditable()

setEditorKit

public void setEditorKit(ReportEditorKit editorKit)
Sets the editor kit.

Parameters:
editorKit - the object to control the rendering and editing of the report
Throws:
java.lang.NullPointerException - if editorKit is null
See Also:
getEditorKit()

setEditorModel

public void setEditorModel(ReportEditorModel editorModel)
Sets the editor model, which controls the editing of report elements.

Parameters:
editorModel - the new editor model
Throws:
java.lang.NullPointerException - if editorModel is null
See Also:
getEditorModel()

setElementTraversalPolicy

public void setElementTraversalPolicy(TraversalPolicy traversalPolicy)
Sets the policy that controls the tab order among elements.

Parameters:
traversalPolicy - the traversal policy

setMargin

public void setMargin(java.awt.Insets margin)
Sets the amount of space between this report pane's border and report. Unlike the margins of javax.swing.JTextComponent, these will not interfere with any border placed around this report pane.

Parameters:
margin - the padding between the border and report
See Also:
getMargin()

setMouseOverEnabled

public void setMouseOverEnabled(boolean enabled)
Sets whether this component should provide mouse-over hints.

Parameters:
enabled - true if this component should provide mouse-over hints
See Also:
isMouseOverEnabled(), mouseOver(java.awt.Point)

setReport

public void setReport(Report report)
               throws java.lang.NullPointerException
Establishes the report that this report pane should render and edit.

Parameters:
report - the report that this report pane should render and edit
Throws:
java.lang.NullPointerException - if report is null

setSelectionBackground

public void setSelectionBackground(java.awt.Color color)
Sets the selection background color.

Parameters:
color - color to paint the background of selected elements
See Also:
getSelectionBackground()

setSelectionForeground

public void setSelectionForeground(java.awt.Color color)
Sets the selection foreground color.

Parameters:
color - color to use in the foreground of selected elements
See Also:
getSelectionForeground()

setSelectionModel

public void setSelectionModel(ReportSelectionModel selectionModel)
Sets the selection model, which governs how elements are selected.

Parameters:
selectionModel - the selection model
Throws:
java.lang.NullPointerException - if selectionModel is null
See Also:
getSelectionModel()

setSelectionNeededForDrag

public void setSelectionNeededForDrag(boolean selectionNeededForDrag)
Sets if an element must be selected before the user can drag it. A value of false means the user can select and drag in one action.

Parameters:
selectionNeededForDrag - true if selection is needed in order to drag; false if the user can select and drag in one action
See Also:
getSelectionNeededForDrag()

setSurrendersFocusOnKeystroke

public void setSurrendersFocusOnKeystroke(boolean surrendersFocusOnKeystroke)
Sets whether editors get the focus after a keystroke activates editing.

Parameters:
surrendersFocusOnKeystroke - true if editors should get the focus after a keystroke activates editing
See Also:
getSurrendersFocusOnKeystroke()

setTextHighlighter

public void setTextHighlighter(TextHighlighter textHighlighter)
Sets the object that controls text highlighting.

Parameters:
textHighlighter - the text highlighter
See Also:
getTextHighlighter()

setUI

public void setUI(ReportPaneUI newUI)
Sets the look and feel delegate for this report pane.

Parameters:
newUI - the new UI delegate

stopEditing

public boolean stopEditing()
Stops the editing of an element.

Returns:
false if the editing cannot be stopped
See Also:
CellEditor.stopCellEditing()

stopMouseOver

public void stopMouseOver()
Hides any mouse-over hints that are being shown. This method turns off mouse-over hints until the next call to mouseOver. To turn off mouse-over hints permamently, use setMouseOverEnabled.

See Also:
mouseOver(java.awt.Point), setMouseOverEnabled(boolean)

updateUI

public void updateUI()
Resets the UI property with the value from the current look and feel.

Overrides:
updateUI in class javax.swing.JComponent


Copyright 2003, 2004 Side of Software (SOS). All rights reserved.