Class Util
- java.lang.Object
-
- com.logicaldoc.gui.common.client.util.Util
-
public class Util extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String[]AUDIO_EXTSstatic String[]DICOM_EXTSstatic String[]EMAIL_EXTSstatic String[]IMAGE_EXTSstatic String[]OFFICE_EXTSstatic String[]VIDEO_EXTSstatic String[]WEBCONTENT_EXTS
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringaudioHTML(String mediaUrl)Generates HTML code for reproducing audio filesstatic StringcontextPath()static Map<String,String>convertToMap(GUIParameter[] parameters)static voidcopyToClipboard(String text)static StringdetectKey()Detect KEY specification from the requeststatic StringdetectLocale()Detect locale specification from the requeststatic StringdetectTenant()Detect tenant specification from the requeststatic StringdisplayURL(Long docId, Long folderId)static StringdownloadAttachmentURL(long docId, String fileVersion, String attachmentFileName)static StringdownloadURL(long docId)static StringdownloadURL(long docId, String fileVersion)static StringdownloadURL(long docId, String fileVersion, boolean open)static StringdownloadURL(long docId, String fileVersion, String suffix, boolean open)static voidexportCSV(com.smartgwt.client.widgets.grid.ListGrid listGrid, boolean allFields)Exports into the CSV format the content of a ListGrid.static StringformatLong(long number)static StringformatPercentage(double value, int fixed)Format number percentage.static StringformatSize(double size)Format file size in Bytes, KBytes, MBytes or GBytes.static StringformatSizeBytes(double size)Format file size in bytesstatic StringformatSizeCompact(double size)Format file size in Bytes, KB, MB, GB.static StringformatSizeKB(double size)Format file size in KB.static StringformatSizeKB(Object value)static StringformatSizeW7(double size)Format file size in Windows 7 Style.static StringformatSizeW7(Object value)Format file size in Windows 7 Style.static StringgetBaseName(String fileName)static StringgetBrowserLanguage()Get browser languagestatic StringgetExtension(String fileName)static StringgetJavascriptVariable(String jsVar)static StringgetLocaleInRequest()static StringgetLoginUrl(String tenant)static StringgetUserAgent()Detects the user agent(browser's family)static StringgetValue(String name, GUIParameter[] parameters)static StringimageHTML(String imageName)Generates HTML image code.static StringimageHTML(String imageName, Integer width, Integer height, String style)static StringimageHTML(String imageName, String alt, String style)Generates HTML image code with style.static StringimagePrefix()static StringimageUrl(String imageName)static booleanisAllowedForUpload(String filename)Checks if the passed filename can be uploaded or not on the basis of what configured in 'upload.disallow'static booleanisAudioFile(String fileName)static booleanisCommunity()static booleanisDICOMFile(String fileName)static booleanisEmailFile(String fileName)static booleanisImageFile(String fileName)static booleanisMediaFile(String fileName)static booleanisOfficeFile(String fileName)static booleanisOfficeFileType(String type)static booleanisTextFile(String fileName)static booleanisValidEmail(String email)static booleanisWebContentFile(String fileName)static StringlicenseUrl()static voidopenBulkCheckout(List<Long> unlockedIds)static voidopenScan()static StringpadLeft(String s, int n)static voidredirect(String url)static voidredirectToLoginUrl(String tenant)Redirects to the configured login page (the url specified in the j_loginurl javascript variablestatic voidredirectToRoot()static voidredirectToRoot(String moduleName)static voidredirectToSuccessUrl(String locale)Redirects to the configured page after a successful login (the url specified in the j_successurl javascript variablestatic voidsetupDensity(GUIInfo info)static Stringstrip(String src)static StringthumbnailImgageHTML(long docId, String fileVersion, Integer width, Integer height)static StringthumbnailUrl(long docId, String fileVersion)static StringtileImageHTML(long docId, String fileVersion, Integer width, Integer height)static StringtileUrl(long docId, String fileVersion)static long[]toPrimitives(Long[] objects)static StringvideoHTML(String mediaUrl, String width, String height)Generates HTML code for reproducing video filesstatic voidwaitForUpAndRunning(String tenant, String locale)static StringwebEditorUrl(int height)static StringwebEditorUrl(long docId, String fileName, int height)static StringwebsocketUrl()static StringwebstartURL(String appName, Map<String,String> params)
-
-
-
Field Detail
-
OFFICE_EXTS
public static String[] OFFICE_EXTS
-
IMAGE_EXTS
public static String[] IMAGE_EXTS
-
VIDEO_EXTS
public static String[] VIDEO_EXTS
-
AUDIO_EXTS
public static String[] AUDIO_EXTS
-
WEBCONTENT_EXTS
public static String[] WEBCONTENT_EXTS
-
EMAIL_EXTS
public static String[] EMAIL_EXTS
-
DICOM_EXTS
public static String[] DICOM_EXTS
-
-
Method Detail
-
imageHTML
public static String imageHTML(String imageName, String alt, String style)
Generates HTML image code with style.- Parameters:
imageName- the name of the icon imagealt- the image altstyle- CSS style specification- Returns:
- the resultant HTML
-
imageHTML
public static String imageHTML(String imageName, Integer width, Integer height, String style)
-
downloadAttachmentURL
public static String downloadAttachmentURL(long docId, String fileVersion, String attachmentFileName)
-
downloadURL
public static String downloadURL(long docId, String fileVersion, String suffix, boolean open)
-
downloadURL
public static String downloadURL(long docId)
-
webEditorUrl
public static String webEditorUrl(int height)
-
videoHTML
public static String videoHTML(String mediaUrl, String width, String height)
Generates HTML code for reproducing video files- Parameters:
mediaUrl- URL of the media file to reproducewidth- width specificationheight- height specification- Returns:
- the HTML content
-
audioHTML
public static String audioHTML(String mediaUrl)
Generates HTML code for reproducing audio files- Parameters:
mediaUrl- URL of the media file to reproduce- Returns:
- the HTML content
-
thumbnailImgageHTML
public static String thumbnailImgageHTML(long docId, String fileVersion, Integer width, Integer height)
-
tileImageHTML
public static String tileImageHTML(long docId, String fileVersion, Integer width, Integer height)
-
licenseUrl
public static String licenseUrl()
-
websocketUrl
public static String websocketUrl()
-
contextPath
public static String contextPath()
-
imagePrefix
public static String imagePrefix()
-
imageHTML
public static String imageHTML(String imageName)
Generates HTML image code.- Parameters:
imageName- the image name- Returns:
- the resultant HTML
-
isCommunity
public static boolean isCommunity()
-
isOfficeFile
public static boolean isOfficeFile(String fileName)
-
isDICOMFile
public static boolean isDICOMFile(String fileName)
-
isTextFile
public static boolean isTextFile(String fileName)
-
isImageFile
public static boolean isImageFile(String fileName)
-
isWebContentFile
public static boolean isWebContentFile(String fileName)
-
isMediaFile
public static boolean isMediaFile(String fileName)
-
isAudioFile
public static boolean isAudioFile(String fileName)
-
isOfficeFileType
public static boolean isOfficeFileType(String type)
-
isEmailFile
public static boolean isEmailFile(String fileName)
-
formatSize
public static String formatSize(double size)
Format file size in Bytes, KBytes, MBytes or GBytes.- Parameters:
size- The file size in bytes.- Returns:
- The formated file size.
-
formatSizeCompact
public static String formatSizeCompact(double size)
Format file size in Bytes, KB, MB, GB.- Parameters:
size- The file size in bytes.- Returns:
- The formated file size.
-
formatLong
public static String formatLong(long number)
-
formatSizeKB
public static String formatSizeKB(double size)
Format file size in KB.- Parameters:
size- The file size in bytes.- Returns:
- The formated file size.
-
formatSizeW7
public static String formatSizeW7(Object value)
Format file size in Windows 7 Style.- Parameters:
value- The file size in bytes(can be Float, Long, Integer or String)- Returns:
- The formated file size
-
formatSizeW7
public static String formatSizeW7(double size)
Format file size in Windows 7 Style.- Parameters:
size- The file size in bytes.- Returns:
- The formated file size.
-
formatSizeBytes
public static String formatSizeBytes(double size)
Format file size in bytes- Parameters:
size- The file size in bytes- Returns:
- the formatted size
-
formatPercentage
public static String formatPercentage(double value, int fixed)
Format number percentage.- Parameters:
value- The value to be formatted.fixed- The number of decimal places.- Returns:
- The formated value.
-
getBrowserLanguage
public static String getBrowserLanguage()
Get browser language- Returns:
- The language in ISO 639 format.
-
getUserAgent
public static String getUserAgent()
Detects the user agent(browser's family)- Returns:
- 'opera', 'safari', 'ie6', 'ie7', 'gecko', or 'unknown'
-
copyToClipboard
public static void copyToClipboard(String text)
-
isValidEmail
public static boolean isValidEmail(String email)
-
redirect
public static void redirect(String url)
-
openScan
public static void openScan()
-
exportCSV
public static void exportCSV(com.smartgwt.client.widgets.grid.ListGrid listGrid, boolean allFields)Exports into the CSV format the content of a ListGrid.- Parameters:
listGrid- Grid containing the dataallFields- True if all the fields(even if hidden) have to be extracted
-
isAllowedForUpload
public static boolean isAllowedForUpload(String filename)
Checks if the passed filename can be uploaded or not on the basis of what configured in 'upload.disallow'- Parameters:
filename- the file name- Returns:
- if the extension is allowed
-
detectTenant
public static String detectTenant()
Detect tenant specification from the request- Returns:
- the current tenant's name
-
getLocaleInRequest
public static String getLocaleInRequest()
-
detectLocale
public static String detectLocale()
Detect locale specification from the request- Returns:
- the locale specification
-
detectKey
public static String detectKey()
Detect KEY specification from the request- Returns:
- the secret KEY
-
redirectToRoot
public static void redirectToRoot()
-
redirectToRoot
public static void redirectToRoot(String moduleName)
-
redirectToSuccessUrl
public static void redirectToSuccessUrl(String locale)
Redirects to the configured page after a successful login (the url specified in the j_successurl javascript variable- Parameters:
locale- language specification
-
redirectToLoginUrl
public static void redirectToLoginUrl(String tenant)
Redirects to the configured login page (the url specified in the j_loginurl javascript variable- Parameters:
tenant- name of the tenant
-
getValue
public static String getValue(String name, GUIParameter[] parameters)
-
toPrimitives
public static long[] toPrimitives(Long[] objects)
-
setupDensity
public static void setupDensity(GUIInfo info)
-
convertToMap
public static Map<String,String> convertToMap(GUIParameter[] parameters)
-
-