Exemplo n.º 1
0
 private void updateModel(CnATreeElement importRootObject, List<CnATreeElement> changedElement) {
   if (changedElement != null && changedElement.size() > 9) {
     // if more than 9 elements changed or added do a complete reload
     CnAElementFactory.getInstance().reloadModelFromDatabase();
   } else {
     if (importRootObject != null) {
       CnAElementFactory.getModel(importRootObject)
           .childAdded(importRootObject.getParent(), importRootObject);
       CnAElementFactory.getModel(importRootObject).databaseChildAdded(importRootObject);
       if (changedElement != null) {
         for (CnATreeElement cnATreeElement : changedElement) {
           CnAElementFactory.getModel(cnATreeElement)
               .childAdded(cnATreeElement.getParent(), cnATreeElement);
           CnAElementFactory.getModel(cnATreeElement).databaseChildAdded(cnATreeElement);
         }
       }
     }
     if (changedElement != null) {
       for (CnATreeElement cnATreeElement : changedElement) {
         CnAElementFactory.getModel(cnATreeElement).childChanged(cnATreeElement);
         CnAElementFactory.getModel(cnATreeElement).databaseChildChanged(cnATreeElement);
       }
     }
   }
 }
 private void getStrukturElements(CnATreeElement parent) {
   for (CnATreeElement child : parent.getChildren()) {
     if (!(child instanceof IDatenschutzElement)) {
       items.add(child);
       if (!categories.contains(child.getParent())) {
         categories.add(child.getParent());
       }
     }
     getStrukturElements(child);
   }
 }
 protected List<CnATreeElement> getItems(CnATreeElement category) {
   if (items == null) {
     getItems();
   }
   ArrayList<CnATreeElement> categoryItems = new ArrayList<CnATreeElement>();
   for (CnATreeElement item : items) {
     if (item.getParent().equals(category)) {
       categoryItems.add(item);
     }
   }
   return categoryItems;
 }
 /** @param baustein */
 private void initParent(/* not final */ BausteinUmsetzung baustein) {
   CnATreeElement withParent = Retriever.checkRetrieveParent(baustein);
   CnATreeElement parent = Retriever.checkRetrieveElement(withParent.getParent());
   baustein.setParent(parent);
 }