avatarImg = new Image("images/default_avatar.png");
avatarImg.setWidth("32px");
avatarImg.setHeight("32px");
avatarImg.setStyleName("handler");
avatarImg.addClickListener(new ClickListener()
{
public void onClick(Widget sender)
{
JabberApp.instance().showInfoSelf();
}
});
nickName = new Label(nick);
nickName.setDirection(Direction.LTR);
nickName.setWidth("100%");
statusLabel = new Label();
statusLabel.setStyleName("status_label");
statusLabel.setWidth("100%");
statusEditor = new TextBox();
statusEditor.setVisible(false);
statusEditor.setWidth("100%");
statusButton = new Button();
statusButton.setMenu(statusMenu);
statusButton.setStyleName("Status-Menu-Button");
//statusMenuLabel = new Label();
//statusMenuLabel.setStyleName("status_menu_label");
//addLink(new HTML("<a href=\"http://samespace.anzsoft.com\">SameSpace</a>"));
// Add the title and some images to the title bar
HorizontalPanel titlePanel = new HorizontalPanel();
titlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
titlePanel.setWidth("100%");
titlePanel.setSpacing(3);
VerticalPanel statusPanel = new VerticalPanel();
statusPanel.setWidth("100%");
statusPanel.add(nickName);
HorizontalPanel hPanel = new HorizontalPanel();
hPanel.setWidth("100%");
hPanel.setSpacing(2);
hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
hPanel.add(statusLabel);
hPanel.add(statusEditor);
hPanel.add(statusButton);
statusPanel.add(hPanel);
titlePanel.add(statusImg);
titlePanel.add(statusPanel);
titlePanel.add(avatarImg);
titlePanel.setCellWidth(statusImg, "20px");
titlePanel.setCellWidth(statusPanel, "100%");
titlePanel.setCellWidth(avatarImg, "32px");
setTitleWidget(titlePanel);
JabberApp.instance().getSession().getUser().addUserListener(new XmppUserListener()
{
public void onPresenceChanged(XmppPresence presence)
{
String show = new String("");
PresenceShow presenceShow = presence.getShow();
if(presenceShow!=null)
show = presenceShow.toString();
String statusString = presence.getStatus();
int priority = presence.getPriority();
boolean avaiable = true;
String type = presence.getType();
if(type != null&&!type.isEmpty())
{
if(type.equalsIgnoreCase("unavailable"))
avaiable = false;
}
status = new XmppContactStatus(show,statusString,priority,avaiable);
statusLabel.setText(status.status());
iconFromStatus(status).applyTo(statusImg);
}
});
statusLabel.addClickListener(new ClickListener()
{
public void onClick(Widget sender)
{
statusLabel.setVisible(false);
statusEditor.setVisible(true);