Package org.javlo.component.files
Class AbstractFileComponent
- java.lang.Object
-
- org.javlo.component.core.AbstractVisualComponent
-
- org.javlo.component.files.AbstractFileComponent
-
- All Implemented Interfaces:
Comparable<IContentVisualComponent>
,IAction
,IContentVisualComponent
,ILink
,IUploadResource
,IRestItem
,IStaticContainer
- Direct Known Subclasses:
CSVArrayComponent
,GenericFile
,Image
,SimpleVideo
,Sound
,VFSFile
public class AbstractFileComponent extends AbstractVisualComponent implements IStaticContainer, ILink, IUploadResource, IAction
Abstract component for access to a file (file,image...)exposed variable :
- inherited from
AbstractVisualComponent
String
url : url to resource.String
description : description of the resource.String
label : label defined by contributor.boolean
blank : true if link must be open as popup.StaticInfo
resource : static info of resource.
- Author:
- pvandermaesen
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DEFAULT_ENCODING
static String
DESCRIPTION_KEY
static String
DIR_KEY
static String
EMBED_CODE_KEY
protected static String
ENCODING_KEY
static String
FILE_NAME_KEY
static String
LABEL_KEY
protected Properties
properties
protected static String
REVERSE_LINK_KEY
static String
TYPE
-
Fields inherited from class org.javlo.component.core.AbstractVisualComponent
CACHE_KEY_SUFFIX_PARAM_NAME, COMPONENT_KEY, config, EDIT_CLASS, FLUID_COL_SIZE, FORCE_COMPONENT_ID, HIDDEN, I18N_FILE, logger, MAX_COL_VALUE, MOBILE_TYPE, NOT_EDIT_PREVIEW_PARAM_NAME, SCROLL_TO_COMP_ID_ATTRIBUTE_NAME, TIME_CACHE_NAME, VALUE_SEPARATOR
-
Fields inherited from interface org.javlo.component.core.IContentVisualComponent
COLORED_WRAPPER_CLASS, COMP_ID_REQUEST_PARAM, COMPLEXITY_ADMIN, COMPLEXITY_EASY, COMPLEXITY_STANDARD, CONTAINER_COLOR, DEFAULT_COLOR, DYN_COMP_COLOR, ECOM_COLOR, EDIT_ACTION_CSS_CLASS, GRAPHIC_COLOR, HIGH_LABEL_LEVEL, ID_SEPARATOR, LINK_COLOR, LOW_LABEL_LEVEL, META_COLOR, MIDDLE_LABEL_LEVEL, SEARCH_LEVEL_HIGH, SEARCH_LEVEL_LOW, SEARCH_LEVEL_MIDDLE, SEARCH_LEVEL_NONE, TEXT_COLOR, VIEW_DEFINITION_REQUEST_ID, WEB2_COLOR
-
-
Constructor Summary
Constructors Constructor Description AbstractFileComponent()
-
Method Summary
-
Methods inherited from class org.javlo.component.core.AbstractVisualComponent
applyReplacement, cleanResources, cleanValue, clearReplacement, clone, compareTo, contructViewStyle, countLine, delete, deleteMySelf, drawColumn, equals, executeCurrentRenderer, executeJSP, executeRenderer, executeRenderer, extractFieldsFromRenderer, forceInit, getAjaxId, getArea, getAuthors, getBackgroundColor, getBaseHelpURL, getClassName, getColomnablePrefix, getColomnableSuffix, getColumn, getColumnMaxSize, getColumnSize, getColumnSizes, getColumnStyle, getComplexityLevel, getComponentBean, getComponentCSS, getComponentCssClass, getComponentId, getComponentLabel, getComponentPath, getConfig, getConfigInValue, getConfigMessage, getContainerPage, getContentAsMap, getContentCache, getContentMessage, getContentName, getContentTimeCache, getCookiesDisplayStatus, getCreationDate, getCSSStyle, getCurrentPage, getCurrentRenderer, getDataAttributes, getDebugHeader, getDefaultHelpURI, getDefaultRenderer, getDeleteDate, getDescription, getDisplayAsInputName, getDisplayMessage, getEditRenderer, getEditText, getEmptyCode, getEmptyXHTMLCode, getErrorMessage, getErrorMessage, getExternalModules, getExternalResources, getFileDirectory, getFirstPrefix, getForcedId, getForcedPrefixViewXHTMLCode, getForcedRenderer, getForcedSuffixViewXHTMLCode, getFormName, getGroup, getHeaderContent, getHelpText, getHelpType, getHelpURI, getHelpURL, getHexColor, getI18nEditableKeys, getIcon, getId, getImportFolderPath, getImportFolderPath, getInlineStyle, getInputName, getInputNameColomn, getInputNameColomnStyle, getInputNameRenderer, getInputNameRendererTitle, getItalicAndStrongLanguageMarkerList, getJSOnSubmit, getKey, getLabelLevel, getLastSufix, getLayout, getListClass, getListGroup, getListItemTag, getListTag, getLocalMessage, getLock, getManualCssClass, getMarkerList, getMessage, getMirrorWrapper, getModificationDate, getNextComponent, getPage, getPageDescription, getPrefixCssClass, getPrefixViewXHTMLCode, getPreviewAttributes, getPreviewCssClass, getPreviewCssId, getPreviousComponent, getQuotationLanguageMarkerList, getReferenceComponent, getRemplacement, getRenderer, getRendererTitle, getRenderes, getRequestComponent, getSearchLevel, getSelectRendererXHTML, getSpecialInputTag, getSpecialPreviewCssId, getSpecialTagTitle, getSpecialTagXHTML, getSpecificClass, getSpecificCssClass, getStyle, getStyleLabel, getStyleLabelList, getStyleList, getStyleTitle, getSuffixViewXHTMLCode, getTag, getTextColor, getTextForSearch, getTextLabel, getTextMessage, getTextPosition, getTextTitle, getTitleLevel, getTypeInputName, getValue, getValue, getVersion, getViewData, getViewDataFile, getViewID, getViewText, getViewXHTMLCode, getWidth, getXHTMLCode, getXHTMLConfig, haveRight, includeComponentJSP, includePage, init, initContent, insert, isAjaxWrapper, isAskWidth, isAutoDeletable, isAutoRenderer, isBackgroundColored, isCanAddClass, isCloseRow, isColored, isColumnable, isConfig, isContentCachableByQuery, isContentTimeCachable, isDefaultValue, isDispayEmptyXHTMLCode, isDisplayHidden, isEditOnCreate, isFirstElementOfRepeatSequence, isFirstRepeated, isFreeInputLayout, isHelpURL, isHiddable, isHidden, isHiddenInMode, isHiddenInModeValue, isInline, isList, isListable, isMetaTitle, isMirrorWrapped, isModify, isNeedDelete, isNeedRefresh, isNeedRenderer, isNew, isNextSame, isNextSame, isNolink, isNoLinkable, isOpenRow, isPreviousSame, isPreviousSame, isRealContent, isRepeat, isRepeatable, isRestMatch, isReversedLink, isStyleHidden, isUnique, isValueProperties, isValueTranslatable, isViewDataFile, isVisible, isVisible, isVisibleFromCookies, isWrapped, isXML, loadViewData, markAsNew, newInstance, next, onStyleChange, performColumnable, performConfig, performUpdate, prepareEdit, previous, processView, renderOtherComponent, renderViewXHTMLCode, replaceAllInContent, replaceInContent, resetContentCache, resetViewData, setBackgroundColor, setColumnSize, setColumnStyle, setComponentBean, setContainerPage, setContentCache, setContentTimeCache, setDisplayHidden, setForcedId, setForcedRenderer, setGroup, setHidden, setHiddenInMode, setList, setLocalMessage, setMessage, setMirrorWrapped, setModify, setNeedRefresh, setNextComponent, setNolink, setPage, setPreviousComponent, setRenderer, setRepeat, setStyle, setTextColor, setTextPosition, setValid, setWidth, stored, storeViewData, stringToReader, stringToReader, stringToStream, textToXHTML, toString, updateCache
-
-
-
-
Field Detail
-
LABEL_KEY
public static final String LABEL_KEY
- See Also:
- Constant Field Values
-
DIR_KEY
public static final String DIR_KEY
- See Also:
- Constant Field Values
-
FILE_NAME_KEY
public static final String FILE_NAME_KEY
- See Also:
- Constant Field Values
-
DESCRIPTION_KEY
public static final String DESCRIPTION_KEY
- See Also:
- Constant Field Values
-
EMBED_CODE_KEY
public static final String EMBED_CODE_KEY
- See Also:
- Constant Field Values
-
REVERSE_LINK_KEY
protected static final String REVERSE_LINK_KEY
- See Also:
- Constant Field Values
-
ENCODING_KEY
protected static final String ENCODING_KEY
- See Also:
- Constant Field Values
-
DEFAULT_ENCODING
protected static final String DEFAULT_ENCODING
- See Also:
- Constant Field Values
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
properties
protected Properties properties
-
-
Method Detail
-
canUpload
protected boolean canUpload(ContentContext ctx)
-
contains
public boolean contains(ContentContext ctx, String inURI)
Description copied from interface:IStaticContainer
check if the class contains the static resources define by a URI- Specified by:
contains
in interfaceIStaticContainer
inURI
- a uri to a static resources- Returns:
- true if the class conatins this static resources.
-
createFileURL
public String createFileURL(ContentContext ctx, String url)
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractVisualComponent
-
expandZip
protected boolean expandZip()
-
getURL
public String getURL(ContentContext ctx)
Description copied from interface:ILink
generate a URL or URI link with all elements to click on.
-
isLinkValid
public boolean isLinkValid(ContentContext ctx)
Description copied from interface:ILink
return true if the link on the component is enabled- Specified by:
isLinkValid
in interfaceILink
- Returns:
-
prepareView
public void prepareView(ContentContext ctx) throws Exception
Description copied from class:AbstractVisualComponent
prepare the rendering of a component. default attributes put in request : style, value, type, compid- Specified by:
prepareView
in interfaceIContentVisualComponent
- Overrides:
prepareView
in classAbstractVisualComponent
- Throws:
Exception
-
getAllResources
public Collection<Resource> getAllResources(ContentContext ctx)
Description copied from interface:IStaticContainer
return all resources found in the component.- Specified by:
getAllResources
in interfaceIStaticContainer
- Returns:
-
getAllResourcesLinks
public Collection<Link> getAllResourcesLinks(ContentContext ctx)
Description copied from interface:IStaticContainer
create link to resources.- Specified by:
getAllResourcesLinks
in interfaceIStaticContainer
- Returns:
-
getCSSType
protected String getCSSType()
-
getDeleteTitle
protected String getDeleteTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getDescription
public String getDescription()
-
getEmbedCode
public String getEmbedCode()
-
setEmbedCode
public void setEmbedCode(String embedCode)
-
getDescriptionName
public String getDescriptionName()
-
getEmbedCodeName
public String getEmbedCodeName()
-
getDirInputName
protected String getDirInputName()
-
getDirLabelTitle
protected String getDirLabelTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getDirList
protected String[] getDirList(ContentContext ctx, String inFolder) throws Exception
- Throws:
Exception
-
getDirSelected
public String getDirSelected(ContentContext ctx)
Description copied from interface:IStaticContainer
get folder with ressources- Specified by:
getDirSelected
in interfaceIStaticContainer
- Returns:
-
getEditorComplexity
protected String getEditorComplexity(ContentContext ctx)
Description copied from class:AbstractVisualComponent
return the wysiwyg editor complexity- Overrides:
getEditorComplexity
in classAbstractVisualComponent
- Returns:
- null if no wysywig editor
-
getMetaCode
protected String getMetaCode(ContentContext ctx)
-
isDisplayMeta
protected boolean isDisplayMeta(ContentContext ctx)
-
getEditXHTMLCode
protected String getEditXHTMLCode(ContentContext ctx) throws Exception
- Overrides:
getEditXHTMLCode
in classAbstractVisualComponent
- Throws:
Exception
-
getEncoding
public String getEncoding()
-
getEncodingXHTMLInputName
protected String getEncodingXHTMLInputName()
-
getFileList
protected String[] getFileList(ContentContext ctx, String directory)
-
getFileFilter
protected FilenameFilter getFileFilter()
-
getDecorationFilter
protected FilenameFilter getDecorationFilter()
-
getFileList
protected String[] getFileList(ContentContext ctx, String directory, FilenameFilter filter)
-
getFileName
public String getFileName(ContentContext ctx)
-
getFileURL
protected String getFileURL(ContentContext ctx, String fileLink)
-
getFileXHTMLInputName
protected String getFileXHTMLInputName()
-
getDecoImageXHTMLInputName
protected String getDecoImageXHTMLInputName()
-
getDecoImageFileXHTMLInputName
protected String getDecoImageFileXHTMLInputName()
-
getImageChangeTitle
protected String getImageChangeTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getImageLabelTitle
protected String getImageLabelTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getImageUploadTitle
protected String getImageUploadTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getFileUploadActionTitle
protected String getFileUploadActionTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getImageDecorativeTitle
protected String getImageDecorativeTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getImageSelectTitle
protected String getImageSelectTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getJSOnChange
public String getJSOnChange(ContentContext ctx)
-
getLabel
public String getLabel()
-
getLabelXHTMLInputName
protected String getLabelXHTMLInputName()
-
getTextAutoInputName
protected String getTextAutoInputName()
-
getFirstTextInputName
protected String getFirstTextInputName()
-
getSecondTextInputName
protected String getSecondTextInputName()
-
getNewDirInputName
protected String getNewDirInputName()
-
getNewDirLabelTitle
protected String getNewDirLabelTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getImageImgName
public String getImageImgName()
-
getResourceURL
public String getResourceURL(ContentContext ctx)
-
getMainFolder
protected String getMainFolder(ContentContext ctx)
-
getResourceURL
public String getResourceURL(ContentContext ctx, String fileLink)
-
getMaxPreviewImages
protected int getMaxPreviewImages()
-
getPreviewZoneId
protected String getPreviewZoneId()
-
getPreviewCode
protected String getPreviewCode(ContentContext ctx) throws Exception
- Throws:
Exception
-
getFile
public File getFile(ContentContext ctx)
-
getPreviewCode
public String getPreviewCode(ContentContext ctx, int maxDisplayedImage) throws Exception
- Throws:
Exception
-
getPreviewCode
public String getPreviewCode(ContentContext ctx, int maxDisplayedImage, boolean imageList) throws Exception
- Throws:
Exception
-
getDisplayAllLabel
protected String getDisplayAllLabel(I18nAccess i18nAccess)
-
getRelativeFileDirectory
protected String getRelativeFileDirectory(ContentContext ctx)
-
getReverseLinkeLabelTitle
protected String getReverseLinkeLabelTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundException
IOException
-
getReverseLinkInputName
protected String getReverseLinkInputName()
-
getSelectXHTMLInputName
protected String getSelectXHTMLInputName()
-
getStaticInfo
public StaticInfo getStaticInfo(ContentContext ctx)
-
getWordCount
public int getWordCount(ContentContext ctx)
Description copied from interface:IContentVisualComponent
count the word in the content.- Specified by:
getWordCount
in interfaceIContentVisualComponent
- Overrides:
getWordCount
in classAbstractVisualComponent
- Returns:
-
init
public void init(ComponentBean bean, ContentContext ctx) throws Exception
- Overrides:
init
in classAbstractVisualComponent
- Throws:
Exception
-
isImported
protected boolean isImported(ContentContext ctx)
-
isContentCachable
public boolean isContentCachable(ContentContext ctx)
Description copied from interface:IContentVisualComponent
return the part of header needed for this component- Specified by:
isContentCachable
in interfaceIContentVisualComponent
- Overrides:
isContentCachable
in classAbstractVisualComponent
- Returns:
-
isFileNameValid
protected boolean isFileNameValid(ContentContext ctx, String fileName)
-
isInsertable
public boolean isInsertable()
Description copied from class:AbstractVisualComponent
you can insert a text in this component- Specified by:
isInsertable
in interfaceIContentVisualComponent
- Overrides:
isInsertable
in classAbstractVisualComponent
- Returns:
- true if a text is insertable
-
isLinkToStatic
protected boolean isLinkToStatic()
-
isOnlyFirstOccurrence
public boolean isOnlyFirstOccurrence()
-
isReverseLink
public boolean isReverseLink()
-
isWithDescription
public boolean isWithDescription()
-
needEncoding
protected boolean needEncoding()
-
isFromShared
protected boolean isFromShared(ContentContext ctx)
-
performEdit
public String performEdit(ContentContext ctx) throws Exception
Description copied from interface:IContentVisualComponent
action call when update the content page.- Specified by:
performEdit
in interfaceIContentVisualComponent
- Overrides:
performEdit
in classAbstractVisualComponent
- Returns:
- the error message, null if no error
- Throws:
Exception
-
setLabel
protected void setLabel(String label)
-
reloadProperties
protected void reloadProperties()
-
renameResource
public boolean renameResource(ContentContext ctx, File oldName, File newName)
Description copied from interface:IStaticContainer
rename a resource- Specified by:
renameResource
in interfaceIStaticContainer
- Returns:
- true if rename, false else
-
saveItem
protected File saveItem(ContentContext ctx, org.apache.commons.fileupload.FileItem item) throws Exception
- Throws:
Exception
-
setDirSelected
public void setDirSelected(String dir)
Description copied from interface:IStaticContainer
set folder with resources- Specified by:
setDirSelected
in interfaceIStaticContainer
-
setFileName
public void setFileName(String name)
-
setValue
public void setValue(String inContent)
Description copied from interface:IContentVisualComponent
set the content without rendering- Specified by:
setValue
in interfaceIContentVisualComponent
- Overrides:
setValue
in classAbstractVisualComponent
-
storeProperties
public void storeProperties()
-
uploadFiles
protected void uploadFiles(ContentContext ctx, RequestService service) throws Exception
- Throws:
Exception
-
performUpload
public String performUpload(ContentContext ctx) throws Exception
- Specified by:
performUpload
in interfaceIUploadResource
- Throws:
Exception
-
isMirroredByDefault
public boolean isMirroredByDefault(ContentContext ctx)
Description copied from interface:IContentVisualComponent
if this component is duplicated, by default it is mirrored.- Specified by:
isMirroredByDefault
in interfaceIContentVisualComponent
- Overrides:
isMirroredByDefault
in classAbstractVisualComponent
- Returns:
-
getContentAsText
public String getContentAsText(ContentContext ctx)
Description copied from interface:IContentVisualComponent
get the text of the component- Specified by:
getContentAsText
in interfaceIContentVisualComponent
- Overrides:
getContentAsText
in classAbstractVisualComponent
- Returns:
-
performLoadImages
public static String performLoadImages(RequestService rs, ContentContext ctx, MessageRepository messageRepository, I18nAccess i18nAccess) throws Exception
- Throws:
Exception
-
getType
public String getType()
Description copied from interface:IContentVisualComponent
return the type of the element.- Specified by:
getType
in interfaceIContentVisualComponent
- Returns:
- the type of the element.
-
getActionGroupName
public String getActionGroupName()
Description copied from interface:IAction
the group name of the action- Specified by:
getActionGroupName
in interfaceIAction
- Returns:
- a group name.
-
isUploadOnDrop
public boolean isUploadOnDrop()
- Specified by:
isUploadOnDrop
in interfaceIUploadResource
-
getPopularity
public int getPopularity(ContentContext ctx)
Description copied from interface:IStaticContainer
return indice of popularity- Specified by:
getPopularity
in interfaceIStaticContainer
- Returns:
-
getFiles
public List<File> getFiles(ContentContext ctx)
- Specified by:
getFiles
in interfaceIStaticContainer
-
setLatestValidDate
public void setLatestValidDate(Date date)
- Specified by:
setLatestValidDate
in interfaceILink
-
getLatestValidDate
public Date getLatestValidDate()
- Specified by:
getLatestValidDate
in interfaceILink
-
isDisplayable
public boolean isDisplayable(ContentContext ctx) throws Exception
Description copied from interface:IContentVisualComponent
true if the component can be displayed in preview mode- Specified by:
isDisplayable
in interfaceIContentVisualComponent
- Overrides:
isDisplayable
in classAbstractVisualComponent
- Returns:
- Throws:
Exception
-
getFontAwesome
public String getFontAwesome()
- Specified by:
getFontAwesome
in interfaceIContentVisualComponent
- Overrides:
getFontAwesome
in classAbstractVisualComponent
-
transflateFrom
public boolean transflateFrom(ContentContext ctx, ITranslator translator, String lang)
Description copied from interface:IContentVisualComponent
translate the content of the component to the current language- Specified by:
transflateFrom
in interfaceIContentVisualComponent
- Overrides:
transflateFrom
in classAbstractVisualComponent
- Parameters:
ctx
- contextContext of the current renderingtranslator
- class to translatelang
- the language of the current content (source language)- Returns:
-
getColumnableDefaultValue
protected boolean getColumnableDefaultValue()
- Overrides:
getColumnableDefaultValue
in classAbstractVisualComponent
-
-