Class Util
java.lang.Object
com.logicaldoc.gui.common.client.util.Util
General utilities container for the GUI
- Since:
- 8.8.3
- Author:
- Marco Meschieri - LogicalDOC
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringGenerates HTML code for reproducing audio filesstatic Stringstatic Stringstatic StringavatarUrl(long userId) static Stringstatic StringavatarWithText(Long userId, String text) static StringavatarWithText(String userIdOrName, String text) static StringconvertToMap(List<GUIParameter> parameters) static voidCopies a text into the client's clipboardstatic Stringstatic StringDetect KEY specification from the requeststatic StringDetect locale specification from the requeststatic StringDetect tenant specification from the requeststatic StringdisplayURL(Long docId, Long folderId) static voidstatic StringdownloadAttachmentURL(long docId, String fileVersion, String attachmentFileName) static StringdownloadPdfURL(long docId, String fileVersion) static voiddownloadTicket(String ticketId) static StringdownloadTicketURL(String ticketId) 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 StringencodeUTF8(String rawString) static StringescapeHTML(String originalText) Converts some HTML specific chars into it's entitystatic StringfileIconUrl(String iconName) static StringfileNameIcon(String iconName, int size) static StringformatDateShortISO(Date date) static StringformatDouble(Double number) static Stringstatic 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 StringGet browser languagestatic StringgetExtension(String fileName) static StringgetJavascriptVariable(String jsVar) static Stringstatic StringgetLoginUrl(String tenant) static StringgetParameter(String name) static GUIParametergetParameter(List<GUIParameter> params, String name) static StringgetParameterValue(List<GUIParameter> params, String name) static StringgetParameterValue(List<GUIParameter> params, String name, String defaultValue) static BooleangetParameterValueAsBoolean(List<GUIParameter> params, String name) static intgetParameterValueAsInt(List<GUIParameter> params, String name, int defaultValue) static StringgetTagsHTML(List<String> tags) Formats a set of tags into an HTML gridstatic Stringstatic StringDetects the user agent(browser's family)static StringgetValue(String name, List<GUIParameter> parameters) static StringiconWithFilename(String iconName, String fileName) static StringimageBase64Src(String imageBase64) Manipulates the given Base64 image specification into a Src to be uses in a <img> tagstatic StringGenerates HTML image code.static Stringstatic StringGenerates HTML image code with style.static Stringstatic Stringstatic voidDeclares the javascript function used to ask confirmation on window closestatic 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 booleanstatic booleanstatic booleanisDICOMFile(String fileName) static booleanisEmailFile(String fileName) static booleanisImageFile(String fileName) static booleanisMediaFile(String fileName) static booleanisOfficeFile(String fileName) static booleanisOfficeFileType(String type) static booleanisPresentationFile(String fileName) static booleanisSpreadsheetFile(String fileName) static booleanisTextFile(String fileName) static booleanisValidEmail(String email) static booleanisWebContentFile(String fileName) static Stringstatic voidopenBulkCheckout(List<Long> unlockedIds) static voidopenEditWithOffice(long docId) static voidopenScan()static Stringstatic Stringstatic Stringstatic voidstatic voidredirectToLoginUrl(String tenant) Redirects to the configured login page (the url specified in the j_loginurl javascript variablestatic voidstatic 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 voidremoveChildren(com.smartgwt.client.widgets.layout.Layout container) static voidsetupDensity(GUIInfo info) static Stringstatic StringtextWithAvatar(Long userId, String text) 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 Stringstatic long[]toPrimitives(Long[] objects) static Stringstatic voidRemoves the javascript function used to ask confirmation on window closestatic StringuserAvatarUrl(String userIdOrName, boolean avoidCaching) static StringGenerates HTML code for reproducing video filesstatic voidwaitForUpAndRunning(String tenant, String locale) static StringwebEditorUrl(int height) static StringwebEditorUrl(long docId, String fileName, int height) static Stringstatic StringwebstartURL(String appName, Map<String, String> params) static voidwriteToClipboard(String text) Writes a text into the client's clipboard
-
Method Details
-
imageHTML
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
-
downloadAttachmentURL
-
downloadURL
-
downloadURL
-
downloadURL
-
downloadPdfURL
-
downloadURL
-
download
-
downloadTicketURL
-
downloadTicket
-
qrURL
-
qrImg
-
displayURL
-
webEditorUrl
-
webEditorUrl
-
webstartURL
-
videoHTML
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
Generates HTML code for reproducing audio files- Parameters:
mediaUrl- URL of the media file to reproduce- Returns:
- the HTML content
-
thumbnailUrl
-
thumbnailImgageHTML
-
tileUrl
-
tileImageHTML
-
imageUrl
-
fileIconUrl
-
fileNameIcon
-
iconWithFilename
-
avatarWithText
-
avatarWithText
-
textWithAvatar
-
avatarImg
-
avatarImg
-
avatarUrl
-
avatarUrl
-
userAvatarUrl
-
licenseUrl
-
websocketUrl
-
strip
-
toString
-
contextPath
-
currentSkin
-
imagePrefix
-
imageHTML
Generates HTML image code.- Parameters:
imageName- the image name- Returns:
- the resultant HTML
-
isCommunity
public static boolean isCommunity() -
isCommercial
public static boolean isCommercial() -
isOfficeFileType
-
isOfficeFile
-
isSpreadsheetFile
-
isPresentationFile
-
isDICOMFile
-
isTextFile
-
isImageFile
-
isWebContentFile
-
isMediaFile
-
isAudioFile
-
isEmailFile
-
copyText
Copies a text into the client's clipboard- Parameters:
text- the content to put into the clipboards
-
writeToClipboard
Writes a text into the client's clipboard- Parameters:
text- the content to put into the clipboards
-
formatSize
Format file size in Bytes, KBytes, MBytes or GBytes.- Parameters:
size- The file size in bytes S- Returns:
- The formated file size
-
formatSizeCompact
Format file size in Bytes, KB, MB, GB.- Parameters:
size- The file size in bytes.- Returns:
- The formated file size.
-
formatLong
-
formatInt
-
formatDouble
-
formatSizeKB
-
formatSizeKB
Format file size in KB.- Parameters:
size- The file size in bytes.- Returns:
- The formated file size.
-
formatSizeW7
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
Format file size in Windows 7 Style.- Parameters:
size- The file size in bytes.- Returns:
- The formated file size.
-
formatSizeBytes
Format file size in bytes- Parameters:
size- The file size in bytes- Returns:
- the formatted size
-
formatPercentage
Format number percentage.- Parameters:
value- The value to be formatted.fixed- The number of decimal places.- Returns:
- The formated value.
-
getBrowserLanguage
Get browser language- Returns:
- The language in ISO 639 format.
-
getUserAgent
Detects the user agent(browser's family)- Returns:
- 'opera', 'safari', 'ie6', 'ie7', 'gecko', or 'unknown'
-
isValidEmail
-
redirect
-
padLeft
-
uninstallCloseWindowAlert
public static void uninstallCloseWindowAlert()Removes the javascript function used to ask confirmation on window close -
installCloseWindowAlert
public static void installCloseWindowAlert()Declares the javascript function used to ask confirmation on window close -
openEditWithOffice
public static void openEditWithOffice(long docId) -
openScan
public static void openScan() -
openBulkCheckout
-
isAllowedForUpload
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
Detect tenant specification from the request- Returns:
- the current tenant's name
-
getTenantInRequest
-
getLocaleInRequest
-
detectLocale
Detect locale specification from the request- Returns:
- the locale specification
-
detectKey
Detect KEY specification from the request- Returns:
- the secret KEY
-
getParameter
-
getParameters
-
redirectToRoot
public static void redirectToRoot() -
redirectToRoot
-
redirectToSuccessUrl
Redirects to the configured page after a successful login (the url specified in the j_successurl javascript variable- Parameters:
locale- language specification
-
redirectToLoginUrl
Redirects to the configured login page (the url specified in the j_loginurl javascript variable- Parameters:
tenant- name of the tenant
-
getLoginUrl
-
getValue
-
toPrimitives
-
getBaseName
-
getExtension
-
setupDensity
-
convertToMap
-
waitForUpAndRunning
-
escapeHTML
Converts some HTML specific chars into it's entity- Parameters:
originalText- the original string to filter- Returns:
- the escaped string
-
imageBase64Src
Manipulates the given Base64 image specification into a Src to be uses in a <img> tag- Parameters:
imageBase64- the Base64 representation of an image- Returns:
- The Src
-
getTagsHTML
Formats a set of tags into an HTML grid- Parameters:
tags- the tags to format- Returns:
- the HTML content
-
formatDateShortISO
-
encodeUTF8
-
getParameter
-
getParameterValue
-
getParameterValue
-
getParameterValueAsBoolean
-
getParameterValueAsInt
-
removeChildren
public static void removeChildren(com.smartgwt.client.widgets.layout.Layout container) -
getJavascriptVariable
-