2 Replies Latest reply: Dec 30, 2013 2:31 AM by gimbal2 RSS

    TreeMap Quandary

    24176c43-31cd-40cc-a018-929a2b53f8dd

      Hello All,

       

      I have the below snipped of code that is giving me problems. The code is called when the user clicks on the "NEXT" button of the form. Can someone please explain why despite getting into the Lines 41-45 I am not able to update the BorderPane? Lines 30-39 appear to work as expected.  In the case below there are 3 entries within the TreeMap.  You can see this within the Output provided by NetBeans shown below.

       

      NetBeans Output

      Next Button Clicked.

      1 => BorderPane@5bee8c9b                   <----------- Entry 1

      Next Button Clicked.

      1 => BorderPane@5bee8c9b                    <----------- Entry 1

      MATCH!

      2 => BorderPane@e857ac                        <------------ Entry 2

      UPDATING! BorderPane@15d3ddab          <------------ Entry 3

      Cancel Button Clicked.

       

        boolean isNewWizard = false;
        boolean isBorderPaneMatchFound = false;
      
        Wizard activeWizard;
        Iterator iterator;
        BorderPane nextBorderPaneToDisplay = new BorderPane();
      
        // Did the user select a new wizard?
        if (this.userSelectedWizard != null) {
        // Becuase the userSelectedWizard within the wizardTracker. Because the userSelectedWizard is
        // no longer "selected" but instead being tracked, it can now be set to null to help determine
        // when the user makes another selection change.
        WizardPage.wizardTracker.put(WizardPage.wizardTracker.lastKey() + 1, this.userSelectedWizard);
        this.userSelectedWizard = null;
      
        isNewWizard = true;
        }
      
        // The last entry within the wizardTracker identifies the wizard to be in use. Get its value and
        // set up an iterator to determine its contents and establish page navigation.
        activeWizard = WizardPage.wizardTracker.lastEntry().getValue();
        iterator = activeWizard.getOrderedWizardPages().entrySet().iterator();
      
        for (Map.Entry entry : activeWizard.getOrderedWizardPages().entrySet()) {
        Integer key = (Integer) entry.getKey();
        BorderPane value = (BorderPane) entry.getValue();
      
        System.out.println(key + " => " + value);
      
        if (isNewWizard) {
        nextBorderPaneToDisplay = value;
        break;
        }
      
        if (value.hashCode() == this.borderPaneMaster.hashCode()) {
        System.out.println("MATCH!");
        isBorderPaneMatchFound = true;
        continue;
        }
      
        if (isBorderPaneMatchFound) {
        System.out.println("UPDATING! " + nextBorderPaneToDisplay);
        nextBorderPaneToDisplay = value;
        break;
        }
        }
      
        this.borderPaneMaster.getChildren().clear();
        this.setBorderPaneMasterTop(nextBorderPaneToDisplay.getTop());
        this.setBorderPaneMasterLeft(nextBorderPaneToDisplay.getLeft());
        this.setBorderPaneMasterCenter(nextBorderPaneToDisplay.getCenter());
        this.setBorderPaneMasterRight(nextBorderPaneToDisplay.getRight());
        this.setBorderPaneMasterBottom(nextBorderPaneToDisplay.getBottom());