97 isLocalChange = true; 98 webView.getEngine().load(url); 99 isLocalChange = false; 100 } 101 102 @Override protected void layoutChildren() { 103 final double w = getWidth(); 104 final double h = getHeight(); 105 if (showSideBar) { 106 final double sideBarWidth = sideBar.prefWidth(-1)+14; 107 webView.resize(w - sideBarWidth, h); 108 scrollPane.setLayoutX(w - sideBarWidth); 109 scrollPane.resize(sideBarWidth, h); 110 } else { 111 webView.resize(w,h); 112 } 113 } 114 115 private void updateSidebar(String url) { 116 String key = url; 117 if (key.startsWith("http://download.java.net/jdk8/jfxdocs/")) { 118 key = key.substring("http://download.java.net/jdk8/jfxdocs/".length(), key.lastIndexOf('.')); 119 key = key.replaceAll("/", "."); 120 } else if (key.startsWith("http://download.java.net/jdk8/docs/api/")) { 121 key = key.substring("http://download.java.net/jdk8/docs/api/".length(), key.lastIndexOf('.')); 122 key = key.replaceAll("/", "."); 123 } 124 SampleInfo[] samples = Samples.getSamplesForDoc(key); 125 if (samples == null || samples.length == 0) { 126 sideBar.getChildren().clear(); 127 getChildren().remove(scrollPane); 128 showSideBar = false; 129 } else { 130 sideBar.getChildren().setAll(sideBarTitle); 131 for (final SampleInfo sample: samples) { 132 Button sampleButton = new Button(sample.name); 133 sampleButton.setCache(true); 134 sampleButton.getStyleClass().setAll("sample-button"); 135 sampleButton.setGraphic(sample.getMediumPreview()); 136 sampleButton.setContentDisplay(ContentDisplay.TOP); 137 sampleButton.setOnAction((ActionEvent actionEvent) -> { 138 pageBrowser.goToSample(sample); 139 }); 140 sideBar.getChildren().add(sampleButton); 141 } | 97 isLocalChange = true; 98 webView.getEngine().load(url); 99 isLocalChange = false; 100 } 101 102 @Override protected void layoutChildren() { 103 final double w = getWidth(); 104 final double h = getHeight(); 105 if (showSideBar) { 106 final double sideBarWidth = sideBar.prefWidth(-1)+14; 107 webView.resize(w - sideBarWidth, h); 108 scrollPane.setLayoutX(w - sideBarWidth); 109 scrollPane.resize(sideBarWidth, h); 110 } else { 111 webView.resize(w,h); 112 } 113 } 114 115 private void updateSidebar(String url) { 116 String key = url; 117 if (key.startsWith("https://docs.oracle.com/javase/8/javafx/api/")) { 118 key = key.substring("https://docs.oracle.com/javase/8/javafx/api/".length(), key.lastIndexOf('.')); 119 key = key.replaceAll("/", "."); 120 } else if (key.startsWith("http://docs.oracle.com/javase/8/docs/api/")) { 121 key = key.substring("http://docs.oracle.com/javase/8/docs/api/".length(), key.lastIndexOf('.')); 122 key = key.replaceAll("/", "."); 123 } 124 SampleInfo[] samples = Samples.getSamplesForDoc(key); 125 if (samples == null || samples.length == 0) { 126 sideBar.getChildren().clear(); 127 getChildren().remove(scrollPane); 128 showSideBar = false; 129 } else { 130 sideBar.getChildren().setAll(sideBarTitle); 131 for (final SampleInfo sample: samples) { 132 Button sampleButton = new Button(sample.name); 133 sampleButton.setCache(true); 134 sampleButton.getStyleClass().setAll("sample-button"); 135 sampleButton.setGraphic(sample.getMediumPreview()); 136 sampleButton.setContentDisplay(ContentDisplay.TOP); 137 sampleButton.setOnAction((ActionEvent actionEvent) -> { 138 pageBrowser.goToSample(sample); 139 }); 140 sideBar.getChildren().add(sampleButton); 141 } |