Hi,

change your constructor to access the data every time, otherwise your page will just work on copy of the original object:

    public Header(String id) {
        super(id);
        setDefaultModel(new CompoundPropertyModel(new AbstractReadOnlyModel() {
            public T getObject() {
                return MyApplication.userBio_data
            }
        }));

BTW it seems strange that you store userBio_data in the application - I'd 
expect it to be in the session instead.

Have fun
Sven


Am 17.06.2017 um 22:52 schrieb gasper:
ok...
This is my header code....

The wicket:id=fullname does not change when i edit and save the details in
my profile panel

/**
  *
  * @author Gasper
  */
public class Header extends Panel implements IMarkupResourceStreamProvider,
IAjaxIndicatorAware {

     private static final Log LOG = LogFactory.getLog(Header.class);

     @Override
     protected void onConfigure() {
         super.onConfigure(); //To change body of generated methods, choose
Tools | Templates.
         LOG.debug("Session Status => UserSession.get().userLoggedIn() " +
UserSession.get().userLoggedIn() + "\n UserSession.get().userNotLoggedIn() "
+ UserSession.get().userNotLoggedIn());
         if (UserSession.get().userNotLoggedIn()) {//once True Redirect To
LogIn Page
             setResponsePage(Login.class);
         }

         if (UserSession.get().userLoggedIn()) {
//            setDefaultModel(new
CompoundPropertyModel(MyApplication.userBio_data));
             LOG.debug("Updating Users " +
UserSession.get().getUser().getMobile() + " Profile Since Sesion Still
Exists and Re_Setting User's Session");
             MyApplication.userLogin =
MyApplication.loginJDBCTemplate.getlogin(UserSession.get().getUser().getMobile());

             MyApplication.activityTemplate.insertactivity("Updating User
Login into the Application", MyApplication.userLogin.getId(), dateTime());
             MyApplication.userBio_data =
MyApplication.bCTemplate.getbio_data(MyApplication.userLogin.getId());
             //Re_Setting Session
             UserSession.get().setUser(MyApplication.userLogin);

             CookieService cookieService =
MyApplication.get().getCookieService();

             cookieService.saveCookie(getResponse(),
REMEMBER_ME_LOGIN_COOKIE, MyApplication.userLogin.getMobile(),
REMEMBER_ME_DURATION_IN_DAYS);
             System.out.println("FullName " +
MyApplication.userBio_data.getFullName());
         }
     }

     public Header(String id) {
         super(id);
         setDefaultModel(new
CompoundPropertyModel(MyApplication.userBio_data));

         add(new Label("fullName"));
         add(new Label("mobile"));

         add(new AjaxLink("myevents") {//Adding myeventsPanel
             @Override
             public void onClick(AjaxRequestTarget target) {
                 Panel contentpanel = new EventHistory("contentpanel");
                 contentpanel.setOutputMarkupId(true);
                 replacedPanel.replaceWith(contentpanel);
                 target.add(contentpanel);
                 replacedPanel = contentpanel;

             }
         });

//        add(new IndicatingAjaxLink("profile") {//Adding profilePanel
         add(new AjaxLink("profile") {//Adding profilePanel
             @Override
             public void onClick(AjaxRequestTarget target) {
                 LOG.debug("Ok we reach here");
Panel contentpanel = new profilePanel("contentpanel");
                 contentpanel.setOutputMarkupId(true);
                 replacedPanel.replaceWith(contentpanel);
                 target.add(contentpanel);
                 replacedPanel = contentpanel;

//                addOrReplace(new profilePanel("contentpanel"));
             }
         });
         add(new Link("endAppNow") {
             @Override
             public void onClick() {
                 UserSession.get().invalidateNow();
                 setResponsePage(Login.class);
             }
         });
         /* add(new AjaxLink<String>("endAppNow") {
             @Override
             public void onClick(AjaxRequestTarget target) {
                 UserSession.get().invalidateNow();

//                CookieService cookieService =
MyApplication.get().getCookieService();
//                cookieService.removeCookieIfPresent(getRequest(),
getResponse(), REMEMBER_ME_LOGIN_COOKIE);
//
//                UserSession.get().setUser(null);
//                UserSession.get().invalidate();
                 setResponsePage(Login.class);
             }
         });*/

         //Creating Notification Messages on Events
         //trigger an AJAX request every 300 seconds (5 minutes)
         AbstractAjaxTimerBehavior eventTimerBehaviour = new
AbstractAjaxTimerBehavior(Duration.seconds(300)) {
             @Override
             protected void onTimer(AjaxRequestTarget target) {
                 request request =
MyApplication.requestJDBCTemplate.getNotificationRequest(MyApplication.userLogin.getId(),
"1");
                 if (request != null) {
                     if (request.getStatus().equalsIgnoreCase("1") &&
request.getVendorid() > 0 &&
request.getDetails().equalsIgnoreCase(defaultValues.NOT_SET)) {
//                        target.appendJavaScript("Materialize.toast('" +
MyApplication.userBio_data.getSurname() + ", a Studio is Available. Click
<wicket:link>  <\"#\"> /menu/ </wicket:link>', 4000);");// For JQuery
                         target.appendJavaScript("Materialize.toast('" +
MyApplication.userBio_data.getSurname() + "', a Studio is Available. Set
your requirements', 4000);");// For JQuery
//                        LOG.info("-------------------------------Counter
check Here");
                         Panel contentpanel = new
EventHistory("contentpanel");
                         contentpanel.setOutputMarkupId(true);
                         replacedPanel.replaceWith(contentpanel);
                         target.add(contentpanel);
                         replacedPanel = contentpanel;
                         //stop(target);//Stop The Notification Message
                     }
                 }
             }
         };

         add(eventTimerBehaviour);
     }

     @Override
     public IResourceStream getMarkupResourceStream(MarkupContainer
container, Class<?> containerClass) {
         String header = "<wicket:panel>\n"
                 + "<wicket:link>\n"
                 + "<nav class=\"white\" role=\"navigation\" >\n"
                 + "<div class=\"nav-wrapper container\">"
                 + "<div class=\"center\"> <\"img/logo.png\"> </div>\n"
                 + "<ul class=\"right hide-on-med-and-down\">\n"
                 + "<li> About <\"#\">  </li>\n"
                 + "</ul>\n"
                 + "<ul id=\"nav-mobile\" class=\"side-nav\">"
                 + "<li>"
                 + "<div class=\"userView\">\n"
                 + "<div class=\"background\">\n"
                 + " <\"img/background1.jpg\"> \n"
                 + "</div>\n"
                 + " <img class=\"circle\" src=\"img/background3.jpg\" >
<\"#!user\">  \n"
                 + " <span class=\"white-text name\" wicket:id=\"fullName\"
id=\"fullName\"> <\"#!name\"> Thompson Gasper \n"
                 + " <span class=\"white-text \" wicket:id=\"mobile\">
<\"#!mobile\"> 0706040222 \n"
                 + "</div></li>\n"
+ "<li> /face/My Profile </li>\n" //+ "<li> / <\"#!\"> info_outline/Notifications4 </li>\n"
                 + "<li><div class=\"divider\"></div></li>\n"
                 + "<li> Settings </li>\n"
                 + "<li> /surround_sound/My Events </li>"
                 + "<li> / <\"#!\"> person_pin/Location </li>"
                 + "<li><div class=\"divider\"></div></li>\n"
                 + "<li> Help </li>\n"
                 + "<li> / <\"#!\"> help/F.A.Q  </li>"
                 + "<li> /chat/LogOut  </li>"
                 + "<li> / <\"#!\"> contact_phone/Support Center </li>"
                 + "<li> Copyright <\"#!\"> <sub class=\"green-text\">v
1.0.0</sub> </li>"
                 + "</ul>\n"
                 + " / <\"#\"> menu/ \n"
                 + "</div>\n"
                 + "</nav>"
                 + ""
                 + ""
                 + "<div id=\"loadingApp\" style=\"display: none;\">"
                 + "<div class=\"content\">"
                 + " <\"img/loading.gif\"> "
                 + "</div>"
                 + "</div>\n"
                 + ""
                 + ""
                 + ""
                 + "</wicket:link>"
                 + "</wicket:panel>";

         StringResourceStream resourceStream = new
StringResourceStream(header);
         return resourceStream;
     }

     @Override
     public String getAjaxIndicatorMarkupId() {
         return "loadingApp";//Displaying a Customize Loading Option
     }

}


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Refreshing-A-Panel-Detail-tp4678066p4678068.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to