List of usage examples for com.vaadin.ui Label setContentMode
public void setContentMode(ContentMode contentMode)
From source file:VaadinIRC.GUI.channelGUI.java
License:Open Source License
/** * Adds standard channel message to the channel textarea. Repaints the panel and scrolls to bottom. * @param username Message sender's nickname. * @param newMessage Message to be sent. *///from w w w . java2s . c o m public void addStandardChannelMessage(String username, String newMessage) { channelMessages++; if (channelMessages > settings.MAX_CHANNEL_MESSAGES) { panelMessages.removeAllComponents(); channelMessages = 0; } newMessage = IRCHelper.removeTags(newMessage); newMessage = IRCHelper.convertURLsToHTMLLinks(newMessage); newMessage = IRCHelper.formatIRCTextToHTML(newMessage); Label label = new Label(IRCHelper.getTimestamp(false) + "<b>" + username + "</b> " + newMessage); label.setContentMode(Label.CONTENT_RAW); label.setWidth(550, Sizeable.UNITS_PIXELS); panelMessages.addComponent(label); // Scroll messages panel to bottom message panelMessages.setScrollTop(Short.MAX_VALUE); panelMessages.requestRepaint(); ircInterface.setNewActivityToTab(channelName); ircInterface.pushChangesToClient(); }
From source file:VaadinIRC.GUI.channelGUI.java
License:Open Source License
/** * Adds new message to the channel textarea, repaints the panel and scrolls to bottom. * @param newMessage Message to be added. *///from w ww.j av a2s .c om public void addMessageToChannelTextarea(String newMessage) { channelMessages++; if (channelMessages > settings.MAX_CHANNEL_MESSAGES) { panelMessages.removeAllComponents(); System.out.println("Removing all labels!!!"); channelMessages = 0; } newMessage = IRCHelper.removeTags(newMessage); newMessage = IRCHelper.convertURLsToHTMLLinks(newMessage); Label label = new Label(IRCHelper.getTimestamp(false) + newMessage); label.setContentMode(Label.CONTENT_RAW); label.setWidth(100, Sizeable.UNITS_PERCENTAGE); panelMessages.addComponent(label); // Scroll messages panel to bottom message panelMessages.setScrollTop(Short.MAX_VALUE); panelMessages.requestRepaint(); ircInterface.setNewActivityToTab(channelName); ircInterface.pushChangesToClient(); }