ilog.views.util.servlet
Class IlvSelectionSupport

java.lang.Object
  extended by ilog.views.util.servlet.IlvSelectionSupport
Direct Known Subclasses:
IlvDiagrammerSelectionSupport

public abstract class IlvSelectionSupport
extends Object

This class describes a servlet support for handling selection requests.

Each subclass must implement the following abstract methods:

Subclasses can also implement the following methods:

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:

This response is encoded into JavaScript to be handled by the client.

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.

Since:
JViews 7.5

Nested Class Summary
static class IlvSelectionSupport.IlvSelectionResponse
          IlvSelectionResponse provides the context for handling a selection request.
 
Field Summary
static String REQUEST_TYPE
          The servlet request type for selection request.
 
Constructor Summary
IlvSelectionSupport()
          Creates a new IlvSelectionSupport instance.
 
Method Summary
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 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.
abstract  void removeListeners()
          Removes the server action previously installed with installListeners.
protected  List 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUEST_TYPE

public static final String REQUEST_TYPE
The servlet request type for selection request.

See Also:
Constant Field Values
Constructor Detail

IlvSelectionSupport

public IlvSelectionSupport()
Creates a new IlvSelectionSupport instance.

Method Detail

getLastSelectedObject

public Object getLastSelectedObject(javax.servlet.ServletContext context,
                                    Object view)
Returns the object that was last selected in a given view.

Parameters:
context - The servlet context.
view - The view for which to retrieve the last selected object.
Returns:
The last selected object in the view.
Since:
JViews 8.0

setLastSelectedObject

public void setLastSelectedObject(javax.servlet.ServletContext context,
                                  Object view,
                                  Object object)
Sets the object that was last selected in a given view.

Parameters:
context - The servlet context.
view - The view for which to set the last selected object.
object - The object that was last selected.
Since:
JViews 8.0

installListeners

public abstract void installListeners()
Installs the server action listeners to properly handle selection actions.


removeListeners

public abstract void removeListeners()
Removes the server action previously installed with installListeners.


handleRequest

public boolean handleRequest(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws IOException,
                             javax.servlet.ServletException
Handles a selection request.

Parameters:
request - The HTTP servlet request.
response - The HTTP servlet response.
Returns:
false if the request is not recognized by this servlet.
Throws:
IOException
javax.servlet.ServletException

initializeResponseProperties

protected void initializeResponseProperties(IlvSelectionSupport.IlvSelectionResponse response,
                                            javax.servlet.http.HttpServletRequest request)
                                     throws javax.servlet.ServletException
Initialize properties that will be used during the handling of a selection request.

Parameters:
response - The selection response object.
request - The HTTP request.
Throws:
javax.servlet.ServletException

getAdditionalProperties

protected abstract List getAdditionalProperties(IlvSelectionSupport.IlvSelectionResponse response,
                                                Object object)
Returns additional information about a selected object.

Parameters:
response - The selection response object.
object - The object selected or deselected.
Returns:
An array list of additional information on a selected/deselected object. Each item of the list could be a 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.

setAdditionalProperties

protected List 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. The default implementation does nothing.

Parameters:
response - The selection response object.
object - The object to set properties on.
list - The List of additional information on a selected object.
Returns:
A List of error descriptors to send back to the client.
Since:
JViews 8.0

doGetUpdatedCapabilities

protected void doGetUpdatedCapabilities(javax.servlet.http.HttpServletRequest request,
                                        IlvSelectionSupport.IlvSelectionResponse response)
                                 throws javax.servlet.ServletException
Updates the capabilities that have changed.

Parameters:
request - The HTTP request.
response - The response object.
Throws:
javax.servlet.ServletException

doGetUpdateAll

protected abstract void doGetUpdateAll(javax.servlet.http.HttpServletRequest request,
                                       IlvSelectionSupport.IlvSelectionResponse response)
                                throws IOException,
                                       javax.servlet.ServletException
Resynchronizes the selection on the client from the server-side state of selection.

Parameters:
request - The HTTP request.
response - The response object.
Throws:
IOException
javax.servlet.ServletException

doGetSelectOne

protected abstract void doGetSelectOne(javax.servlet.http.HttpServletRequest request,
                                       IlvSelectionSupport.IlvSelectionResponse response,
                                       int x,
                                       int y)
                                throws IOException,
                                       javax.servlet.ServletException
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. The response updates the client-side selection accordingly.

Parameters:
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
Throws:
IOException
javax.servlet.ServletException

doGetSelectOneById

protected void doGetSelectOneById(javax.servlet.http.HttpServletRequest request,
                                  IlvSelectionSupport.IlvSelectionResponse response,
                                  String id)
                           throws IOException,
                                  javax.servlet.ServletException
Clears the current selections and attempts to select the object with the specified identifier. If a selectable object is found with the specified identifier, it is selected. The response updates the client-side selection accordingly.

Parameters:
request - The HTTP request.
response - The response object.
id - The identifier of the object to select.
Throws:
IOException
javax.servlet.ServletException
Since:
JViews 8.1

doGetSelectOneMultiple

protected abstract void doGetSelectOneMultiple(javax.servlet.http.HttpServletRequest request,
                                               IlvSelectionSupport.IlvSelectionResponse response,
                                               int x,
                                               int y)
                                        throws IOException,
                                               javax.servlet.ServletException
Attempts to extend the selection with the object at a given position, if any. The response updates the client-side selection accordingly. If a selectable object is found at the specified position it is added or removed to the selection: an already selected object is deselected; an unselected object is selected. Otherwise (there was no selectable object), the selection is unchanged.

Parameters:
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.
Throws:
IOException
javax.servlet.ServletException

doGetSelectOneMultipleById

protected void doGetSelectOneMultipleById(javax.servlet.http.HttpServletRequest request,
                                          IlvSelectionSupport.IlvSelectionResponse response,
                                          String id)
                                   throws IOException,
                                          javax.servlet.ServletException
Attempts to extend the selection with the object with the specified identifier, if any. The response updates the client-side selection accordingly. If a selectable object is found with the specified identifier, it is added or removed to the selection: an already selected object is deselected; an unselected object is selected. Otherwise (there was no selectable object), the selection is unchanged.

Parameters:
request - The HTTP request.
response - The response object.
id - The identifier of the object to select.
Throws:
IOException
javax.servlet.ServletException
Since:
JViews 8.1

doGetSelectAll

protected void doGetSelectAll(javax.servlet.http.HttpServletRequest request,
                              IlvSelectionSupport.IlvSelectionResponse response)
                       throws IOException,
                              javax.servlet.ServletException
Attempts to select all the selectable objects. The response updates the client-side selection accordingly.

Parameters:
request - The HTTP request.
response - The response object.
Throws:
IOException
javax.servlet.ServletException
Since:
JViews 8.1

doGetDeselectAll

protected void doGetDeselectAll(javax.servlet.http.HttpServletRequest request,
                                IlvSelectionSupport.IlvSelectionResponse response)
                         throws IOException,
                                javax.servlet.ServletException
Attempts to deselect all the objects that are currently selected. The response updates the client-side selection accordingly.

Parameters:
request - The HTTP request.
response - The response object.
Throws:
IOException
javax.servlet.ServletException
Since:
JViews 8.1

doPostSetProperties

protected void doPostSetProperties(javax.servlet.http.HttpServletRequest request,
                                   IlvSelectionSupport.IlvSelectionResponse response,
                                   List list)
                            throws IOException
Handles client-side updates of selected objects. Attempts to update the server-side objects from the property changes. The default implementation does nothing.

Parameters:
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.
Throws:
IOException
Since:
JViews 8.0


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.