Package com.google.api.explorer.client.parameter.schema.SchemaForm

Examples of com.google.api.explorer.client.parameter.schema.SchemaForm.SchemaEditor


      // appropriate editor type. The {@link #onSelect(String)} function
      // instantiates the proper editor type for the key and binds the new
      // editor to our editor.
      for (String key : obj.keySet()) {
        if (properties.containsKey(key)) {
          SchemaEditor editor = onSelect(key, OPTIONAL_PROPERTY);
          editor.setJSONValue(obj.get(key));
        } else if (additionalPropertiesType != null){
          SchemaEditor editor = addAdditionalPropertyEditor(key);
          editor.setJSONValue(obj.get(key));
        } else {
          throw new JSONException("JSON object contains unknown key: " + key);
        }
      }
    } else {
View Full Code Here


    }

    String selectedKey = key == null ? listBox.getValue(listBox.getSelectedIndex()) : key;
    Schema selectedProperty = properties.get(selectedKey);

    SchemaEditor editor = schemaForm.getSchemaEditorForSchema(service, selectedProperty,
        /* Descendants inherit nullability. */ nullableValues);

    boolean isRemovable = !isRequired && !selectedProperty.locked();
    final ObjectElement row =
        new ObjectElement(selectedKey, editor, selectedProperty, isRemovable, nullableValues);
View Full Code Here

    return row;
  }

  private SchemaEditor addAdditionalPropertyEditor(String initialKeyValue) {
    SchemaEditor editor = schemaForm.getSchemaEditorForSchema(service, additionalPropertiesType,
        /* Descendants inherit nullability. */ nullableValues);
    final AdditionalPropertyElement row =
        new AdditionalPropertyElement(editor, additionalPropertiesType);

    // If the editor was created with an initial key, set it now.
View Full Code Here

    return this;
  }

  private void addItem() {
    // Get the correct editor to show for the type of array element.
    final SchemaEditor editor = schemaForm.getSchemaEditorForSchema(service, items,
        /* This is an array element, so descendants should not be nullable. */ false);

    // Render the widget and make an ArrayElement widget out of it
    final ArrayElement el = new ArrayElement(editor, items);
    editors.add(el);
View Full Code Here

        // We may have to create additional editors
        if (i >= editors.size()) {
          addItem();
        }

        SchemaEditor editor = editors.get(i);
        editor.setJSONValue(arr.get(i));
      }
    } else {
      throw new JSONException("Not a valid JSON array: " + value.toString());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.api.explorer.client.parameter.schema.SchemaForm.SchemaEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.