Exemple #1
0
  Object defaultBlankLabel() {
    Messages containerMessages = resources.getContainerMessages();

    String key = resources.getId() + "-blanklabel";

    if (containerMessages.contains(key)) return containerMessages.get(key);

    return null;
  }
Exemple #2
0
  @SuppressWarnings("unchecked")
  SelectModel defaultModel() {
    Class valueType = resources.getBoundType("value");

    if (valueType == null) return null;

    if (Enum.class.isAssignableFrom(valueType))
      return new EnumSelectModel(valueType, resources.getContainerMessages());

    return null;
  }
  @SetupRender
  final void setup() {
    // Often, these controlName and clientId will end up as the same value. There are many
    // exceptions, including a form that renders inside a loop, or a form inside a component
    // that is used multiple times.

    if (formSupport == null)
      throw new RuntimeException(
          String.format(
              "Component %s must be enclosed by a Form component.", resources.getCompleteId()));

    assignedClientId = allocateClientId();

    String controlName = formSupport.allocateControlName(resources.getId());

    formSupport.storeAndExecute(this, new Setup(controlName));
    formSupport.store(this, PROCESS_SUBMISSION_ACTION);
  }
Exemple #4
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);
    }
  }
Exemple #5
0
 public String getClassForPageName() {
   return resources.getPageName().equalsIgnoreCase(pageName) ? "current_page_item" : null;
 }