@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}; } }