• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java JavascriptRuntime类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中gmapsfx.javascript.JavascriptRuntime的典型用法代码示例。如果您正苦于以下问题:Java JavascriptRuntime类的具体用法?Java JavascriptRuntime怎么用?Java JavascriptRuntime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

JavascriptRuntime类属于gmapsfx.javascript包,在下文中一共展示了JavascriptRuntime类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startVisualization

点赞 2

import gmapsfx.javascript.JavascriptRuntime; //导入依赖的package包/类
public void startVisualization() {

    	LatLongBounds bounds = new LatLongBounds();
    	List<LatLong> latLongs = new ArrayList<LatLong>();
    	JavascriptArray jsArray = new JavascriptArray();
    	manager.hideIntermediateMarkers();
        manager.hideDestinationMarker();
//    	manager.disableRouteButtons(true);

    	// create JavascriptArray of points
    	for(geography.GeographicPoint point : points) {
    		LatLong ll = new LatLong(point.getX(), point.getY());
    		MarkerOptions options = MarkerManager.createDefaultOptions(ll);
    		Marker newMarker = new Marker(options);
            jsArray.push(newMarker);
            markerList.add(newMarker);
            bounds.extend(ll);
    	}

    	// fit map bounds to visualization
    	manager.getMap().fitBounds(bounds);

        // get javascript runtime and execute animation
    	runtime = JavascriptRuntime.getInstance();
    	String command = runtime.getFunction("visualizeSearch", manager.getMap(), jsArray);
    	// System.out.println(command);

    	runtime.execute(command);

//    	MapApp.showInfoAlert("Nodes visited :"  , latLongs.size() +" nodes were visited in the search");
    	manager.disableVisButton(true);
//        manager.disableRouteButtons(false);


    }
 

开发者ID:sanekas,
项目名称:map-graph,
代码行数:36,
代码来源:RouteVisualization.java

示例2: startVisualization

点赞 2

import gmapsfx.javascript.JavascriptRuntime; //导入依赖的package包/类
public void startVisualization() {

    	LatLongBounds bounds = new LatLongBounds();
    	List<LatLong> latLongs = new ArrayList<LatLong>();
    	JavascriptArray jsArray = new JavascriptArray();
    	manager.hideIntermediateMarkers();
        manager.hideStopMarkers();
//    	manager.disableRouteButtons(true);

    	// create JavascriptArray of points
    	for(geography.GeographicPoint point : points) {
    		LatLong ll = new LatLong(point.getX(), point.getY());
    		MarkerOptions options = MarkerManager.createDefaultOptions(ll);
    		Marker newMarker = new Marker(options);
            jsArray.push(newMarker);
            markerList.add(newMarker);
            bounds.extend(ll);
    	}

    	// fit map bounds to visualization
    	manager.getMap().fitBounds(bounds);

        // get javascript runtime and execute animation
    	runtime = JavascriptRuntime.getInstance();
    	String command = runtime.getFunction("visualizeSearch", manager.getMap(), jsArray);
    	// System.out.println(command);

    	runtime.execute(command);

//    	MapApp.showInfoAlert("Nodes visited :"  , latLongs.size() +" nodes were visited in the search");
    	manager.disableVisButton(true);
//        manager.disableRouteButtons(false);


    }
 

开发者ID:ryanwc,
项目名称:GraphSearch,
代码行数:36,
代码来源:RouteVisualization.java

示例3: start

点赞 2

import gmapsfx.javascript.JavascriptRuntime; //导入依赖的package包/类
@Override
public void start(final Stage stage) throws Exception {

    System.out.println("test ArrayTester");
    webview = new WebView();
    webengine = new JavaFxWebEngine(webview.getEngine());
    JavascriptRuntime.setDefaultWebEngine( webengine );

    BorderPane bp = new BorderPane();
    bp.setCenter(webview);

    webengine.getLoadWorker().stateProperty().addListener(
            new ChangeListener<Worker.State>() {
                public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
                    if (newState == Worker.State.SUCCEEDED) {
                        runTests();
                        //Platform.exit();
                    }
                }
            });
    webengine.load(getClass().getResource("/html/arrays.html").toExternalForm());
    System.out.println("after loading arrays");

    Scene scene = new Scene(bp, 600, 600);

    stage.setScene(scene);
    stage.show();

}
 

开发者ID:ryanwc,
项目名称:GraphSearch,
代码行数:30,
代码来源:ArrayTester.java

示例4: start

点赞 2

import gmapsfx.javascript.JavascriptRuntime; //导入依赖的package包/类
@Override
public void start(final Stage stage) throws Exception {

    webview = new WebView();
    webengine = new JavaFxWebEngine(webview.getEngine());
    JavascriptRuntime.setDefaultWebEngine( webengine );

    BorderPane bp = new BorderPane();
    bp.setCenter(webview);

    webengine.getLoadWorker().stateProperty().addListener(
            new ChangeListener<Worker.State>() {
                public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
                    if (newState == Worker.State.SUCCEEDED) {
                        runTests();
                        //Platform.exit();
                    }
                }
            });
    webengine.load(getClass().getResource("/html/arrays.html").toExternalForm());

    Scene scene = new Scene(bp, 600, 600);

    stage.setScene(scene);
    stage.show();

}
 

开发者ID:anand9522,
项目名称:MapsApplication,
代码行数:28,
代码来源:ArrayTester.java

示例5: GoogleMapView

点赞 2

import gmapsfx.javascript.JavascriptRuntime; //导入依赖的package包/类
/**
 * Creates a new map view and specifies if the FireBug pane should be
 * displayed in the WebView
 *
 * @param mapResourcePath
 * @param debug true if the FireBug pane should be displayed in the WebView.
 */
public GoogleMapView(String mapResourcePath, boolean debug) {
    String htmlFile;
    System.out.println("test GoogleMapView with mapResourePath and debug");
    System.out.println("mapResourcePath is: " + mapResourcePath);
    if (mapResourcePath == null) {
        if (debug) {
            htmlFile = "/html/maps-debug.html";
        } else {
            htmlFile = "/html/index.html";
        }
    } else {
        htmlFile = mapResourcePath;
    }
    
    System.out.println("mapResourcePath is now: " + htmlFile);
    webview = new WebView();
    //System.out.println("webview : " + webview);
    webengine = new JavaFxWebEngine(webview.getEngine());
    JavascriptRuntime.setDefaultWebEngine(webengine);

    setTopAnchor(webview, 0.0);
    setLeftAnchor(webview, 0.0);
    setBottomAnchor(webview, 0.0);
    setRightAnchor(webview, 0.0);
    getChildren().add(webview);

    webview.widthProperty().addListener(e -> mapResized());
    webview.heightProperty().addListener(e -> mapResized());

    webview.widthProperty().addListener(e -> mapResized());
    webview.heightProperty().addListener(e -> mapResized());

    webengine.getLoadWorker().stateProperty().addListener(
            new ChangeListener<Worker.State>() {
                public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
                    if (newState == Worker.State.SUCCEEDED) {
                        setInitialized(true);
                        fireMapInitializedListeners();

                    }
                }
            });
    System.out.println("loading " + getClass().getResource(htmlFile).toExternalForm());
    //System.out.println("web engine before load : " + webengine);
    webengine.load(getClass().getResource(htmlFile).toExternalForm());
    //System.out.println("AFTER LOAD");

}
 

开发者ID:ryanwc,
项目名称:GraphSearch,
代码行数:56,
代码来源:GoogleMapView.java

示例6: GoogleMapView

点赞 2

import gmapsfx.javascript.JavascriptRuntime; //导入依赖的package包/类
/**
 * Creates a new map view and specifies if the FireBug pane should be
 * displayed in the WebView
 *
 * @param mapResourcePath
 * @param debug true if the FireBug pane should be displayed in the WebView.
 */
public GoogleMapView(String mapResourcePath, boolean debug) {
    String htmlFile;
    if (mapResourcePath == null) {
        if (debug) {
            htmlFile = "/html/maps-debug.html";
        } else {
            htmlFile = "/html/index.html";
        }
    } else {
        htmlFile = mapResourcePath;
    }
    webview = new WebView();
    //System.out.println("webview : " + webview);
    webengine = new JavaFxWebEngine(webview.getEngine());
    JavascriptRuntime.setDefaultWebEngine(webengine);

    setTopAnchor(webview, 0.0);
    setLeftAnchor(webview, 0.0);
    setBottomAnchor(webview, 0.0);
    setRightAnchor(webview, 0.0);
    getChildren().add(webview);

    webview.widthProperty().addListener(e -> mapResized());
    webview.heightProperty().addListener(e -> mapResized());

    webview.widthProperty().addListener(e -> mapResized());
    webview.heightProperty().addListener(e -> mapResized());

    webengine.getLoadWorker().stateProperty().addListener(
            new ChangeListener<Worker.State>() {
                public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
                    if (newState == Worker.State.SUCCEEDED) {
                        setInitialized(true);
                        fireMapInitializedListeners();

                    }
                }
            });
    //System.out.println("web engine before load : " + webengine);
    webengine.load(getClass().getResource(htmlFile).toExternalForm());
    //System.out.println("AFTER LOAD");

}
 

开发者ID:anand9522,
项目名称:MapsApplication,
代码行数:51,
代码来源:GoogleMapView.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)