public void onClick$btn_export() throws InterruptedException { try { Listbox listBox = new Listbox(); Listhead listHeader = new Listhead(); for (Object o : lb_user_org_list.getChildren()) { if (o instanceof Listhead) { Listhead head = (Listhead) o; for (Object o1 : head.getChildren()) { if (o1 instanceof Listheader) { Listheader header = (Listheader) o1; Listheader newHeader = new Listheader(header.getLabel()); newHeader.setParent(listHeader); } } listHeader.setParent(listBox); } } listBox.setModel( new ListModelList(userOrgManager.getUserOrgListByID(bb_user_org.getValue()))); ExportUtil.exportToExcel( globalUtils.getGlobalPropValue(Commons.SCREEN_USER_ORG_SEARCH), listBox); } catch (Exception e) { e.printStackTrace(); GlobalUtils.showMessage( globalUtils.getMessagePropValue(Commons.ERR_MSG_EXPORT), globalUtils.getGlobalPropValue(Commons.MSG_HEADER_ERROR), Messagebox.OK, Messagebox.ERROR); } }
@SuppressWarnings("unchecked") public void onClick$btn_delete() throws InterruptedException { selectedOrgSet = lb_user_org_list.getSelectedItems(); if (selectedOrgSet.isEmpty()) { GlobalUtils.showMessage( globalUtils.getMessagePropValue(Commons.ERR_MSG_USER_ORG_NO_SELECTED), globalUtils.getMessagePropValue(Commons.MSG_HEADER_DELETE), Messagebox.OK, Messagebox.EXCLAMATION); return; } Messagebox.show( MessageFormat.format( globalUtils.getMessagePropValue(Commons.MSG_USER_ORG_DELETE_PROMPT_MULTI), selectedOrgSet.size()), globalUtils.getMessagePropValue(Commons.MSG_HEADER_DELETE), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION, new EventListener() { @Override public void onEvent(Event evt) throws Exception { switch (((Integer) evt.getData()).intValue()) { case Messagebox.OK: Set<String> userOrgSet = new HashSet<String>(); for (Listitem item : selectedOrgSet) { String userOrg = (String) item.getValue(); userOrgSet.add(userOrg); } int deletedUsers = deleteSelectedUserOrg(userOrgSet); GlobalUtils.showMessage( MessageFormat.format( globalUtils.getMessagePropValue(Commons.MSG_USER_ORG_DELETE_MULTI), deletedUsers, (userOrgSet.size() - deletedUsers)), globalUtils.getMessagePropValue(Commons.MSG_HEADER_DELETE), Messagebox.OK, Messagebox.INFORMATION); break; case Messagebox.CANCEL: // Do nothing break; } } }); }