コード例 #1
0
 @Override
 protected void setState(NodeStateHolder.SelectedState state) {
   for (Enumeration children = children(); children.hasMoreElements(); ) {
     UpdaterTreeNode child = (UpdaterTreeNode) children.nextElement();
     child.setState(state);
   }
 }
コード例 #2
0
 @Override
 public NodeStateHolder.SelectedState getInitialState() {
   boolean hasInstalled = false;
   boolean hasNotInstalled = false;
   for (Enumeration children = children(); children.hasMoreElements(); ) {
     UpdaterTreeNode child = (UpdaterTreeNode) children.nextElement();
     if (child.getInitialState() == NodeStateHolder.SelectedState.MIXED) {
       return NodeStateHolder.SelectedState.MIXED;
     } else if (child.getInitialState() == NodeStateHolder.SelectedState.INSTALLED) {
       hasInstalled = true;
     } else {
       hasNotInstalled = true;
     }
   }
   return hasInstalled
       ? (hasNotInstalled
           ? NodeStateHolder.SelectedState.MIXED
           : NodeStateHolder.SelectedState.INSTALLED)
       : NodeStateHolder.SelectedState.NOT_INSTALLED;
 }
コード例 #3
0
 @Override
 public NodeStateHolder.SelectedState getCurrentState() {
   boolean foundInstalled = false;
   boolean foundNotInstalled = false;
   for (Enumeration children = children(); children.hasMoreElements(); ) {
     UpdaterTreeNode child = (UpdaterTreeNode) children.nextElement();
     if (child.getCurrentState() != NodeStateHolder.SelectedState.INSTALLED) {
       foundNotInstalled = true;
     }
     if (child.getCurrentState() != NodeStateHolder.SelectedState.NOT_INSTALLED) {
       foundInstalled = true;
     }
   }
   if (foundInstalled && foundNotInstalled) {
     return NodeStateHolder.SelectedState.MIXED;
   } else if (foundInstalled) {
     return NodeStateHolder.SelectedState.INSTALLED;
   } else {
     return NodeStateHolder.SelectedState.NOT_INSTALLED;
   }
 }