public ContextMenuImage() { add = new AbstractAction(UIUtils.i18n.getLanguage("rmenu.add", false), ImageUtils.PLUS_16) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent ae) { // list.remove(index); } }; edit = new AbstractAction(UIUtils.i18n.getLanguage("rmenu.edit", false), ImageUtils.EDIT_16) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent ae) { // list.remove(index); } }; delete = new AbstractAction(UIUtils.i18n.getLanguage("rmenu.delete", false), ImageUtils.DELETE_16) { private static final long serialVersionUID = 1L; @Override @SuppressWarnings("unchecked") public void actionPerformed(ActionEvent ae) { ImageListModel<IImage> model = (ImageListModel<IImage>) list.getModel(); model.removeElement(iimage); } }; menu.add(add); menu.add(edit); menu.addSeparator(); menu.add(delete); }
/** 初始化List事件等等动作 */ private void initMemberList() { final WebPopupMenu memberPopup = new WebPopupMenu(); WebMenuItem openChatItem = new WebMenuItem("发送消息"); WebMenuItem userDetailsItem = new WebMenuItem("查看资料"); WebMenuItem refreshListItem = new WebMenuItem("刷新列表"); WebMenuItem refreshFaceItem = new WebMenuItem("刷新头像"); memberPopup.add(openChatItem); memberPopup.addSeparator(); memberPopup.add(userDetailsItem); memberPopup.addSeparator(); memberPopup.add(refreshListItem); memberPopup.addSeparator(); memberPopup.add(refreshFaceItem); memberPopup.addSeparator(); memberList.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { checkSendSessionMsg(); } else if (e.isMetaDown()) { memberPopup.show(e.getComponent(), e.getX(), e.getY()); } } }); openChatItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { checkSendSessionMsg(); } }); userDetailsItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { WebOptionPane.showMessageDialog(UIGroupMemberModule.this, "No Implements!!!"); } }); refreshListItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (namedObject != null) { updateMembers(namedObject); } } }); refreshFaceItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (namedObject != null) { updateFaces(namedObject); } } }); }