app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordDocument.java
public void readFromJavaPreferences() {

    assert documentPreferences == null;

    final URL fxmlLocation = documentWindowController.getEditorController().getFxmlLocation();
    if (fxmlLocation == null) {
      // Document has not been saved yet => nothing to read
      return;
    }

    // Check if there is some preferences for this document
    try {
      final File fxmlFile = new File(fxmlLocation.toURI());
      final String filePath = fxmlFile.getPath();
      final String[] childrenNames = documentsRootPreferences.childrenNames();
      for (String child : childrenNames) {
        final Preferences pref = documentsRootPreferences.node(child);
        final String nodePath = pref.get(PATH, null);
        assert nodePath != null && nodePath.isEmpty() == false; // Each document node defines a path
        if (filePath.equals(nodePath)) {
          documentPreferences = pref;
          break;
        }
      }
    } catch (BackingStoreException ex) {
      Logger.getLogger(PreferencesRecordDocument.class.getName()).log(Level.SEVERE, null, ex);
      return;
    } catch (URISyntaxException ex) {
      Logger.getLogger(PreferencesRecordDocument.class.getName()).log(Level.SEVERE, null, ex);
    }

    // There is no preferences for this document in the Java preferences DB
    // => nothing to read
    if (documentPreferences == null) {
      return;
    }

    // Window position
    double xpos = documentPreferences.getDouble(X_POS, DEFAULT_X_POS);
    if (xpos < 0) {
      xpos = DEFAULT_X_POS;
    }
    setXPos(xpos);
    double ypos = documentPreferences.getDouble(Y_POS, DEFAULT_Y_POS);
    if (ypos < 0) {
      ypos = DEFAULT_Y_POS;
    }
    setYPos(ypos);

    // Window size
    double h = documentPreferences.getDouble(STAGE_HEIGHT, DEFAULT_STAGE_HEIGHT);
    if (h < 0) {
      h = DEFAULT_STAGE_HEIGHT;
    }
    setStageHeight(h);
    double w = documentPreferences.getDouble(STAGE_WIDTH, DEFAULT_STAGE_WIDTH);
    if (w < 0) {
      w = DEFAULT_STAGE_WIDTH;
    }
    setStageWidth(w);

    // Panel visibility
    final boolean bv = documentPreferences.getBoolean(BOTTOM_VISIBLE, DEFAULT_BOTTOM_VISIBLE);
    setBottomVisible(bv);
    final boolean lv = documentPreferences.getBoolean(LEFT_VISIBLE, DEFAULT_LEFT_VISIBLE);
    setLeftVisible(lv);
    final boolean rv = documentPreferences.getBoolean(RIGHT_VISIBLE, DEFAULT_RIGHT_VISIBLE);
    setRightVisible(rv);
    final boolean libv = documentPreferences.getBoolean(LIBRARY_VISIBLE, DEFAULT_LIBRARY_VISIBLE);
    // Since SB 2.0 b11, the visibility of Library and Document was handled
    // independently from the Left visibility.
    // Starting from SB 2.0 b12, the visibility of Library and Document is
    // linked to the Left visibility.
    // We need to handle new preferences as well as old ones :
    // hence the value set for Library and Document visible property.
    setLibraryVisible(lv && libv);
    final boolean docv = documentPreferences.getBoolean(DOCUMENT_VISIBLE, DEFAULT_DOCUMENT_VISIBLE);
    setDocumentVisible(lv && docv);

    // Inspector expanded TitledPane
    final String sectionId =
        documentPreferences.get(INSPECTOR_SECTION_ID, DEFAULT_INSPECTOR_SECTION_ID.name());
    setInspectorSectionId(SectionId.valueOf(sectionId));

    // Dividers position
    final double ldhp = documentPreferences.getDouble(LEFT_DIVIDER_HPOS, DEFAULT_LEFT_DIVIDER_HPOS);
    setLeftDividerHPos(ldhp);
    final double rdhp =
        documentPreferences.getDouble(RIGHT_DIVIDER_HPOS, DEFAULT_RIGHT_DIVIDER_HPOS);
    setRightDividerHPos(rdhp);
    final double bdvp =
        documentPreferences.getDouble(BOTTOM_DIVIDER_VPOS, DEFAULT_BOTTOM_DIVIDER_VPOS);
    setBottomDividerVPos(bdvp);
    final double ldvp = documentPreferences.getDouble(LEFT_DIVIDER_VPOS, DEFAULT_LEFT_DIVIDER_VPOS);
    setLeftDividerVPos(ldvp);

    // Scene style sheets
    final String items = documentPreferences.get(SCENE_STYLE_SHEETS, null);
    if (items != null) {
      final String[] itemsArray = items.split("\\" + File.pathSeparator); // NOI18N
      sceneStyleSheets.addAll(Arrays.asList(itemsArray));
    }

    // I18NResource
    final String resource = documentPreferences.get(I18N_RESOURCE, null); // NOI18N
    setI18NResource(resource);

    // Theme and Gluon Theme
    final String theme = documentPreferences.get(THEME, null);
    if (theme != null) {
      setTheme(EditorPlatform.Theme.valueOf(theme));
    } else {
      setTheme(documentWindowController.getEditorController().getTheme());
    }
  }
/** Read data from the java preferences DB and initialize properties. */
Read data from the java preferences DB and initialize properties.
Read data from the java preferences DB and initialize properties .
public void readFromJavaPreferences() {
    assert documentPreferences == null;
    final URL fxmlLocation = documentWindowController.getEditorController().getFxmlLocation();
    if (fxmlLocation == null) {
      return;
    }
    try {
      final File fxmlFile = new File(fxmlLocation.toURI());
      final String filePath = fxmlFile.getPath();
      final String[] childrenNames = documentsRootPreferences.childrenNames();
      for (String child : childrenNames) {
        final Preferences pref = documentsRootPreferences.node(child);
        final String nodePath = pref.get(PATH, null);
        assert nodePath != null && nodePath.isEmpty() == false; 
        if (filePath.equals(nodePath)) {
          documentPreferences = pref;
          break;
        }
      }
    } catch (BackingStoreException ex) {
      Logger.getLogger(PreferencesRecordDocument.class.getName()).log(Level.SEVERE, null, ex);
      return;
    } catch (URISyntaxException ex) {
      Logger.getLogger(PreferencesRecordDocument.class.getName()).log(Level.SEVERE, null, ex);
    }
    if (documentPreferences == null) {
      return;
    }
    double xpos = documentPreferences.getDouble(X_POS, DEFAULT_X_POS);
    if (xpos < 0) {
      xpos = DEFAULT_X_POS;
    }
    setXPos(xpos);
    double ypos = documentPreferences.getDouble(Y_POS, DEFAULT_Y_POS);
    if (ypos < 0) {
      ypos = DEFAULT_Y_POS;
    }
    setYPos(ypos);
    double h = documentPreferences.getDouble(STAGE_HEIGHT, DEFAULT_STAGE_HEIGHT);
    if (h < 0) {
      h = DEFAULT_STAGE_HEIGHT;
    }
    setStageHeight(h);
    double w = documentPreferences.getDouble(STAGE_WIDTH, DEFAULT_STAGE_WIDTH);
    if (w < 0) {
      w = DEFAULT_STAGE_WIDTH;
    }
    setStageWidth(w);
    final boolean bv = documentPreferences.getBoolean(BOTTOM_VISIBLE, DEFAULT_BOTTOM_VISIBLE);
    setBottomVisible(bv);
    final boolean lv = documentPreferences.getBoolean(LEFT_VISIBLE, DEFAULT_LEFT_VISIBLE);
    setLeftVisible(lv);
    final boolean rv = documentPreferences.getBoolean(RIGHT_VISIBLE, DEFAULT_RIGHT_VISIBLE);
    setRightVisible(rv);
    final boolean libv = documentPreferences.getBoolean(LIBRARY_VISIBLE, DEFAULT_LIBRARY_VISIBLE);
    setLibraryVisible(lv && libv);
    final boolean docv = documentPreferences.getBoolean(DOCUMENT_VISIBLE, DEFAULT_DOCUMENT_VISIBLE);
    setDocumentVisible(lv && docv);
    final String sectionId =
        documentPreferences.get(INSPECTOR_SECTION_ID, DEFAULT_INSPECTOR_SECTION_ID.name());
    setInspectorSectionId(SectionId.valueOf(sectionId));
    final double ldhp = documentPreferences.getDouble(LEFT_DIVIDER_HPOS, DEFAULT_LEFT_DIVIDER_HPOS);
    setLeftDividerHPos(ldhp);
    final double rdhp =
        documentPreferences.getDouble(RIGHT_DIVIDER_HPOS, DEFAULT_RIGHT_DIVIDER_HPOS);
    setRightDividerHPos(rdhp);
    final double bdvp =
        documentPreferences.getDouble(BOTTOM_DIVIDER_VPOS, DEFAULT_BOTTOM_DIVIDER_VPOS);
    setBottomDividerVPos(bdvp);
    final double ldvp = documentPreferences.getDouble(LEFT_DIVIDER_VPOS, DEFAULT_LEFT_DIVIDER_VPOS);
    setLeftDividerVPos(ldvp);
    final String items = documentPreferences.get(SCENE_STYLE_SHEETS, null);
    if (items != null) {
      final String[] itemsArray = items.split("\\" + File.pathSeparator); 
      sceneStyleSheets.addAll(Arrays.asList(itemsArray));
    }
    final String resource = documentPreferences.get(I18N_RESOURCE, null); 
    setI18NResource(resource);
    final String theme = documentPreferences.get(THEME, null);
    if (theme != null) {
      setTheme(EditorPlatform.Theme.valueOf(theme));
    } else {
      setTheme(documentWindowController.getEditorController().getTheme());
    }
  }
public void readFromJavaPreferences ( ) { assert documentPreferences == null ; final URL fxmlLocation = documentWindowController . getEditorController ( ) . getFxmlLocation ( ) ; if ( fxmlLocation == null ) { return ; } try { final File fxmlFile = new File ( fxmlLocation . toURI ( ) ) ; final String filePath = fxmlFile . getPath ( ) ; final String [ ] childrenNames = documentsRootPreferences . childrenNames ( ) ; for ( String child : childrenNames ) { final Preferences pref = documentsRootPreferences . node ( child ) ; final String nodePath = pref . get ( PATH , null ) ; assert nodePath != null && nodePath . isEmpty ( ) == false ; if ( filePath . equals ( nodePath ) ) { documentPreferences = pref ; break ; } } } catch ( BackingStoreException ex ) { Logger . getLogger ( PreferencesRecordDocument . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; return ; } catch ( URISyntaxException ex ) { Logger . getLogger ( PreferencesRecordDocument . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } if ( documentPreferences == null ) { return ; } double xpos = documentPreferences . getDouble ( X_POS , DEFAULT_X_POS ) ; if ( xpos < 0 ) { xpos = DEFAULT_X_POS ; } setXPos ( xpos ) ; double ypos = documentPreferences . getDouble ( Y_POS , DEFAULT_Y_POS ) ; if ( ypos < 0 ) { ypos = DEFAULT_Y_POS ; } setYPos ( ypos ) ; double h = documentPreferences . getDouble ( STAGE_HEIGHT , DEFAULT_STAGE_HEIGHT ) ; if ( h < 0 ) { h = DEFAULT_STAGE_HEIGHT ; } setStageHeight ( h ) ; double w = documentPreferences . getDouble ( STAGE_WIDTH , DEFAULT_STAGE_WIDTH ) ; if ( w < 0 ) { w = DEFAULT_STAGE_WIDTH ; } setStageWidth ( w ) ; final boolean bv = documentPreferences . getBoolean ( BOTTOM_VISIBLE , DEFAULT_BOTTOM_VISIBLE ) ; setBottomVisible ( bv ) ; final boolean lv = documentPreferences . getBoolean ( LEFT_VISIBLE , DEFAULT_LEFT_VISIBLE ) ; setLeftVisible ( lv ) ; final boolean rv = documentPreferences . getBoolean ( RIGHT_VISIBLE , DEFAULT_RIGHT_VISIBLE ) ; setRightVisible ( rv ) ; final boolean libv = documentPreferences . getBoolean ( LIBRARY_VISIBLE , DEFAULT_LIBRARY_VISIBLE ) ; setLibraryVisible ( lv && libv ) ; final boolean docv = documentPreferences . getBoolean ( DOCUMENT_VISIBLE , DEFAULT_DOCUMENT_VISIBLE ) ; setDocumentVisible ( lv && docv ) ; final String sectionId = documentPreferences . get ( INSPECTOR_SECTION_ID , DEFAULT_INSPECTOR_SECTION_ID . name ( ) ) ; setInspectorSectionId ( SectionId . valueOf ( sectionId ) ) ; final double ldhp = documentPreferences . getDouble ( LEFT_DIVIDER_HPOS , DEFAULT_LEFT_DIVIDER_HPOS ) ; setLeftDividerHPos ( ldhp ) ; final double rdhp = documentPreferences . getDouble ( RIGHT_DIVIDER_HPOS , DEFAULT_RIGHT_DIVIDER_HPOS ) ; setRightDividerHPos ( rdhp ) ; final double bdvp = documentPreferences . getDouble ( BOTTOM_DIVIDER_VPOS , DEFAULT_BOTTOM_DIVIDER_VPOS ) ; setBottomDividerVPos ( bdvp ) ; final double ldvp = documentPreferences . getDouble ( LEFT_DIVIDER_VPOS , DEFAULT_LEFT_DIVIDER_VPOS ) ; setLeftDividerVPos ( ldvp ) ; final String items = documentPreferences . get ( SCENE_STYLE_SHEETS , null ) ; if ( items != null ) { final String [ ] itemsArray = items . split ( "\\" + File . pathSeparator ) ; sceneStyleSheets . addAll ( Arrays . asList ( itemsArray ) ) ; } final String resource = documentPreferences . get ( I18N_RESOURCE , null ) ; setI18NResource ( resource ) ; final String theme = documentPreferences . get ( THEME , null ) ; if ( theme != null ) { setTheme ( EditorPlatform . Theme . valueOf ( theme ) ) ; } else { setTheme ( documentWindowController . getEditorController ( ) . getTheme ( ) ) ; } }
Read data from the java preferences DB and initialize properties.
Read data from the java preferences DB and initialize properties .
// Document has not been saved yet => nothing to read // Check if there is some preferences for this document // Each document node defines a path // There is no preferences for this document in the Java preferences DB // => nothing to read // Window position // Window size // Panel visibility // Since SB 2.0 b11, the visibility of Library and Document was handled // independently from the Left visibility. // Starting from SB 2.0 b12, the visibility of Library and Document is // linked to the Left visibility. // We need to handle new preferences as well as old ones : // hence the value set for Library and Document visible property. // Inspector expanded TitledPane // Dividers position // Scene style sheets // NOI18N // I18NResource // NOI18N // Theme and Gluon Theme