public class ActivityController
extends java.lang.Object
DataResultActivity
object or to a DataDetailsActivity
object, during its lifecycle.
Uses the JotyApp.dataMainActivity()
method to get the "top" DataMainActivity object, and,
by default, initializes the local members defining the operating context (for the "controlled" activity)
by replicating the ones of the got DataMainActivity;
The class administers and addresses the QueryResponseHandlersManager
object the controlled Activity has to work with.
The QueryResponseHandlersManager si created, opened by this class that provides all the necessary methods
but would be nice that it were retrieved also by it along the various states the Activity traverses.
Look at the following design beliefs:
1) the QueryResponseHandlersManager is used to face with the long running network operation the effect of which
is rendered by the "Data" Activity,
2) a controller is needed, that encapsulates dedicated metadata that survive to the Activity traversing
several different states as the Android Os determines,
3) the QueryResponseHandlersManager is a repository of working parameters (like the WResultSet object processed) and, as structured object,
inspecting the possibility to pass it to the activity as extra is not in the mind of the Joty designer,
4) Joty 2.0 Mobile works with an instance of the android.app.Application
class (JotyApp class) that is, just by self, a "context container"....
... then the design choice is the following: to use a map of QueryResponseHandlersManager objects hosted by the JotyApp instance: the m_respManagerCatalog
member;
the key of the map is the controlled Activity class name plus, optionally, a tailing count value, based on the quantity of instantiations of
Activities of the "controlled" type, made since the navigation left the main activity of the application (an instance of the IdleActivity
class).
In the above scenario, this class provides the creator method that relies on the map (see the createRespHandler
method).
Modifier and Type | Field and Description |
---|---|
JotyActivity.AccessorCoordinates |
m_accessorCoordinates |
protected JotyApp |
m_app |
java.lang.Class |
m_controlledActivityClass |
android.os.Bundle |
m_extras |
org.joty.common.ParamContext |
m_paramContext |
boolean |
m_processing |
org.joty.common.Utilities.Stocker |
m_smallBlobs |
Constructor and Description |
---|
ActivityController(java.lang.Class targetClass) |
Modifier and Type | Method and Description |
---|---|
protected JotyApp.QueryResponseHandler |
createRespHandler(JotyActivity starterActivity,
int respManagerCount)
Creates a
JotyApp.QueryResponseHandler object to be used with a JotyApp.QueryResponseHandlersManager
object that holds the context used by the controlled activity. |
protected int |
getRespManagerCount()
Relies on the
JotyApp.RespManagerCountProvider to get the next count value available. |
void |
instantiateOwnData() |
boolean |
isEnabled() |
protected void |
openRespManager(JotyApp.QueryResponseHandlersManager qRespManager,
int count)
The method, beyond "opening" the manager, eventually, inserts the manager into the map so that
it is available to the handler, and indeed to the controlled activity too.
|
protected JotyApp m_app
public JotyActivity.AccessorCoordinates m_accessorCoordinates
public org.joty.common.ParamContext m_paramContext
public java.lang.Class m_controlledActivityClass
public android.os.Bundle m_extras
public org.joty.common.Utilities.Stocker m_smallBlobs
public boolean m_processing
public void instantiateOwnData()
protected JotyApp.QueryResponseHandler createRespHandler(JotyActivity starterActivity, int respManagerCount)
JotyApp.QueryResponseHandler
object to be used with a JotyApp.QueryResponseHandlersManager
object that holds the context used by the controlled activity.
As factory of such an object it has a synchronous part and a handling part that we know to be
asynchronous because forwarded, through the manager to the WebConn.Connector
object.
This method, together with the getRespManagerCount
method realizes the chance
(as can be found in the subclasses of this class) to create an instance of QueryResponseHandler
equipping it with the way to address its manager (a QueryResponseHandlersManager object) before that one one exists;
this is possible thanks to the existence of the JotyApp.m_respManagerCatalog
map and to the count value
computable in advance by the getRespManagerCount
and passed as argument to this method.starterActivity
- the calling activityrespManagerCount
- the computed count value. By being final can be referenced even in the
"handling" part of the code: it is passed in the invocation of
JotyActivity.startActivity where the value is, in turn, passed as extra to
the opening activity, that this way can address the QueryResponseHandlersManager
object by means of the JotyActivity.getRespManager
method.JotyActivity.startActivity(java.lang.Class)
,
MenuActivity.finish(boolean)
public boolean isEnabled()
protected int getRespManagerCount()
JotyApp.RespManagerCountProvider
to get the next count value available.
The counting grows at every call and is reset when the navigation goes back to the IdleActivity
class (the main activity of the Joty application).protected void openRespManager(JotyApp.QueryResponseHandlersManager qRespManager, int count)
qRespManager
- the QueryResponseHandlersManager objectcount
- the count value preliminarily computed by the getRespManagerCount
methodJotyApp.QueryResponseHandlersManager