Menu

Adding extra fields types

Help
2010-01-17
2015-09-01
  • Mohammad Sami

    Mohammad Sami - 2010-01-17

    Hi;
    as jtrac was designed there are many types of fields like drop down lists and date etc.
    last week i added 2 extra decimal numbers, i made changes on fields.java, abstractItem.java and hbm file and I added them to the tables and it works correctly.
    now i need to add 2 extra fields types  : text area and checkbox
    any idea how can i add these two types and what classes should i change
    thanks

     
  • Mohammad Sami

    Mohammad Sami - 2010-01-18

    I made modification to fields, abstractItem and hbm file and messages.properties file
    I also made modification on CustomFieldFormPanel.html : I added these two tags

    <wicket:fragment wicket:id="textArea"><textarea cols="20" rows="5" wicket:id="myTextArea"></textarea></wicket:fragment>
    <wicket:fragment wicket:id="checkBox"><input type="checkbox" wicket:id="myCheckbox"/></wicket:fragment>

    and I added this code to the CustomFieldFormPane.java
    else if (field.getName().getType()== 7){ // TextArea
                        Fragment f =new Fragment("myTextArea", "textArea");
                        TextArea textArea = new TextArea("myTextArea");
                        textArea.setLabel(new Model(field.getLabel()));
                        f.add(model.bind(textArea, field.getName().getText()));
                        listItem.add(f);
                    }
                    else if (field.getName().getType()== 8){ // CheckBox
                       Fragment f =new Fragment("myCheckbox", "checkBox");
                       CheckBox checkBox = new CheckBox("myCheckbox");
                       checkBox.setLabel(new Model(field.getLabel()));
                       f.add(model.bind(checkBox,field.getName().getText()));
                       listItem.add(f);
                    }

    but there is an error occurred, can you please tell me is my work correct and if not what i should have done
    thanks

     
  • aurelien gour

    aurelien gour - 2010-03-04

    I m actually also trying but having the same issue.
    Could you let me know if you find a solution?

     
  • Bharathi

    Bharathi - 2010-05-18

    Hi mohsami
    Were you able to add the new field types with out any errors? please help me too. I want to add checkbox custom field in my Jtrac applicaiton . I am using JTrac 2.1 version.
    Thanks so much for your help
    Bharathi

     
  • Nicolas Crappe

    Nicolas Crappe - 2015-09-01

    Hi,

    I was able to add a textarea. I guess that it should be the same procedure for checkbox.
    The files that I changed :
    domain
    * AbstractItem.java : add getter/setter for the new custom fields
    private String cusText01;
    private String cusText02;
    private String cusText03;
    * ColumnHeading.java : getProcessor adding the new case number
    case 7:
    case 5: // free text
    return new Processor() {
    * Field.java : adding the custom fields like
    CUS_TEXT_01 (7, "cusText01"),
    CUS_TEXT_02 (7, "cusText02"),
    CUS_TEXT_03 (7, "cusText03")
    and the coresponding decription/methods
    wicket
    * CustomsFieldsFromPanel.html :

            <wicket:fragment wicket:id="textArea"> <textarea cols="20" rows="5" wicket:id="field" class="customSizeTextArea"></textarea></wicket:fragment>
    *  CustomFieldsFormPanel.java#addComponents() : 
          else if (field.isTextArea()) {
                     /*
                      * ======================================
                      * TextArea field
                      * ======================================
                      */
                     Fragment f = new Fragment("field", "textArea", CustomFieldsFormPanel.this);
                     TextArea textArea = new TextArea("field");
                     textArea.add(new ErrorHighlighter());
                     textArea.setRequired(isRequired);
                     textArea.setLabel(new Model(field.getLabel()));
                     f.add(model.bind(textArea, field.getName().getText()));
                     listItem.add(f);
    
                 }
    
    • ressources
      • jtrac.hbm.xml :
        <property name="cusText01" column="cus_text_01"/>
        <property name="cusText02" column="cus_text_02"/>
        <property name="cusText03" column="cus_text_03"/>
      • jtrac.css :
        .customSizeTextArea { width: 425px; margin: 0px; height: 75px; }
     

    Last edit: Nicolas Crappe 2015-09-01

Log in to post a comment.