|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--sos.reports.AbstractReportSelectionModel
|
+--sos.reports.TierReportSelectionModel
A selection model for rows and columns.
By default, selection ranges are allowed. To control multiple selection, use
setSelectionMode.
Before moving the selection to a tier, this model invokes isTierSelectable,
allowing subclasses to easily customize tier selection.
For example, a client who wishes to ignore the first three tiers
may customize TierReportSelectionModel as follows:
TierReportSelectionModel model = new TierReportSelectionModel() {
protected boolean isTierSelectable( TierElement tierElement )
{
if( !super.isTierSelectable( tierElement ))
return false;
if( tierElement.getIndex() < 3 )
return false;
return true;
}
};
Warning: TierReportSelectionModel is intended to
be used to control the selection
within a single table. Clients may see unspecified results if the same
selection model is used across multiple tables.
CellReportSelectionModel| Constructor Summary | |
TierReportSelectionModel(int tierType)
Creates an instance of TierReportSelectionModel for the
specified tier type. |
|
TierReportSelectionModel(int tierType,
boolean headerSelectable,
boolean footerSelectable)
Creates an instance of TierReportSelectionModel for the
specified tier type that can select headers and footers
as specified. |
|
| 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. |
int |
getSelectionMode()
Returns the tier selection mode. |
int |
getTierType()
Returns TableElement.ROW if this selection model selects rows
and TableElement.COLUMN if this selection model selects columns. |
boolean |
isFooterSelectable()
Returns true if footer tiers can be selected. |
boolean |
isHeaderSelectable()
Returns true if header tiers can be selected. |
boolean |
isSelected(Element element)
Returns true if the specified element is selected. |
protected boolean |
isTierSelectable(TierElement tierElement)
Returns true if the specified tier element is allowed to be 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 |
setFooterSelectable(boolean selectable)
Specifies if footer tiers can be selected. |
void |
setHeaderSelectable(boolean selectable)
Specifies if header tiers can be selected. |
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 |
setSelectionMode(int selectionMode)
Sets the selection mode. |
| 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 |
public TierReportSelectionModel(int tierType)
TierReportSelectionModel for the
specified tier type. By default, the selection mode will
be ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
and header and footer tiers will not be selectable.
tierType - either TableElement.ROW or
TableElement.COLUMN
java.lang.IllegalArgumentException - if tierType is not
TableElement.ROW or TableElement.COLUMNTierReportSelectionModel(int,boolean,boolean)
public TierReportSelectionModel(int tierType,
boolean headerSelectable,
boolean footerSelectable)
TierReportSelectionModel for the
specified tier type that can select headers and footers
as specified. By default, the selection mode will
be ListSelectionModel.MULTIPLE_INTERVAL_SELECTION.
tierType - either TableElement.ROW or
TableElement.COLUMNheaderSelectable - true if header tiers can be selectedfooterSelectable - true if footer tiers can be selected
java.lang.IllegalArgumentException - if tierType is not
TableElement.ROW or TableElement.COLUMN| Method Detail |
public boolean canSelect(Element element,
boolean toggle,
boolean extend)
ReportSelectionModeltoggle and extend.
A subsequent call to select with the same arguments will
throw a NotSelectableException if and only if this invocation returns
false.
canSelect in interface ReportSelectionModelelement - report element on which the selection change is madetoggle - whether or not the selection should be toggledextend - whether or not the selection should be extended to include
the specified element
true if the selection can succeedReportSelectionModel.select(sos.reports.Element, boolean, boolean)public void clearSelection()
ReportSelectionModelgetSelectedElements will return an empty set.
clearSelection in interface ReportSelectionModelpublic Element getAnchorSelectionElement()
ReportSelectionModelselect
with the extend paramter set to false.
getAnchorSelectionElement in interface ReportSelectionModelselect
with the extend paramter set to falsepublic Element getLeadSelectionElement()
ReportSelectionModelselect.
getLeadSelectionElement in interface ReportSelectionModelselectpublic java.util.Set getSelectedElements()
ReportSelectionModel
getSelectedElements in interface ReportSelectionModelpublic int getSelectionMode()
ListSelectionModel.MULTIPLE_INTERVAL_SELECTION,
ListSelectionModel.SINGLE_INTERVAL_SELECTION, and
ListSelectionModel.SINGLE_SELECTION.setSelectionMode(int)public int getTierType()
TableElement.ROW if this selection model selects rows
and TableElement.COLUMN if this selection model selects columns.
public boolean isFooterSelectable()
true if footer tiers can be selected.
setFooterSelectable(boolean)public boolean isHeaderSelectable()
true if header tiers can be selected.
setHeaderSelectable(boolean)public boolean isSelected(Element element)
ReportSelectionModeltrue if the specified element is selected.
isSelected in interface ReportSelectionModelelement - report element in question
true if element is in the selectionprotected boolean isTierSelectable(TierElement tierElement)
true if the specified tier element is allowed to be selected.
This implementation returns true for body tiers,
for header tiers if isHeaderSelectable returns false,
and for footer tiers if isFooterSelectable return false.
Subclasses may override this method to further
restrict tier selection.
tierElement - the tier element in consideration
true if tierElement is selectablepublic void reportChanged(ReportEvent event)
ReportSelectionModel
reportChanged in interface ReportSelectionModelreportChanged in class AbstractReportSelectionModelevent - the event describing how the report has changed
public void select(Element element,
boolean toggle,
boolean extend)
throws NotSelectableException
ReportSelectionModel
select in interface ReportSelectionModelelement - report element on which the selection change is madetoggle - whether or not the selection should be toggledextend - whether or not the selection should be extended to include
the specified element
NotSelectableException - if the action cannot be carried out because
one or more of the needed report elements are not selectableReportSelectionModel.canSelect(sos.reports.Element, boolean, boolean)
public void setAnchorSelectionElement(Element element)
throws NotSelectableException
ReportSelectionModel
setAnchorSelectionElement in interface ReportSelectionModelelement - report element to use as the anchor
NotSelectableException - if element is not selectableReportSelectionModel.getAnchorSelectionElement()public void setFooterSelectable(boolean selectable)
selectable - true if footer tiers are selectableisFooterSelectable()public void setHeaderSelectable(boolean selectable)
selectable - true if header tiers are selectableisHeaderSelectable()
public void setLeadSelectionElement(Element element)
throws NotSelectableException
ReportSelectionModel
setLeadSelectionElement in interface ReportSelectionModelelement - report element to use as the lead anchor
NotSelectableException - if element is not selectableReportSelectionModel.getLeadSelectionElement()
public void setSelectedElements(java.util.Set elements)
throws NotSelectableException
ReportSelectionModel
setSelectedElements in interface ReportSelectionModelelements - report elements to be selected
NotSelectableException - if any element in the set is not selectablepublic void setSelectionMode(int selectionMode)
selectionMode - the ability to select ranges and multiple elements
java.lang.IllegalArgumentException - selectionMode is not
one of ListSelectionEvent.MULTIPLE_INTERVAL_SELECTION,
ListSelectionEvent.SINGLE_INTERVAL_SELECTION,
or ListSelectionEvent.SINGLE_SELECTIONgetSelectionMode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||