// Path: appinventor/appengine/src/com/google/appinventor/client/properties/Property.java
// public class Property {
//   // Name of the property
//   private final String name;
// 
//   // Default value of the property
//   private final String defaultValue;
// 
//   // Current value of the property (initially the same as its default value)
//   private String value;
// 
//   // Category of the property
//   private final String category;
// 
//   /**
//    * Creates a new property.
//    *
//    * @param name  property's name
//    * @param defaultValue  property's default value (will also be its initial
//    *                      current value)
//    */
//   public Property(String name, String defaultValue, String category) {
//     this.name = name;
//     value = defaultValue;
//     this.defaultValue = defaultValue;
//     this.category = category;
//   }
// 
//   /**
//    * Returns the property's name.
//    *
//    * @return  property's name
//    */
//   public String getName() {
//     return name;
//   }
// 
//   /**
//    * Returns the property's current value.
//    *
//    * @return property's value
//    */
//   public String getValue() {
//     return value;
//   }
// 
//   /**
//    * Changes the property's value.
//    *
//    * @param value  new property value
//    */
//   public void setValue(String value) {
//     this.value = value;
//   }
// 
//   /**
//    * Returns the property's default value.
//    *
//    * @return property's default value
//    */
//   public final String getDefaultValue() {
//     return defaultValue;
//   }
// 
//   /**
//    * Returns the property's category.
//    *
//    * @return
//    */
//   public final String getCategory() {
//     return category;
//   }
// 
//   /**
//    * Indicates whether a property is persisted to the source file upon saving.
//    *
//    * @return  {@code true} for persisted properties, {@code false} otherwise
//    */
//   protected boolean isPersisted() {
//     return true;
//   }
// 
//   protected boolean isYail() {
//     return true;
//   }
// 
//   /**
//    * Resets the value the property to its default value.
//    */
//   public final void resetToDefault() {
//     if (!getDefaultValue().equals(getValue())) {
//       setValue(getDefaultValue());
//     }
//   }
// 
//   /**
//    * Encodes the property using JSON format.
//    *
//    * @param sb  buffer to add encoded property to
//    */
//   public final void encode(StringBuilder sb) {
//     sb.append('"');
//     sb.append(getName());
//     sb.append("\":");
//     sb.append(JSONUtil.toJson(getValue()));
//   }
// }


import com.google.appinventor.client.properties.Property;
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2012 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0

package com.google.appinventor.client.widgets.properties;


/**
 * Property for display in a {@link PropertiesPanel}.
 *
 * <p>Such properties have an associated {@link PropertyEditor},
 * hence the name of this class.
 *
 */
public final class EditableProperty extends Property {

  /**
   * Properties of this type will be persisted to the source file upon saving
   * and will be displayed in the properties panel.
   */
  public static final int TYPE_NORMAL = 0;

  /**
   * Properties of this type will not be persisted to the source file upon saving.
   */
  public static final int TYPE_NONPERSISTED = 0x01;

  /**
   * Properties of this type will not be displayed in the properties panel.
   */
  public static final int TYPE_INVISIBLE = 0x02;

  /**
   * Properties of this type will be included in a yail generation
   * even if they are not persisted. This is used for computed properties
   * which aren't stored, but which must be passed to a component both
   * in the Companion and when built. Example: The FirebaseToken and
   * deveoperId which are computed on the fly by MockFirebaseDB but
   * which are not persisted for security reasons. Yet we still need
   * to output them in the Yail.
   */

  public static final int TYPE_DOYAIL = 0x04;

  // EditableProperties that contains this EditableProperty
  private final EditableProperties properties;

  // Type of property
  private int type;

  // Property editor for use in properties panel
  private final PropertyEditor editor;

  // Property caption for use in properties panel
  private final String caption;

  // Property description for use in properties panel help dialogs
  private final String description;

  /**
   * Creates a new property.
   *
   * @param properties  the EditableProperties that contains this
   *                    EditableProperty
   * @param name  property's name
   * @param defaultValue property's default value
   *                     (will also be its initial current value)
   * @param caption  property's caption for use in the UI
   * @param editor  property editor
   * @param type  type of property; see {@code TYPE_*} constants
   */
  public EditableProperty(EditableProperties properties, String name, String defaultValue,
      String caption, String category, String description, PropertyEditor editor, int type) {
    super(name, defaultValue, category);

    this.properties = properties;
    this.type = type;
    this.editor = editor;
    this.caption = caption;
    this.description = description;

    editor.setProperty(this);
  }

  /**
   * Creates a new property.
   *
   * @param properties  the EditableProperties that contains this
   *                    EditableProperty
   * @param name  property's name (also used as the caption in the UI)
   * @param defaultValue property's default value
   *                     (will also be its initial current value)
   * @param type  type of property; see {@code TYPE_*} constants
   */
  public EditableProperty(EditableProperties properties, String name, String defaultValue,
      String category, int type) {
    this(properties, name, defaultValue, name, category, null, new TextPropertyEditor(), type);
  }

  /**
   * Returns whether this property is persisted.
   */
  @Override
// Path: appinventor/appengine/src/com/google/appinventor/client/properties/Property.java
// public class Property {
//   // Name of the property
//   private final String name;
// 
//   // Default value of the property
//   private final String defaultValue;
// 
//   // Current value of the property (initially the same as its default value)
//   private String value;
// 
//   // Category of the property
//   private final String category;
// 
//   /**
//    * Creates a new property.
//    *
//    * @param name  property's name
//    * @param defaultValue  property's default value (will also be its initial
//    *                      current value)
//    */
//   public Property(String name, String defaultValue, String category) {
//     this.name = name;
//     value = defaultValue;
//     this.defaultValue = defaultValue;
//     this.category = category;
//   }
// 
//   /**
//    * Returns the property's name.
//    *
//    * @return  property's name
//    */
//   public String getName() {
//     return name;
//   }
// 
//   /**
//    * Returns the property's current value.
//    *
//    * @return property's value
//    */
//   public String getValue() {
//     return value;
//   }
// 
//   /**
//    * Changes the property's value.
//    *
//    * @param value  new property value
//    */
//   public void setValue(String value) {
//     this.value = value;
//   }
// 
//   /**
//    * Returns the property's default value.
//    *
//    * @return property's default value
//    */
//   public final String getDefaultValue() {
//     return defaultValue;
//   }
// 
//   /**
//    * Returns the property's category.
//    *
//    * @return
//    */
//   public final String getCategory() {
//     return category;
//   }
// 
//   /**
//    * Indicates whether a property is persisted to the source file upon saving.
//    *
//    * @return  {@code true} for persisted properties, {@code false} otherwise
//    */
//   protected boolean isPersisted() {
//     return true;
//   }
// 
//   protected boolean isYail() {
//     return true;
//   }
// 
//   /**
//    * Resets the value the property to its default value.
//    */
//   public final void resetToDefault() {
//     if (!getDefaultValue().equals(getValue())) {
//       setValue(getDefaultValue());
//     }
//   }
// 
//   /**
//    * Encodes the property using JSON format.
//    *
//    * @param sb  buffer to add encoded property to
//    */
//   public final void encode(StringBuilder sb) {
//     sb.append('"');
//     sb.append(getName());
//     sb.append("\":");
//     sb.append(JSONUtil.toJson(getValue()));
//   }
// }


// Path: appinventor/appengine/src/com/google/appinventor/client/widgets/properties/EditableProperty.java
import com.google.appinventor.client.properties.Property;

// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2012 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0

package com.google.appinventor.client.widgets.properties;


/**
 * Property for display in a {@link PropertiesPanel}.
 *
 * <p>Such properties have an associated {@link PropertyEditor},
 * hence the name of this class.
 *
 */
public final class EditableProperty extends Property {

  /**
   * Properties of this type will be persisted to the source file upon saving
   * and will be displayed in the properties panel.
   */
  public static final int TYPE_NORMAL = 0;

  /**
   * Properties of this type will not be persisted to the source file upon saving.
   */
  public static final int TYPE_NONPERSISTED = 0x01;

  /**
   * Properties of this type will not be displayed in the properties panel.
   */
  public static final int TYPE_INVISIBLE = 0x02;

  /**
   * Properties of this type will be included in a yail generation
   * even if they are not persisted. This is used for computed properties
   * which aren't stored, but which must be passed to a component both
   * in the Companion and when built. Example: The FirebaseToken and
   * deveoperId which are computed on the fly by MockFirebaseDB but
   * which are not persisted for security reasons. Yet we still need
   * to output them in the Yail.
   */

  public static final int TYPE_DOYAIL = 0x04;

  // EditableProperties that contains this EditableProperty
  private final EditableProperties properties;

  // Type of property
  private int type;

  // Property editor for use in properties panel
  private final PropertyEditor editor;

  // Property caption for use in properties panel
  private final String caption;

  // Property description for use in properties panel help dialogs
  private final String description;

  /**
   * Creates a new property.
   *
   * @param properties  the EditableProperties that contains this
   *                    EditableProperty
   * @param name  property's name
   * @param defaultValue property's default value
   *                     (will also be its initial current value)
   * @param caption  property's caption for use in the UI
   * @param editor  property editor
   * @param type  type of property; see {@code TYPE_*} constants
   */
  public EditableProperty(EditableProperties properties, String name, String defaultValue,
      String caption, String category, String description, PropertyEditor editor, int type) {
    super(name, defaultValue, category);

    this.properties = properties;
    this.type = type;
    this.editor = editor;
    this.caption = caption;
    this.description = description;

    editor.setProperty(this);
  }

  /**
   * Creates a new property.
   *
   * @param properties  the EditableProperties that contains this
   *                    EditableProperty
   * @param name  property's name (also used as the caption in the UI)
   * @param defaultValue property's default value
   *                     (will also be its initial current value)
   * @param type  type of property; see {@code TYPE_*} constants
   */
  public EditableProperty(EditableProperties properties, String name, String defaultValue,
      String category, int type) {
    this(properties, name, defaultValue, name, category, null, new TextPropertyEditor(), type);
  }

  /**
   * Returns whether this property is persisted.
   */
  @Override
  protected final boolean isPersisted() {