Re: Ajax ListView as Gmail

2008-05-30 Thread Davidoff
public Component getLazyLoadComponent(String id)
{
// sleep for 1 second to show the behavior
try
{
Thread.sleep(1000);
}
catch (InterruptedException e)
{
throw new RuntimeException(e);
}
return new Label(id, );
}

};
lazzzy.setOutputMarkupId(true);
lazzzy.add(new
AjaxSelfUpdatingTimerBehavior(Duration.seconds(20)));
add(listContainer);
add(lazzzy);
add(contains);
add(modal);
add(errorPanel);
}

} 


another question... there is some way to let JWebUnit tests work with Wicket
modal Windows?


igor.vaynberg wrote:
 
 you have to use a detachable model for your label. i suggest you read
 the models wiki page
 
 -igor
 
 On Thu, May 29, 2008 at 9:24 AM, Davidoff [EMAIL PROTECTED] wrote:

 finally i had an answer to my questions... was an email handling
 issue...but
 the problems are far to finish, then now i've a listview that refreshes
 dinamically, but a label i've put with the number of messages doesn't
 refresh its content...this is the code as you can see:

 public class AccountPage extends WebPage{

private Manager manager;
private User user;
private Folder folder;
private ModalWindow modal;
private Store store;
private Label contains;

public AccountPage(final String username,final String password)
 throws MessagingException{
manager=new Manager(AjaxUbiMailDB,1000);
user=manager.authenticate(username, password);
add(new Label(hello,Hello + user.firstName() +   +
 user.lastName()));

IModel mailList =  new LoadableDetachableModel()
{
protected Object load(){

Message[] messages=null;
try {
if (folder==null )
{
folder=user.openPopServer();
}

else if (folder.isOpen())
{
folder.close(false);

folder=user.openPopServer();


}
contains=new
 Label(contains,+folder.getMessageCount());

addOrReplace(contains);
   
 messages=folder.getMessages();
} catch (MessagingException e) {
// TODO Auto-generated
 catch block
e.printStackTrace();
}
  ListMessage messagesList=Arrays.asList(messages);
   return messagesList;
   }
};
  modal=new ModalWindow(modal);
   ListView listTable=new ListView(listView,mailList)
{

private int index;
   public void populateItem(ListItem item)
   {
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

Re: Ajax ListView as Gmail

2008-05-29 Thread Davidoff
);
//
e.printStackTrace();
}
   
   

   }
};
  

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(20)));
// add the list view to the container
listContainer.add(listTable);
// finally add the container to the page

add(listContainer);
add(modal);
   
}


AccountPage.html

!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;
html xmlns:wicket=http://wicket.apache.org/;
head
style type=text/css
 .odd { background-color: #FFE0E0 }
 .even { background-color: #E0E0FF }
/style
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
titleAjax UbiMail/title
/head
body
h1Ajax UbiMail/h1
br



table wicket:id=theContainer width=100%
tr
th#/th
thSubject/th
thSender/th
thDate/th
/tr
tr wicket:id=listView
td #  /td
td/td
td/td
td/td
/tr
/table
div wicket:id=modal/div
/body
/html


the label contains doesn't refresh its content: the number of messages is
still the number given at first( when the page loades)
What's the matter with this?


Davidoff wrote:
 
 yes, i think is a email handling issue, because the ajax calls that i see
 through the wicket ajax debug window gives the right response.
 
 
 igor.vaynberg wrote:
 
 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 nothingi send emails but no new email results on the
 tablesee the code:

 MailList.java

 public class MailList extends Panel implements Serializable {

private ListView listTable;
private ModalWindow modal;
private Message[] messages;
private ListMessage 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

Re: Ajax ListView as Gmail

2008-05-27 Thread Davidoff

yes, i think is a email handling issue, because the ajax calls that i see
through the wicket ajax debug window gives the right response.


igor.vaynberg wrote:
 
 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 nothingi send emails but no new email results on the
 tablesee the code:

 MailList.java

 public class MailList extends Panel implements Serializable {

private ListView listTable;
private ModalWindow modal;
private Message[] messages;
private ListMessage 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

Ajax ListView as Gmail

2008-05-23 Thread Davidoff

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 its content, and clicking again i want to return to the
list (the content collapses).How can i do this?

Second question: i created a list like this
http://www.google.it/search?q=ajax+listviewie=utf-8oe=utf-8aq=trls=org.mozilla:it:officialclient=firefox-a
  
but even if i send emails to the address in list, the listview will not
refresh(the messages are always the same).
-- 
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]



Re: Ajax ListView as Gmail

2008-05-23 Thread Davidoff

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+listviewie=utf-8oe=utf-8aq=trls=org.mozilla:it:officialclient=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]



Re: Ajax ListView as Gmail

2008-05-23 Thread Davidoff

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 ListMessage 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

Re: Html mail representation

2008-05-21 Thread Davidoff
(StandardHostValve.java:128)   
 
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)   
 
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)Complete
stack:org.apache.wicket.WicketRuntimeException: Error attaching this
container for rendering: [Page class = ajaxubimail.index.MailAccount, id =
7, version = 0] at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1601)

at org.apache.wicket.Component.onBeforeRender(Component.java:3681) at
org.apache.wicket.Page.onBeforeRender(Page.java:1416) at
org.apache.wicket.Component.internalBeforeRender(Component.java:1002) at
org.apache.wicket.Component.beforeRender(Component.java:1034) at
org.apache.wicket.Component.prepareForRender(Component.java:2158) at
org.apache.wicket.Page.renderPage(Page.java:885) at
org.apache.wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:163)

at
org.apache.wicket.request.target.component.PageRequestTarget.respond(PageRequestTarget.java:58)

at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)

at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172)  
  
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243) at
org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331) at
org.apache.wicket.RequestCycle.request(RequestCycle.java:493) at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:363)


I've partially resolved the question putting in the ListView constructor the
lines
if (!folder.isOpen)
   folder.open(Folder.READ_ONLY);

but the system is really slow to download all emails because opens and
closes folder for each message in it
How can i simplify this?

Excuse me for my poor English... :)


jwcarman wrote:
 
 How are you spitting out the contents of the mail?  Are you using a
 stream of some sort?  Are you forgetting to flush/close the stream?
 
 On Tue, May 20, 2008 at 6:45 AM, Davidoff [EMAIL PROTECTED] wrote:

 wonderful...the problem now is that some mail do not render
 completely...i
 don't see any tags now, i see the rendered mail, but some mails are half
 rendered, maybe a part of these contain text/plain?

 Michael Sparer wrote:

 i mean label.setEscapeModelStrings(false) ;-)

 Michael Sparer wrote:

 try label.setEscapeModelStrings(true)


 Davidoff wrote:

 I'm developing a simple webmail application...i want to render in HTML
 what is in a MIME multipart message...now here is the code:

 GetMessage.java

 public abstract class GetMessage extends Panel {
 private MultiLineLabel text;
 private String type;

 public GetMessage(String id,Message msg,int index) throws
 MessagingException, IOException {
 super(id);
 add(new Label(num,String.valueOf(index)));
 add(new Label(sub,msg.getSubject().toString()));
 add(new Label(sender,msg.getFrom()[0].toString()));
 add(new Label(dat,msg.getSentDate().toString()));

 Object content = msg.getContent();

  if( content instanceof String){
 text=new MultiLineLabel(content,content.toString());


  }else{
   Multipart multi = (Multipart)content;
for(int j=0; jmulti.getCount(); ++j){
BodyPart part = multi.getBodyPart(j);
type = part.getContentType();
 content = part.getContent();
  if( content instanceof String){
text=new MultiLineLabel(content, content.toString());
 }
  }
  }
 add(text);
 add(new Label(prova1,type));

 }
 }

 GetMessage.html

 wicket:panel

 table
 trth#/thtd class=even wicket:id=num/td/tr
 trthSubject/thtd class=odd wicket:id=sub/td/tr
 trthSender/thtd class=even wicket:id=sender/td/tr
 trthDate/thtd class=odd wicket:id=dat/td/tr
 trtd colspan=2div wicket:id=content/div/td/tr
 /table

 LAbel
 /wicket:panel


 The problem is the MultiLineLabel shows  not the HTML resulting
 rendering, but the HTML code itself!
 My target is to render the html code that is in the content.toString()






 --
 View this message in context:
 http://www.nabble.com/Html-mail-representation-tp17337174p17337580.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

Re: Html mail representation

2008-05-21 Thread Davidoff

i did it...was simple!I had to declare Folder folder field in ListView
Constructor...
now the systems opens the mails, but the problem is it not opens non-HTML
mails...How can i do the trick?

Davidoff wrote:
 
 i resolved that problem...i put a label instead of
 MultiLineLabel...thanks.
 Now i want optimize the opening of the email.
 
 MailAccount.java
 
 package ajaxubimail.index;
 
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
 
 import javax.mail.Address;
 import javax.mail.Folder;
 import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.Session;
 import javax.mail.Store;
 import javax.mail.internet.InternetAddress;
 
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.behavior.AttributeAppender;
 import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 
 
 
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.markup.repeater.data.IDataProvider;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.LoadableDetachableModel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.util.time.Duration;
 
 import UbiMail.Manager;
 import UbiMail.User;
 
 public class  MailAccount extends WebPage {
   private ModalWindow modal;
   private Message msg;
   private int index;
   public MailAccount(String username, String password) throws
 MessagingException, IOException
 {
   Manager manager=new Manager(AjaxUbiMailDB,1000);
 User 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);
   /*  Store store = session.getStore(pop3); 
   if (user.popServer()==in.virgilio.it)
   store.connect(user.popServer(), user.popUser() + @virgilio.it,
 user.popPass());
   else
   store.connect(user.popServer(), user.popUser(), 
 user.popPass());
 final Folder folder = store.getFolder(INBOX); 
folder.open(Folder.READ_ONLY); 
add(new Label(contains,Your MailBox contains +
 folder.getMessageCount()));
  Message[] messages = folder.getMessages();
 */
   Folder folder=user.openPopServer();
 Message[] messages=   folder.getMessages();
  ListMessage test=Arrays.asList(messages);
  modal = new ModalWindow(modal);
 ListView listTable=new ListView(listview,test)  
 {
   
 
 
   /**
* 
*/
   private static final long serialVersionUID = 1L;
 
   public void populateItem(ListItem item)
{
   try {
   //  if (!folder.isOpen())
   //  
 folder.open(Folder.READ_ONLY);
   final Message msg=(Message) item.getModelObject();
   Address[] add=msg.getFrom();
  index=msg.getMessageNumber();
   AjaxLink rate = new AjaxLink(mess) {
  
 
   /**
* 
*/
   private static final 
 long serialVersionUID = 1L;
 
   public void 
 onClick(AjaxRequestTarget target) {
   
   try {
   
 GetMessage getMessage;
   
 getMessage = new GetMessage(modal.getContentId(), msg, index){
 
   
 /**
   
  * 
   
  */
   
 private static final long serialVersionUID = 1L

Html mail representation

2008-05-20 Thread Davidoff

I'm developing a simple webmail application...i want to render in HTML what
is in a MIME multipart message...now here is the code:

GetMessage.java

public abstract class GetMessage extends Panel {
private MultiLineLabel text;
private String type;

public GetMessage(String id,Message msg,int index) throws
MessagingException, IOException {
super(id);
add(new Label(num,String.valueOf(index)));
add(new Label(sub,msg.getSubject().toString()));
add(new Label(sender,msg.getFrom()[0].toString()));
add(new Label(dat,msg.getSentDate().toString()));

Object content = msg.getContent();
 
 if( content instanceof String){
text=new MultiLineLabel(content,content.toString());


 }else{
  Multipart multi = (Multipart)content;
   for(int j=0; jmulti.getCount(); ++j){
   BodyPart part = multi.getBodyPart(j);
   type = part.getContentType();
content = part.getContent();
 if( content instanceof String){
   text=new MultiLineLabel(content, content.toString());
}
 }
 }
add(text);
add(new Label(prova1,type));

}
}

GetMessage.html

wicket:panel

table
trth#/thtd class=even wicket:id=num/td/tr
trthSubject/thtd class=odd wicket:id=sub/td/tr
trthSender/thtd class=even wicket:id=sender/td/tr
trthDate/thtd class=odd wicket:id=dat/td/tr
trtd colspan=2div wicket:id=content/div/td/tr
/table

LAbel
/wicket:panel


The problem is the MultiLineLabel shows  not the HTML resulting rendering,
but the HTML code itself!
My target is to render the html code in the content.toString()
-- 
View this message in context: 
http://www.nabble.com/Html-mail-representation-tp17337174p17337174.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]



Re: Html mail representation

2008-05-20 Thread Davidoff

wonderful...the problem now is that some mail do not render completely...i
don't see any tags now, i see the rendered mail, but some mails are half
rendered, maybe a part of these contain text/plain?

Michael Sparer wrote:
 
 i mean label.setEscapeModelStrings(false) ;-)
 
 Michael Sparer wrote:
 
 try label.setEscapeModelStrings(true)
 
 
 Davidoff wrote:
 
 I'm developing a simple webmail application...i want to render in HTML
 what is in a MIME multipart message...now here is the code:
 
 GetMessage.java
 
 public abstract class GetMessage extends Panel {
 private MultiLineLabel text;
 private String type;
 
 public GetMessage(String id,Message msg,int index) throws
 MessagingException, IOException {
 super(id);
 add(new Label(num,String.valueOf(index)));
 add(new Label(sub,msg.getSubject().toString()));
 add(new Label(sender,msg.getFrom()[0].toString()));
 add(new Label(dat,msg.getSentDate().toString()));
 
 Object content = msg.getContent();
  
  if( content instanceof String){
 text=new MultiLineLabel(content,content.toString());
 
 
  }else{
   Multipart multi = (Multipart)content;
for(int j=0; jmulti.getCount(); ++j){
BodyPart part = multi.getBodyPart(j);
type = part.getContentType();
 content = part.getContent();
  if( content instanceof String){
text=new MultiLineLabel(content, content.toString());
 }
  }
  }
 add(text);
 add(new Label(prova1,type));
 
 }
 }
 
 GetMessage.html
 
 wicket:panel
 
 table
 trth#/thtd class=even wicket:id=num/td/tr
 trthSubject/thtd class=odd wicket:id=sub/td/tr
 trthSender/thtd class=even wicket:id=sender/td/tr
 trthDate/thtd class=odd wicket:id=dat/td/tr
 trtd colspan=2div wicket:id=content/div/td/tr
 /table
 
 LAbel
 /wicket:panel
 
 
 The problem is the MultiLineLabel shows  not the HTML resulting
 rendering, but the HTML code itself!
 My target is to render the html code that is in the content.toString()
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Html-mail-representation-tp17337174p17337580.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]