()
| 337 | } |
| 338 | |
| 339 | private void updateTab() { |
| 340 | Tab selectedTab = tabPane.getSelectionModel().getSelectedItem(); |
| 341 | |
| 342 | // If the tab was already loaded and its just a tab switch, no need to reload. |
| 343 | final Object tabLoadCache = selectedTab.getProperties().get(TAB_LOAD_CACHE); |
| 344 | if (tabLoadCache != null && (boolean)tabLoadCache) return; |
| 345 | |
| 346 | progressIndicator.progressProperty().unbind(); |
| 347 | // we only update the selected tab - leaving the other tabs in their |
| 348 | // previous state until they are selected |
| 349 | if (selectedTab == sampleTab) { |
| 350 | sampleTab.setContent(buildSampleTabContent(selectedSample)); |
| 351 | } else if (selectedTab == javaDocTab) { |
| 352 | prepareTabContent(javaDocTab, javaDocWebView); |
| 353 | loadWebViewContent(javaDocWebView, selectedSample, Sample::getJavaDocURL, sample -> "No Javadoc available"); |
| 354 | } else if (selectedTab == sourceTab) { |
| 355 | prepareTabContent(sourceTab, sourceWebView); |
| 356 | loadWebViewContent(sourceWebView, selectedSample, Sample::getSampleSourceURL, this::formatSourceCode); |
| 357 | } else if (selectedTab == cssTab) { |
| 358 | prepareTabContent(cssTab, cssWebView); |
| 359 | loadWebViewContent(cssWebView, selectedSample, Sample::getControlStylesheetURL, this::formatCss); |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | private void loadWebViewContent(WebView webView, Sample sample, |
| 364 | Function<Sample, String> urlFunction, Function<Sample, String> contentFunction) { |
no test coverage detected