Index: /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/FCKeditor.java =================================================================== --- /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/FCKeditor.java (revision 3430) +++ /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/FCKeditor.java (revision 3431) @@ -294,6 +294,10 @@ /** - * TODO document me - * Creates the HTML representation of this editor instance. + * Creates the HTML representation of this editor instance. First of all, + * this method determines whether the request browser is supported. + * According to the result an appropriate HTML representation is assembled + * and returned. + * + * @return HTML representation of this editor instance */ @Override @@ -304,5 +308,5 @@ String encodedValue = escapeXml(value); - if (Compatibility.check(request.getHeader("user-agent"))) { + if (Compatibility.isCompatibleBrowser(request)) { strEditor.append(createInputForVariable(instanceName, instanceName, encodedValue)); @@ -315,13 +319,15 @@ // create IFrame - String sLink = request.getContextPath().concat( - basePath.concat("/editor/fckeditor.html?InstanceName=") - .concat(instanceName)); + StringBuffer editorLink = new StringBuffer(request.getContextPath()); + editorLink.append(basePath); + editorLink.append("/editor/fckeditor.html?InstanceName=").append( + instanceName); if (Utils.isNotEmpty(toolbarSet)) - sLink += "&Toolbar=".concat(toolbarSet); + editorLink.append("&Toolbar=").append(toolbarSet); + XHtmlTagTool iframeTag = new XHtmlTagTool("iframe", XHtmlTagTool.SPACE); iframeTag.addAttribute("id", instanceName.concat("___Frame")); - iframeTag.addAttribute("src", sLink); + iframeTag.addAttribute("src", editorLink.toString()); iframeTag.addAttribute("width", width); iframeTag.addAttribute("height", height); @@ -345,6 +351,8 @@ /** - * TODO document me - * Wraps to {@link #toString()}. + * Creates the HTML representation of this editor instance. + * + * @see #toString() + * @return HTML representation of this editor instance */ public String createHtml() { Index: /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/handlers/LocalizedMessages.java =================================================================== --- /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/handlers/LocalizedMessages.java (revision 3430) +++ /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/handlers/LocalizedMessages.java (revision 3431) @@ -40,7 +40,5 @@ /** - * TODO document me * Provides access to localized messages (properties). - * *
* Localized messages are loaded for a particular locale from a HTTP request.
@@ -60,4 +58,5 @@
public class LocalizedMessages {
+ // TODO do we need to synchronize this map?
private static final Map
- * This method is fail save, either a null request or locale will be safely
- * served with the default messages.
+ * Creates a new instance of LocalizedMessages
for a given
+ * request. This method automatically determines the locale of this request
+ * and loads the appropriate bundle. If either one if null or not available,
+ * the default bundle will be used.
*
* @param request
* the current request instance
- * @return an instance with localized strings.
- */
+ * @return instance with localized messages
+ */
+ // TODO maybe align name to getInstance?
public static LocalizedMessages getMessages(HttpServletRequest request) {
@@ -129,5 +129,8 @@
/**
- * Returns a locale resolver instance.
+ * Returns the locale resolver instance. The implementation class name is
+ * provided by {@link PropertiesLoader#getLocaleResolverImpl()}.
+ *
+ * @return the locale resolver instance
*/
private static LocaleResolver getLocaleResolverInstance() {
@@ -153,9 +156,12 @@
/**
- * Loads the default strings and the string for the given locale and only
- * for this locale.
+ * Loads the localized messages for the given locale. This constructor loads
+ * the resource bundle for this locale and only for this, in other words it
+ * shortcircuits the default resource bundle load mechanism in order to
+ * prevent the loading of the system default locale which may result in a
+ * completely different resource bundle.
*
* @param locale
- * given locale
+ * the locale of the new localized messages
*/
private LocalizedMessages(Locale locale) {
@@ -206,180 +212,107 @@
}
- private String getString(String key) {
+ /**
+ * Searches for the message with the specified key in this message list.
+ *
+ * @see Properties#getProperty(String)
+ */
+ private String getMessage(String key) {
return properties.getProperty(key);
}
- /**
- * Returns localized editor.compatibleBrowser.yes
property.
- *
- * @return localized message
- */
+ /** Returns localized editor.compatibleBrowser.yes
property. */
public String getCompatibleBrowserYes() {
- return getString("editor.compatibleBrowser.yes"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized editor.compatibleBrowser.no
property.
- *
- * @return localized message
- */
+ return getMessage("editor.compatibleBrowser.yes"); //$NON-NLS-1$
+ }
+
+ /** Returns localized editor.compatibleBrowser.no
property. */
public String getCompatibleBrowserNo() {
- return getString("editor.compatibleBrowser.no"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.fileUpload.enabled
property
- *
- * @return localized message
- */
+ return getMessage("editor.compatibleBrowser.no"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.fileUpload.enabled
property. */
public String getFileUploadEnabled() {
- return getString("connector.fileUpload.enabled"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.fileUpload.disabled
property
- *
- * @return localized message
- */
+ return getMessage("connector.fileUpload.enabled"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.fileUpload.disabled
property. */
public String getFileUploadDisabled() {
- return getString("connector.fileUpload.disabled"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.file_renamed_warning
property
+ return getMessage("connector.fileUpload.disabled"); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns localized connector.file_renamed_warning
property.
*
* @param newFileName
- * the new filename
- * @return localized message
+ * the new filename of the warning
+ * @return localized message with new filename
*/
public String getFileRenamedWarning(String newFileName) {
- return MessageFormat
- .format(
- getString("connector.fileUpload.file_renamed_warning"), newFileName); //$NON-NLS-1$
- }
-
- /**
- * Returns localized
- * connector.fileUpload.invalid_file_type_specified
property
- *
- * @return localized message
- */
+ return MessageFormat.format(getMessage("connector.fileUpload.file_renamed_warning"), newFileName); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.fileUpload.invalid_file_type_specified
property. */
public String getInvalidFileTypeSpecified() {
- return getString("connector.fileUpload.invalid_file_type_specified"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.fileUpload.write_error
property.
- *
- * @return localized message
- */
+ return getMessage("connector.fileUpload.invalid_file_type_specified"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.fileUpload.write_error
property. */
public String getFileUploadWriteError() {
- return getString("connector.fileUpload.write_error"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.getResources.enabled
property
- *
- * @return localized message
- */
+ return getMessage("connector.fileUpload.write_error"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.getResources.enabled
property. */
public String getGetResourcesEnabled() {
- return getString("connector.getResources.enabled"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.getResources.disabled
property
- *
- * @return localized message
- */
+ return getMessage("connector.getResources.enabled"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.getResources.disabled
property. */
public String getGetResourcesDisabled() {
- return getString("connector.getResources.disabled"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.getResources.read_error
property
- *
- * @return localized message
- */
+ return getMessage("connector.getResources.disabled"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.getResources.read_error
property. */
public String getGetResourcesReadError() {
- return getString("connector.getResources.read_error"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.createFolder.enabled
property.
- *
- * @return localized message
- */
+ return getMessage("connector.getResources.read_error"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.createFolder.enabled
property. */
public String getCreateFolderEnabled() {
- return getString("connector.createFolder.enabled"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.createFolder.disabled
property.
- *
- * @return localized message
- */
+ return getMessage("connector.createFolder.enabled"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.createFolder.disabled
property. */
public String getCreateFolderDisabled() {
- return getString("connector.createFolder.disabled"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.invalid_command_specified
- * property.
- *
- * @return localized message
- */
+ return getMessage("connector.createFolder.disabled"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.invalid_command_specified
property. */
public String getInvalidCommandSpecified() {
- return getString("connector.invalid_command_specified"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized
- * connector.createFolder.folder_already_exists_error
property.
- *
- * @return localized message
- */
+ return getMessage("connector.invalid_command_specified"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.createFolder.folder_already_exists_error
property. */
public String getFolderAlreadyExistsError() {
- return getString("connector.createFolder.folder_already_exists_error"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized
- * connector.createFolder.invalid_new_folder_name_specified
- * property.
- *
- * @return localized message
- */
+ return getMessage("connector.createFolder.folder_already_exists_error"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.createFolder.invalid_new_folder_name_specified
property. */
public String getInvalidNewFolderNameSpecified() {
- return getString("connector.createFolder.invalid_new_folder_name_specified"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.createFolder.write_error
- * property.
- *
- * @return localized message
- */
+ return getMessage("connector.createFolder.invalid_new_folder_name_specified"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.createFolder.write_error
property. */
public String getCreateFolderWriteError() {
- return getString("connector.createFolder.write_error"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.invalid_resource_type_specified
- * property.
- *
- * @return localized message
- */
+ return getMessage("connector.createFolder.write_error"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.invalid_resource_type_specified
property. */
public String getInvalidResouceTypeSpecified() {
- return getString("connector.invalid_resource_type_specified"); //$NON-NLS-1$
- }
-
- /**
- * Returns localized connector.invalid_current_folder_specified
- * property.
- *
- * @return localized message
- */
+ return getMessage("connector.invalid_resource_type_specified"); //$NON-NLS-1$
+ }
+
+ /** Returns localized connector.invalid_current_folder_specified
property. */
public String getInvalidCurrentFolderSpecified() {
- return getString("connector.invalid_current_folder_specified"); //$NON-NLS-1$
+ return getMessage("connector.invalid_current_folder_specified"); //$NON-NLS-1$
}
Index: /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/handlers/ResourceType.java
===================================================================
--- /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/handlers/ResourceType.java (revision 3430)
+++ /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/handlers/ResourceType.java (revision 3431)
@@ -139,5 +139,5 @@
/**
- * Returns the absolute path of the resource type. This path is absolute to
+ * Returns the absolute path of this resource type. This path is absolute to
* the userfiles path. To set this path, see the configuration.
Index: /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/GetResponse.java
===================================================================
--- /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/GetResponse.java (revision 3430)
+++ /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/GetResponse.java (revision 3431)
@@ -45,5 +45,4 @@
/**
- * TODO document me
* Represents the XML response for the File Browser's GET
request.
* The XML response is described GetResources request */
protected Element foldersElement;
+ /** Files element, in case of a GetResources
request */
protected Element filesElement;
@@ -78,13 +81,12 @@
/**
- *
* Constructs a response with a specific error number and message.
*
* @param number
- * error number
+ * the error number of the new get response
* @param message
- * specific message
+ * the specific message of the new get response
* @throws RuntimeException
- * if creation of the underlying DOM object failed
+ * if creation of the underlying DOM document failed
*/
public GetResponse(int number, String message) {
@@ -108,13 +110,13 @@
*
* @param command
- * current command
+ * the current command of the new get response
* @param resourceType
- * current resource type
+ * the current resource type of the new get response
* @param currentFolder
- * current folder
+ * the current folder of the new get response
* @param constructedUrl
- * final url
+ * the final URL of the new get response
* @throws RuntimeException
- * if creation of the underlying DOM object failed
+ * if creation of the underlying DOM document failed
*/
public GetResponse(Command command, ResourceType resourceType,
@@ -132,5 +134,5 @@
Element root = document.createElement("Connector");
document.appendChild(root);
- root.setAttribute("command", command.toString());
+ root.setAttribute("command", command.getName());
root.setAttribute("resourceType", resourceType.getName());
@@ -147,7 +149,7 @@
*
* @param number
- * error number
+ * the error number of the new get response
* @throws RuntimeException
- * if creation of the underlying DOM object failed
+ * if creation of the underlying DOM document failed
*/
public GetResponse(int number) {
@@ -156,10 +158,10 @@
/**
- * Sets an error number with a message.
+ * Sets the error number and specific message of this get response.
*
* @param number
- * error number
+ * the error number of this get response
* @param message
- * specific message
+ * the specific message of this get response
*/
public void setError(int number, String message) {
@@ -177,8 +179,8 @@
/**
- * Sets an error number only.
+ * Sets the error number of this get response.
*
* @param number
- * error number
+ * the error number of this get response
*/
public void setError(int number) {
@@ -187,8 +189,8 @@
/**
- * Sets folders associated with this response.
+ * Sets the folders of this get response.
*
* @param folders
- * list with folder names
+ * the folders of this get response
*/
public void setFolders(final List