Example usage for javafx.scene.web WebEngine getClass

List of usage examples for javafx.scene.web WebEngine getClass

Introduction

In this page you can find the example usage for javafx.scene.web WebEngine getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:de.bayern.gdi.gui.Controller.java

private void chooseAtomType(ItemModel data, boolean datasetAvailable) {
    Atom.Item item;/*from   ww  w. ja  v a  2s  . c  o m*/
    if (datasetAvailable) {
        item = (Atom.Item) data.getItem();
        try {
            item.load();
        } catch (URISyntaxException | SAXException | ParserConfigurationException | IOException e) {
            log.error("Could not Load Item\n" + e.getMessage(), item);
            return;
        }
    } else {
        try {
            item = new Atom.Item(new URL(this.downloadConfig.getServiceURL()), "");
        } catch (Exception e) {
            return;
        }
    }
    if (wmsAtomMapHandler != null) {
        wmsAtomMapHandler.highlightSelectedPolygon(item.getID());
    }
    List<Atom.Field> fields = item.getFields();
    ObservableList<ItemModel> list = FXCollections.observableArrayList();
    for (Atom.Field f : fields) {
        AtomFieldModel afm = new AtomFieldModel(f);
        list.add(afm);
    }
    this.atomVariationChooser.setItems(list);
    this.atomVariationChooser.getSelectionModel().selectFirst();
    WebEngine engine = this.valueAtomDescr.getEngine();
    java.lang.reflect.Field f;
    try {
        f = engine.getClass().getDeclaredField("page");
        f.setAccessible(true);
        com.sun.webkit.WebPage page = (com.sun.webkit.WebPage) f.get(engine);
        page.setBackgroundColor((new java.awt.Color(BGCOLOR, BGCOLOR, BGCOLOR)).getRGB());
    } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
        // Displays the webview with white background...
    }
    engine.loadContent("<head> <style>" + ".description-content" + "{" + "font-family: Sans-Serif" + "}"
            + "</style> </head>" + "<div class=\"description-content\">" + item.getDescription() + "</div>");
    this.simpleWFSContainer.setVisible(false);
    this.basicWFSContainer.setVisible(false);
    this.atomContainer.setVisible(true);
}