sos.reports
Class TemplateReportSelectionModel

java.lang.Object
  |
  +--sos.reports.AbstractReportSelectionModel
        |
        +--sos.reports.TemplateReportSelectionModel
All Implemented Interfaces:
ReportSelectionModel, java.io.Serializable

public class TemplateReportSelectionModel
extends AbstractReportSelectionModel
implements ReportSelectionModel, java.io.Serializable

A report selection model that bases the selection model on the name of the report template.

Since:
1.0
See Also:
TierReportSelectionModel, CellReportSelectionModel, CompositeReportSelectionModel

Constructor Summary
TemplateReportSelectionModel()
          Creates an empty TemplateReportSelectionModel.
TemplateReportSelectionModel(java.lang.String templateName, ReportSelectionModel selectionModel)
          Creates an instance of TemplateReportSelectionModel with an initial selection model mapping.
 
Method Summary
 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 isSelected(Element element)
          Returns true if the specified element is selected.
 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 setTemplateSelectionModel(java.lang.String templateName, ReportSelectionModel selectionModel)
          Associates the specified selection model to the specified template name.
 
Methods inherited from class sos.reports.AbstractReportSelectionModel
addReportSelectionListener, fireSelectionChanged, fireSelectionChanged, fireSelectionChanged, getValueIsAdjusting, removeReportSelectionListener, setValueIsAdjusting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface sos.reports.ReportSelectionModel
addReportSelectionListener, getValueIsAdjusting, removeReportSelectionListener, setValueIsAdjusting
 

Constructor Detail

TemplateReportSelectionModel

public TemplateReportSelectionModel()
Creates an empty TemplateReportSelectionModel. Use setTemplateSelectionModel to add selection models.

See Also:
TemplateReportSelectionModel(String,ReportSelectionModel), setTemplateSelectionModel(java.lang.String, sos.reports.ReportSelectionModel)

TemplateReportSelectionModel

public TemplateReportSelectionModel(java.lang.String templateName,
                                    ReportSelectionModel selectionModel)
Creates an instance of TemplateReportSelectionModel with an initial selection model mapping.

Parameters:
templateName - name of the template for which to use selectionModel
selectionModel - selection model to use if an element corresponding to a report generated by a template named templateName is being selected
Method Detail

canSelect

public boolean canSelect(Element element,
                         boolean toggle,
                         boolean extend)
Description copied from interface: ReportSelectionModel
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.

Specified by:
canSelect in interface ReportSelectionModel
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
See Also:
ReportSelectionModel.select(sos.reports.Element, boolean, boolean)

clearSelection

public void clearSelection()
Description copied from interface: ReportSelectionModel
Clears the current selection, if any. A subsequent call to getSelectedElements will return an empty set.

Specified by:
clearSelection in interface ReportSelectionModel

getAnchorSelectionElement

public Element getAnchorSelectionElement()
Description copied from interface: ReportSelectionModel
Returns the element passed to the last successful invocation of select with the extend paramter set to false.

Specified by:
getAnchorSelectionElement in interface ReportSelectionModel
Returns:
the element passed to the last successful invocation of select with the extend paramter set to false

getLeadSelectionElement

public Element getLeadSelectionElement()
Description copied from interface: ReportSelectionModel
Returns the element passed to the last successful invocation of select.

Specified by:
getLeadSelectionElement in interface ReportSelectionModel
Returns:
the element passed to the last successful invocation of select

getSelectedElements

public java.util.Set getSelectedElements()
Description copied from interface: ReportSelectionModel
Returns the set of selected elements.

Specified by:
getSelectedElements in interface ReportSelectionModel

isSelected

public boolean isSelected(Element element)
Description copied from interface: ReportSelectionModel
Returns true if the specified element is selected.

Specified by:
isSelected in interface ReportSelectionModel
Parameters:
element - report element in question
Returns:
true if element is in the selection

reportChanged

public void reportChanged(ReportEvent event)
Description copied from interface: ReportSelectionModel
Updates itself (if necessary) as a result of a report modification.

Specified by:
reportChanged in interface ReportSelectionModel
Overrides:
reportChanged in class AbstractReportSelectionModel
Parameters:
event - the event describing how the report has changed

select

public void select(Element element,
                   boolean toggle,
                   boolean extend)
            throws NotSelectableException
Description copied from interface: ReportSelectionModel
Changes the selection.

Specified by:
select in interface ReportSelectionModel
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
See Also:
ReportSelectionModel.canSelect(sos.reports.Element, boolean, boolean)

setTemplateSelectionModel

public void setTemplateSelectionModel(java.lang.String templateName,
                                      ReportSelectionModel selectionModel)
Associates the specified selection model to the specified template name. When the client tries to select an element generated by a report template named templateName, this selection model will use selectionModel. A null selectionModel unassociates any selection model from the template name.

Parameters:
templateName - name of the template for which to use selectionModel
selectionModel - selection model to use if an element corresponding to a report generated by a template named templateName is being selected

setAnchorSelectionElement

public void setAnchorSelectionElement(Element element)
                               throws NotSelectableException
Description copied from interface: ReportSelectionModel
Sets the anchor selection element.

Specified by:
setAnchorSelectionElement in interface ReportSelectionModel
Parameters:
element - report element to use as the anchor
Throws:
NotSelectableException - if element is not selectable
See Also:
ReportSelectionModel.getAnchorSelectionElement()

setLeadSelectionElement

public void setLeadSelectionElement(Element element)
                             throws NotSelectableException
Description copied from interface: ReportSelectionModel
Sets the lead selection element.

Specified by:
setLeadSelectionElement in interface ReportSelectionModel
Parameters:
element - report element to use as the lead anchor
Throws:
NotSelectableException - if element is not selectable
See Also:
ReportSelectionModel.getLeadSelectionElement()

setSelectedElements

public void setSelectedElements(java.util.Set elements)
                         throws NotSelectableException
Description copied from interface: ReportSelectionModel
Sets the selection to the report elements in the specified set.

Specified by:
setSelectedElements in interface ReportSelectionModel
Parameters:
elements - report elements to be selected
Throws:
NotSelectableException - if any element in the set is not selectable


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