Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha Premium Member
    Join Date
    May 2013
    Posts
    12
    Vote Rating
    0
    sws is on a distinguished road

      0  

    Default Unanswered: TextField blank to null mapping

    Unanswered: TextField blank to null mapping


    Hi,

    I'm trying to use SimpleBeanEditorDriver to bind a form to a bean. Is there a way to map blank string values to 'null' on the bean? EditorDriver.isDirty() is unreliable without it.

    I tried an implementation of PropertyEditor that does the mapping but TextField and PasswordField don't seem to use it.

    My attempt:

    Code:
        @Override
        public String parse(CharSequence text) throws ParseException {
            GWT.log("Parsing >" + text + "<");
            if (text.length() == 0) return null;
            return text.toString();
        }
    
        @Override
        public String render(String object) {
            if (object == null) return "";
            return object;
        }
    Thanks in advance if you can help.

    Regards,
    Pete

  2. #2
    Sencha Premium Member
    Join Date
    May 2013
    Posts
    12
    Vote Rating
    0
    sws is on a distinguished road

      0  

    Default Work around - manual massage during onValueChange

    Work around - manual massage during onValueChange


    The less-desirable work around is to manually convert blank field values to 'null' in the 'onValueChange' just before using Driver.isDirty().

    EG:
    Code:
    String s = field.getValue();
    if (s != null && s.isEmpty()) field.setValue(null);
    Pete

  3. #3
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    239
    Answers
    4
    Vote Rating
    2
    gishmo is on a distinguished road

      0  

    Default


    Just one thought:

    If an empty string is a undesirable value, why not use the set-method of the bean to convert emtpy strings to null?

  4. #4
    Sencha Premium Member
    Join Date
    May 2013
    Posts
    12
    Vote Rating
    0
    sws is on a distinguished road

      0  

    Default


    Thanks Frank (gishmo), that would probably work.

    But this bean is used by other parts of the code (including the server) and I wouldn't want a UI specific issue to leak out everywhere.

  5. #5
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    239
    Answers
    4
    Vote Rating
    2
    gishmo is on a distinguished road

      0  

    Default


    My business functions are encapsulated in services, so I have the need for two data models, one for the client and one for the server. These services are used by serveral applications, some of them are not GWT based.

    If I have your requirement (storing empty fields as null), I would implement this requirement in my server data model, because I want to have the behavior for every application that uses my services.

Thread Participants: 1

Tags for this Thread