< prev index next >

apps/toys/Hello/src/main/java/hello/dialog/wizard/Wizard.java

Print this page




 329     private void readSettings(WizardPane page) {
 330         // for now we cannot know the structure of the page, so we just drill down
 331         // through the entire scenegraph (from page.content down) until we get
 332         // to the leaf nodes. We stop only if we find a node that is a
 333         // ValueContainer (either by implementing the interface), or being
 334         // listed in the internal valueContainers map.
 335 
 336         settingCounter = 0;
 337         checkNode(page.getContent());
 338     }
 339 
 340     private boolean checkNode(Node n) {
 341         boolean success = readSetting(n);
 342 
 343         if (success) {
 344             // we've added the setting to the settings map and we should stop drilling deeper
 345             return true;
 346         } else {
 347             // go into children of this node (if possible) and see if we can get
 348             // a value from them (recursively)
 349             List<Node> children = ImplUtils.getChildren(n, false);
 350 
 351             // we're doing a depth-first search, where we stop drilling down
 352             // once we hit a successful read
 353             boolean childSuccess = false;
 354             for (Node child : children) {
 355                 childSuccess |= checkNode(child);
 356             }
 357             return childSuccess;
 358         }
 359     }
 360 
 361     private boolean readSetting(Node n) {
 362         if (n == null) {
 363             return false;
 364         }
 365 
 366         Object setting = ValueExtractor.getValue(n);
 367 
 368         if (setting != null) {
 369             // save it into the settings map.




 329     private void readSettings(WizardPane page) {
 330         // for now we cannot know the structure of the page, so we just drill down
 331         // through the entire scenegraph (from page.content down) until we get
 332         // to the leaf nodes. We stop only if we find a node that is a
 333         // ValueContainer (either by implementing the interface), or being
 334         // listed in the internal valueContainers map.
 335 
 336         settingCounter = 0;
 337         checkNode(page.getContent());
 338     }
 339 
 340     private boolean checkNode(Node n) {
 341         boolean success = readSetting(n);
 342 
 343         if (success) {
 344             // we've added the setting to the settings map and we should stop drilling deeper
 345             return true;
 346         } else {
 347             // go into children of this node (if possible) and see if we can get
 348             // a value from them (recursively)
 349             List<Node> children = ImplUtils.getChildren(n);
 350 
 351             // we're doing a depth-first search, where we stop drilling down
 352             // once we hit a successful read
 353             boolean childSuccess = false;
 354             for (Node child : children) {
 355                 childSuccess |= checkNode(child);
 356             }
 357             return childSuccess;
 358         }
 359     }
 360 
 361     private boolean readSetting(Node n) {
 362         if (n == null) {
 363             return false;
 364         }
 365 
 366         Object setting = ValueExtractor.getValue(n);
 367 
 368         if (setting != null) {
 369             // save it into the settings map.


< prev index next >