|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.esri.adf.web.tasks.PrintTask
public class PrintTask
The task class is to help user to print out the current map, legend, the map elements and query result data.
The output map quality can be improved by changing its DPI(dot per inch), which is an integer from 96 to 300.
This task can be configured at the design-time in faces-config.xml as shown below, <managed-bean> <managed-bean-name>printTask</managed-bean-name> <managed-bean-class>com.esri.adf.web.tasks.PrintTask</managed-bean-class> <managed-bean-scope>none</managed-bean-scope> <managed-property> <property-name>mapTitle</property-name> <value>Map</value> </managed-property> <managed-property> <property-name>printResultOnly</property-name> <value>false</value> </managed-property> <managed-property> <property-name>mapSize</property-name> <value>5.0</value> </managed-property> <managed-property> <property-name>mapQuality</property-name> <value>100</value> </managed-property> <managed-property> <property-name>printLegend</property-name> <value>true</value> </managed-property> <managed-property> <property-name>printScalebar</property-name> <value>true</value> </managed-property> <managed-property> <property-name>printNorthArrow</property-name> <value>true</value> </managed-property> <managed-property> <property-name>legendColumns</property-name> <value>2</value> </managed-property> <managed-property> <property-name>mapSizes</property-name> <map-entries> <map-entry> <key>3.0</key> <value>Small</value> </map-entry> <map-entry> <key>5.0</key> <value>Medium</value> </map-entry> <map-entry> <key>7.0</key> <value>Large</value> </map-entry> </map-entries> </managed-property> <managed-property> <property-name>mapQualities</property-name> <map-entries> <map-entry> <key>96</key> <value>Draft</value> </map-entry> <map-entry> <key>200</key> <value>Normal</value> </map-entry> </map-entries> </managed-property> <managed-property> <property-name>printButtonText</property-name> <value>print Button</value> </managed-property> <managed-property> <property-name>displayMapTitle</property-name> <value>true</value> </managed-property> <managed-property> <property-name>displayPrintResultOnlyChoice</property-name> <value>true</value> </managed-property> <managed-property> <property-name>displayMapSizeChoices</property-name> <value>true</value> </managed-property> <managed-property> <property-name>displayMapQualityChoices</property-name> <value>true</value> </managed-property> <managed-property> <property-name>displayPrintScalebarChoice</property-name> <value>true</value> </managed-property> <managed-property> <property-name>displayPrintLegendChoice</property-name> <value>true</value> </managed-property> <managed-property> <property-name>displayPrintNorthArrowChoice</property-name> <value>true</value> </managed-property> <managed-property> <property-name>preserveScale</property-name> <value>true</value> </managed-property> </managed-bean>
Field Summary | |
---|---|
static String |
LEGEND_SHOWALL
the constant string for generating legend |
static String |
LEGEND_SHOWNONE
the constant string for generating legend |
static String |
MAPSIZE_CM
the constant string for centimeter |
static String |
MAPSIZE_INCH
the constant string for inch |
protected WebNorthArrow |
mWebNorthArrow
the WebNorthArrow object |
protected WebScaleBar |
mWebScaleBar
the WebScaleBar object |
Fields inherited from interface com.esri.adf.web.data.results.WebResultsObserver |
---|
ALL_RESULTS_CLEARED, RESULT_ADDED, RESULT_MODIFIED, RESULT_REMOVED, RESULT_REPLACED |
Constructor Summary | |
---|---|
PrintTask()
|
Method Summary | |
---|---|
boolean |
checkTocNode(TocNode node)
The method is called when the legend is generated. |
String |
createPrintMap(WebContext webContext)
Deprecated. Use createPrintMapImage method as createPrintMapImage generates the map image and returns the bytes of the map image created. |
byte[] |
createPrintMapImage(WebContext webContext)
Creates a printable map and returns its image in a byte array. |
void |
createPrintPage(TaskEvent event)
Creates the printable map. |
void |
destroy()
Destroys the references. |
String |
getCopyrightText()
Returns the copyright text string |
double |
getCustomPrintHeight()
returns the custom print map height |
double |
getCustomPrintWidth()
Returns the custom print map width; |
String |
getDisplayName()
Gets the task display name |
protected String |
getErrorMessage()
If there is some exception occurred during the generation of printing map image, the error will be sent back to client. |
int |
getLegendColumns()
Returns the legend columns |
String |
getLegendLayerVisibilityList()
Returns the layer list to be shown in the legend |
Map<Integer,String> |
getMapQualities()
Returns the map qualities in a Map |
int |
getMapQuality()
Returns the map quality DPI; |
double |
getMapSize()
Returns the current map size in double.If the user selects the small, the value is 3.0, medium is 5.0 and large is 7.0 by default. |
Map<Double,String> |
getMapSizes()
Returns a HashMap |
String |
getMapSizeUnit()
Returns the printing map unit constant. |
String |
getMapTitle()
Gets the map title |
String |
getMapUrl()
Returns url stlye string |
List<? extends PrintableResult> |
getPrintableResults()
Returns a list of PrintableResult objects. |
String |
getPrintButtonText()
Set the print task printing button text |
int |
getPrintMapHeight()
Returns the map height in pixel.This is the map height shown on the print page. |
int |
getPrintMapWidth()
Returns the map width in pixel.This is the map width shown on the print page. |
String |
getPrintTemplate()
Returns the printing template file name. |
Object[] |
getQueryResults()
Returns an array object with length equal to 2. |
String |
getResultList()
Returns the query result string in form of "resutl1, result2"; |
Map<String,ResultNode> |
getResultLists()
Returns a result map |
TaskInfo |
getTaskInfo()
Returns the task info class |
WebContext |
getWebContext()
Returns the WebContext object |
WebToc |
getWebToc()
Returns the WebToc object of the printing task |
boolean |
hasMapNorthArrow()
Returns true if there is a north arrow in current context. |
boolean |
hasMapScalebar()
Returns true if there is a WebScaleBar in the current WebContext. |
void |
init(WebContext webContext)
Initilaizes the PrintTask. |
boolean |
isDisplayMapQualityChoices()
Returns true if the map quality combobox is visible. |
boolean |
isDisplayMapSizeChoices()
Returns true if the map size combobox is visible. |
boolean |
isDisplayMapTitle()
Returns true if the map title input text field is visible |
boolean |
isDisplayPrintLegendChoice()
Returns true if the printing legend choice is visible. |
boolean |
isDisplayPrintNorthArrowChoice()
Returns true if the printing north arrow check box is visible. |
boolean |
isDisplayPrintResultList()
Returns true if the print result list box is visible. |
boolean |
isDisplayPrintResultOnlyChoice()
Returns true if the print results choice is visible; |
boolean |
isDisplayPrintScalebarChoice()
Returns true if the printing scale bar check box is visible. |
boolean |
isLayerShown(int layerId)
Check if the given layer sequential number to be shown in the legend. |
protected static boolean |
isNumeric(String s)
To test if the string is numeric; |
boolean |
isPreserveScale()
Returns true if the printed map scale is preserved same as the current scale in map viewer. |
boolean |
isPrintLegend()
Returns the default value for printing legend choice. |
boolean |
isPrintNorthArrow()
Returns true for default value of print north arrow |
boolean |
isPrintResultOnly()
Returns true if the print map is not created and only the results are generated. |
boolean |
isPrintScalebar()
Returns true for default value of printing scalebar |
void |
setCopyrightText(String text)
Sets the copyright text string |
void |
setCustomPrintHeight(double customPrintHeight)
Sets the print map height in default unit(inch). |
void |
setCustomPrintWidth(double customPrintWidth)
Sets the print map width in default unit(inch). |
void |
setDisplayMapQualityChoices(boolean displayMapQualityChoices)
Sets the visibility of the map quality combobox. |
void |
setDisplayMapSizeChoices(boolean displayMapSizeChoices)
Sets the visibility of the map size combobox. |
void |
setDisplayMapTitle(boolean displayMapTitle)
Sets the visibility of map title input field. |
void |
setDisplayName(String displayName)
Sets the task display name |
void |
setDisplayPrintLegendChoice(boolean displayPrintLegendChoice)
Sets the visibility of the printing legend choice. |
void |
setDisplayPrintNorthArrowChoice(boolean printNorthArrow)
Sets the visibility of the printing north arrow choice. |
void |
setDisplayPrintResultList(boolean displayPrintResultList)
Sets the visibility of print result list. |
void |
setDisplayPrintResultOnlyChoice(boolean displayPrintResultChoice)
Sets the visibility of print results only choice. |
void |
setDisplayPrintScalebarChoice(boolean printScalebar)
Sets the visibility of the printing scalebar choice. |
void |
setLegendColumns(int legendColumns)
Sets the number of columns for displaying legend. |
void |
setLegendLayerVisibilityList(String layerVisibleList)
Sets the visible layer list for the legend. |
void |
setMapQuality(int quality)
Sets the map quality DPI, e.g. |
void |
setMapSize(double value)
Sets the map size (width), the print map height is calculated proportionally based on the ratio of current map height and width. |
void |
setMapSizeUnit(String unit)
Sets the print map unit. |
void |
setMapTitle(String value)
Sets the map title |
void |
setPreserveScale(boolean preserveScale)
Specifies whether to preserve the map scale in the printed map. |
void |
setPrintableResults(List<? extends PrintableResult> resultList)
Sets a list of PrintableResult objects |
void |
setPrintButtonText(String printButtonText)
Returns the print task printing button text |
void |
setPrintLegend(boolean printLegend)
Sets default value for printing legend. |
void |
setPrintNorthArrow(boolean printNorthArrow)
Sets default value for printing north arrow if the server has. |
void |
setPrintResultOnly(boolean value)
If it is set to true, then it will print only the results and not the map. |
void |
setPrintScalebar(boolean printScalebar)
Sets default value for printing scalebar if the server has. |
void |
setPrintTemplate(String templateFile)
Specifies the template file to use for the print page. |
void |
setResultList(String ResultList)
Sets the selected results string to be printed out. |
void |
setTaskInfo(TaskInfo taskInfo)
Sets the task info object |
void |
setVisibleGraphicFeatures(String flist)
Sets the visibility of graphic features.The method is called from the print task UI. |
protected static String |
toLocalString(String message)
Returns the localized string value. |
String |
toString()
Returns a printing map url String |
void |
update(WebContext webContext,
Object arg)
The method is to update print scale and result list. |
void |
webResultsUpdate(WebResults results,
int updateType,
ResultNode affectedNode,
Object args)
The implemented method for |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String MAPSIZE_INCH
public static final String MAPSIZE_CM
public static final String LEGEND_SHOWALL
public static final String LEGEND_SHOWNONE
protected WebNorthArrow mWebNorthArrow
protected WebScaleBar mWebScaleBar
Constructor Detail |
---|
public PrintTask()
Method Detail |
---|
public void init(WebContext webContext)
init
in interface WebContextInitialize
webContext
- WebContext
- the WebContextWebContext.init(WebContext)
,
WebContext.addResource(String, GISResource, int)
,
WebContext.removeResource(GISResource)
public void update(WebContext webContext, Object arg)
update
in interface WebContextObserver
webContext
- the WebContext
that has been refreshedarg
- the argument passed to the WebContext
's refresh(arg)
methodWebContext.refresh(Object)
,
WebContext.addObserver(WebContextObserver)
,
WebContext.removeObserver(WebContextObserver)
public void destroy()
destroy
in interface WebContextInitialize
WebContext.destroy()
public TaskInfo getTaskInfo()
getTaskInfo
in interface TaskInfoBean
public void setTaskInfo(TaskInfo taskInfo)
setTaskInfo
in interface TaskInfoBean
taskInfo
- a TaskInfo object.public String getDisplayName()
public void setDisplayName(String displayName)
displayName
- Stringpublic WebContext getWebContext()
public WebToc getWebToc()
protected String getErrorMessage()
protected static String toLocalString(String message)
protected static final boolean isNumeric(String s)
s
- - String
public boolean isLayerShown(int layerId)
layerId
- - layer sequential number counted from 0public boolean checkTocNode(TocNode node)
node
- - a TocNode object
public void setCopyrightText(String text)
text
- - Stringpublic String getCopyrightText()
public void setPrintTemplate(String templateFile)
The default value is 'print.jsf'.
public String getPrintTemplate()
public void setPreserveScale(boolean preserveScale)
It is false by default to preserve the extent.
scalePreserved
- booleanpublic boolean isPreserveScale()
public boolean isPrintResultOnly()
public void setPrintResultOnly(boolean value)
value
- - booleanpublic Map<Double,String> getMapSizes()
public String getMapTitle()
public void setMapTitle(String value)
value
- - Stringpublic double getMapSize()
public void setMapSize(double value)
value
- - doublepublic int getMapQuality()
public void setMapQuality(int quality)
quality
- Stringpublic Map<Integer,String> getMapQualities()
public boolean hasMapScalebar()
public boolean hasMapNorthArrow()
public void setCustomPrintWidth(double customPrintWidth)
customPrintWidth
- - doublepublic void setCustomPrintHeight(double customPrintHeight)
customPrintHeight
- - doublepublic double getCustomPrintWidth()
public double getCustomPrintHeight()
public String getMapUrl()
public int getPrintMapHeight()
public int getPrintMapWidth()
public String getResultList()
public void setResultList(String ResultList)
ResultList
is a string consisted of query id
delimited by ",".
ResultList
- - Stringpublic void setVisibleGraphicFeatures(String flist)
flist
- - Stringpublic Map<String,ResultNode> getResultLists()
@Deprecated public String createPrintMap(WebContext webContext)
webContext
- the context object, passing null will use the context from this object
public byte[] createPrintMapImage(WebContext webContext)
public void createPrintPage(TaskEvent event)
event
- - TaskEventpublic void webResultsUpdate(WebResults results, int updateType, ResultNode affectedNode, Object args)
webResultsUpdate
in interface WebResultsObserver
results
- the WebResults
object that was updatedupdateType
- the type of update (such as WebResultsObserver.RESULT_ADDED
, WebResultsObserver.ALL_RESULTS_CLEARED
, etc.)affectedNode
- the primarily affected ResultNode
(optional)args
- an arbitrary argument which observers can use to fine-tune their update behaviors (optional)public Object[] getQueryResults()
public String getLegendLayerVisibilityList()
public void setLegendLayerVisibilityList(String layerVisibleList)
layerVisibleList
- - a String consisting a set of layer numbers separated by a comma, e.g. "2,3"public boolean isDisplayMapTitle()
public void setDisplayMapTitle(boolean displayMapTitle)
displayMapTitle
- - booleanpublic void setDisplayPrintResultList(boolean displayPrintResultList)
displayPrintResultList
- booleanpublic boolean isDisplayPrintResultList()
public void setDisplayPrintResultOnlyChoice(boolean displayPrintResultChoice)
displayPrintResultChoice
- - booleanpublic boolean isDisplayPrintResultOnlyChoice()
public void setPrintNorthArrow(boolean printNorthArrow)
printNorthArrow
- booleanpublic boolean isPrintNorthArrow()
public void setPrintScalebar(boolean printScalebar)
printScalebar
- booleanpublic boolean isPrintScalebar()
public void setPrintLegend(boolean printLegend)
printLegend
- booleanpublic boolean isPrintLegend()
public void setDisplayPrintScalebarChoice(boolean printScalebar)
printScalebar
- booleanpublic boolean isDisplayPrintScalebarChoice()
public void setDisplayPrintNorthArrowChoice(boolean printNorthArrow)
printNorthArrow
- true/falsepublic boolean isDisplayPrintNorthArrowChoice()
public void setDisplayPrintLegendChoice(boolean displayPrintLegendChoice)
displayPrintLegendChoice
- - booleanpublic boolean isDisplayPrintLegendChoice()
public String getMapSizeUnit()
public void setMapSizeUnit(String unit)
public void setPrintButtonText(String printButtonText)
public String getPrintButtonText()
public void setLegendColumns(int legendColumns)
legendColumns
- - integer;public int getLegendColumns()
public void setDisplayMapSizeChoices(boolean displayMapSizeChoices)
displayMapSizeChoices
- public boolean isDisplayMapSizeChoices()
public void setDisplayMapQualityChoices(boolean displayMapQualityChoices)
displayMapQualityChoices
- - booleanpublic boolean isDisplayMapQualityChoices()
public String toString()
toString
in class Object
public void setPrintableResults(List<? extends PrintableResult> resultList)
resultList
- a Listpublic List<? extends PrintableResult> getPrintableResults()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |