Hybrid View

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    2
    Vote Rating
    0
    rezdm is on a distinguished road

      0  

    Default NullPointerException in TimeField::getValue()::getDate()

    NullPointerException in TimeField::getValue()::getDate()


    Hello.

    I've got the following issue(?) in 2.2.3:
    Code:
    public class SomePanel extends ContentPanel
    {
        private final TimeField theFieldTimeStart = new TimeField();
        private final DateTimeFormat theTimeFieldsDateFormat = DateTimeFormat.getFormat("HH:mm");
        public SomePanel()
        {
            theFieldTimeStart.setTriggerAction(ComboBox.TriggerAction.ALL);
            theFieldTimeStart.setFormat(theTimeFieldsDateFormat);
        }
    
        @Override protected void onRender(Element aParent, int aPos)
        {
            super.onRender(aParent, aPos);
            final Time myTimeStart = new Time();
            myTimeStart.setText("09:00");
            theFieldTimeStart.setValue(myTimeStart);
        }
    
         private void handleSomeEvent()
        {
            //Here I need to get Date from theFieldTimeStart
            theFieldTimeStart.getValue().getDate(); //causes NPE
            theFieldTimeStart.getDateValue(); //causes NPE
            //my workaround:
            final Date myDateStart = theTimeFieldsDateFormat.parse(theFieldTimeStart.getValue().getText());
        }
    }
    Is it supposed behavior or I missed a step in initialization?


    Thanks.

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Who is calling handleSomeEvent? The most important part is missing in your code snippet. Do you have a fully working testcase implementing EntryPoint? Why do you call setText to set the value? Have you tried to disable lazyrendering?

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    2
    Vote Rating
    0
    rezdm is on a distinguished road

      0  

    Default


    Hello, Sven.

    1) Where the
    handleSomeEvent

    is called from:


    Code:
        final Button myButtonAdd = new Button("Add");
    
    myButtonAdd.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { final SomeSelectionDialog mySomeSelectionDialog = new SomeSelectionDialog(); mySomeSelectionDialog.addListener(Events.Hide, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { handleSomeEvent(); ...




    2) Unfortunately not, this is a part of a larger piece of code

    3) Just tried to add to ctor theFieldTimeStart.setLazyRender(false) helped. Problem solved.

    4) Just to make the picture full, here're the theFieldTimeStart with default LazyRender (note, that theFieldTimeStart.getValue() returns Time object with empty value, but getRawValue() contains proper string by the same time):
    Attachment 30821



    Thanks!
    Attached Images

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar