You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by lienok <li...@gmail.com> on 2008/09/22 16:05:35 UTC

refresh page with detachable model - not working

Hello, 

the panel with detachable model is not refreshing after model has changed.
kindly check the code please.

the panel - ActivityPanel is not refreshing after I press link and status of
the DetachableTcktModel is changed.

public LoansTabPanel(String id, int ticketId) {
            super(id);            
            setModel(new CompoundPropertyModel(new
DetachableTcktModel(ticketId)));
            getMenu();            
            getFullContent();
}

public void getFullContent() {            

            //when ticket was not authorized "sendToAuth" link is visible
            add(new ActivityPanel("activityPanel", getModel()));   
        }

..........

public ActivityPanel(String id, IModel model) {
        super(id, model);       
        tck = (Ticket) getModelObject(); 

        lnkSendToAuth = new Link("sendToAuth") {

            public void onClick() {
           /**
             *after ticket is authorized link "sendToAuth" is disabled 
             * BUT THIS IS NOT WORKING AUTOMATICALLY, 
             * I have to reopen the page. NOT EVEN REFRESH IS HELPING */

                tck.sendToAuthorization(true);  
                info("Ticket was sent to authorization.");
            }
        };
        add(lnkSendToAuth);

}
.... 
public DetachableTcktModel(int ticketID) {
    this.ticketId = ticketID;
}

protected Object load() {
        tck = findTicket(ticketId);
        return tck;
}

public void detach() {
        tck = null;
    }

.....


Any advice what I am doing wrong I would appreciate.

Thanks, Lenka

-- 
View this message in context: http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19608631.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: refresh page with detachable model - not working

Posted by lienok <li...@gmail.com>.
Well, I found my problem.

of course the model was changed but it did not have a chance to show,
because I didn't call the method setVisibility() where changes are visible.

so I add to every click
. 
lnkSendToAuth = new Link("sendToAuth") {

            public void onClick() {
           /**
             *after ticket is authorized link "sendToAuth" is disabled
             * BUT THIS IS NOT WORKING AUTOMATICALLY,
             * I have to reopen the page. NOT EVEN REFRESH IS HELPING */

                tck.sendToAuthorization(true);
                info("Ticket was sent to authorization.");
            }

            setVisibility();
        };
        add(lnkSendToAuth); 


anyway thank you for the assistance :)  
at least I knew there was no problem with models.. 


lienok wrote:
> 
> Hi Marijn, 
> 
> I have moved it to the onclick handler in a following way, but it did not
> help.
> tck = (Ticket) getParent().getModel().getObject();
> 
> 
> 
> 
> Martijn Dashorst wrote:
>> 
>> move tck = getModelObject() into the onclick handler.
>> 
>> Martijn
>> 
>> On Mon, Sep 22, 2008 at 4:05 PM, lienok <li...@gmail.com> wrote:
>>>
>>> Hello,
>>>
>>> the panel with detachable model is not refreshing after model has
>>> changed.
>>> kindly check the code please.
>>>
>>> the panel - ActivityPanel is not refreshing after I press link and
>>> status of
>>> the DetachableTcktModel is changed.
>>>
>>> public LoansTabPanel(String id, int ticketId) {
>>>            super(id);
>>>            setModel(new CompoundPropertyModel(new
>>> DetachableTcktModel(ticketId)));
>>>            getMenu();
>>>            getFullContent();
>>> }
>>>
>>> public void getFullContent() {
>>>
>>>            //when ticket was not authorized "sendToAuth" link is visible
>>>            add(new ActivityPanel("activityPanel", getModel()));
>>>        }
>>>
>>> ..........
>>>
>>> public ActivityPanel(String id, IModel model) {
>>>        super(id, model);
>>>        tck = (Ticket) getModelObject();
>>>
>>>        lnkSendToAuth = new Link("sendToAuth") {
>>>
>>>            public void onClick() {
>>>           /**
>>>             *after ticket is authorized link "sendToAuth" is disabled
>>>             * BUT THIS IS NOT WORKING AUTOMATICALLY,
>>>             * I have to reopen the page. NOT EVEN REFRESH IS HELPING */
>>>
>>>                tck.sendToAuthorization(true);
>>>                info("Ticket was sent to authorization.");
>>>            }
>>>        };
>>>        add(lnkSendToAuth);
>>>
>>> }
>>> ....
>>> public DetachableTcktModel(int ticketID) {
>>>    this.ticketId = ticketID;
>>> }
>>>
>>> protected Object load() {
>>>        tck = findTicket(ticketId);
>>>        return tck;
>>> }
>>>
>>> public void detach() {
>>>        tck = null;
>>>    }
>>>
>>> .....
>>>
>>>
>>> Any advice what I am doing wrong I would appreciate.
>>>
>>> Thanks, Lenka
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19608631.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.4 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19625525.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: refresh page with detachable model - not working

Posted by lienok <li...@gmail.com>.
Hi Marijn, 

I have moved it to the onclick handler in a following way, but it did not
help.
tck = (Ticket) getParent().getModel().getObject();




Martijn Dashorst wrote:
> 
> move tck = getModelObject() into the onclick handler.
> 
> Martijn
> 
> On Mon, Sep 22, 2008 at 4:05 PM, lienok <li...@gmail.com> wrote:
>>
>> Hello,
>>
>> the panel with detachable model is not refreshing after model has
>> changed.
>> kindly check the code please.
>>
>> the panel - ActivityPanel is not refreshing after I press link and status
>> of
>> the DetachableTcktModel is changed.
>>
>> public LoansTabPanel(String id, int ticketId) {
>>            super(id);
>>            setModel(new CompoundPropertyModel(new
>> DetachableTcktModel(ticketId)));
>>            getMenu();
>>            getFullContent();
>> }
>>
>> public void getFullContent() {
>>
>>            //when ticket was not authorized "sendToAuth" link is visible
>>            add(new ActivityPanel("activityPanel", getModel()));
>>        }
>>
>> ..........
>>
>> public ActivityPanel(String id, IModel model) {
>>        super(id, model);
>>        tck = (Ticket) getModelObject();
>>
>>        lnkSendToAuth = new Link("sendToAuth") {
>>
>>            public void onClick() {
>>           /**
>>             *after ticket is authorized link "sendToAuth" is disabled
>>             * BUT THIS IS NOT WORKING AUTOMATICALLY,
>>             * I have to reopen the page. NOT EVEN REFRESH IS HELPING */
>>
>>                tck.sendToAuthorization(true);
>>                info("Ticket was sent to authorization.");
>>            }
>>        };
>>        add(lnkSendToAuth);
>>
>> }
>> ....
>> public DetachableTcktModel(int ticketID) {
>>    this.ticketId = ticketID;
>> }
>>
>> protected Object load() {
>>        tck = findTicket(ticketId);
>>        return tck;
>> }
>>
>> public void detach() {
>>        tck = null;
>>    }
>>
>> .....
>>
>>
>> Any advice what I am doing wrong I would appreciate.
>>
>> Thanks, Lenka
>>
>> --
>> View this message in context:
>> http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19608631.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> 
> -- 
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.4 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19609156.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: refresh page with detachable model - not working

Posted by Martijn Dashorst <ma...@gmail.com>.
move tck = getModelObject() into the onclick handler.

Martijn

On Mon, Sep 22, 2008 at 4:05 PM, lienok <li...@gmail.com> wrote:
>
> Hello,
>
> the panel with detachable model is not refreshing after model has changed.
> kindly check the code please.
>
> the panel - ActivityPanel is not refreshing after I press link and status of
> the DetachableTcktModel is changed.
>
> public LoansTabPanel(String id, int ticketId) {
>            super(id);
>            setModel(new CompoundPropertyModel(new
> DetachableTcktModel(ticketId)));
>            getMenu();
>            getFullContent();
> }
>
> public void getFullContent() {
>
>            //when ticket was not authorized "sendToAuth" link is visible
>            add(new ActivityPanel("activityPanel", getModel()));
>        }
>
> ..........
>
> public ActivityPanel(String id, IModel model) {
>        super(id, model);
>        tck = (Ticket) getModelObject();
>
>        lnkSendToAuth = new Link("sendToAuth") {
>
>            public void onClick() {
>           /**
>             *after ticket is authorized link "sendToAuth" is disabled
>             * BUT THIS IS NOT WORKING AUTOMATICALLY,
>             * I have to reopen the page. NOT EVEN REFRESH IS HELPING */
>
>                tck.sendToAuthorization(true);
>                info("Ticket was sent to authorization.");
>            }
>        };
>        add(lnkSendToAuth);
>
> }
> ....
> public DetachableTcktModel(int ticketID) {
>    this.ticketId = ticketID;
> }
>
> protected Object load() {
>        tck = findTicket(ticketId);
>        return tck;
> }
>
> public void detach() {
>        tck = null;
>    }
>
> .....
>
>
> Any advice what I am doing wrong I would appreciate.
>
> Thanks, Lenka
>
> --
> View this message in context: http://www.nabble.com/refresh-page-with-detachable-model---not-working-tp19608631p19608631.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org