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 Stringurl : url to resource.Stringdescription : description of the resource.Stringlabel : label defined by contributor.booleanblank : true if link must be open as popup.StaticInforesource : static info of resource.
- Author:
- pvandermaesen
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringDEFAULT_ENCODINGstatic StringDESCRIPTION_KEYstatic StringDIR_KEYstatic StringEMBED_CODE_KEYprotected static StringENCODING_KEYstatic StringFILE_NAME_KEYstatic StringLABEL_KEYprotected Propertiespropertiesprotected static StringREVERSE_LINK_KEYstatic StringTYPE-
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:IStaticContainercheck if the class contains the static resources define by a URI- Specified by:
containsin interfaceIStaticContainerinURI- 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:
equalsin classAbstractVisualComponent
-
expandZip
protected boolean expandZip()
-
getURL
public String getURL(ContentContext ctx)
Description copied from interface:ILinkgenerate a URL or URI link with all elements to click on.
-
isLinkValid
public boolean isLinkValid(ContentContext ctx)
Description copied from interface:ILinkreturn true if the link on the component is enabled- Specified by:
isLinkValidin interfaceILink- Returns:
-
prepareView
public void prepareView(ContentContext ctx) throws Exception
Description copied from class:AbstractVisualComponentprepare the rendering of a component. default attributes put in request : style, value, type, compid- Specified by:
prepareViewin interfaceIContentVisualComponent- Overrides:
prepareViewin classAbstractVisualComponent- Throws:
Exception
-
getAllResources
public Collection<Resource> getAllResources(ContentContext ctx)
Description copied from interface:IStaticContainerreturn all resources found in the component.- Specified by:
getAllResourcesin interfaceIStaticContainer- Returns:
-
getAllResourcesLinks
public Collection<Link> getAllResourcesLinks(ContentContext ctx)
Description copied from interface:IStaticContainercreate link to resources.- Specified by:
getAllResourcesLinksin interfaceIStaticContainer- Returns:
-
getCSSType
protected String getCSSType()
-
getDeleteTitle
protected String getDeleteTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundExceptionIOException
-
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:
FileNotFoundExceptionIOException
-
getDirList
protected String[] getDirList(ContentContext ctx, String inFolder) throws Exception
- Throws:
Exception
-
getDirSelected
public String getDirSelected(ContentContext ctx)
Description copied from interface:IStaticContainerget folder with ressources- Specified by:
getDirSelectedin interfaceIStaticContainer- Returns:
-
getEditorComplexity
protected String getEditorComplexity(ContentContext ctx)
Description copied from class:AbstractVisualComponentreturn the wysiwyg editor complexity- Overrides:
getEditorComplexityin 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:
getEditXHTMLCodein 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:
FileNotFoundExceptionIOException
-
getImageLabelTitle
protected String getImageLabelTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundExceptionIOException
-
getImageUploadTitle
protected String getImageUploadTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundExceptionIOException
-
getFileUploadActionTitle
protected String getFileUploadActionTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundExceptionIOException
-
getImageDecorativeTitle
protected String getImageDecorativeTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundExceptionIOException
-
getImageSelectTitle
protected String getImageSelectTitle(ContentContext ctx) throws FileNotFoundException, IOException
- Throws:
FileNotFoundExceptionIOException
-
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:
FileNotFoundExceptionIOException
-
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:
FileNotFoundExceptionIOException
-
getReverseLinkInputName
protected String getReverseLinkInputName()
-
getSelectXHTMLInputName
protected String getSelectXHTMLInputName()
-
getStaticInfo
public StaticInfo getStaticInfo(ContentContext ctx)
-
getWordCount
public int getWordCount(ContentContext ctx)
Description copied from interface:IContentVisualComponentcount the word in the content.- Specified by:
getWordCountin interfaceIContentVisualComponent- Overrides:
getWordCountin classAbstractVisualComponent- Returns:
-
init
public void init(ComponentBean bean, ContentContext ctx) throws Exception
- Overrides:
initin classAbstractVisualComponent- Throws:
Exception
-
isImported
protected boolean isImported(ContentContext ctx)
-
isContentCachable
public boolean isContentCachable(ContentContext ctx)
Description copied from interface:IContentVisualComponentreturn the part of header needed for this component- Specified by:
isContentCachablein interfaceIContentVisualComponent- Overrides:
isContentCachablein classAbstractVisualComponent- Returns:
-
isFileNameValid
protected boolean isFileNameValid(ContentContext ctx, String fileName)
-
isInsertable
public boolean isInsertable()
Description copied from class:AbstractVisualComponentyou can insert a text in this component- Specified by:
isInsertablein interfaceIContentVisualComponent- Overrides:
isInsertablein 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:IContentVisualComponentaction call when update the content page.- Specified by:
performEditin interfaceIContentVisualComponent- Overrides:
performEditin 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:IStaticContainerrename a resource- Specified by:
renameResourcein 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:IStaticContainerset folder with resources- Specified by:
setDirSelectedin interfaceIStaticContainer
-
setFileName
public void setFileName(String name)
-
setValue
public void setValue(String inContent)
Description copied from interface:IContentVisualComponentset the content without rendering- Specified by:
setValuein interfaceIContentVisualComponent- Overrides:
setValuein 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:
performUploadin interfaceIUploadResource- Throws:
Exception
-
isMirroredByDefault
public boolean isMirroredByDefault(ContentContext ctx)
Description copied from interface:IContentVisualComponentif this component is duplicated, by default it is mirrored.- Specified by:
isMirroredByDefaultin interfaceIContentVisualComponent- Overrides:
isMirroredByDefaultin classAbstractVisualComponent- Returns:
-
getContentAsText
public String getContentAsText(ContentContext ctx)
Description copied from interface:IContentVisualComponentget the text of the component- Specified by:
getContentAsTextin interfaceIContentVisualComponent- Overrides:
getContentAsTextin 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:IContentVisualComponentreturn the type of the element.- Specified by:
getTypein interfaceIContentVisualComponent- Returns:
- the type of the element.
-
getActionGroupName
public String getActionGroupName()
Description copied from interface:IActionthe group name of the action- Specified by:
getActionGroupNamein interfaceIAction- Returns:
- a group name.
-
isUploadOnDrop
public boolean isUploadOnDrop()
- Specified by:
isUploadOnDropin interfaceIUploadResource
-
getPopularity
public int getPopularity(ContentContext ctx)
Description copied from interface:IStaticContainerreturn indice of popularity- Specified by:
getPopularityin interfaceIStaticContainer- Returns:
-
getFiles
public List<File> getFiles(ContentContext ctx)
- Specified by:
getFilesin interfaceIStaticContainer
-
setLatestValidDate
public void setLatestValidDate(Date date)
- Specified by:
setLatestValidDatein interfaceILink
-
getLatestValidDate
public Date getLatestValidDate()
- Specified by:
getLatestValidDatein interfaceILink
-
isDisplayable
public boolean isDisplayable(ContentContext ctx) throws Exception
Description copied from interface:IContentVisualComponenttrue if the component can be displayed in preview mode- Specified by:
isDisplayablein interfaceIContentVisualComponent- Overrides:
isDisplayablein classAbstractVisualComponent- Returns:
- Throws:
Exception
-
getFontAwesome
public String getFontAwesome()
- Specified by:
getFontAwesomein interfaceIContentVisualComponent- Overrides:
getFontAwesomein classAbstractVisualComponent
-
transflateFrom
public boolean transflateFrom(ContentContext ctx, ITranslator translator, String lang)
Description copied from interface:IContentVisualComponenttranslate the content of the component to the current language- Specified by:
transflateFromin interfaceIContentVisualComponent- Overrides:
transflateFromin 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:
getColumnableDefaultValuein classAbstractVisualComponent
-
-