public abstract class IlvGanttServletSupport extends IlvServletSupport
IlvGanttServletSupport
is the core class of the Gantt Servlet
framework. It is able to respond to HTTP requests to generate an image
from a Gantt
or
Schedule
chart. IlvGanttServletSupport
is not a subclass of
HttpServlet
itself. This allows you to add the functionality of
the Gantt Servlet framework into your existing servlets. You can do this
by invoking handleRequest
from within your servlet's
doGet()
method. Alternatively, you can use the
IlvGanttServlet
class as the basis for developing your servlets. It
is a lightweight servlet that automatically delegates its HTTP requests to
an instance of IlvGanttServletSupport
.
The IlvGanttServletSupport
class is abstract. As a minimum,
you will have to provide an implementation of the getChart
method in your concrete subclass.
By default, IlvGanttServletSupport
has
image encoders registered for the JPEG_IMAGE_FORMAT
and the
PNG_IMAGE_FORMAT
. You can register additional image formats by
calling the setImageEncoder
method.
IlvGanttServletSupport
understands the following general
parameters in the HTTP request:
Parameter | Required | Allowed Values | Default Value | Notes |
request |
Yes | image or capabilities |
Custom request types can be handled by overriding the handleRequest method.
See below for additional parameters that are specific to the request
type. |
|
verbose |
No | A Boolean value allowed by the parseBoolean method. |
false | If the verbose parameter is not specified in the HTTP request, the servlet configuration and the servlet context will be searched, in that order, for the parameter value. |
action |
No | Values must take the form: actionName(arg1,arg2,...) | Use the addServerAction method to register
an action to handle a specific actionName. |
The following HTTP request parameters are specific to an
image
request:
Parameter | Required | Allowed Values | Default Value | Notes |
comp |
No | chart , table or
sheet . The valid values are also specified by
the VALID_COMPONENTS array. |
chart |
|
width | Yes | positive integer | Specifies the width of the generated image. | |
height | Yes | positive integer | Specifies the height of the generated image. | |
format |
No | JPEG , PNG , or any
other format that has been registered by calling the
setImageEncoder method. |
JPEG |
|
vpos |
No | positive integer | The current vertical scroll position of the component. | |
hpos |
No | positive integer | The current horizontal scroll position of the component. | This parameter is applicable for the table
component. |
startTime |
No | A comma-delimited list of 3 to 6 integers that specify a date, as
allowed by the parseDate method. |
The current visible start time of the component. | This parameter is applicable for the chart
and sheet components. |
endTime |
No | A comma-delimited list of 3 to 6 integers that specify a date, as
allowed by the parseDate method. |
The current visible end time of the component. | This parameter is applicable for the chart
and sheet components. |
The following HTTP request parameters are specific to a
capabilities
request:
Parameter | Required | Allowed Values | Default Value | Notes |
format |
Yes | json |
See below for a description of the response generated by a capabilities request. |
A capabilities request returns information about the current state of the chart. The information is returned in JSON format.
Once the HTML page is loaded by the client browser, the JSON object is executed. You can then query the variables. Refer to the documentation for the{ 'tableWidth' : 120, // total width of all table columns 'tableHeight': 100, // total height of all table rows 'tableHeaderHeight': 40, // height of table header and time scale 'rowHeight' : 20, // height of each row 'rowCount' : 5, // number of visible rows 'visibleTime [ // start of visible interval as 6 calendar values 2001, // year = 2001 2, // month = February 12, // day of month = 12 14, // hour = 2 PM 0, // minutes = 0 0 ], // seconds = 0 'minVisibleTime' : [ // minimum visible time as 6 calendar values 1998, ... ], 'maxVisibleTime' : [ // maximum visible time as 6 calendar values 2010, ... ], 'dataStartTime': [ // start of data model interval as 6 calendar values 2000, ... ], 'dataEndTime': [ // end of data model interval as 6 calendar values 2000, ... ], 'sheetXOffset' : 1, // position of the Gantt sheet view in the Gantt sheet component 'sheetYOffset' : 36, // position of the Gantt sheet view in the Gantt sheet component 'sheetWidth' : 390, // width of the Gantt sheet view 'sheetHeight' : 360 } // height of the Gantt sheet view
IlvGanttComponentView.getCapabilities
method for an explanation of how the HTML capabilities are handled by the
Gantt DHTML client-side components.Modifier and Type | Field and Description |
---|---|
static String |
ACTION_PARAM
The action parameter.
|
static String |
CAP_FORMAT_PARAM
The capabilities format parameter for capabilities requests.
|
static String |
CAPABILITIES_REQUEST
The capabilities request value for
REQUEST_PARAM . |
static String |
CHART_COMPONENT
The Gantt chart value for
COMPONENT_PARAM . |
static String |
COMPONENT_PARAM
The component parameter for image requests.
|
static String |
END_TIME_PARAM
The end time parameter for image requests.
|
static String |
HEIGHT
The height request value for
REQUEST_PARAM . |
static String |
HITMAP_REQUEST
The hitmap request value for
REQUEST_PARAM . |
static String |
HORZ_POSITION_PARAM
The horizontal scroll position parameter for image requests.
|
static String |
HTML_CAP_FORMAT
Deprecated.
Beginning with JViews 8.1 use
JSON_CAP_FORMAT instead. |
static String |
IMAGE_FORMAT_PARAM
The image format parameter for image requests.
|
static String |
IMAGE_REQUEST
The image request value for
REQUEST_PARAM . |
static String |
JPEG_IMAGE_FORMAT
The JPEG image format value for
IMAGE_FORMAT_PARAM . |
static String |
JSON_CAP_FORMAT
The JSON capabilities format value for
CAP_FORMAT_PARAM . |
static String |
OCTET_CAP_FORMAT
Deprecated.
Beginning with JViews 8.1 use
JSON_CAP_FORMAT instead. |
static String |
PNG_IMAGE_FORMAT
The PNG image format value for
IMAGE_FORMAT_PARAM . |
static String |
REQUEST_PARAM
The request type parameter.
|
static String |
SHEET_COMPONENT
The Gantt sheet value for
COMPONENT_PARAM . |
static String |
START_TIME_PARAM
The start time parameter for image requests.
|
static String |
TABLE_COMPONENT
The Gantt table value for
COMPONENT_PARAM . |
static String[] |
VALID_CAP_FORMATS
The array of valid values for
CAP_FORMAT_PARAM . |
static String[] |
VALID_COMPONENTS
The array of valid values for
COMPONENT_PARAM . |
static String |
VERBOSE_PARAM
The verbose parameter.
|
static String |
VERT_POSITION_PARAM
The vertical scroll position parameter for image requests.
|
static String |
WIDTH
The width request value for
REQUEST_PARAM . |
Constructor and Description |
---|
IlvGanttServletSupport()
Creates a new
IlvGanttServletSupport instance. |
Modifier and Type | Method and Description |
---|---|
protected void |
additionalBinaryCapabilities(IlvHierarchyChart chart,
IlvServletRequestParameters params,
DataOutputStream dataStream)
Deprecated.
since JViews 8.1 you must use
getAdditionalCapabilities(IlvHierarchyChart, IlvServletRequestParameters)
instead. |
protected void |
additionalTextCapabilities(IlvHierarchyChart chart,
IlvServletRequestParameters params,
PrintWriter writer)
Deprecated.
since JViews 8.1 you must use
getAdditionalCapabilities(IlvHierarchyChart, IlvServletRequestParameters)
instead. |
void |
addServerAction(String name,
IlvServerAction action)
Adds the specified
IlvServerAction to receive events when the named
action is requested from the client. |
protected IlvPopupMenuServletSupport |
createPopupMenuSupport()
Creates a new instance of pop-up menu servlet support.
|
protected IlvSelectionSupport |
createSelectionSupport()
Creates a new instance of selection servlet support.
|
protected BufferedImage |
generateImage(IlvServletRequestParameters params)
Generates the requested image.
|
protected Map |
getAdditionalCapabilities(IlvHierarchyChart chart,
IlvServletRequestParameters params)
Allows you to put additional capabilities to the capability request.
|
protected abstract IlvHierarchyChart |
getChart(jakarta.servlet.http.HttpServletRequest request,
IlvServletRequestParameters params)
Returns the chart used for the specified request.
|
IlvServletParameters |
getConfigParameters()
Returns the servlet configuration parameters.
|
protected jakarta.servlet.ServletContext |
getContext()
Gets the servlet context.
|
protected IlvTimeInterval |
getDataInterval(IlvHierarchyChart chart,
IlvServletRequestParameters params)
Returns the time interval of the chart's data model.
|
IlvGanttHitmapSupport |
getHitmapSupport()
Returns the hitmap support that should be an instance of
IlvGanttHitmapSupport . |
IlvImageEncoder |
getImageEncoder(String format)
Returns the image encoder registered for the specified format.
|
Object |
getObjectAt(IlvServletRequestParameters params,
int x,
int y)
Returns the object at the specified location inside a component.
|
IlvPopupMenuServletSupport |
getPopupMenuSupport()
Returns the pop-up menu servlet support that handles pop-up menu requests.
|
IlvSelectionSupport |
getSelectionSupport()
Returns the servlet support that manages selection requests.
|
jakarta.servlet.ServletContext |
getServletContext()
Returns the servlet context.
|
protected String |
getTimestamp()
Returns a formatted time stamp, suitable for logging.
|
boolean |
handleRequest(jakarta.servlet.http.HttpServletRequest request,
jakarta.servlet.http.HttpServletResponse response)
This method is the main entry point for handling HTTP requests.
|
boolean |
isPopupEnabled()
Returns
true if the servlet is set to handle pop-up menu
requests. |
boolean |
isSelectionEnabled()
Returns
true if the servlet is set to handle selection
requests in the sheet area. |
boolean |
isVerbose(IlvServletRequestParameters params)
Returns whether verbose mode is enabled.
|
protected void |
prepareChart(jakarta.servlet.http.HttpServletRequest request,
IlvHierarchyChart chart,
IlvServletRequestParameters params)
Allows you to prepare the chart contents before the
presentation is generated.
|
void |
removeServerAction(String name,
IlvServerAction action)
Removes the specified
IlvServerAction so that it no longer
receives action events generated from the client. |
void |
setConfigParameters(IlvServletParameters configParams)
Sets the servlet configuration parameters.
|
void |
setImageEncoder(String format,
IlvImageEncoder encoder)
Registers the image encoder for the specified format.
|
void |
setPopupEnabled(boolean popupEnabled)
Enables or disables the support of pop-up menu requests.
|
void |
setSelectionEnabled(boolean selectionEnabled)
Enables or disables the support of selection requests in the sheet area.
|
void |
setServletContext(jakarta.servlet.ServletContext context)
Sets the servlet context.
|
doGetScriptMessage, getParameterValidationListener, getScriptMessageSupport, setParameterValidationListener
public static final String REQUEST_PARAM
IMAGE_REQUEST
or CAPABILITIES_REQUEST
.public static final String HEIGHT
REQUEST_PARAM
.public static final String WIDTH
REQUEST_PARAM
.public static final String IMAGE_REQUEST
REQUEST_PARAM
.public static final String CAPABILITIES_REQUEST
REQUEST_PARAM
.public static final String HITMAP_REQUEST
REQUEST_PARAM
.public static final String VERBOSE_PARAM
IlvParameterUtil.parseBoolean(java.lang.String)
method.public static final String START_TIME_PARAM
chart
and sheet
components.public static final String END_TIME_PARAM
chart
and sheet
components.public static final String VERT_POSITION_PARAM
public static final String HORZ_POSITION_PARAM
table
component.public static final String ACTION_PARAM
actionName(arg1,arg2,...)
. Use the addServerAction(java.lang.String, ilog.views.gantt.servlet.IlvServerAction)
method to register an action to handle the specific actionName.public static final String IMAGE_FORMAT_PARAM
JPEG_IMAGE_FORMAT
, PNG_IMAGE_FORMAT
, or
any other format that has been registered by calling the
setImageEncoder(java.lang.String, ilog.views.gantt.servlet.IlvImageEncoder)
method.public static final String JPEG_IMAGE_FORMAT
IMAGE_FORMAT_PARAM
.public static final String PNG_IMAGE_FORMAT
IMAGE_FORMAT_PARAM
.public static final String CAP_FORMAT_PARAM
JSON_CAP_FORMAT
.public static final String JSON_CAP_FORMAT
CAP_FORMAT_PARAM
.@Deprecated public static final String HTML_CAP_FORMAT
JSON_CAP_FORMAT
instead.CAP_FORMAT_PARAM
.@Deprecated public static final String OCTET_CAP_FORMAT
JSON_CAP_FORMAT
instead.CAP_FORMAT_PARAM
.public static final String[] VALID_CAP_FORMATS
CAP_FORMAT_PARAM
. The array
consists of a single value: (@link #JSON_CAP_FORMAT}.public static final String COMPONENT_PARAM
CHART_COMPONENT
, TABLE_COMPONENT
, or
SHEET_COMPONENT
. The valid values are also specified by the
VALID_COMPONENTS
array.public static final String CHART_COMPONENT
COMPONENT_PARAM
.public static final String TABLE_COMPONENT
COMPONENT_PARAM
.public static final String SHEET_COMPONENT
COMPONENT_PARAM
.public static final String[] VALID_COMPONENTS
COMPONENT_PARAM
. The array
consists of 3 values: chart
,
table
, and sheet
.public IlvGanttServletSupport()
IlvGanttServletSupport
instance.public void setPopupEnabled(boolean popupEnabled)
This method must be called to support either static or dynamic pop-up menus.
See the user's documentation for further details.
popupEnabled
- The new value for pop-up enabled.getPopupMenuSupport()
public final boolean isPopupEnabled()
true
if the servlet is set to handle pop-up menu
requests.setPopupEnabled(boolean)
public final IlvPopupMenuServletSupport getPopupMenuSupport()
If the pop-up menu is dynamic, you must set a menu factory through the
setMenuFactory(IlvMenuFactory)
on the pop-up menu support
returned by this method.
See user's documentation for further details.
null
when
isPopupEnabled()
returns false
.isPopupEnabled()
protected IlvPopupMenuServletSupport createPopupMenuSupport()
public final boolean isSelectionEnabled()
true
if the servlet is set to handle selection
requests in the sheet area.setSelectionEnabled(boolean)
public void setSelectionEnabled(boolean selectionEnabled)
See user's documentation for further details.
isSelectionEnabled()
public final IlvSelectionSupport getSelectionSupport()
null
when the
selection is disabled.setSelectionEnabled(boolean)
protected IlvSelectionSupport createSelectionSupport()
public IlvServletParameters getConfigParameters()
public void setConfigParameters(IlvServletParameters configParams)
configParams
- The servlet configuration parameters.public jakarta.servlet.ServletContext getServletContext()
public void setServletContext(jakarta.servlet.ServletContext context)
context
- The servlet context.public boolean isVerbose(IlvServletRequestParameters params)
params
- The servlet request parameters.protected String getTimestamp()
protected abstract IlvHierarchyChart getChart(jakarta.servlet.http.HttpServletRequest request, IlvServletRequestParameters params) throws jakarta.servlet.ServletException
request
- The current HTTP request.params
- The parameters parsed from the request.jakarta.servlet.ServletException
protected void prepareChart(jakarta.servlet.http.HttpServletRequest request, IlvHierarchyChart chart, IlvServletRequestParameters params) throws jakarta.servlet.ServletException
request
- The current HTTP request.chart
- The chart returned by getChart
.params
- The parameters parsed from the request.jakarta.servlet.ServletException
public boolean handleRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
You can override this method to provide a new request type like this:
public boolean handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (super.handleRequest(request, response)) return true; IlvServletRequestParameters params = new IlvServletRequestParameters(request); String requestType = params.getString(REQUEST_PARAM, null); if ("somethingImportant".equals(requestType)) { doSomethingImportant(request, response, params); return true; } return false; }
handleRequest
in class IlvServletSupport
request
- The current HTTP request.response
- The HTTP response.true
if a recognized request was handled
successfully, or false
if the request type was not
recognized. If a recognized request is not handled
successfully, an exception will be thrown.IOException
- if an input or output error is detected when the
servlet handles the request.jakarta.servlet.ServletException
- if the request could not be handled.public IlvGanttHitmapSupport getHitmapSupport()
IlvGanttHitmapSupport
.protected BufferedImage generateImage(IlvServletRequestParameters params) throws IOException, jakarta.servlet.ServletException
params
- The parameters parsed from the current HTTP request.IOException
jakarta.servlet.ServletException
public void setImageEncoder(String format, IlvImageEncoder encoder)
format
- The image format. For example: "JPEG" or "PNG".encoder
- The encoder or null
to unregister the format.getImageEncoder(java.lang.String)
public IlvImageEncoder getImageEncoder(String format)
format
- The image format. For example: "JPEG" or "PNG".null
if the format is not registered.setImageEncoder(java.lang.String, ilog.views.gantt.servlet.IlvImageEncoder)
protected IlvTimeInterval getDataInterval(IlvHierarchyChart chart, IlvServletRequestParameters params) throws jakarta.servlet.ServletException
IlvSimpleActivity
that have
their setAutoCalcTimeIntervalFromChildren
flag set to true
.
In this case, the root activity's interval will be the union of all its
children. Override this method to provide a different strategy for
calculating the data model interval.chart
- The chart returned by getChart
.params
- The parameters parsed from the request.jakarta.servlet.ServletException
@Deprecated protected void additionalTextCapabilities(IlvHierarchyChart chart, IlvServletRequestParameters params, PrintWriter writer) throws IOException, jakarta.servlet.ServletException
getAdditionalCapabilities(IlvHierarchyChart, IlvServletRequestParameters)
instead.chart
- The chart returned by getChart
.params
- The parameters parsed from the current HTTP request.writer
- The servlet print writer for writing additional text/html
capabilities.IOException
jakarta.servlet.ServletException
@Deprecated protected void additionalBinaryCapabilities(IlvHierarchyChart chart, IlvServletRequestParameters params, DataOutputStream dataStream) throws IOException, jakarta.servlet.ServletException
getAdditionalCapabilities(IlvHierarchyChart, IlvServletRequestParameters)
instead.chart
- The chart returned by getChart
.params
- The parameters parsed from the current HTTP request.dataStream
- The servlet data output stream for writing additional
binary capabilities.IOException
jakarta.servlet.ServletException
protected Map getAdditionalCapabilities(IlvHierarchyChart chart, IlvServletRequestParameters params) throws jakarta.servlet.ServletException
Map
should contains pairs of propertyName
and propertyValue
for each additional capability.chart
- The chart returned by getChart
.params
- The parameters parsed from the current HTTP request.null if none
).jakarta.servlet.ServletException
public final void addServerAction(String name, IlvServerAction action)
IlvServerAction
to receive events when the named
action is requested from the client. An action is generated from the client
side when the IlvGanttComponentView.performAction()
method is
called. The performAction
method queries the server for a new
image with additional parameters appended to the request so that an action
such as adding, removing, or selecting objects can be performed before the
image is generated. The IlvServerAction
will be invoked
on the AWT event dispatch thread.name
- The action name.action
- The server action.removeServerAction(java.lang.String, ilog.views.gantt.servlet.IlvServerAction)
public final void removeServerAction(String name, IlvServerAction action)
IlvServerAction
so that it no longer
receives action events generated from the client.name
- The action name.action
- The server action.addServerAction(java.lang.String, ilog.views.gantt.servlet.IlvServerAction)
public Object getObjectAt(IlvServletRequestParameters params, int x, int y) throws jakarta.servlet.ServletException
params
- The parameters parsed from the current HTTP request.
These are the same as the image request parameters for the
component to look into.x
- X coordinate of the location where to look at.y
- Y coordinate of the location where to look at.null
when none is
found.jakarta.servlet.ServletException
IOException
protected jakarta.servlet.ServletContext getContext()
getContext
in class IlvServletSupport
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.