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