@Override public void getObject(String id) { IDepartmentBN departmentBN = Lookup.getDefault().lookup(IDepartmentBN.class); Department department = departmentBN.getByObjectId(id); if (department != null) { DepartmentExt_W43 bean = dao.getByObjectId(String.valueOf(department.getId())); tableSB32.setValueAt(bean.getSumMoneyImport(), 0, 1); tableSB32.setValueAt(bean.getSumMoneyExport(), 0, 3); tableSB32.setValueAt(bean.getSumprofit(), 1, 1); tableSB32.setValueAt(bean.getProportionProfit(), 1, 3); tableSB32.setValueAt(" ", 2, 1); tableSB32.setValueAt(" ", 2, 3); } }
@Override protected void addNotify() { if (enterprise != null) { list = departmentBN.filterDepartmentByEnterprise(enterprise); super.addNotify(); Vector instr = new Vector(); for (int i = 0; i < list.size(); i++) { if (list.get(i).getDepartmentParent().equals(department.getDepartmentName())) { Department department1 = new Department(); department1.setDepartmentName(list.get(i).getDepartmentName()); department1.setPersonID(list.get(i).getPersonID()); department1.setEnterpriseID(list.get(i).getEnterpriseID()); department1.setDepartmentParent(list.get(i).getDepartmentParent()); instr.addElement(department1); } } Object[] departments = new Object[instr.size() + 1]; departments[0] = new Department("", department.getDepartmentName(), "", "", "", ""); for (int i = 1; i <= instr.size(); i++) { departments[i] = (Department) instr.elementAt(i - 1); } setKeys(departments); } }
@Override protected Node[] createNodes(Object key) { final Department department1 = (Department) key; // Node rootNode = new AbstractNode(new // PersonChildren(person1,enterprise),Lookups.singleton(department1)); if (department1.getEnterpriseID().equals("")) { Node rootNode = null; rootNode = new AbstractNode( new PersonParent(department1, enterprise), Lookups.singleton(department1)); rootNode.setDisplayName("Person"); return new Node[] {rootNode}; } else { Node result = new AbstractNode( new DepartmentChildren(department1, enterprise), Lookups.singleton(department1)) { @Override protected Sheet createSheet() { Sheet sheet = Sheet.createDefault(); Sheet.Set set = Sheet.createPropertiesSet(); Property giamDocProperty = new PropertySupport.ReadOnly<String>( Giamdoc_PROPERTY, String.class, "Trưởng phòng", "aaa") { @Override public String getValue() throws IllegalAccessException, InvocationTargetException { return department1.getPersonID(); } @Override public PropertyEditor getPropertyEditor() { return new PropertyEditorSupport(); } }; set.put(giamDocProperty); Property congTyMeProperty = new PropertySupport.ReadOnly<String>( Congtyme_PROPERTY, String.class, "Công ty", "bbb") { @Override public String getValue() throws IllegalAccessException, InvocationTargetException { return department1.getEnterpriseID(); } @Override public PropertyEditor getPropertyEditor() { return new PropertyEditorSupport(); } }; set.put(congTyMeProperty); sheet.put(set); return sheet; } }; result.setDisplayName(department1.getDepartmentName()); return new Node[] {result}; } }