Radio Button

Help
ivan.svi
2013-02-25
2013-04-26
  • ivan.svi
    ivan.svi
    2013-02-25

    Yo quiero crear un Radio Button, me fije en la wiki de openxava y lo cree como decia.

    @Editor(forViews="TipoConRadioButton", value="ValidValuesRadioButton")
    private Tipo tipo;
    public enum Tipo { NORMAL, FIJO, ESPECIAL };

    ademas dice que hay que agregarlo en el archivo xava/editors.xml de nuestro proyecto.
    En mi proyecto no existe el editors.xml.

    Debo copiarlo de Openxava/xava a mi proyecto?

    muchas gracias

     
  • Laurent
    Laurent
    2013-02-26

    Hi Ivan,

    No need, since the ValidValuesRadioButton is already defined in 'default-editors.xml' which will be included in your project when you build the WAR file.

    Laurent

     
    • ivan.svi
      ivan.svi
      2013-02-27

      thank you for your quick response!

      I did it but it is not showing me the radio button. Also I added the get and the set as detailed below.
      I attached the screen to show how it is working now.

      @Editor(forViews="TipoConRadioButton", value="ValidValuesRadioButton")
      private Tipo tipo;
      public enum Tipo { PERCHITA, RINON, FUNDA, MEDIALUNA, SACAAIRE, PARCHE, ASA};

      public Tipo getTipo() {
      return tipo;
      }
      public void setTipo(Tipo tipo) {
      this.tipo = tipo;
      }

      Thank you a lot!

      ivan

       
      • ivan.svi
        ivan.svi
        2013-02-27

        I forgot to attach the file

        Now is complete

         
        Last edit: ivan.svi 2013-02-27
        Attachments
  • Javier Paniza
    Javier Paniza
    2013-03-01

    Hi Ivan,

    you have done in the right way, so it should work, maybe it's that you have misspelled the view name. If you write just @Editor("ValidValuesRadioButton"), does it work?

    If it still fails for you, write a very simple class that uses the editor and try it, then put here the complete source code of the class, I will try it.


    Help others in this forum as I help you.
    Before posting a question search this forum for the answer,
    and read the OpenXava documentation in openxava.org.

     
    • ivan.svi
      ivan.svi
      2013-03-02

      Hi Javier,

      Now it is working. thank you and Laurent!!!!

      Now I'm having another question.
      The statement below is working

      public enum Tipo { MEDIALUNA, SACAAIRE};
      

      However if I write the below it is showing me errors in the compile phase

      public enum Tipo { MEDIA LUNA, SACA AIRE};
      

      It looks like the compiler does not allow the words with a space character in the middle

      Thanks in advance

      Ivan

       
    • ivan.svi
      ivan.svi
      2013-04-23

      I have another issue with radio button.

      The entity Producto works properly. I have entity PedidoDetalle where producto is referenced as detailed below:

      PedidoDCetalle:

      @ManyToOne(optional=false, fetch=FetchType.LAZY)
      private Producto producto;

      public Producto getProducto() {
      return producto;
      }
      public void setProducto(Producto producto) {
      this.producto = producto;
      }

      This entity is not working properly because is not showing me the value in the "troquel" field (Radio Button detailed in producto)

      Producto:

      @Editor(value="ValidValuesVerticalRadioButton")
      private Troquel troquel;
      public enum Troquel {Perchita, Rinon, Funda, Media_Luna, Saca_Aire, Parche};

      public Troquel getTroquel() {
      return troquel;
      }
      public void setTroquel(Troquel troquel) {
      this.troquel = troquel;
      }

      I attached the screen related to pedidodetalle in order to know the cause of this issue

      Thanks a lot, Ivan

       
      • Javier Paniza
        Javier Paniza
        2013-04-25

        Hi Ivan,

        I have a look at radioButtonEditor.jsp and I see that the code is incomplete for the non-editable case. It's just a little bug. Please, add it in the tracker so we'll solve it.

        This bug is easy to solve. It would be nice if you fix it and contribute back the code.


        Help others in this forum as I help you.
        Need more help? Get OpenXava professional support.

         
        • ivan.svi
          ivan.svi
          2013-04-26

          Javier,

          I will try to solve it

          Regards, Ivan

           
  • Javier Paniza
    Javier Paniza
    2013-03-05

    Hi Ivan,

    It looks like the compiler does not allow the words with a space character

    Of course, Java does not allow space as a valid identifier character. But this is usual, I have programmed in many programming languages (Java, Groovy, C++, C, BASIC, LOGO, COBOL and Pascal) and no one allows space as valid character identifier.

    Use underscore, that is MEDIA_LUNA instead of MEDIA LUNA.


    Help others in this forum as I help you.
    Need more help? Get OpenXava professional support.