public abstract class UITableFilter extends Object
Filters are specified in the same parent element as osd:table
, for example:
where<xs:annotation> <xs:appinfo> <osd:table>...</osd:table> <osd:uiFilter class="com.foo.MyUIFilter1"> <label>Label of filter 1</label> </osd:uiFilter> <osd:uiFilter class="com.foo.MyUIFilter2"> <label>Default label of filter 2</label> <label xml:lang="fr">Libellé en français du filtre 2</label> </osd:uiFilter> <xs:appinfo> </xs:annotation>
com.foo.MyUIFilter1
and com.foo.MyUIFilter2
are
the fully qualified name of classes implementing this interface.
The declaration may also use parameters:
where<osd:uiFilter class="com.foo.MyUIFilter3"> <param1>...</param1> <param2>...</param2> </osd:uiFilter>
param1
and param2
are JavaBean properties
of com.foo.MyUIFilter3
class.
For more information, see the JavaBean specification.
Each specified filter class is instantiated
through its default constructor and, if defined, the JavaBean property
setters are called (in the example above, setParam1(...)
and
setParam2(...)
).
Constructor and Description |
---|
UITableFilter() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addForEdit(UITableFilterResponseContext aResponse)
Adds HTML or DHTML to the filter pane, to allow the user to set the filter.
|
void |
addForPrint(UITableFilterResponseContext aResponse)
Deprecated.
Use
addForEdit(UITableFilterResponseContext) instead. |
UserMessage |
getLabel()
Returns the label of this filter.
|
abstract void |
handleApply(UITableFilterRequestContext aContext)
Handles the request when the "Apply filter" button is selected.
|
void |
handleReset()
This method is invoked when the "Reset" button is selected or when a custom view is applied to the table.
|
void |
handleSelect(UITableFilterRequestContext aContext)
Deprecated.
From v5.0.0, all filters are displayed on the screen.
|
boolean |
hasFilterToApply()
If this method returns
true , a check box is
displayed in the filter title bar, allowing the user to easily apply or remove this filter. |
boolean |
isResetButtonEnabled()
Returns whether the "Reset" button is to be displayed.
|
void |
setLabel(Locale aLocale,
String aLabel)
Sets the label of this filter for the specified locale.
|
void |
setLabel(String aLabel)
Sets the default label of this filter.
|
void |
setLabel(UserMessage aUserMessage) |
void |
setLabelUserMessage(UserMessageString aUserMessage)
Sets the labels of this filter for the specified locales by looking in the
UserMessageString . |
public abstract void addForEdit(UITableFilterResponseContext aResponse)
When this method is called, the container has already added a <form ...>
tag.
After this method has returned, a closing </form>
tag is added.
Therefore, the implementation of this method only needs to insert the HTML components within.
aResponse.add("<input type=\"checkbox\" name=\"item\" style=\"border: 0;\" value=\"P4\" "); if (selection.contains("P4")) aResponse.add(" checked"); aResponse.add("> Label of P4<br>");
requestID
onw
(in lower or upper case).
public void addForPrint(UITableFilterResponseContext aResponse)
addForEdit(UITableFilterResponseContext)
instead.
The default implementation redirects to addForEdit(UITableFilterResponseContext)
.
For production use, it is recommended to implement this method appropriately.
public abstract void handleApply(UITableFilterRequestContext aContext)
The implementation of this method should:
addForEdit(UITableFilterResponseContext)
);
UITableFilterRequestContext.setTableFilter(AdaptationFilter)
.
public void handleSelect(UITableFilterRequestContext aContext)
The implementation of this method should take into account the internal state
of this instance in order to build the appropriate
AdaptationFilter
and set it by calling
UITableFilterRequestContext.setTableFilter(AdaptationFilter)
.
Default implementation does nothing.
public boolean isResetButtonEnabled()
handleReset()
is called.
Default returned value is false
, to be overridden if necessary.
true
if the "Reset" button is to be displayed,
false
otherwise.handleReset()
public void handleReset()
isResetButtonEnabled()
.
Default implementation does nothing. If overridden, this method should reset this instance to its initial state.
isResetButtonEnabled()
public boolean hasFilterToApply()
true
, a check box is
displayed in the filter title bar, allowing the user to easily apply or remove this filter.
Thus, it is recommended to return false
if no filtering is defined
by the user interface.
Default returned value is true
, to be overridden if necessary.
true
if the filter has criteria to apply,
false
otherwise.public UserMessage getLabel()
public final void setLabel(Locale aLocale, String aLabel)
public final void setLabelUserMessage(UserMessageString aUserMessage)
UserMessageString
.public final void setLabel(String aLabel)
public void setLabel(UserMessage aUserMessage)