Exemplo n.º 1
0
  /** Renders the options, including the blank option. */
  @BeforeRenderTemplate
  void options(MarkupWriter writer) {
    selectedClientValue = tracker.getInput(this);

    // Use the value passed up in the form submission, if available.
    // Failing that, see if there is a current value (via the value parameter), and
    // convert that to a client value for later comparison.

    if (selectedClientValue == null)
      selectedClientValue = value == null ? null : encoder.toClient(value);

    if (showBlankOption()) {
      writer.element("option", "value", "");
      writer.write(blankLabel);
      writer.end();
    }

    SelectModelVisitor renderer = new Renderer(writer);

    model.visit(renderer);
  }
Exemplo n.º 2
0
  void beginRender(MarkupWriter writer) {
    writer.element("select", "name", getControlName(), "id", getClientId());

    putPropertyNameIntoBeanValidationContext("value");

    validate.render(writer);

    removePropertyNameFromBeanValidationContext();

    resources.renderInformalParameters(writer);

    decorateInsideField();

    // Disabled is via a mixin

    if (this.zone != null) {
      Link link = resources.createEventLink(CHANGE_EVENT);

      JSONObject spec =
          new JSONObject("selectId", getClientId(), "zoneId", zone, "url", link.toURI());

      javascriptSupport.addInitializerCall("linkSelectToZone", spec);
    }
  }