changeset 1345:92074508a387

Added documentation. flys-client/trunk@3003 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 18 Oct 2011 12:33:23 +0000
parents 51d4b51a51ed
children a3c04eb326f3
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java flys-client/src/main/java/de/intevation/flys/client/shared/model/CollectionItemAttribute.java flys-client/src/main/java/de/intevation/flys/client/shared/model/Style.java flys-client/src/main/java/de/intevation/flys/client/shared/model/StyleSetting.java
diffstat 5 files changed, 150 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Oct 17 17:33:27 2011 +0000
+++ b/flys-client/ChangeLog	Tue Oct 18 12:33:23 2011 +0000
@@ -1,3 +1,11 @@
+2011-10-18  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/shared/model/Style.java,
+	  src/main/java/de/intevation/flys/client/shared/model/StyleSetting.java,
+	  src/main/java/de/intevation/flys/client/shared/model/CollectionItemAttribute.java,
+	  src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java:
+	  Added documentation.
+
 2011-10-17  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/ChartOutputServiceImpl.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Mon Oct 17 17:33:27 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Tue Oct 18 12:33:23 2011 +0000
@@ -67,6 +67,12 @@
         GWT.create(CollectionItemAttributeService.class);
 
 
+    /**
+     * Setup editor dialog.
+     * @param collection The collection the current theme belongs to.
+     * @param attributes The collection attributes.
+     * @param facet      The selected facet.
+     */
     public StyleEditorWindow (
         Collection collection,
         CollectionItemAttribute attributes,
@@ -82,6 +88,9 @@
     }
 
 
+    /**
+     * Initialize the window and set the layout.
+     */
     protected void init() {
         setTitle(MSG.properties());
         setWidth(270);
@@ -94,6 +103,9 @@
     }
 
 
+    /**
+     * Initialize the static window content like buttons and main layout.
+     */
     protected void initPanels() {
         HLayout buttons = new HLayout();
         Button accept = new Button(MSG.label_ok());
@@ -115,16 +127,28 @@
     }
 
 
+    /**
+     * Setter for the parent panel.
+     * @param panel The panel.
+     */
     public void setThemePanel (ThemePanel panel) {
         this.panel = panel;
     }
 
 
+    /**
+     * this method is called when the user aborts theming.
+     * @param event The event.
+     */
     public void onClick(ClickEvent event) {
         this.hide();
     }
 
 
+    /**
+     * This method creates the property grid for available styling attributes.
+     * @return The layout containing the UI elements.
+     */
     protected VLayout createPropertyGrid() {
         VLayout properties = new VLayout();
 
@@ -154,6 +178,15 @@
     }
 
 
+    /**
+     * Create a property form.
+     * @param dname The display name.
+     * @param name The property name.
+     * @param type The property type.
+     * @param value The current value.
+     *
+     * @return The dynamic form for the attribute property.
+     */
     protected DynamicForm createPropertyUI(
         String dname,
         String name,
@@ -247,6 +280,12 @@
     }
 
 
+    /**
+     * Static method to convert a color from RGB to HTML notation.
+     * @param rgb String in RGB notation.
+     *
+     * @return String in HTML notation.
+     */
     protected static String rgbToHtml(String rgb) {
         String[] parts = rgb.split(",");
         int values[] = new int[parts.length];
@@ -270,6 +309,12 @@
     }
 
 
+    /**
+     * Static method to convert a color from HTML to RGB notation.
+     * @param html String in HTML notation.
+     *
+     * @return String in RGB notation.
+     */
     protected static String htmlToRgb(String html) {
         if (!html.startsWith("#")) {
             return "0, 0, 0";
@@ -283,6 +328,9 @@
     }
 
 
+    /**
+     * Saves the current style attributes and requests a redraw.
+     */
     protected void saveStyle () {
         GWT.log("StyleEditorWindow.saveStyle()");
         Config config = Config.getInstance();
@@ -310,6 +358,11 @@
     }
 
 
+    /**
+     * Sets a new value for an attribute.
+     * @param name Attribute name.
+     * @param value The new value.
+     */
     protected final void setNewValue(String name, String value) {
         Theme t = facet.getTheme();
         Style s = attributes.getStyle(t.getFacet(), t.getIndex());
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/CollectionItemAttribute.java	Mon Oct 17 17:33:27 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/CollectionItemAttribute.java	Tue Oct 18 12:33:23 2011 +0000
@@ -11,18 +11,34 @@
  */
 public class CollectionItemAttribute implements Serializable {
 
+    /** The list of styles. */
     protected List<Style> styles;
 
+    /** The artifact. */
     protected String artifact;
 
+
+    /**
+     * Creates a new CollectionItem Attribute.
+     */
     public CollectionItemAttribute() {
         styles = new ArrayList<Style>();
     }
 
+
+    /**
+     * Append a new Style.
+     * @param style The style.
+     */
     public void appendStyle (Style style) {
         this.styles.add(style);
     }
 
+
+    /**
+     * Remove a style from the attributes.
+     * @param name The style name.
+     */
     public void removeStyle (String name) {
         for (int i = 0; i < styles.size(); i++) {
             if (styles.get(i).getName().equals(name)) {
@@ -31,6 +47,14 @@
         }
     }
 
+
+    /**
+     * Get a style from the collection item.
+     * @param facet The facet this style belongs to.
+     * @param index The style index.
+     *
+     * @return The selected style or 'null'.
+     */
     public Style getStyle(String facet, int index) {
         for (int i = 0; i < styles.size(); i++) {
             Style tmp = styles.get(i);
@@ -42,18 +66,40 @@
         return null;
     }
 
+
+    /**
+     * Get the style at a postion.
+     * @param i The position index.
+     *
+     * @return The selected style.
+     */
     public Style getStyle(int i) {
         return styles.get(i);
     }
 
+
+    /**
+     * Get the number of styles.
+     * @return The number of styles.
+     */
     public int getNumStyles() {
         return styles.size();
     }
 
+
+    /**
+     * Set the current artifact.
+     * @param The artifact uuid.
+     */
     public void setArtifact(String artifact) {
         this.artifact = artifact;
     }
 
+
+    /**
+     * Get the associated artifact.
+     * @return The artifact.
+     */
     public String getArtifact () {
         return this.artifact;
     }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/Style.java	Mon Oct 17 17:33:27 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/Style.java	Tue Oct 18 12:33:23 2011 +0000
@@ -10,18 +10,31 @@
  */
 public class Style implements Serializable {
 
+    /** The theme name. */
     protected String name;
 
+    /** The facet. */
     protected String facet;
 
+    /** The theme index. */
     protected int index;
 
+    /** List of theme attribute settings. */
     protected List<StyleSetting> settings;
 
+
+    /**
+     * Create a new style for theme attribution.
+     */
     public Style() {
         settings = new ArrayList<StyleSetting>();
     }
 
+
+    /**
+     * Append a new style setting.
+     * @param setting A theme attribution setting.
+     */
     public void appendStyleSetting(StyleSetting setting) {
         settings.add(setting);
     }
@@ -50,6 +63,11 @@
         return this.index;
     }
 
+
+    /**
+     * Getter for a theme attribution setting.
+     * @return The style setting.
+     */
     public StyleSetting getSetting(String name) {
         for (int i = 0; i < settings.size (); i++) {
             if (settings.get(i).getName().equals(name)) {
@@ -59,10 +77,22 @@
         return null;
     }
 
+
+    /**
+     * Getter for number of settings.
+     * @return The size of the settings list.
+     */
     public int getNumSettings () {
         return settings.size();
     }
 
+
+    /**
+     * Getter for style setting.
+     * @param i The index in the settings list.
+     *
+     * @return The style setting at the given index.
+     */
     public StyleSetting getSetting(int i) {
         return this.settings.get(i);
     }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/StyleSetting.java	Mon Oct 17 17:33:27 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/StyleSetting.java	Tue Oct 18 12:33:23 2011 +0000
@@ -23,9 +23,22 @@
     /**The type*/
     protected String type;
 
+
+    /**
+     * Create a new StyleSetting for theme attribution.
+     */
     public StyleSetting() {
     }
 
+
+    /**
+     * Create a new StyleSetting for theme attribution.
+     * @param name The attribute name.
+     * @param defaultValue The current value.
+     * @param displayName The name to show in a dialog.
+     * @param hints Hints.
+     * @param type The attribute type.
+     */
     public StyleSetting(
         String name,
         String defaultValue,

http://dive4elements.wald.intevation.org