first you have to confirm that this is a wicket issue or your email
handling issue. it sounds like it is an email handling issue. make
sure that part works first before trying to fix your UI components.

-igor

On Tue, May 27, 2008 at 4:01 AM, Davidoff <[EMAIL PROTECTED]> wrote:
>
> the problem is that even if i refresh the page manually, its content doesn't
> change...i modified the code for closing connection with the pop3
> server...but nothing....i send emails but no new email results on the
> table....see the code:
>
> MailList.java
>
> public class MailList extends Panel implements Serializable {
>
>        private ListView listTable;
>        private ModalWindow modal;
>        private Message[] messages;
>        private List<Message> mailList;
>        private int contains;
>
>
>        public MailList(String id, final User user, Folder folder) throws
> MessagingException {
>                super(id);
>                // TODO Auto-generated constructor stub
>                  final Folder folder1=folder;
>                try {
>                        contains=folder1.getMessageCount();
>                        addOrReplace(new Label("contains","Your MailBox 
> contains " + contains +"
> messages."));
>
>                        messages=folder1.getMessages();
>
>                } catch (MessagingException e2) {
>                        // TODO Auto-generated catch block
>                        e2.printStackTrace();
>                }
>                mailList=Arrays.asList(messages);
>
>                add(new Label("prova",folder1.getFullName()));
>                //user.closePopServer();
>                modal = new ModalWindow("modal");
>
>
>                //listTable.setReuseItems(true);
>
>                listTable=new ListView("listview",mailList)
>                {
>
>                        private int index;
>                   public void populateItem(ListItem item)
>                               {
>                                user.openPopServer();
>                                try {
>                                final Message msg=(Message) 
> item.getModelObject();
>
>                                                        //Address[]
> add=msg.getFolder().open(Folder.READ_ONLY).getFrom();
>                                                   
> index=msg.getMessageNumber();
>                                                    AjaxLink rate = new 
> AjaxLink("mess") {
>                                                        public void 
> onClick(AjaxRequestTarget target) {
>
>                                                                               
>          GetMessage getMessage;
>                                                                               
>          getMessage = new GetMessage(modal.getContentId(), msg){};
>
>                                                                               
>          modal.setContent(getMessage);
>                                                                               
>          modal.setInitialHeight(400);
>                                                                               
>          modal.setInitialWidth(800);
>                                                                               
>          modal.show(target);
>                                                                               
>          modal.setTitle("Mail View");
>
>                                                                               
>  }
>                                                    };
>                                                                        
> rate.add(new
> Label("prova",String.valueOf(msg.getMessageNumber())));
>                                                                        
> item.add(rate);
>                                                                        
> item.add(new AttributeAppender("class", true, new
> Model(index % 2 ==0 ? "odd": "even"), " "));
>                                                                        
> item.add(new Label("subject",
> msg.getSubject().toString()));
>                                                                        
> item.add(new Label("from",
> msg.getFrom()[0].toString()));
>                                                                        if 
> (msg.getSentDate()!=null)
>                                                                               
>  item.add(new Label("date",
> msg.getSentDate().toString()));
>                                                                        else
>                                                                               
>  item.add(new Label("date", "Nothing"));
>
>                                                } catch (MessagingException e) 
> {
>                                                        
> System.out.println("Error populate item");
>                                                                //      
> e.printStackTrace();
>                                        }
>                                                try {
>
>                                                        
> messages=folder1.getMessages();
>                                                        
> mailList=Arrays.asList(messages);
>                                                        
> contains=folder1.getMessageCount();
>                                                } catch (MessagingException e) 
> {
>                                                        // TODO Auto-generated 
> catch block
>                                                        e.printStackTrace();
>                                                }
>                                        user.closePopServer();
>
>                               }
>                    };
>                        add(listTable);
>                        addOrReplace(modal);
>                }
>
> }
>
>
> AccountPage.java
>
> public class AccountPage extends WebPage{
>
>        private Manager manager;
>        private User user;
>        private Folder folder;
>        private MailList tableListPanel;
>        private Store store;
>
>        public AccountPage(String username,String password) throws
> MessagingException{
>                manager=new Manager("AjaxUbiMailDB",1000);
>                  user=manager.authenticate(username, password);
>                add(new Label("welcome","hello "+ user.firstName() + " " + 
> user.lastName()
> + "."));
>        folder=user.openPopServer();
>                tableListPanel=new MailList("mail",user,folder);
>                WebMarkupContainer listContainer = new 
> WebMarkupContainer("theContainer");
>                //generate a markup-id so the contents can be updated through 
> an AJAX call
>                listContainer.setOutputMarkupId(true);
>        listContainer.add(new 
> AjaxSelfUpdatingTimerBehavior(Duration.seconds(10)));
>                // add the list view to the container
>                listContainer.add(tableListPanel);
>                // finally add the container to the page
>        add(listContainer);
> //      add(tableListPanel);
>                }
>         IModel mailList =  new LoadableDetachableModel()
>     {
>                 protected Object load() {
>
> user.closePopServer();
> folder=user.openPopServer();
>                        return tableListPanel;
>                        }
>     };
> }
>
>
> Please help me...i'm really in trouble!
>
>
>
> Iman Rahmatizadeh wrote:
>>
>> The problem is with the way you fetch the messages, they are not loaded
>> again , just fetched from the same folder instance each time. I guess the
>> folder instance isnt updated between requests.
>>
>> On Fri, May 23, 2008 at 8:58 PM, Davidoff <[EMAIL PROTECTED]> wrote:
>>
>>>
>>> it just exists...it's in the code i posted
>>>
>>> IModel mailList =  new LoadableDetachableModel()
>>>     {
>>>                protected Object load() {
>>>
>>>                        user.openPopServer();
>>>                           try {
>>>                                        messages=folder.getMessages();
>>>                                } catch (MessagingException e) {
>>>                                        // TODO Auto-generated catch block
>>>
>>>                                        e.printStackTrace();
>>>                                }
>>>                        List mailList1=Arrays.asList(messages);
>>>                        return mailList1;
>>>                        }
>>>     };
>>>  }
>>>
>>> maybe the problem is that the new mails are not downloaded?!I've to start
>>> a
>>> new session or reconnect to the pop folder in some way (i think it just
>>> happens with folder.openPopServer() )??
>>>
>>>
>>> igor.vaynberg wrote:
>>> >
>>> > you should use a loadable detachable model for your listview, that way
>>> > it will work transparently.
>>> >
>>> > -igor
>>> >
>>> > On Fri, May 23, 2008 at 9:25 AM, Davidoff <[EMAIL PROTECTED]> wrote:
>>> >>
>>> >> this is code for the mail list (i implemented modal windows in order
>>> to
>>> >> show
>>> >> emails but JWebUnit tests returned errors then i have to find some
>>> other
>>> >> way
>>> >> to show mails...my priority now is to find the way to refresh the mail
>>> >> listview:
>>> >>
>>> >> public class  MailAccount extends WebPage {
>>> >>        private ModalWindow modal;
>>> >>        private Folder folder;
>>> >>        private User user;
>>> >>        private ListView listTable;
>>> >>        private List<Message> test;
>>> >>        private Message[] messages;
>>> >>        private Message msg;
>>> >>        private int index;
>>> >>        public MailAccount(String username, String password)
>>> >>    {
>>> >>        Manager manager=new Manager("AjaxUbiMailDB",1000);
>>> >>          user=manager.authenticate(username, password);
>>> >>                add(new Label("message","Hello " + user.firstName() +"
>>> "+
>>> >> user.lastName()));
>>> >>                Properties sysProperties = System.getProperties();
>>> >>                Session
>>> session=Session.getDefaultInstance(sysProperties,
>>> >> null);
>>> >>                session.setDebug(false);
>>> >>
>>> >>                folder=user.openPopServer();
>>> >>                try {
>>> >>
>>> >>                        add(new Label("contains","Your MailBox contains
>>> "+
>>> >> folder.getMessageCount() + " messages."));
>>> >>
>>> >>
>>> >>                } catch (MessagingException e) {
>>> >>                        // TODO Auto-generated catch block
>>> >>                        add(new Label("contains","Wrong Username or
>>> >> password"));
>>> >>                        System.out.println("Error on opening pop folder
>>> or
>>> >> something else");
>>> >>                        //e.printStackTrace();
>>> >>                }
>>> >>
>>> >>
>>> >>                initMailList();
>>> >>
>>> >>                WebMarkupContainer listContainer = new
>>> >> WebMarkupContainer("theContainer");
>>> >>                //generate a markup-id so the contents can be updated
>>> >> through an AJAX call
>>> >>                listContainer.setOutputMarkupId(true);
>>> >>                listContainer.add(new
>>> >> AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
>>> >>                // add the list view to the container
>>> >>                listContainer.add(listTable);
>>> >>                // finally add the container to the page
>>> >>                add(listContainer);
>>> >>                user.closePopServer();
>>> >>                modal = new ModalWindow("modal");
>>> >>                addOrReplace(modal);
>>> >>    }
>>> >>
>>> >>  public void initMailList(){
>>> >>        listTable=new ListView("listview",mailList)
>>> >>        {
>>> >>                private Folder folder=user.openPopServer();
>>> >>
>>> >>                public void populateItem(ListItem item)
>>> >>                       {
>>> >>                        try {
>>> >>                               final Message msg=(Message)
>>> >> item.getModelObject();
>>> >>                                                Address[]
>>> >> add=msg.getFrom();
>>> >>
>>> index=msg.getMessageNumber();
>>> >>                                            AjaxLink rate = new
>>> >> AjaxLink("mess") {
>>> >>                                                public void
>>> >> onClick(AjaxRequestTarget target) {
>>> >>
>>> >>
>>> >> GetMessage getMessage;
>>> >>
>>> >> getMessage = new GetMessage(modal.getContentId(), msg){};
>>> >>
>>> >> modal.setContent(getMessage);
>>> >>
>>> >> modal.setInitialHeight(600);
>>> >>
>>> >> modal.setInitialWidth(1000);
>>> >>
>>> >> modal.show(target);
>>> >>
>>> >> modal.setTitle("Mail View");
>>> >>
>>> >> }
>>> >>                                            };
>>> >>
>>> >> rate.add(new
>>> >> Label("prova",String.valueOf(msg.getMessageNumber())));
>>> >>
>>> >> item.add(rate);
>>> >>
>>> >> item.add(new AttributeAppender("class", true, new
>>> >> Model(index % 2 ==0 ? "odd": "even"), " "));
>>> >>
>>> >> item.add(new Label("subject",
>>> >> msg.getSubject().toString()));
>>> >>
>>> >> item.add(new Label("from", add[0].toString()));
>>> >>                                                                if
>>> >> (msg.getSentDate()!=null)
>>> >>
>>> >> item.add(new Label("date",
>>> >> msg.getSentDate().toString()));
>>> >>                                                                else
>>> >>
>>> >> item.add(new Label("date", "Nothing"));
>>> >>                                        } catch (MessagingException e)
>>> {
>>> >>
>>> System.out.println("Error
>>> >> populate item");
>>> >>                                                        //
>>> >> e.printStackTrace();
>>> >>                                }
>>> >>
>>> >>                       }
>>> >>                };
>>> >>        }
>>> >>         IModel mailList =  new LoadableDetachableModel()
>>> >>     {
>>> >>
>>> >>
>>> >>                protected Object load() {
>>> >>
>>> >>                        user.openPopServer();
>>> >>                           try {
>>> >>                                        messages=folder.getMessages();
>>> >>                                } catch (MessagingException e) {
>>> >>                                        // TODO Auto-generated catch
>>> block
>>> >>
>>> >>                                        e.printStackTrace();
>>> >>                                }
>>> >>                        List mailList1=Arrays.asList(messages);
>>> >>                        return mailList1;
>>> >>                        }
>>> >>     };
>>> >> }
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> igor.vaynberg wrote:
>>> >>>
>>> >>> On Fri, May 23, 2008 at 2:20 AM, Davidoff <[EMAIL PROTECTED]>
>>> wrote:
>>> >>>>
>>> >>>> I'm creating a simple webmail application: i've created a listview
>>> >>>> where
>>> >>>> the
>>> >>>> items are rows containing the number of the message, the subject and
>>> so
>>> >>>> on... my target is to reproduce what Gmail does: clicking on the
>>> number
>>> >>>> of a
>>> >>>> mail i wanto to read it's content, and clicking again i want to
>>> return
>>> >>>> to
>>> >>>> the list (the content collapses).How can i do this?
>>> >>>
>>> >>> include a hidden webmarkupcontainer which you then replace with some
>>> >>> other component that contains the mail content when the header is
>>> >>> clicked. replace it back with a webmarkupcontianer to collapse.
>>> >>>
>>> >>>> Second question: i created a list like this
>>> >>>>
>>> http://www.google.it/search?q=ajax+listview&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:it:official&client=firefox-a
>>> >>>> but even if i send emails to the address in list, the listview will
>>> not
>>> >>>> refresh(the messages are always the same).
>>> >>>
>>> >>> show us some code
>>> >>>
>>> >>> -igor
>>> >>>
>>> >>>> --
>>> >>>> View this message in context:
>>> >>>>
>>> http://www.nabble.com/Ajax-ListView-as-Gmail-tp17421986p17421986.html
>>> >>>> Sent from the Wicket - User 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]
>>> >>>
>>> >>>
>>> >>>
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >> http://www.nabble.com/Ajax-ListView-as-Gmail-tp17421986p17428158.html
>>> >> Sent from the Wicket - User 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]
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Ajax-ListView-as-Gmail-tp17421986p17430132.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Ajax-ListView-as-Gmail-tp17421986p17487871.html
> Sent from the Wicket - User 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