private void showMessageList(View parent) { if (m_popupMessageList == null) { // 消息列表初始化 m_popupMessageList = new MessageListPopup(btnConsultMessage.getRootView(), getApplicationContext(), this); } m_popupMessageList.refreshList(m_MessageQueue.getMessages(), m_MessageQueue.getClientIds()); m_popupMessageList.setFocusable(true); m_popupMessageList.show(); }
@Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); if (mapShow != null) { mapShow.dispose(); } if (m_MessageQueue != null) { m_MessageQueue.stopReceive(); } if (m_popupMessageList != null) { m_popupMessageList.dismiss(); } if (m_popupMultiMedia != null) { m_popupMultiMedia.dismiss(); } if (m_popupTextMessage != null) { m_popupTextMessage.dismiss(); } if (m_TencentLocation != null) { m_TencentLocation.dispose(); } }
private int fetchMessages(MessageListPopup popup) { List<Message> messages = messageCenter.getMessages(); popup.getMessageList().setRowCount(messages.size(), true); popup.getMessageList().setRowData(0, messages); return messages.size(); }
private void showDetail(final Message msg) { msg.setNew(false); final DefaultWindow window = new DefaultWindow(Console.CONSTANTS.common_label_messageDetailTitle()); window.setWidth(480); window.setHeight(360); window.setGlassEnabled(true); // ImageResource icon = MessageCenterView.getSeverityIcon(msg.getSeverity()); // AbstractImagePrototype prototype = AbstractImagePrototype.create(icon); SafeHtmlBuilder html = new SafeHtmlBuilder(); // TODO: XSS prevention? html.appendHtmlConstant(msg.getSeverity().getTag()); html.appendHtmlConstant(" "); html.appendHtmlConstant(msg.getFired().toString()); html.appendHtmlConstant("<h3 id='consise-message'>"); html.appendHtmlConstant(msg.getConciseMessage()); html.appendHtmlConstant("</h3>"); html.appendHtmlConstant("<p/>"); String detail = msg.getDetailedMessage() != null ? msg.getDetailedMessage() : ""; html.appendHtmlConstant( "<pre style='font-family:tahoma, verdana, sans-serif;' id='detail-message'>"); html.appendHtmlConstant(detail); html.appendHtmlConstant("</pre>"); final HTML widget = new HTML(html.toSafeHtml()); widget.getElement().setAttribute("style", "margin:5px"); DialogueOptions options = new DialogueOptions( "OK", new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { window.hide(); } }, Console.CONSTANTS.common_label_cancel(), new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { window.hide(); } }); options.getSubmit().setAttribute("aria-describedby", "consise-message detail-message"); Widget windowContent = new WindowContentBuilder(widget, options).build(); TrappedFocusPanel trap = new TrappedFocusPanel(windowContent) { @Override protected void onAttach() { super.onAttach(); Scheduler.get() .scheduleDeferred( new Scheduler.ScheduledCommand() { @Override public void execute() { getFocus().onFirstButton(); } }); } }; window.setWidget(trap); window.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { messagePopup.getMessageList().getSelectionModel().setSelected(msg, false); messagePopup.hide(); } }); messagePopup.hide(); window.center(); }