public abstract class PControllerImpl extends Object implements PControllerBean, Serializable, Unreferenced
PControllerImpl
is an abstract class that implements the server
side of a component controller. Use this abstract class as the base for all
component-specific controllers.
PControllerImpl
implements the functionality that is implied by
the PAppComponent
API (as implemented by PComponentDelegate
),
and provides general utility methods, for example, field access, model access,
and Portal connection access. All the subclasser needs to do is override
update(int, Object)
.
This is called when the model changes, and should be called when any other
property changes.Modifier and Type | Field and Description |
---|---|
protected PModelHandle |
mFList |
protected EventListenerList |
mRemoteListeners |
static int |
UPDATE_CLIENT
Constant reason code for a client update.
|
static int |
UPDATE_MODEL_CHANGE
Constant reason code for changed model update.
|
static int |
UPDATE_NEW_MODEL
Constant reason code for a new model update.
|
static int |
UPDATE_PROPERTY
Constant reason code for a property update.
|
Constructor and Description |
---|
PControllerImpl()
Creates an instance of
PControllerImpl . |
Modifier and Type | Method and Description |
---|---|
void |
addRemoteListener(Object remoteListenerHandle)
Adds a remote listener to the list of listeners.
|
void |
closeSecContext(PCachedContext conn)
Close the secondary connection created for the purpose of step_searching.
|
PInfranetException |
createClientException(EBufException ebuf)
Serves as a helper method.
|
protected void |
distributeEventToListeners(Class listenerClass,
EventObject evt)
Distributes an event to a specific type of listener.
|
protected void |
fireModelChangeEvent(PModelHandle old,
PModelHandle newMH)
Fires a controller model change event.
|
protected PInfranetAppController |
getAppController()
Gets the connection to Portal for this instance.
|
int[] |
getArrayRange(PModelHandle mh,
String spec)
Gets the range of possible values of a
SparseArray , given the array
as a model and a field description. |
protected PCachedContext |
getContext()
Retrieves the the current connection instance
|
protected Object |
getField(FList flist,
PFieldSpecification spec)
Gets a specific field from the
Flist . |
protected Object |
getField(PFieldSpecification spec)
Gets a specific field from the data model.
|
protected Object |
getField(PModelHandle mh,
PFieldSpecification spec)
Gets a specific field from the data model.
|
protected Object |
getFieldWithRestriction(FList flist,
PFieldSpecification spec)
Gets a specific field from the data model.
|
protected Object |
getFieldWithRestriction(PFieldSpecification spec)
Gets a specific field from the data model.
|
protected Object |
getFieldWithRestriction(PModelHandle mh,
PFieldSpecification spec)
Gets a specific field from the data model.
|
PModelHandle |
getModel()
Gets the controller's model handle.
|
Object |
getRemoteListenerHandle(String type)
Default implementation for getting a remote listener (it returns null).
|
PCachedContext |
getSecContext()
Opens a secondary connection for Step_search purposes
|
protected void |
handleDistributeToListener(Object listener,
EventObject evt)
Called by
distributeEventToListeners to pass an event
to specific listener methods. |
boolean |
isLight()
Determines whether this is a lightweight component.
|
void |
register(PControllerBean stub)
Allows the component to register the controller stub it received
when the controller was created.
|
protected void |
releaseContext(PCachedContext ctx)
Returns the current connection instance to the pool if one exists
|
void |
releaseRemoteListener(Object remoteListenerHandle)
Releases a remote listener that is no longer in use.
|
void |
removeRemoteListener(Object remoteListenerHandle)
Removes a remote listener from the list of listeners.
|
protected void |
setField(FList flist,
PFieldSpecification spec,
Object val)
Sets the value of a specific field within the controller's data model.
|
protected void |
setField(PFieldSpecification spec,
Object val)
Sets the value of a specific field within the controller's data model.
|
void |
setModel(PModelHandle model)
Sets the model handle in the controller.
|
void |
unreferenced() |
abstract void |
update(int reason,
Object data)
The
update method is called by various internal methods when
the data has changed enough to require changing the client display. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSelectionDataFor
public static final int UPDATE_NEW_MODEL
public static final int UPDATE_PROPERTY
public static final int UPDATE_MODEL_CHANGE
public static final int UPDATE_CLIENT
protected PModelHandle mFList
protected EventListenerList mRemoteListeners
public PControllerImpl() throws RemoteException
PControllerImpl
.RemoteException
- thrown for errorspublic void setModel(PModelHandle model) throws RemoteException
PComponent
.setModel
in interface PControllerBean
model
- a model handleRemoteException
- thrown for errorspublic PModelHandle getModel() throws RemoteException
PComponent
.getModel
in interface PControllerBean
RemoteException
- thrown for errorspublic boolean isLight() throws RemoteException
getModel
always returns null,
setModel
is ignored, and no property change events
are generated.The default value is false.
isLight
in interface PControllerBean
RemoteException
- thrown for errorspublic abstract void update(int reason, Object data) throws RemoteException
update
method is called by various internal methods when
the data has changed enough to require changing the client display. Must
be overridden by a specific controller subclass.reason
- an integer constant that indicates the reason for the update
(UPDATE_NEW_MODEL
, UPDATE_PROPERTY
,
UPDATE_MODEL_CHANGE
, or UPDATE_CLIENT
)data
- the data associated with update
RemoteException
- thrown for errorspublic int[] getArrayRange(PModelHandle mh, String spec) throws RemoteException
SparseArray
, given the array
as a model and a field description.getArrayRange
in interface PControllerBean
mh
- a model handlespec
- a field descriptionSparseArray
.RemoteException
- thrown for errorspublic PInfranetException createClientException(EBufException ebuf) throws RemoteException
EBufException
needs
to be passed to a View, however, because it doesn't exist in the client class name
space, a different exception with the relevant information must be thrown.
That exception is PInfranetException
; the relevant information is
the detailed error and help text from the Portal server. This helper
method can be used to do the common conversion. The returned exception
still needs to be thrown by the caller.ebuf
- an EBufException
to convertPInfranetException
with text from the Portal
server.RemoteException
- thrown for errorspublic Object getRemoteListenerHandle(String type) throws RemoteException
getRemoteListenerHandle
in interface PControllerBean
type
- the type of remote listener to getRemoteException
- thrown for errorspublic void releaseRemoteListener(Object remoteListenerHandle) throws RemoteException
releaseRemoteListener
in interface PControllerBean
remoteListenerHandle
- the handle for the remote listenerRemoteException
- thrown for errorspublic void addRemoteListener(Object remoteListenerHandle) throws RemoteException
addRemoteListener
in interface PControllerBean
remoteListenerHandle
- the handle for the remote listenerRemoteException
- thrown for errorspublic void removeRemoteListener(Object remoteListenerHandle) throws RemoteException
removeRemoteListener
in interface PControllerBean
remoteListenerHandle
- the handle for the remote listenerRemoteException
- thrown for errorsprotected void distributeEventToListeners(Class listenerClass, EventObject evt)
handleDistributeToListener( Object listener, EventObject evt )
,
which should be overridden to call the correct listener methods.listenerClass
- the class of listener to distribute toevt
- the event object to distributepublic void register(PControllerBean stub) throws RemoteException
register
in interface PControllerBean
stub
- the controller stub owned by the client view.RemoteException
- thrown in case of errorPInfranetAppController.registerController( PControllerBean, PControllerImpl )
public void unreferenced()
unreferenced
in interface Unreferenced
protected void handleDistributeToListener(Object listener, EventObject evt)
distributeEventToListeners
to pass an event
to specific listener methods. When overriding this method, be sure to
pass calls for unknown listener classes to the parent controller
to handle other types of event objects.listener
- the listener to call a method forevt
- the event object to distributeprotected void fireModelChangeEvent(PModelHandle old, PModelHandle newMH)
old
- the old model handlenewMH
- the new model handleprotected PInfranetAppController getAppController()
PInfranetConnectionImpl
object.protected Object getFieldWithRestriction(PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException
getField( PFieldSpecification spec )
but wraps the return value with its restriction object, if any.spec
- a field specificationEBufException
- thrown if there is a problem with PortalPBadFieldException
- thrown if the specification is incorrectRemoteException
- thrown for other problemsPBadFieldDescriptionException
protected Object getFieldWithRestriction(FList flist, PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException
getField( FList flist, PFieldSpecification spec )
but wraps the return value with its restriction object, if any.flist
- an FList
from which to get a
restrained fieldspec
- a field specificationEBufException
- thrown if there is a problem with PortalPBadFieldException
- thrown if the specification is incorrectRemoteException
- thrown for other problemsPBadFieldDescriptionException
protected Object getFieldWithRestriction(PModelHandle mh, PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException
getField( PModelHandle mh, PFieldSpecification spec )
but wraps the return value with its restriction object, if any.mh
- a model handle from which to get a restrained fieldspec
- a field specificationEBufException
- thrown if there is a problem with PortalPBadFieldException
- thrown if the specification is incorrectRemoteException
- thrown for other problemsPBadFieldDescriptionException
protected Object getField(PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException
spec
- a field specificationEBufException
- thrown if there is a problem with PortalPBadFieldException
- thrown if the specification is incorrectRemoteException
- thrown for other problemsPBadFieldDescriptionException
protected Object getField(FList flist, PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException
Flist
. Gets all the
fields specified by a compound specification.flist
- the FList
to get a field fromspec
- a field specificationEBufException
- thrown if there is a problem with PortalPBadFieldException
- thrown if the specification is incorrectRemoteException
- thrown for other problemsPBadFieldDescriptionException
protected Object getField(PModelHandle mh, PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException
mh
- a model handle from which to get a fieldspec
- a field specificationEBufException
- thrown if there is a problem with PortalPBadFieldException
- thrown if the specification is incorrectRemoteException
- thrown for other problemsPBadFieldDescriptionException
protected void setField(PFieldSpecification spec, Object val) throws PBadFieldDescriptionException, RemoteException, EBufException
spec
- the specification of the field to setval
- the value to setEBufException
- thrown if there is a problem with PortalPBadFieldException
- thrown if the specification is incorrectRemoteException
- thrown for other problemsPBadFieldDescriptionException
protected void setField(FList flist, PFieldSpecification spec, Object val) throws PBadFieldDescriptionException, RemoteException, EBufException
spec
- the specification of the field to setval
- the value to setEBufException
- thrown if there is a problem with PortalPBadFieldException
- thrown if the specification is incorrectRemoteException
- thrown for other problemsPBadFieldDescriptionException
protected PCachedContext getContext() throws RemoteException
RemoteException
protected void releaseContext(PCachedContext ctx) throws RemoteException
RemoteException
public PCachedContext getSecContext() throws RemoteException
RemoteException
public void closeSecContext(PCachedContext conn) throws RemoteException
RemoteException
Copyright © 2003, 2023, Oracle and/or its affiliates.