com.levigo.jadice.appbase
Interface AddOnPresenter

All Known Implementing Classes:
BasicAddOnPresenter

public interface AddOnPresenter

Implementations of this interface are responsible for the presentation of add-on components within the context of jadice viewer. Examples for add-on components are the PageSorter or the SearchPanel if the module addon-search is available on the classpath. In most implementations of jadice viewer only one instance of a certain add-on component is visible at a time. However, AddOnPresenters may also decide to associate a different instance of an add-on component per ViewComponent. Therefore implementations may or may not make use of the supplied context view component. There can only be one AddOnPresenter at a time. AddOnPresenter implementations are usually registered early-on during application startup via the AddOns.setPresenter(AddOnPresenter) API, although some applications may offer a runtime-changeable presentation style. Please note that most add-ons expect certain items to be contained in their Context, e.g. the PageView or the ThumbnailView. However, it is outside the scope of this interface to define how exactly those items end up in the Context.


Method Summary
 void activateAddOn(Class<? extends JComponent> addOnComponentClass, ViewComponent context)
          Activate an existing add-on component of the given class within the context of the given view component.
 void deactivateAddOn(Class<? extends JComponent> addOnComponentClass, ViewComponent context)
          Deactivate an existing add-on component of the given class within the context of the given view component.
 void disposeAddOn(Class<? extends JComponent> addOnComponentClass, ViewComponent context)
          Deactivate and dispose an existing add-on component of the given class within the context of the given view component.
<T extends JComponent>
T
getAddOn(Class<T> addOnComponentClass, ViewComponent context)
          Return the add-on component of the given class within the context of the given view component.
 HashMap<ViewComponent,List<JComponent>> getAddOns()
          Return a map of currently managed add-ons, indexed by context.
 boolean isAddOnActive(Class<? extends JComponent> addOnComponentClass, ViewComponent context)
          Determine whether there is a registered and active (visible) add-on component of the given class within the context of the given view component.
 boolean isAddOnRegistered(Class<? extends JComponent> addOnComponentClass, ViewComponent context)
          Determine whether there is a registered (displayable) add-on component of the given class within the context of the given view component.
 void manageAddOn(JComponent addOn, ViewComponent context)
          Register an add-on component of the given class within the context of the given view component.
 

Method Detail

isAddOnRegistered

boolean isAddOnRegistered(Class<? extends JComponent> addOnComponentClass,
                          ViewComponent context)
Determine whether there is a registered (displayable) add-on component of the given class within the context of the given view component.

Parameters:
addOnComponentClass - the add-on class
context - the view component
Returns:
true if there is a matching add-on, false otherwise

isAddOnActive

boolean isAddOnActive(Class<? extends JComponent> addOnComponentClass,
                      ViewComponent context)
Determine whether there is a registered and active (visible) add-on component of the given class within the context of the given view component.

Parameters:
addOnComponentClass - the add-on class
context - the view component
Returns:
true if there is a matching add-on, false otherwise

getAddOn

<T extends JComponent> T getAddOn(Class<T> addOnComponentClass,
                                  ViewComponent context)
Return the add-on component of the given class within the context of the given view component. Return null if there is no such add-on component.

Type Parameters:
T - the type of add-on
Parameters:
addOnComponentClass - the add-on class
context - the view component
Returns:
the add-on component or null

activateAddOn

void activateAddOn(Class<? extends JComponent> addOnComponentClass,
                   ViewComponent context)
Activate an existing add-on component of the given class within the context of the given view component. The exact semantics of add-on activation depends on the type of presenter implementation: in a multi-frame setting, activation will show the add-on frame and bring it to front, whereas a docking UI will open the corresponding view etc.

Parameters:
addOnComponentClass - the add-on class
context - the view component

deactivateAddOn

void deactivateAddOn(Class<? extends JComponent> addOnComponentClass,
                     ViewComponent context)
Deactivate an existing add-on component of the given class within the context of the given view component. The exact semantics of add-on deactivation depends on the type of presenter implementation: in a multi-frame setting, deactivation will hide the add-on frame, whereas a docking UI will close the corresponding view etc.

Parameters:
addOnComponentClass - the add-on class
context - the view component

manageAddOn

void manageAddOn(JComponent addOn,
                 ViewComponent context)
Register an add-on component of the given class within the context of the given view component.

Parameters:
addOn - the add-on class
context - the view component
Throws:
IllegalArgumentException - if there is already an instance of this add-on class registered within the given context.

disposeAddOn

void disposeAddOn(Class<? extends JComponent> addOnComponentClass,
                  ViewComponent context)
Deactivate and dispose an existing add-on component of the given class within the context of the given view component. The exact semantics of add-on deactivation depends on the type of presenter implementation: in a multi-frame setting, deactivation will dispose the add-on frame, whereas a docking UI will destroy the corresponding view etc.

Parameters:
addOnComponentClass - the add-on class
context - the view component

getAddOns

HashMap<ViewComponent,List<JComponent>> getAddOns()
Return a map of currently managed add-ons, indexed by context.

Returns:
a map of context to list-of-add-ons


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.