/**
 * <License>
 */
package edu.colorado.csdms.wmt.client.data;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;

/**
 * A GWT JavaScript overlay (JSO) type that describes the JSON returned on a
 * HTTP GET call to <a
 * href="http://csdms.colorado.edu/wmt/api/tag/list">tag/list</a>. Declares
 * JSNI methods to access attributes.
 * 
 * @see <a
 *      href="http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsOverlay.html">http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsOverlay.html</a>
 * @author Mark Piper (mark.piper@colorado.edu)
 */
public class LabelJSO extends JavaScriptObject {

  private Boolean selected = false; 
  
  // Overlay types always have protected, zero-arg constructors.
  protected LabelJSO() {
  }

  /**
   * Gets the owner of a label, a String. This is a JSNI method.
   */
  public final native String getOwner() /*-{
		return this.owner;
  }-*/;

  /**
   * Gets the text of the label, a String. This is a JSNI method.
   */
  public final native String getLabel() /*-{
		return this.tag;
  }-*/;

  /**
   * A JSNI method to get the id of the label, an int. 
   */
  public final native int getId() /*-{
		return this.id;
  }-*/;    
  
  /**
   * Gets a JsArray of labels. This is a JSNI method.
   */
  public final native JsArray<LabelJSO> getLabels() /*-{
		return this;
  }-*/;
  
  /**
   * Returns the state of the label button; true = selected. Not a JSNI method.
   */
  public Boolean isSelected() {
    return this.selected;
  }
  
  /**
   * Stores the state of the label button. Not a JSNI method.
   * 
   * @param selected a value of true indicates button is selected
   */
  public void isSelected(Boolean selected) {
    this.selected = selected;
  }
}

@@ -373,16 +373,116 @@
 ibutes.%0A
+ * %3Cp%3E%0A * Note that an instance of LabelJSO can represent a single label or a JsArray%0A * of labels.%0A
  * %0A * @
@@ -751,46 +751,8 @@
 ct %7B
-%0A%0A  private Boolean selected = false; 
 %0A  %0A
@@ -1505,26 +1505,35 @@
 lected. 
-Not
+This is
  a JSNI
+%0A   *
  method.
@@ -1548,17 +1548,30 @@
  public 
-B
+final native b
 oolean i
@@ -1582,16 +1582,19 @@
 ected() 
+/*-
 %7B%0A    re
@@ -1594,24 +1594,32 @@
 %0A    return 
+(typeof 
 this.selecte
@@ -1619,21 +1619,65 @@
 selected
+ != 'undefined') ? this.selected : false
 ;%0A  %7D
+-*/;
 %0A  %0A  /*
@@ -1721,19 +1721,23 @@
 button. 
-Not
+This is
  a JSNI 
@@ -1739,24 +1739,81 @@
 JSNI method.
+ (It actually%0A   * adds a %22selected%22 object to the JSON.)
 %0A   * %0A   * 
@@ -1888,16 +1888,29 @@
  public 
+final native 
 void isS
@@ -1935,16 +1935,19 @@
 lected) 
+/*-
 %7B%0A    th
@@ -1973,11 +1973,15 @@
 ted;%0A  %7D
+-*/;
 %0A%7D%0A

Remove LabelJSO "selected" variable; replace with JSNI methods