public void openPage(String location) {
final URL url;
try {
url = URLVerifier.verifyURL(location);
} catch (MalformedURLException ex) {
Logger.getLogger(BrowserFXController.class.getName()).log(Level.SEVERE, null, ex);
return;
}
URLHandler urlHandler = URLHandlersRegistry.getHandler(url);
if (urlHandler == null) {
return;
}
Platform.runLater(() -> {
URLHandler.Result handleResult = urlHandler.handle(url);
if (handleResult.contentDescriptor != ContentDescriptor.NoContent.instance()) {
BrowserTab browserTab = TabFactory.newTab(this, locale, handleResult.contentDescriptor);
browserTab.getNavigationContext().goTo(url);
selectionTab.getSelectedItem().contentProperty().bind(browserTab.contentProperty());
browserMap.put(selectionTab.getSelectedIndex(), browserTab);
urlField.textProperty().bind(browserTab.locationProperty());
stopButton.disableProperty().set(!browserTab.isStoppable());
selectionTab.getSelectedItem().textProperty().bind(browserTab.titleProperty());
}
});
}