public abstract class IlvSelectionSupport extends Object
Each subclass must implement the following abstract methods:
doGetSelectOne(HttpServletRequest, IlvSelectionResponse, int, int)
method handles selection of an object.doGetSelectOneMultiple(HttpServletRequest, IlvSelectionResponse, int, int)
method handles selection of an object in multiple selection mode.doGetUpdateAll(HttpServletRequest, IlvSelectionResponse)
method
handles a full selection refresh.doGetSelectAll(HttpServletRequest, IlvSelectionResponse)
method
handles a selection of all the objects.doGetDeselectAll(HttpServletRequest, IlvSelectionResponse)
method
handles a deselection of the selected objects.Subclasses can also implement the following methods:
doGetSelectOneById(HttpServletRequest, IlvSelectionResponse, String)
method handles selection of an object by its identifier.doGetSelectOneMultipleById(HttpServletRequest, ilog.views.util.servlet.IlvSelectionSupport.IlvSelectionResponse, String)
method handles selection of an object by its identifier in multiple selection mode.doGetSelectAll(HttpServletRequest, ilog.views.util.servlet.IlvSelectionSupport.IlvSelectionResponse)
method handles selection of all the objects.doGetDeselectAll(HttpServletRequest, ilog.views.util.servlet.IlvSelectionSupport.IlvSelectionResponse)
method handles deselection of all the objects.The default implementation of these optional methods redirects to the
doGetUpdateAll(HttpServletRequest, ilog.views.util.servlet.IlvSelectionSupport.IlvSelectionResponse)
method and prints a warning.
These main methods return an IlvSelectionResponse
instance
that contains the changes to apply to the client side selection. This object
has the following properties:
removeAll
: If set to true
, the client
selection is cleared.noSelection
: Must be set to true
if no object
was selected.addList
: A list of selections to add.removeList
: A list of selections to remove.If some capabilities change, the
doGetUpdatedCapabilities(HttpServletRequest, IlvSelectionResponse)
method defines these variables that must be processed on the client
side.
On the client side the IlvAbstractSelectionManager
class
is dealing with requests to and responses from this Servlet support class.
Modifier and Type | Class and Description |
---|---|
static class |
IlvSelectionSupport.IlvSelectionResponse
IlvSelectionResponse provides the context for handling a
selection request. |
Modifier and Type | Field and Description |
---|---|
static String |
REQUEST_TYPE
The servlet request type for selection request.
|
Constructor and Description |
---|
IlvSelectionSupport()
Creates a new
IlvSelectionSupport instance. |
Modifier and Type | Method and Description |
---|---|
protected void |
doGetDeselectAll(javax.servlet.http.HttpServletRequest request,
IlvSelectionSupport.IlvSelectionResponse response)
Attempts to deselect all the objects that are currently selected.
|
protected void |
doGetSelectAll(javax.servlet.http.HttpServletRequest request,
IlvSelectionSupport.IlvSelectionResponse response)
Attempts to select all the selectable objects.
|
protected abstract void |
doGetSelectOne(javax.servlet.http.HttpServletRequest request,
IlvSelectionSupport.IlvSelectionResponse response,
int x,
int y)
Clears the current selections and attempts to select the object at a given position
If a selectable object is found with the specified position, it is selected.
|
protected void |
doGetSelectOneById(javax.servlet.http.HttpServletRequest request,
IlvSelectionSupport.IlvSelectionResponse response,
String id)
Clears the current selections and attempts to select the object with the specified identifier.
|
protected abstract void |
doGetSelectOneMultiple(javax.servlet.http.HttpServletRequest request,
IlvSelectionSupport.IlvSelectionResponse response,
int x,
int y)
Attempts to extend the selection with the object at a given position, if
any.
|
protected void |
doGetSelectOneMultipleById(javax.servlet.http.HttpServletRequest request,
IlvSelectionSupport.IlvSelectionResponse response,
String id)
Attempts to extend the selection with the object with the specified identifier,
if any.
|
protected abstract void |
doGetUpdateAll(javax.servlet.http.HttpServletRequest request,
IlvSelectionSupport.IlvSelectionResponse response)
Resynchronizes the selection on the client from the server-side state of
selection.
|
protected void |
doGetUpdatedCapabilities(javax.servlet.http.HttpServletRequest request,
IlvSelectionSupport.IlvSelectionResponse response)
Updates the capabilities that have changed.
|
protected void |
doPostSetProperties(javax.servlet.http.HttpServletRequest request,
IlvSelectionSupport.IlvSelectionResponse response,
List<?> list)
Handles client-side updates of selected objects.
|
protected abstract List<Object> |
getAdditionalProperties(IlvSelectionSupport.IlvSelectionResponse response,
Object object)
Returns additional information about a selected object.
|
Object |
getLastSelectedObject(javax.servlet.ServletContext context,
Object view)
Returns the object that was last selected in a given view.
|
boolean |
handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles a selection request.
|
protected void |
initializeResponseProperties(IlvSelectionSupport.IlvSelectionResponse response,
javax.servlet.http.HttpServletRequest request)
Initialize properties that will be used during the handling of a selection
request.
|
abstract void |
installListeners()
Installs the server action listeners to properly handle selection actions.
|
protected boolean |
isResizable(IlvSelectionSupport.IlvSelectionResponse response,
Object selectedObj)
Checks the selected object whether is resizable or not.
|
abstract void |
removeListeners()
Removes the server action previously installed with
installListeners . |
protected List<Object> |
setAdditionalProperties(IlvSelectionSupport.IlvSelectionResponse response,
Object object,
List<?> list)
This method is called to set additional properties on the given
Object following a client-side request. |
void |
setLastSelectedObject(javax.servlet.ServletContext context,
Object view,
Object object)
Sets the object that was last selected in a given view.
|
public static final String REQUEST_TYPE
public IlvSelectionSupport()
IlvSelectionSupport
instance.protected boolean isResizable(IlvSelectionSupport.IlvSelectionResponse response, Object selectedObj)
response
- The selection response object.selectedObj
- the object that was selected.true
if object is resizable,false
otherwise. The default value is false
public Object getLastSelectedObject(javax.servlet.ServletContext context, Object view)
context
- The servlet context.view
- The view for which to retrieve the last selected object.public void setLastSelectedObject(javax.servlet.ServletContext context, Object view, Object object)
context
- The servlet context.view
- The view for which to set the last selected object.object
- The object that was last selected.public abstract void installListeners()
public abstract void removeListeners()
installListeners
.public boolean handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
request
- The HTTP servlet request.response
- The HTTP servlet response.false
if the request is not recognized by this
servlet.IOException
javax.servlet.ServletException
protected void initializeResponseProperties(IlvSelectionSupport.IlvSelectionResponse response, javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
response
- The selection response object.request
- The HTTP request.javax.servlet.ServletException
protected abstract List<Object> getAdditionalProperties(IlvSelectionSupport.IlvSelectionResponse response, Object object)
response
- The selection response object.object
- The object selected or deselected.String
, an
array, a List
or Map
.
List
and arrays are rendered as JSON arrays on the
client and Map
are rendered as JSON objects on the
client.
Note that the two first objects must be:
ID
-- A unique identifier of the selected object.Movable
-- true
if this object is
movable, false
otherwise.Type
-- the type of the selected object.
protected List<Object> setAdditionalProperties(IlvSelectionSupport.IlvSelectionResponse response, Object object, List<?> list)
Object
following a client-side request.
The default implementation does nothing.response
- The selection response object.object
- The object to set properties on.list
- The List
of additional information on a
selected object.List
of error descriptors to send back to the
client.protected void doGetUpdatedCapabilities(javax.servlet.http.HttpServletRequest request, IlvSelectionSupport.IlvSelectionResponse response) throws javax.servlet.ServletException
request
- The HTTP request.response
- The response object.javax.servlet.ServletException
protected abstract void doGetUpdateAll(javax.servlet.http.HttpServletRequest request, IlvSelectionSupport.IlvSelectionResponse response) throws IOException, javax.servlet.ServletException
request
- The HTTP request.response
- The response object.IOException
javax.servlet.ServletException
protected abstract void doGetSelectOne(javax.servlet.http.HttpServletRequest request, IlvSelectionSupport.IlvSelectionResponse response, int x, int y) throws IOException, javax.servlet.ServletException
request
- The HTTP request.response
- The response object.x
- The x coordinate of the point in view coordinates.y
- The y coordinate of the point in view coordinatesIOException
javax.servlet.ServletException
protected void doGetSelectOneById(javax.servlet.http.HttpServletRequest request, IlvSelectionSupport.IlvSelectionResponse response, String id) throws IOException, javax.servlet.ServletException
request
- The HTTP request.response
- The response object.id
- The identifier of the object to select.IOException
javax.servlet.ServletException
protected abstract void doGetSelectOneMultiple(javax.servlet.http.HttpServletRequest request, IlvSelectionSupport.IlvSelectionResponse response, int x, int y) throws IOException, javax.servlet.ServletException
request
- The HTTP request.response
- The response object.x
- The x coordinate of the point in view coordinates.y
- The y coordinate of the point in view coordinates.IOException
javax.servlet.ServletException
protected void doGetSelectOneMultipleById(javax.servlet.http.HttpServletRequest request, IlvSelectionSupport.IlvSelectionResponse response, String id) throws IOException, javax.servlet.ServletException
request
- The HTTP request.response
- The response object.id
- The identifier of the object to select.IOException
javax.servlet.ServletException
protected void doGetSelectAll(javax.servlet.http.HttpServletRequest request, IlvSelectionSupport.IlvSelectionResponse response) throws IOException, javax.servlet.ServletException
request
- The HTTP request.response
- The response object.IOException
javax.servlet.ServletException
protected void doGetDeselectAll(javax.servlet.http.HttpServletRequest request, IlvSelectionSupport.IlvSelectionResponse response) throws IOException, javax.servlet.ServletException
request
- The HTTP request.response
- The response object.IOException
javax.servlet.ServletException
protected void doPostSetProperties(javax.servlet.http.HttpServletRequest request, IlvSelectionSupport.IlvSelectionResponse response, List<?> list) throws IOException
request
- The HTTP request.response
- The response object.list
- The List
of additional information on
selected objects. Each item of this list is a
List
of properties of a selected object.
The first object of each of these sub lists is
the unique identifier of the selected object.IOException
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.