Exemplo n.º 1
0
  protected IFormComponent newField(String displayName) {
    IFormComponent field = newMock(IFormComponent.class);

    expect(field.getDisplayName()).andReturn(displayName);

    return field;
  }
Exemplo n.º 2
0
  protected IFormComponent newField(String displayName, String clientId) {
    IFormComponent field = newMock(IFormComponent.class);
    checkOrder(field, false);

    expect(field.getClientId()).andReturn(clientId).anyTimes();
    expect(field.getDisplayName()).andReturn(displayName);

    return field;
  }
  /**
   * Restores the property to its default value. For {@link Direction#FORM} parameters, extracts the
   * property value and sets the binding form it (when appropriate).
   */
  public void resetParameter(IRequestCycle cycle) {
    if (_direction == Direction.FORM && cycle.isRewinding()) {
      IFormComponent component = (IFormComponent) _component;

      if (!component.isDisabled()) {
        IForm form = Form.get(cycle);

        if (form != null && form.isRewinding()) {
          Object value = readCurrentPropertyValue();

          _binding.setObject(value);
        }
      }
    }

    // Either way, clear the value.

    setPropertyValue(_clearValue);
  }