Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1117

FormComponent.setType is called in AbstractTextComponent.onBeforeRender

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.0-beta4
    • 1.3.0-rc1
    • wicket
    • None
    • Linux

    Description

      The method FormComponent.setType() is called in onBeforeRender() and this will happen everytime, without having changes in the Model.
      The only way I see to change the Model's Component, is calling setModel().
      So, my suggestion is to override Component.setModel in AsbtractTextComponent calling super.setModel, and after that update the type.

      public Component setModel(final IModel model)
      {
      Component component = super.setModel(model);
      updateType();
      return component;
      }

      protected void updateType()
      {
      if (getType() == null)
      {
      // Set the type, but only if it's not a String (see WICKET-606).
      // Otherwise, getConvertEmptyInputStringToNull() won't work.
      Class type = getModelType(getModel());
      if (!String.class.equals(type))

      { setType(type); }

      }
      }

      Attachments

        Activity

          People

            jcompagner Johan Compagner
            miojo Bruno Borges
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: