@SuppressWarnings("unchecked") private void setTooltip(ClinicalCorrespondenceVo vo) { if (vo != null && vo.getStatusHistoryIsNotNull() && vo.getStatusHistory().size() > 0) { CorrespondenceStatusVoCollection collVo = vo.getStatusHistory(); if(collVo != null) { ArrayList collActions = getArrayList(collVo); Collections.sort(collActions, new ActionsComparator()); copyArrayListIntoColl(collVo, collActions); StringBuffer tooltip = new StringBuffer(); for (int i = 0; i < collVo.size(); i++) { tooltip.append(new Textile().process("**"+(i+1)+". "+ collVo.get(i).getCorrespondenceStatus().getText() +"**"+"\n"+ collVo.get(i).getAuthoringInformation().getCreationUser()+" "+ collVo.get(i).getAuthoringInformation().getCreationDateTime())); } form.lyrDetails().tabRecipents().imbStatus().setTooltip(tooltip.toString()); } } else form.lyrDetails().tabRecipents().imbStatus().setTooltip(null); }
private ArrayList getArrayList(Object obj) { ArrayList<CorrespondenceStatusVo> list = new ArrayList<CorrespondenceStatusVo>(); if (obj instanceof CorrespondenceStatusVoCollection) { CorrespondenceStatusVoCollection coll = (CorrespondenceStatusVoCollection)obj; for (int i = 0; i < coll.size(); i++) { list.add(coll.get(i)); } } return list; }
private void copyArrayListIntoColl(Object obj, ArrayList collActions) { if (obj instanceof CorrespondenceStatusVoCollection) { CorrespondenceStatusVoCollection coll = (CorrespondenceStatusVoCollection)obj; coll.clear(); for (int i = 0; collActions != null && i < collActions.size(); i++) { coll.add((CorrespondenceStatusVo)collActions.get(i)); } } }