MCPcopy Create free account
hub / github.com/controlsfx/controlsfx / updateTab

Method updateTab

fxsampler/src/main/java/fxsampler/FXSampler.java:339–361  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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) {

Callers 2

startMethod · 0.95
changeSampleMethod · 0.95

Calls 8

buildSampleTabContentMethod · 0.95
prepareTabContentMethod · 0.95
loadWebViewContentMethod · 0.95
getSelectionModelMethod · 0.80
getMethod · 0.65
getPropertiesMethod · 0.45
progressPropertyMethod · 0.45
setContentMethod · 0.45

Tested by

no test coverage detected