public class DownloadResource extends ResourceWrapper
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NN_FILE
name of the file node.
|
static java.lang.String |
PN_DESCRIPTION
name of the description property
|
static java.lang.String |
PN_FILE_NAME
name of the 'file name' property.
|
static java.lang.String |
PN_REFERENCE
name of the file reference property.
|
static java.lang.String |
PN_TITLE
name of the title property.
|
RESOURCE_TYPE_NON_EXISTING
Constructor and Description |
---|
DownloadResource(Resource resource)
Creates a new download based on the given resource.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(java.lang.String name,
java.lang.String value)
Adds a tag attribute to this download.
|
void |
addCssClass(java.lang.String name)
Adds a CSS class name to the respective attribute.
|
void |
addQueryParam(java.lang.String name,
java.lang.String value)
Adds a query param to the 'query' attribute
|
void |
draw(java.io.Writer w)
Writes this download as link tag to the given writer
|
java.lang.String |
get(java.lang.String name)
Get a property either from the overlaid map or the underlying properties.
|
int |
get(java.lang.String name,
int defaultValue)
Get a property and convert it to an integer.
|
java.util.Map<java.lang.String,java.lang.String> |
getAttributes()
Returns a map of attributes.
|
Property |
getData()
Returns the property that contains the binary data of this download.
|
java.lang.String |
getDescription()
Returns the image description as defined by getItemName(PN_DESCRIPTION)
or overridden by
setDescription(String) . |
java.lang.String |
getDescription(boolean escape)
Returns the image description as defined by 'getItemName(PN_DESCRIPTION)'
or overridden by
setDescription(String) . |
java.lang.String |
getExtension()
Returns the extension.
|
java.lang.String |
getFileName()
Returns the file name of this download as defined by the property with
the name from 'getItemName(PN_FILE_NAME).
|
java.lang.String |
getFileNodePath()
Returns the file path.
|
java.lang.String |
getFileReference()
Returns the file reference.
|
java.lang.String |
getHref()
Returns the href attribute of this download.
|
java.lang.String |
getIconPath()
Deprecated.
since 5.4 please use css classes for the icon, like "icon_xls.gif"
|
java.lang.String |
getIconType()
Returns the icon type of this file.
|
java.lang.Object |
getInnerHtml()
Returns the inner html object for the download link.
|
java.lang.String |
getItemName(java.lang.String name)
Returns the name of the given item which is either the default or
can be redefined by
setItemName(String, String) . |
java.util.Calendar |
getLastModified()
Returns the last modified of this image.
|
java.lang.String |
getMimeType()
Returns the mime type of this image.
|
java.lang.String |
getQuery()
Gets the query attribute
|
java.lang.String |
getSelector()
Returns the selector string.
|
java.lang.String |
getString()
Returns a string representation as HTML tag of this image.
|
java.lang.String |
getSuffix()
Returns the suffix.
|
java.lang.String |
getTitle()
Returns the image title as defined by 'getItemName(PN_TITLE)'
or overridden by
setTitle(String) . |
java.lang.String |
getTitle(boolean escape)
Returns the image title as defined by 'getItemName(PN_TITLE)'
or overridden by
setTitle(String) . |
boolean |
hasContent()
Checks if this download has content.
|
void |
init()
Calculates all default values if 'source' is
null |
boolean |
isTouchAuthoringUIMode()
Returns if page is in UI Touch mode?
|
void |
set(java.lang.String name,
java.lang.String value)
Set a property to the overlaid map.
|
void |
setDescription(java.lang.String description)
Sets the description.
|
void |
setExtension(java.lang.String extension)
Sets the extension.
|
void |
setFileName(java.lang.String fileName)
Sets the file name.
|
void |
setFileNodePath(java.lang.String fileNodePath)
Sets the path to the file node.
|
void |
setFileReference(java.lang.String fileReference)
Sets the file reference.
|
void |
setHref(java.lang.String href)
Sets the href attribute
|
void |
setInnerHtml(java.lang.Object innerHtml)
Sets the inner html object for the download.
|
void |
setIsInUITouchMode(boolean inUITouchMode)
Page is in UI Touch mode?
|
void |
setItemName(java.lang.String key,
java.lang.String name)
Defines the name of an item.
|
void |
setQuery(java.lang.String query)
Sets the query attribute, overwrites any previously generated queries.
|
void |
setSelector(java.lang.String selector)
Sets the selector string.
|
void |
setSuffix(java.lang.String suffix)
Sets the suffix.
|
void |
setTitle(java.lang.String title)
Sets the title.
|
adaptTo, getChild, getChildren, getName, getParent, getPath, getResource, getResourceMetadata, getResourceResolver, getResourceSuperType, getResourceType, getValueMap, hasChildren, isResourceType, listChildren, toString
public static final java.lang.String PN_REFERENCE
public static final java.lang.String NN_FILE
public static final java.lang.String PN_FILE_NAME
public static final java.lang.String PN_TITLE
public static final java.lang.String PN_DESCRIPTION
public DownloadResource(Resource resource)
resource
- resource of the imagejava.lang.IllegalArgumentException
- if the given resource is not adaptable to node.public boolean isTouchAuthoringUIMode()
public void setIsInUITouchMode(boolean inUITouchMode)
inUITouchMode
- value to setpublic java.lang.String get(java.lang.String name)
name
- name of the propertypublic int get(java.lang.String name, int defaultValue)
name
- name of the propertydefaultValue
- default valuepublic void set(java.lang.String name, java.lang.String value)
name
- name of the propertyvalue
- value of the propertypublic void addAttribute(java.lang.String name, java.lang.String value)
drawing
the tag.name
- name of the attributevalue
- value of the attributepublic void addCssClass(java.lang.String name)
name
- the class namepublic void init()
null
public java.lang.String getItemName(java.lang.String name)
setItemName(String, String)
. If the name
is not defined, the given name is returned.
Example: Download.getItemName(Download.PN_FILE_NAME)name
- item namepublic void setItemName(java.lang.String key, java.lang.String name)
key
- key. eg PN_FILE_NAME
.name
- redefined namepublic java.lang.String getFileReference()
public void setFileReference(java.lang.String fileReference)
fileReference
- the file reference.public java.lang.Object getInnerHtml()
null
if not defined.public void setInnerHtml(java.lang.Object innerHtml)
innerHtml
- the inner html objectpublic java.lang.String getFileNodePath()
public void setFileNodePath(java.lang.String fileNodePath)
fileNodePath
- path of the file node.public java.lang.String getFileName()
public void setFileName(java.lang.String fileName)
fileName
- the file namepublic java.lang.String getTitle()
setTitle(String)
.public java.lang.String getTitle(boolean escape)
setTitle(String)
.escape
- if true
the string is HTML escapedpublic void setTitle(java.lang.String title)
title
- the title.public java.lang.String getDescription()
setDescription(String)
.public java.lang.String getDescription(boolean escape)
setDescription(String)
.escape
- if true
the string is HTML escapedpublic void setDescription(java.lang.String description)
description
- the description.public java.lang.String getHref()
public void setHref(java.lang.String href)
href
- the href attributepublic java.lang.String getQuery()
public void setQuery(java.lang.String query)
query
- the querypublic void addQueryParam(java.lang.String name, java.lang.String value)
name
- name of the paramvalue
- value of the parampublic java.lang.String getExtension()
.res
public void setExtension(java.lang.String extension)
extension
- the extension.public java.lang.String getIconType()
@Deprecated public java.lang.String getIconPath()
null
.public java.lang.String getSuffix()
""
public void setSuffix(java.lang.String suffix)
suffix
- the suffix.public java.lang.String getSelector()
public void setSelector(java.lang.String selector)
selector
- the selector string.public boolean hasContent()
true
if this download has content.public void draw(java.io.Writer w) throws java.io.IOException
w
- the writerjava.io.IOException
- if an I/O error occurspublic java.lang.String getString()
public java.lang.String getMimeType() throws RepositoryException
getData()
.null
if the image
has no content.RepositoryException
- if an error accessing the repository occurs.public java.util.Calendar getLastModified() throws RepositoryException
getData()
.null
if the image
has no content.RepositoryException
- if an error accessing the repository occurs.public Property getData() throws RepositoryException
null
RepositoryException
- if an error accessing the repository occurs.public java.util.Map<java.lang.String,java.lang.String> getAttributes()
Copyright © 2010 - 2020 Adobe. All Rights Reserved