cmsworkplacemanager.java
来自「找了很久才找到到源代码」· Java 代码 · 共 1,709 行 · 第 1/5 页
JAVA
1,709 行
* @return the instanciated editor handler class
*/
public I_CmsEditorHandler getEditorHandler() {
return m_editorHandler;
}
/**
* Returns the configured workplace encoding.<p>
*
* @return the configured workplace encoding
*/
public String getEncoding() {
return m_encoding;
}
/**
* Returns the explorer type settings for the specified resource type.<p>
*
* @param type the resource type for which the settings are required
* @return the explorer type settings for the specified resource type
*/
public CmsExplorerTypeSettings getExplorerTypeSetting(String type) {
return (CmsExplorerTypeSettings)m_explorerTypeSettingsMap.get(type);
}
/**
* Returns the list of explorer type settings.<p>
*
* These settings provide information for the new resource dialog and the context menu appearance.<p>
*
* @return the list of explorer type settings
*/
public List getExplorerTypeSettings() {
if (m_explorerTypeSettings == null) {
// initialize all explorer type settings if not already done
initExplorerTypeSettings();
}
return m_explorerTypeSettings;
}
/**
* Returns the set of configured export points for the workplace.<p>
*
* @return the set of configured export points for the workplace
*/
public Set getExportPoints() {
return m_exportPoints;
}
/**
* Returns the value (in bytes) for the maximum file upload size of the current user.<p>
*
* @param cms the initialized CmsObject
* @return the value (in bytes) for the maximum file upload size
*/
public long getFileBytesMaxUploadSize(CmsObject cms) {
int maxFileSize = getFileMaxUploadSize();
long maxFileSizeBytes = maxFileSize * 1024;
// check if current user belongs to Admin group, if so no file upload limit
if ((maxFileSize <= 0) || OpenCms.getRoleManager().hasRole(cms, CmsRole.VFS_MANAGER)) {
maxFileSizeBytes = -1;
}
return maxFileSizeBytes;
}
/**
* Returns the value (in kb) for the maximum file upload size.<p>
*
* @return the value (in kb) for the maximum file upload size
*/
public int getFileMaxUploadSize() {
return m_fileMaxUploadSize;
}
/**
* Returns the system-wide file view settings for the workplace.<p>
*
* Note that this instance may not modified (invocation of setters) directly or a
* <code>{@link org.opencms.main.CmsRuntimeException}</code> will be thrown.
* It has to be cloned first and then may be written back to the workplace settings using
* method {@link #setFileViewSettings(CmsObject, org.opencms.util.CmsRfsFileViewer)}.
*
* @return the system-wide file view settings for the workplace
*/
public CmsRfsFileViewer getFileViewSettings() {
return m_fileViewSettings;
}
/**
* Returns a collection of all available galleries.<p>
*
* The Map has the gallery type name as key and an instance of the gallery class (not completely initialized) as value.<p>
*
* @return a collection of all available galleries
*/
public Map getGalleries() {
return m_galleries;
}
/**
* @see org.opencms.i18n.I_CmsLocaleHandler#getI18nInfo(javax.servlet.http.HttpServletRequest, org.opencms.file.CmsUser, org.opencms.file.CmsProject, java.lang.String)
*/
public CmsI18nInfo getI18nInfo(HttpServletRequest req, CmsUser user, CmsProject project, String resource) {
Locale locale = null;
// try to read locale from session
if (req != null) {
// set the request character encoding
try {
req.setCharacterEncoding(m_encoding);
} catch (UnsupportedEncodingException e) {
// should not ever really happen
LOG.error(Messages.get().getBundle().key(Messages.LOG_UNSUPPORTED_ENCODING_SET_1, m_encoding), e);
}
// read workplace settings
HttpSession session = req.getSession(false);
if (session != null) {
CmsWorkplaceSettings settings = (CmsWorkplaceSettings)session.getAttribute(CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
if (settings != null) {
locale = settings.getUserSettings().getLocale();
}
}
}
if (locale == null) {
// no session available, try to read the locale form the user additional info
if (!user.isGuestUser()) {
// check user settings only for "real" users
CmsUserSettings settings = new CmsUserSettings(user);
locale = settings.getLocale();
}
if (req != null) {
List acceptedLocales = (new CmsAcceptLanguageHeaderParser(req, getDefaultLocale())).getAcceptedLocales();
if ((locale != null) && (!acceptedLocales.contains(locale))) {
acceptedLocales.add(0, locale);
}
locale = OpenCms.getLocaleManager().getFirstMatchingLocale(acceptedLocales, m_locales);
}
// if no locale was found, use the default
if (locale == null) {
locale = getDefaultLocale();
}
}
return new CmsI18nInfo(locale, m_encoding);
}
/**
* Returns a list of site folders which generate labeled links.<p>
*
* @return a list of site folders which generate labeled links
*/
public List getLabelSiteFolders() {
return m_labelSiteFolders;
}
/**
* Returns the list of available workplace locales, sorted ascending.<p>
*
* Please note: Be careful not to modify the returned Set as it is not a clone.<p>
*
* @return the set of available workplace locales
*/
public List getLocales() {
return m_locales;
}
/**
* Returns the configured list of localized workplace folders.<p>
*
* @return the configured list of localized workplace folders
*/
public List getLocalizedFolders() {
return m_localizedFolders;
}
/**
* Returns the menu rule set with the given name.<p>
*
* If no rule set with the specified name is found, <code>null</code> is returned.<p>
*
* @param ruleName the name of the rule set to get
* @return the menu rule set with the given name
*/
public CmsMenuRule getMenuRule(String ruleName) {
return (CmsMenuRule)m_menuRulesMap.get(ruleName);
}
/**
* Returns the configured menu rule sets.<p>
*
* @return the configured menu rule sets
*/
public List getMenuRules() {
return m_menuRules;
}
/**
* Returns the configured menu rule sets as Map.<p>
*
* @return the configured menu rule sets as Map
*/
public Map getMenuRulesMap() {
return m_menuRulesMap;
}
/**
* Returns the {@link CmsWorkplaceMessages} for the given locale.<p>
*
* The workplace messages are a collection of resource bundles, containing the messages
* for all OpenCms core bundles and of all initialized modules.<p>
*
* Please note that the message objects are cached internally.
* The returned message object should therefore never be modified directly in any way.<p>
*
* @param locale the locale to get the messages for
*
* @return the {@link CmsWorkplaceMessages} for the given locale
*/
public CmsWorkplaceMessages getMessages(Locale locale) {
CmsWorkplaceMessages result = (CmsWorkplaceMessages)m_messages.get(locale);
if (result != null) {
// messages have already been read
return result;
}
// messages have not been read so far
synchronized (this) {
result = new CmsWorkplaceMessages(locale);
m_messages.put(locale, result);
}
return result;
}
/**
* Returns the configured multi context menu to use in the Explorer view.<p>
*
* @return the configured multi context menu to use in the Explorer view
*/
public CmsExplorerContextMenu getMultiContextMenu() {
return m_multiContextMenu;
}
/**
* Returns the condition definition for the given resource type that is triggered before opening the editor.<p>
*
* @param resourceType the resource type
* @return the condition definition for the given resource type class name or null if none is found
*/
public I_CmsPreEditorActionDefinition getPreEditorConditionDefinition(I_CmsResourceType resourceType) {
Iterator i = m_preEditorConditionDefinitions.iterator();
I_CmsPreEditorActionDefinition result = null;
int matchResult = -1;
while (i.hasNext()) {
I_CmsPreEditorActionDefinition currentDefinition = (I_CmsPreEditorActionDefinition)i.next();
if (resourceType.getClass().isInstance(currentDefinition.getResourceType())) {
// now determine the match count...
int matchDistance = 0;
Class superClass = resourceType.getClass();
while (true) {
// check if a super class is present
if (superClass == null) {
break;
}
if (superClass.getName().equals(currentDefinition.getResourceType().getClass().getName())) {
break;
}
matchDistance += 1;
superClass = superClass.getSuperclass();
}
if (matchResult != -1) {
if (matchDistance < matchResult) {
matchResult = matchDistance;
result = currentDefinition;
}
} else {
matchResult = matchDistance;
result = currentDefinition;
}
}
}
return result;
}
/**
* Returns the condition definitions for the different resource types which are triggered before opening the editor.<p>
*
* @return the condition definitions
*/
public List getPreEditorConditionDefinitions() {
return m_preEditorConditionDefinitions;
}
/**
* Returns the id of the temporary file project required by the editors.<p>
*
* @return the id of the temporary file project required by the editors
*/
public CmsUUID getTempFileProjectId() {
if (m_tempFileProject != null) {
return m_tempFileProject.getUuid();
} else {
return null;
}
}
/**
* Returns the tool manager.<p>
*
* @return the tool manager
*/
public CmsToolManager getToolManager() {
if (m_toolManager == null) {
m_toolManager = new CmsToolManager();
}
return m_toolManager;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?