Package de.xima.fc.gui.model.form_theme
Class FormThemeElFinderConfigurator
- java.lang.Object
-
- de.xima.fc.gui.model.form_theme.FormThemeElFinderConfigurator
-
public final class FormThemeElFinderConfigurator extends Object
Helper for editing the data of aClientFormTheme
in the elFinder file explorer. Provides some configuration data, as well as methods for creating the various components needed for the file explorer.- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
-
-
Field Summary
Fields Modifier and Type Field Description static String
METHOD_EXPRESSION_EL_FINDER_CONNECTOR
The EL method expression for the ElFinder connector.static String
METHOD_EXPRESSION_EL_FINDER_THUMBNAIL
The EL method expression for the thumbnail URL.
-
Constructor Summary
Constructors Constructor Description FormThemeElFinderConfigurator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
createAdditionalElFinderMessages(Locale locale)
Creates additional localized messages for the elFinder file explorer.static FileSystemElFinderConnector<?>
createConnector(String explorerSessionId, FormThemeFileSystemManager fileSystemManager, IResourceStoreManager storeManager)
Creates the elFinder connector that handles requests from the elFinder file explorer.static String
createElFinderConnectorUrl(javax.faces.context.FacesContext facesContext, String explorerSessionId, String connectorMethodExpression)
Creates the URL for the elfinder connector for viewing and editing the files of the client form theme associated with the given explorer session ID.static Set<String>
getAllowedFileExtensions()
Gets a list of file extensions that are allowed for files in the elFinder file explorer.static String
getRequestParamExplorerSessionId()
Gets the name of the request parameter that is used to pass the explorer session ID to the elFinder connector method.static IDynamicResourceThumbnailRequestHandler<FormThemeFileEntry>
newThumbnailRequestHandler(String tempFolder)
Creates the handler for thumbnail requests, for a specific file from a client form theme.
-
-
-
Field Detail
-
METHOD_EXPRESSION_EL_FINDER_CONNECTOR
public static final String METHOD_EXPRESSION_EL_FINDER_CONNECTOR
The EL method expression for the ElFinder connector. When elFinder needs to make a request to the server, this method is invoked via PrimeFaces' dynamic resource mechanism.- See Also:
- Constant Field Values
-
METHOD_EXPRESSION_EL_FINDER_THUMBNAIL
public static final String METHOD_EXPRESSION_EL_FINDER_THUMBNAIL
The EL method expression for the thumbnail URL. When the URL is requested, this method is invoked to server the thumbnail image.- See Also:
- Constant Field Values
-
-
Method Detail
-
createAdditionalElFinderMessages
public static String createAdditionalElFinderMessages(Locale locale)
Creates additional localized messages for the elFinder file explorer. This is a stringified JSON object with string keys and values. The keys are the messages keys, the values the localized messages. These messages are for example used when our custom elFinder connector raises certain custom errors.- Parameters:
locale
- The locale for which to create the messages.- Returns:
- The additional messages for the elFinder file explorer.
-
createConnector
public static FileSystemElFinderConnector<?> createConnector(String explorerSessionId, FormThemeFileSystemManager fileSystemManager, IResourceStoreManager storeManager)
Creates the elFinder connector that handles requests from the elFinder file explorer. The connector is used to access and edit the files of a client form theme.- Parameters:
explorerSessionId
- The session ID for the explorer session, usually bound to the lifecycle of a view scoped bean.fileSystemManager
- The file system manager with the client form themes and their files.storeManager
- The resource store manager for associating additional data with e.g. files.- Returns:
- A new elFinder connector for the client form themes of a client.
-
createElFinderConnectorUrl
public static String createElFinderConnectorUrl(javax.faces.context.FacesContext facesContext, String explorerSessionId, String connectorMethodExpression)
Creates the URL for the elfinder connector for viewing and editing the files of the client form theme associated with the given explorer session ID.- Parameters:
facesContext
- The current Faces context.explorerSessionId
- The session ID for the explorer session, usually bound to the lifecycle of a view scoped bean.connectorMethodExpression
- The method expression for the bean connector method to invoke when a request is made to the elFinder connector URL.- Returns:
- The URL for the elfinder connector.
-
getAllowedFileExtensions
public static Set<String> getAllowedFileExtensions()
Gets a list of file extensions that are allowed for files in the elFinder file explorer. Each file extensions is without the leading dot, e.g. "jpg", "png", or "gif".- Returns:
- The allowed file extensions.
-
getRequestParamExplorerSessionId
public static String getRequestParamExplorerSessionId()
Gets the name of the request parameter that is used to pass the explorer session ID to the elFinder connector method. This parameter is added to the elFinder connector URL. This way, the request scoped bean can locate the explorer session in the current HTTP session.- Returns:
- The request parameter name.
-
newThumbnailRequestHandler
public static IDynamicResourceThumbnailRequestHandler<FormThemeFileEntry> newThumbnailRequestHandler(String tempFolder)
Creates the handler for thumbnail requests, for a specific file from a client form theme. Images are created as PNGs to avoid loss of quality. Since thumbnails are only used as icons in the file explorer, and those icons are usually not too large, a fixed size of 100x100 pixels is sufficient.- Parameters:
tempFolder
- Temp folder for storing temporary files such as thumbnails.- Returns:
- The thumbnail request handler.
-
-