public MessageFrame getMessageFrame() { try { MessageFrame view = Vovo.getViewManager().getView(Constants.ViewKey.MESSAGEFRAME.toString()); // if (view == null) { view = Vovo.getViewManager() .createView(MessageFrame.class, Constants.ViewKey.MESSAGEFRAME.toString()); MessageTabPanel createView = Vovo.getViewManager() .createView(MessageTabPanel.class, Constants.ViewKey.MESSAGETABPANEL.toString()); view.add(createView); LoginInfo loginInfo = Vovo.getMyContext().getDataManager().getValue(Constants.DataKey.LOGGININFO.toString()); // UserInfoUtil.setProperty("", value) String tabPlacement = UserInfoUtil.getProperty(loginInfo.getUsername(), "TabPlacement"); if (tabPlacement == null || tabPlacement.equals("")) { tabPlacement = "2"; UserInfoUtil.setProperty(loginInfo.getUsername() + "_TabPlacement", tabPlacement); } createView.getMainTabbedPane().setTabPlacement(Integer.parseInt(tabPlacement)); view.setLocationRelativeTo(null); } return view; } catch (Exception e) { log.error("ChatController static", e); JOptionPane.showMessageDialog( null, "init msg frame error", "error", JOptionPane.ERROR_MESSAGE); } return null; }
public FriendChatPanel getFriendChatPanel(MemberBean bean) { String sessionID = getSessionID(bean.getId()); MessageTabPanel tabPanel = context.getViewManager().getView(Constants.ViewKey.MESSAGETABPANEL.toString()); FriendChatPanel panel = (FriendChatPanel) tabPanel.getTab(sessionID); if (panel == null) { panel = new FriendChatPanel(); panel.setInfo(bean); // ImageIcon icon = new // ImageIcon(getClass().getResource("/com/lorent/vovo/resource/images/systemheads/default40.png")); tabPanel.addTab(panel, bean, sessionID); } else { tabPanel.setNoticeTab(sessionID); } return panel; }
public boolean canRemoveMsgFrame() throws Exception { MessageTabPanel tab = Vovo.getViewManager().getView(Constants.ViewKey.MESSAGETABPANEL.toString()); Set<String> sessionIDs = tab.getAllSessionIDs(); return canRemovePanel(StringUtil.parseSetToArray(sessionIDs, String.class)); }