sos.reports
Interface ReportSelectionModel

All Known Implementing Classes:
AbstractReportSelectionModel, CellReportSelectionModel, CompositeReportSelectionModel, TemplateReportSelectionModel, TierReportSelectionModel

public interface ReportSelectionModel

The interface to selecting report elements.

Since:
1.0
See Also:
JReportPane.getSelectionModel()

Method Summary
 void addReportSelectionListener(ReportSelectionListener listener)
          Registers the specified listener so that it is notified when the selection changes.
 boolean canSelect(Element element, boolean toggle, boolean extend)
          Returns true if the specified element is selectable given the current selection and the state of toggle and extend.
 void clearSelection()
          Clears the current selection, if any.
 Element getAnchorSelectionElement()
          Returns the element passed to the last successful invocation of select with the extend paramter set to false.
 Element getLeadSelectionElement()
          Returns the element passed to the last successful invocation of select.
 java.util.Set getSelectedElements()
          Returns the set of selected elements.
 boolean getValueIsAdjusting()
          Returns true if the selection is undergoing a series of changes.
 boolean isSelected(Element element)
          Returns true if the specified element is selected.
 void removeReportSelectionListener(ReportSelectionListener listener)
          Unregisters the specified listener so that it is not notified when the selection changes.
 void reportChanged(ReportEvent event)
          Updates itself (if necessary) as a result of a report modification.
 void select(Element element, boolean toggle, boolean extend)
          Changes the selection.
 void setAnchorSelectionElement(Element element)
          Sets the anchor selection element.
 void setLeadSelectionElement(Element element)
          Sets the lead selection element.
 void setSelectedElements(java.util.Set elements)
          Sets the selection to the report elements in the specified set.
 void setValueIsAdjusting(boolean isAdjusting)
          Sets whether or not the selection is about to undergo changes.
 

Method Detail

addReportSelectionListener

public void addReportSelectionListener(ReportSelectionListener listener)
Registers the specified listener so that it is notified when the selection changes.

Parameters:
listener - object to be notified when a change in the selection occurs

clearSelection

public void clearSelection()
Clears the current selection, if any. A subsequent call to getSelectedElements will return an empty set.


getLeadSelectionElement

public Element getLeadSelectionElement()
Returns the element passed to the last successful invocation of select.

Returns:
the element passed to the last successful invocation of select

getAnchorSelectionElement

public Element getAnchorSelectionElement()
Returns the element passed to the last successful invocation of select with the extend paramter set to false.

Returns:
the element passed to the last successful invocation of select with the extend paramter set to false

getSelectedElements

public java.util.Set getSelectedElements()
Returns the set of selected elements.


getValueIsAdjusting

public boolean getValueIsAdjusting()
Returns true if the selection is undergoing a series of changes.

Returns:
true if the selection is currently adjusting
See Also:
setValueIsAdjusting(boolean)

canSelect

public boolean canSelect(Element element,
                         boolean toggle,
                         boolean extend)
Returns true if the specified element is selectable given the current selection and the state of toggle and extend. A subsequent call to select with the same arguments will throw a NotSelectableException if and only if this invocation returns false.

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 can succeed
Throws:
java.lang.NullPointerException - if element is null
See Also:
select(sos.reports.Element, boolean, boolean)

isSelected

public boolean isSelected(Element element)
Returns true if the specified element is selected.

Parameters:
element - report element in question
Returns:
true if element is in the selection

removeReportSelectionListener

public void removeReportSelectionListener(ReportSelectionListener listener)
Unregisters the specified listener so that it is not notified when the selection changes.

Parameters:
listener - object that does not wish to be notified when a change in the selection occurs

reportChanged

public void reportChanged(ReportEvent event)
Updates itself (if necessary) as a result of a report modification.

Parameters:
event - the event describing how the report has changed

select

public void select(Element element,
                   boolean toggle,
                   boolean extend)
            throws NotSelectableException
Changes the selection.

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
Throws:
NotSelectableException - if the action cannot be carried out because one or more of the needed report elements are not selectable
java.lang.NullPointerException - if element is null
See Also:
canSelect(sos.reports.Element, boolean, boolean)

setAnchorSelectionElement

public void setAnchorSelectionElement(Element element)
                               throws NotSelectableException
Sets the anchor selection element.

Parameters:
element - report element to use as the anchor
Throws:
NotSelectableException - if element is not selectable
java.lang.NullPointerException - if element is null
See Also:
getAnchorSelectionElement()

setLeadSelectionElement

public void setLeadSelectionElement(Element element)
                             throws NotSelectableException
Sets the lead selection element.

Parameters:
element - report element to use as the lead anchor
Throws:
NotSelectableException - if element is not selectable
java.lang.NullPointerException - if element is null
See Also:
getLeadSelectionElement()

setSelectedElements

public void setSelectedElements(java.util.Set elements)
                         throws NotSelectableException
Sets the selection to the report elements in the specified set.

Parameters:
elements - report elements to be selected
Throws:
java.lang.ClassCastException - if any element in the set is not an instance of Element
NotSelectableException - if any element in the set is not selectable
java.lang.NullPointerException - if elements is null or any element in the set is null

setValueIsAdjusting

public void setValueIsAdjusting(boolean isAdjusting)
Sets whether or not the selection is about to undergo changes.

Parameters:
isAdjusting - true if a series of changes is about to take place
See Also:
getValueIsAdjusting()


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