public abstract class AbstractFeature extends AbstractPluginStateComponent implements Feature, DependencyScopeOwner
AbstractFeature provides an abstract base class for implementing Features.| Modifier and Type | Field and Description |
|---|---|
protected java.util.ArrayList<FeatureView> |
activeViews |
protected java.util.HashMap<java.lang.String,FeatureView> |
backStackViews |
protected int |
featureContainerId |
protected FeatureManager |
featureManager |
protected DependencyScope |
featureScope |
protected boolean |
isActivityFeature |
protected Feature |
parentFeature |
protected java.lang.Class<? extends DependencyScope> |
scopeClass |
params| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFeature(java.lang.Class<? extends DependencyScope> scopeClass)
Construct a new instance of
AbstractFeature. |
protected |
AbstractFeature(java.lang.Class<? extends DependencyScope> scopeClass,
boolean isActivityFeature)
Construct a new instance of
AbstractFeature. |
| Modifier and Type | Method and Description |
|---|---|
FeatureView |
addActiveView(FeatureView view)
|
protected void |
addBackStackView(java.lang.String tag,
FeatureView view)
Adds the given
FeatureView to the HashMap that contains all
the FeatureViews of this Feature that has been added to back stack. |
boolean |
canGoBack()
Tests if the previous
FeatureView can be navigated back to. |
void |
clearBackStack()
Clears the back stack managed by
FragmentManager. |
void |
destroy()
Invoked to set the state of
PluginStateComponent to be destroyed. |
void |
finish()
Finishes this
Feature |
java.util.List<FeatureView> |
getActiveViews()
Gets the currently active
FeatureViews. |
protected static java.lang.Class<? extends FeatureView> |
getClass(FeatureView view) |
FeatureContainer |
getFeatureContainer()
|
protected DependencyScope |
getFeatureScope() |
DependencyScope |
getOwnedScope()
Gets the
DependencyScope owned by this DependencyScopeOwner. |
Feature |
getParentFeature()
|
java.lang.Class<? extends DependencyScope> |
getScopeClass()
|
void |
goBack()
Goes back to previous
FeatureView. |
boolean |
hasBackStackViews()
Tests if this
Feature has any FeatureViews in back stack. |
boolean |
hasForegroundView()
Tests if this
Feature is in foreground i.e. |
void |
hideView(java.lang.Class<? extends Presenter> presenterClass,
boolean addedToBackStack,
java.lang.String tag)
Hides the
FeatureView attached to the given Presenter. |
void |
hideView(FeaturePresenter presenter,
boolean addedToBackStack,
java.lang.String tag)
Hides the
FeatureView attached to the given Presenter. |
boolean |
isActiveView(FeatureView view)
Tests if the given
FeatureView is currently active one. |
boolean |
isActivityFeature()
Tests if this
Feature is set to be an Activity Feature that is owned and controlled
by an Activity. |
boolean |
isBackPressedEventHandler()
Tests if this
Feature handles the back pressed event. |
void |
onFeatureContainerPaused(FeatureContainer container,
boolean finishing)
Invoked when a
FeatureContainer has been paused. |
void |
onFeatureContainerResumed(FeatureContainer container)
Invoked when a
FeatureContainer has been resumed. |
void |
onFeatureContainerStarted(FeatureContainer container)
Invoked when a
FeatureContainer has been started. |
void |
onFeatureContainerStopped(FeatureContainer container,
boolean finishing)
Invoked when a
FeatureContainer has been stopped. |
protected void |
onPause(boolean finishing)
Invoked by
Feature.pause(boolean). |
void |
onPresenterFinished(Presenter presenter)
Invoked by a
Presenter when it has been finished by invoking Presenter.finish(). |
void |
pause()
Invoked to pause this
PluginStateComponent. |
void |
pause(boolean finishing)
Invoked to pause this
Feature. |
<T> T |
plug(java.lang.Class<?> pluginClass)
Plugs an instance of specific
Class to PluginBus. |
<T> T |
plug(java.lang.Object plugin)
Plugs the the given plugin
Object to this PluginBus. |
FeatureView |
removeActiveView(FeatureView view)
|
protected void |
removeBackStackView(java.lang.String tag)
Removes the specified
FeatureView from the HashMap that contains all the
FeatureViews of this Feature that has been added to back stack. |
void |
resume()
Invoked to resume this
PluginStateComponent. |
void |
setActivityFeature(boolean isActivityFeature)
Sets this
Feature to be an Activity Feature that is owned and controlled by
an Activity. |
void |
setFeatureContainer(FeatureContainer container)
|
void |
setFeatureManager(FeatureManager manager)
Sets the
FeatureManager that started this Feature. |
void |
setParentFeature(Feature parentFeature)
|
FeatureView |
showView(java.lang.Class<? extends Presenter> presenterClass,
boolean addToBackStack,
Params... params)
Shows the
FeatureView attached to the specified Presenter. |
FeatureView |
showView(FeatureTransitionManager transitionManager,
java.lang.Class<? extends Presenter> presenterClass,
boolean addToBackStack,
java.lang.String tag,
Params... params)
Shows the
FeatureView attached to the specified Presenter. |
FeatureView |
showView(int featureContainerId,
java.lang.Class<? extends Presenter> presenterClass,
boolean addToBackStack,
java.lang.String tag,
Params... params)
Shows the
FeatureView attached to the specified Presenter. |
void |
stop()
Invoked to set the state of
PluginStateComponent to be stopped. |
void |
unplug(java.lang.Object plugin)
Unplugs the the given plugin
Object to this PluginBus. |
getLifecycleState, getParams, getState, isDestroyed, isPaused, isRestarted, isResumed, isStarted, isStopped, onCreate, onDestroy, onPause, onRestart, onResume, onStart, onStop, restart, start, startonPlugged, onPluginPlugged, onPluginUnplugged, onUnpluggedgetScope, setScopeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLifecycleState, getState, isDestroyed, isPaused, isRestarted, isResumed, isStarted, isStopped, restart, start, startonPlugged, onPluginPlugged, onPluginUnplugged, onUnpluggedprotected final java.util.ArrayList<FeatureView> activeViews
protected final java.util.HashMap<java.lang.String,FeatureView> backStackViews
protected int featureContainerId
protected FeatureManager featureManager
protected DependencyScope featureScope
protected boolean isActivityFeature
protected Feature parentFeature
protected java.lang.Class<? extends DependencyScope> scopeClass
protected AbstractFeature(java.lang.Class<? extends DependencyScope> scopeClass)
AbstractFeature.scopeClass - The Class of the owned DependencyScope.protected AbstractFeature(java.lang.Class<? extends DependencyScope> scopeClass, boolean isActivityFeature)
AbstractFeature.scopeClass - The Class of the owned DependencyScope.isActivityFeature - A boolean flag specifying if this AbstractFeature
is an Activity Feature.public java.lang.Class<? extends DependencyScope> getScopeClass()
DependencyScopeOwnergetScopeClass in interface DependencyScopeOwnerClass.public DependencyScope getOwnedScope()
DependencyScopeOwnerDependencyScope owned by this DependencyScopeOwner.getOwnedScope in interface DependencyScopeOwnerDependencyScope.protected DependencyScope getFeatureScope()
public Feature getParentFeature()
FeaturegetParentFeature in interface FeatureFeature.public void setParentFeature(Feature parentFeature)
FeaturesetParentFeature in interface FeatureparentFeature - A Feature.public final java.util.List<FeatureView> getActiveViews()
FeatureFeatureViews.getActiveViews in interface FeatureList containing the currently active views as FeatureViews.public final FeatureView addActiveView(FeatureView view)
FeatureaddActiveView in interface Featureview - A FeatureView to be added.FeatureView if it was added as a new active FeatureView.public final FeatureView removeActiveView(FeatureView view)
FeatureremoveActiveView in interface Featureview - A FeatureView to be removed.FeatureView if it was removed from being an active FeatureView.protected final void addBackStackView(java.lang.String tag,
FeatureView view)
FeatureView to the HashMap that contains all
the FeatureViews of this Feature that has been added to back stack.tag - The tag of the added FeatureView.view - The FeatureView that has been added.protected final void removeBackStackView(java.lang.String tag)
FeatureView from the HashMap that contains all the
FeatureViews of this Feature that has been added to back stack.tag - The tag specifying the FeatureView to be removed.public boolean hasForegroundView()
FeatureFeature is in foreground i.e. it has at least one visible
FeatureView.hasForegroundView in interface Featureboolean value.public void setActivityFeature(boolean isActivityFeature)
FeatureFeature to be an Activity Feature that is owned and controlled by
an Activity.setActivityFeature in interface FeatureisActivityFeature - A boolean value.public boolean isActivityFeature()
FeatureFeature is set to be an Activity Feature that is owned and controlled
by an Activity.isActivityFeature in interface Featureboolean value.public boolean isActiveView(FeatureView view)
FeatureFeatureView is currently active one.isActiveView in interface Featureview - A FeatureView.boolean value.public void setFeatureManager(FeatureManager manager)
FeatureFeatureManager that started this Feature.setFeatureManager in interface Featuremanager - A FeatureManager.public FeatureContainer getFeatureContainer()
FeaturegetFeatureContainer in interface FeatureFeatureContainer.public void setFeatureContainer(FeatureContainer container)
FeaturesetFeatureContainer in interface Featurecontainer - A FeatureContainer.public FeatureView showView(java.lang.Class<? extends Presenter> presenterClass, boolean addToBackStack, Params... params)
FeatureView attached to the specified Presenter.showView in interface FeaturepresenterClass - A Class specifying the Presenter.addToBackStack - A boolean value specifying if the FeatureView is added
to back stack.params - Optional Params.FeatureView. May be PlugInvoker.public FeatureView showView(int featureContainerId, java.lang.Class<? extends Presenter> presenterClass, boolean addToBackStack, java.lang.String tag, Params... params)
FeatureView attached to the specified Presenter.
The FeatureView is shown using the specified FeatureContainer.showView in interface FeaturefeatureContainerId - An id of the FeatureContainer.presenterClass - A Class specifying the Presenter.addToBackStack - A boolean value specifying if the FeatureView is to
be added to back stack.tag - A tag for the FeatureView used for FragmentTransaction.
May be null.params - Optional Params.FeatureView. May be PlugInvoker.public FeatureView showView(FeatureTransitionManager transitionManager, java.lang.Class<? extends Presenter> presenterClass, boolean addToBackStack, java.lang.String tag, Params... params)
FeatureView attached to the specified Presenter.
The FeatureView is shown using the given FeatureTransitionManager.showView in interface FeaturetransitionManager - A FeatureTransitionManager.presenterClass - A Class specifying the Presenter.addToBackStack - A boolean value specifying if the FeatureView is to
be added to back stack.tag - A tag for the FeatureView used for FragmentTransaction.
May be null.params - Optional Params.FeatureView. May be PlugInvoker.public void hideView(java.lang.Class<? extends Presenter> presenterClass, boolean addedToBackStack, java.lang.String tag)
FeatureView attached to the given Presenter.hideView in interface FeaturepresenterClass - A Presenter.addedToBackStack - A boolean value specifying if the FeatureView was
added to backstack.tag - A tag for the FeatureView used for FragmentTransaction.
May be null.public void hideView(FeaturePresenter presenter, boolean addedToBackStack, java.lang.String tag)
FeatureView attached to the given Presenter.hideView in interface Featurepresenter - A Presenter.addedToBackStack - A boolean value specifying if the FeatureView was
added to backstack.tag - A tag for the FeatureView used for FragmentTransaction.
May be null.public void clearBackStack()
FeatureFragmentManager.clearBackStack in interface Featurepublic void goBack()
FeatureFeatureView.protected static java.lang.Class<? extends FeatureView> getClass(FeatureView view)
public boolean isBackPressedEventHandler()
FeatureFeature handles the back pressed event.isBackPressedEventHandler in interface Featureboolean value.public boolean hasBackStackViews()
FeatureFeature has any FeatureViews in back stack.hasBackStackViews in interface Featureboolean value.public boolean canGoBack()
FeatureFeatureView can be navigated back to.public <T> T plug(java.lang.Class<?> pluginClass)
Class to PluginBus.pluginClass - A ClassObjectpublic <T> T plug(java.lang.Object plugin)
Object to this PluginBus.plugin - A plugin Object.public void unplug(java.lang.Object plugin)
Object to this PluginBus.plugin - A plugin Object.public final void pause()
PluginStateComponentPluginStateComponent.pause in interface PluginStateComponentpause in class AbstractPluginStateComponentpublic final void pause(boolean finishing)
FeatureFeature.public final void resume()
PluginStateComponentPluginStateComponent.resume in interface PluginStateComponentresume in class AbstractPluginStateComponentpublic final void stop()
PluginStateComponentPluginStateComponent to be stopped. A stopped
PluginStateComponent is unplugged from PluginBus.stop in interface PluginStateComponentstop in class AbstractPluginStateComponentpublic final void destroy()
PluginStateComponentPluginStateComponent to be destroyed. This method is
automatically invoked for a stopped PluginStateComponent.destroy in interface PluginStateComponentdestroy in class AbstractPluginStateComponentprotected void onPause(boolean finishing)
Feature.pause(boolean).finishing - A boolean value indicating if the Feature is
going to be finished i.e. it is not resumed nor restarted anymore.public void onPresenterFinished(Presenter presenter)
PresenterListenerPresenter when it has been finished by invoking Presenter.finish().onPresenterFinished in interface PresenterListenerpresenter - The finished Presenter.public void onFeatureContainerPaused(FeatureContainer container, boolean finishing)
FeatureFeatureContainer has been paused.onFeatureContainerPaused in interface Featurecontainer - A FeatureContainer.finishing - A boolean flag indicating if the FeatureContainer is finishing.public void onFeatureContainerResumed(FeatureContainer container)
FeatureFeatureContainer has been resumed.onFeatureContainerResumed in interface Featurecontainer - A FeatureContainer.public void onFeatureContainerStarted(FeatureContainer container)
FeatureFeatureContainer has been started.onFeatureContainerStarted in interface Featurecontainer - A FeatureContainer.public void onFeatureContainerStopped(FeatureContainer container, boolean finishing)
FeatureFeatureContainer has been stopped.onFeatureContainerStopped in interface Featurecontainer - A FeatureContainer.finishing - A boolean flag indicating if the FeatureContainer is finishing.