public abstract class IlvPopupMenuServletSupport extends Object
Subclasses must override all getters.
Modifier and Type | Field and Description |
---|---|
static String |
MENU_SESSION_KEY
The session key for the current menu handled by this servlet support.
|
static String |
REQUEST_TYPE
The request type of a dynamic pop-up menu request.
|
static String |
SERVLET_ACTION_NAME
The action name of the builtin action listener that is responsible for
translating the servlet event into a suitable event for a menu item listener.
|
Constructor and Description |
---|
IlvPopupMenuServletSupport()
Creates a new
IlvPopupMenuServletSupport instance. |
Modifier and Type | Method and Description |
---|---|
protected IlvMenu |
createMenu(jakarta.servlet.http.HttpServletRequest request,
IlvMenuFactory factory,
Object graphicObject,
Object selectedObject,
String menuModelId)
Calls the menu factory to return the menu model.
|
protected IlvMenu |
createMenu(IlvMenuFactory factory,
Object graphicObject,
Object selectedObject,
String menuModelId)
Deprecated.
Beginning with Perforce JViews 8.0 use
createMenu(HttpServletRequest, IlvMenuFactory, Object, Object, String) instead. |
protected abstract Object |
getGraphicComponent(jakarta.servlet.http.HttpServletRequest request)
Returns the graphic component displayed by the linked servlet.
|
protected IlvPopupMenuEncoder |
getMenuEncoder(jakarta.servlet.http.HttpServletRequest request)
Returns the menu encoder responsible for encoding the root
IlvMenu
into a code comprehensible for the client. |
protected IlvMenuFactory |
getMenuFactory(jakarta.servlet.http.HttpServletRequest request)
Returns the factory that dynamically generates the menu depending on:
The graphic component.
|
protected abstract String |
getMenuModelId(jakarta.servlet.http.HttpServletRequest request)
Returns the menu model ID from the request.
|
protected IlvMenu |
getPopupMenuFromSession(jakarta.servlet.http.HttpServletRequest request)
Retrieve menu model stored in the session with the
MENU_SESSION_KEY key. |
protected abstract Object |
getSelectedObject(jakarta.servlet.http.HttpServletRequest request,
int x,
int y)
Returns the object selected by the user when he triggered the pop-up menu.
|
jakarta.servlet.ServletContext |
getServletContext()
Returns the servlet context.
|
boolean |
handleRequest(jakarta.servlet.http.HttpServletRequest request,
jakarta.servlet.http.HttpServletResponse response)
Responds to HTTP requests.
|
abstract void |
installListeners()
Installs the server action listeners to properly handle pop-up actions.
|
protected void |
prepareComponent(jakarta.servlet.http.HttpServletRequest request,
Object graphicComponent)
Configures the graphic component to be in a correct state before the
selected object is picked.
|
abstract void |
removeListeners()
Removes the server action previously installed with
installListeners . |
protected void |
savePopupMenuModelInSession(jakarta.servlet.http.HttpServletRequest request,
IlvMenu root)
Saves the generated menu in session using the
MENU_SESSION_KEY key. |
void |
setMenuFactory(IlvMenuFactory menuFactory)
Sets the menu factory that generates the pop-up menu.
|
void |
setServletContext(jakarta.servlet.ServletContext context)
Sets the servlet context used by this support.
|
public static final String SERVLET_ACTION_NAME
public static final String REQUEST_TYPE
public static final String MENU_SESSION_KEY
public IlvPopupMenuServletSupport()
IlvPopupMenuServletSupport
instance.public abstract void installListeners()
public abstract void removeListeners()
installListeners
.public boolean handleRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
false
if the request is not a request recognized by this servlet.
If the request is correct generate in the output stream the
Javascript Code used by the client to display the pop-up menu.request
- the current Http request.response
- the Http response.true
if the request was processed, false if an error occurred.IOException
jakarta.servlet.ServletException
protected void prepareComponent(jakarta.servlet.http.HttpServletRequest request, Object graphicComponent) throws jakarta.servlet.ServletException
request
- The HTTP request.graphicComponent
- The graphic component.jakarta.servlet.ServletException
- If an error occurs during configuration.protected IlvMenu createMenu(jakarta.servlet.http.HttpServletRequest request, IlvMenuFactory factory, Object graphicObject, Object selectedObject, String menuModelId) throws jakarta.servlet.ServletException
request
- The HTTP servlet request.factory
- The menu factory.graphicObject
- The graphic component.selectedObject
- The selected object.menuModelId
- The menu model ID.jakarta.servlet.ServletException
@Deprecated protected IlvMenu createMenu(IlvMenuFactory factory, Object graphicObject, Object selectedObject, String menuModelId) throws jakarta.servlet.ServletException
createMenu(HttpServletRequest, IlvMenuFactory, Object, Object, String)
instead.factory
- The menu factorygraphicObject
- The graphic componentselectedObject
- The selected objectmenuModelId
- The menu model ID.jakarta.servlet.ServletException
protected void savePopupMenuModelInSession(jakarta.servlet.http.HttpServletRequest request, IlvMenu root)
MENU_SESSION_KEY
key.request
- The Http request.root
- The root menu of the menu model.protected IlvMenu getPopupMenuFromSession(jakarta.servlet.http.HttpServletRequest request)
MENU_SESSION_KEY
key.request
- The Http request.protected abstract Object getGraphicComponent(jakarta.servlet.http.HttpServletRequest request) throws jakarta.servlet.ServletException
request
- The HTTP request.jakarta.servlet.ServletException
protected abstract Object getSelectedObject(jakarta.servlet.http.HttpServletRequest request, int x, int y) throws jakarta.servlet.ServletException
request
- The HTTP request.x
- x coordinate in image view coordinate system.y
- y coordinate in image view coordinate system.jakarta.servlet.ServletException
getGraphicComponent(HttpServletRequest)
protected IlvMenuFactory getMenuFactory(jakarta.servlet.http.HttpServletRequest request) throws jakarta.servlet.ServletException
setmenuFactory
method.request
- The HTTP request.jakarta.servlet.ServletException
public void setMenuFactory(IlvMenuFactory menuFactory)
menuFactory
- The menu factory.protected abstract String getMenuModelId(jakarta.servlet.http.HttpServletRequest request) throws jakarta.servlet.ServletException
request
- The HTTP request.jakarta.servlet.ServletException
protected IlvPopupMenuEncoder getMenuEncoder(jakarta.servlet.http.HttpServletRequest request) throws jakarta.servlet.ServletException
IlvMenu
into a code comprehensible for the client.IlvPopupMenuEncoder
instance.request
- The HTTP request.jakarta.servlet.ServletException
public jakarta.servlet.ServletContext getServletContext()
public void setServletContext(jakarta.servlet.ServletContext context)
init()
of the servlet.context
- The servlet context.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.