Author: fred
Date: 2007-09-16 11:13:26 +0000 (Sun, 16 Sep 2007)
New Revision: 15201
Modified:
trunk/plugins/Echo/src/plugins/echo/Echo.java
trunk/plugins/Echo/src/plugins/echo/NodesManager.java
trunk/plugins/Echo/src/plugins/echo/editor/Page.java
trunk/plugins/Echo/src/plugins/echo/editor/StaticPage.java
Log:
javadoc
Modified: trunk/plugins/Echo/src/plugins/echo/Echo.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/Echo.java 2007-09-16 10:54:51 UTC
(rev 15200)
+++ trunk/plugins/Echo/src/plugins/echo/Echo.java 2007-09-16 11:13:26 UTC
(rev 15201)
@@ -42,7 +42,6 @@
// TODO
// * Exceptions !
// * var Project / projectManager
-// * var Page
public class Echo implements FredPlugin, FredPluginHTTP,
FredPluginHTTPAdvanced, FredPluginThreadless {
Modified: trunk/plugins/Echo/src/plugins/echo/NodesManager.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/NodesManager.java 2007-09-16
10:54:51 UTC (rev 15200)
+++ trunk/plugins/Echo/src/plugins/echo/NodesManager.java 2007-09-16
11:13:26 UTC (rev 15201)
@@ -250,7 +250,7 @@
}
/**
- * Rename a category
+ * Renames a category
* @param id The id of the category
* @param newName The new name to set
* @return true if the category was successfully; false if the
category 'id' does not exists.
Modified: trunk/plugins/Echo/src/plugins/echo/editor/Page.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/editor/Page.java 2007-09-16
10:54:51 UTC (rev 15200)
+++ trunk/plugins/Echo/src/plugins/echo/editor/Page.java 2007-09-16
11:13:26 UTC (rev 15201)
@@ -9,12 +9,18 @@
import nu.xom.Element;
import nu.xom.Attribute;
+/**
+* This abstract class represents an editor page
+*/
public abstract class Page {
private Element content;
private String title;
private List<String> errors;
+ /**
+ * Class constructor
+ */
protected Page() {
content = new Element("content");
@@ -22,6 +28,9 @@
}
+ /**
+ * Class constructor specifying page title
+ */
protected Page(String title) {
this();
@@ -31,42 +40,69 @@
public abstract void handleHTTPRequest(HTTPRequest request);
+ /**
+ * Appends XML content to this page
+ * @param n the XML content node to append
+ */
protected void appendContent(Node n) {
content.appendChild(n);
}
+ /**
+ * Appends text content to this page
+ * @param text the content to append
+ */
protected void appendContent(String text) {
content.appendChild(text);
}
+ /**
+ * Appends an error to this page
+ * @param desc the description of the errror
+ */
protected void appendError(String desc) {
errors.add(desc);
}
-
+
+ /**
+ * Appends an error to this page
+ * @param t the throwable object to append
+ */
protected void appendError(Throwable t){
errors.add(t.toString());
}
+ /**
+ * Returns the number of errors
+ * @return the number of errors
+ */
public int countErrors() {
return errors.size();
}
+ /**
+ * Set the title of this page
+ * @param title the new title
+ */
protected void setTitle(String title) {
this.title = title;
}
-
+
+ /**
+ * Removes the content of this page and clears the errors
+ */
protected void clear() {
content.removeChildren();
@@ -74,6 +110,10 @@
}
+ /**
+ * Generates an XML representation of this page
+ * @return an XML representation of this page
+ */
public Element toXML() {
content.detach();
Modified: trunk/plugins/Echo/src/plugins/echo/editor/StaticPage.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/editor/StaticPage.java 2007-09-16
10:54:51 UTC (rev 15200)
+++ trunk/plugins/Echo/src/plugins/echo/editor/StaticPage.java 2007-09-16
11:13:26 UTC (rev 15201)
@@ -6,6 +6,9 @@
import nu.xom.Builder;
import nu.xom.Document;
+/**
+* A static editor page
+*/
public class StaticPage extends Page {
protected StaticPage() {
@@ -14,6 +17,12 @@
}
+ /**
+ * Creates a new static page from a content file
+ * @param title the title of this page
+ * @param fileName the content file to load
+ * @return an instance of StaticPage
+ */
public static StaticPage createFromContentFile(String title, String
fileName) {
StaticPage page = new StaticPage();