1. #1
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    365
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Question GXT DateTimeField?

    GXT DateTimeField?


    In our apps we often have to set specific dates and times (i.e. a date without a time is to vague). Does GXT have a component that sets both? I see the DateField and TimeField but didn't see a way to combine them, is this possible? I'd be okay with the DateField with spinners at the bottom to set hours:minuteseconds, etc.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Nov 2010
    Posts
    209
    Vote Rating
    -2
    Ersmarker has a little shameless behaviour in the past

      0  

    Default


    You can build it using a MultiField

    The example below is not tested but should give you a good startingpoint.

    Code:
        public class DateTimeField extends MultiField<Date> {
    
    
            private final TimeField timeField;
            private final DateField dateField;
    
    
            public DateTimeField() {
                super();    
                dateField = new DateField();
                add(dateField);
                timeField = new TimeField();
                add(timeField);
            }
            
            @Override
            public Date getValue() {
                Date result = dateField.getValue();
                if (result == null) {
                    return null;
                }
                return new Date(result.getTime() + timeField.getValue().getDate().getTime());
            }
    
    
            @Override
            public void setValue(Date value) {
                dateField.setValue(new Date(value.getYear(), value.getMonth(), value.getDate()));
                timeField.setValue(new Time(value.getHours(), value.getMinutes()));
            }
        }

  3. #3
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    365
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Default


    I'm not finding the MultiField<> type in 3.x is there something equivalent?

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    I've built such a thing subclassing Field (or AdapterField) in 2.x. As mentioned, MultiField could also work in 2.

    In 3, I'd probably start by making an Editor instance with two sub-editors, one DateField and one TimeField, each using @Path("") to have them bind to the same value.

    Or make the new class implement IsField, and use setValue() and getValue() to modify/read both sub-editors.

    IsField is what is being used in 3 to replace most MultiField cases - it allows a widget to supply methods that are helpful for most fields, and as it extends LeafValueEditor, it can be used in GWT Editor framework, and subfields will be ignored, leaving the dev to write their own logic for binding the values.

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi