if (j > 0) {
text.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
text.addComponent(new MyTextArea(m.substring(0, j), 0,j));
}
j = j + 5;
Button link = new Button(m.substring(j, k));
link.getStyle().setBgTransparency(100);
link.getStyle().setBorder(Border.createEmpty()); //no border
link.addActionListener(new ButtonActionListener());
text.addComponent(link); k = k + 5;
if (k < m.length()-1)
text.addComponent(new MyTextArea(m.substring(k, m.length()), 0, 100));
}
else if (j == -1 && p == -1) {
//txt.setText(m);
MyTextArea t = new MyTextArea(m, 0,50);
t.setEnabled(true);
text.addComponent(t);
}
conversationForm.addComponent(text);
}
//if it is multi chat
if (currentConversation.isMulti) {
//conversationForm.append(new util.CustomSpacer(conversationForm.getWidth()));
// res.append("Room Members: ");
Container multi = new Container();
multi.setLayout(new BorderLayout());
multi.addComponent(BorderLayout.NORTH,new MyLabel("Room Members:"));
GroupChat chat = (GroupChat)Datas.multichat.get(currentConversation.name);
//conversationForm.append(new util.CustomStringItem("Room Members:", /*chat.jids,*/ conversationForm.getWidth()));
Container friends = new Container();
for (int j=0; j<chat.jids.size(); j++){
String temp = (String)chat.jids.elementAt(j);
if (temp.equals(currentConversation.name))
continue;
else if (temp.indexOf('@') != -1)
friends.addComponent(new Label(temp.substring(0, temp.indexOf('@'))));
else
friends.addComponent(new Label(temp));
}
multi.addComponent(BorderLayout.CENTER, friends);
//conversationForm.append(new util.CustomSpacer(conversationForm.getWidth()));
TextField tf1 = new TextField(Contents.invite_textbox, 64);
//mainForm.addCommand(Contents.invite);
infopool.put("invite", tf1);
multi.addComponent(BorderLayout.SOUTH, tf1);
conversationForm.addComponent(multi);
}
Button his = new Button("Show History");
his.getStyle().setBgTransparency(100);
his.getStyle().setBorder(Border.createEmpty());
his.addActionListener(new ButtonActionListener());
conversationForm.addComponent(his);
//his.addCommand(Contents.history);
//TODO: se mettessimo un tastino send sotto la textarea?
mainForm.addCommand(Contents.send, 0);