public abstract static class SearchProvider.Presenter extends Object
Example:
class ExampleSearchPresenter
extends BasicSearchProvider.Presenter {
BasicSearchForm form = null;
private boolean replacing;
public ExampleSearchPresenter(boolean replacing) {
this.replacing = replacing;
}
public JComponent getForm() {
if (form == null) {
form = new Form(); // create a new with UI for specifying search settings
form.setName("Example Provider");
}
return form;
}
public SearchComposition<Def> composeSearch() {
// here create a new search composition appropriate for settings
// specified in the form.
}
public boolean isUsable() {
return form.isUsable();
}
public void addUsabilityChangeListener(ChangeListener cl) {
form.setUsabilityChangeListener(cl);
}
public void clean() {
super.clean();
form.clean();
}
}
Modifier | Constructor and Description |
---|---|
protected |
Presenter(SearchProvider searchProvider,
boolean replacing)
Constructor for subclasses.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener changeListener)
Adds a
ChangeListener to the listener list. |
void |
clean()
Method called when the dialog is closed.
|
abstract SearchComposition<?> |
composeSearch()
Performs search considering current settings in the panel that was
returned by
SearchProvider.Presenter.getForm() |
protected void |
fireChange()
Fires a change event to all registered listeners.
|
abstract JComponent |
getForm()
Return a JComponent that contains controls for setting search
options.
|
HelpCtx |
getHelpCtx()
Get help ID for this type of search.
|
SearchProvider |
getSearchProvider()
Get associated search provider.
|
boolean |
hasListeners()
Checks if there are any listeners registered to
this
ChangeSupport . |
boolean |
isReplacing()
Get replace mode.
|
abstract boolean |
isUsable(NotificationLineSupport notificationLineSupport)
Test that the current settings specified in associated form are
usable for searching.
|
void |
removeChangeListener(ChangeListener listener)
Removes a
ChangeListener from the listener list. |
protected Presenter(SearchProvider searchProvider, boolean replacing)
searchProvider
- Provider this instance is created for.replacing
- True if the presenter should be shown in replace
dialog, false if it should be shown in find dialog.@NonNull public abstract JComponent getForm()
SearchProvider.Presenter.composeSearch()
is called.@NonNull public abstract SearchComposition<?> composeSearch()
SearchProvider.Presenter.getForm()
public abstract boolean isUsable(@NonNull NotificationLineSupport notificationLineSupport)
notificationLineSupport
- You can set warning, info or error
message shown in the dialog using this object. If you set warning or
error messages, call NotificationLineSupport.clearMessages()
before this method returns true.public final void addChangeListener(@NullAllowed ChangeListener changeListener)
ChangeListener
to the listener list. The same
listener object may be added more than once, and will be called as
many times as it is added. If listener
is null, no
exception is thrown and no action is taken.changeListener
- the ChangeListener
to be added.public final void removeChangeListener(@NullAllowed ChangeListener listener)
ChangeListener
from the listener list. If
listener
was added more than once, it will be notified
one less time after being removed. If listener
is null,
or was never added, no exception is thrown and no action is taken.listener
- the ChangeListener
to be removed.protected final void fireChange()
public final boolean hasListeners()
ChangeSupport
.public void clean()
public final SearchProvider getSearchProvider()
public final boolean isReplacing()
@CheckForNull public HelpCtx getHelpCtx()