Java 类javafx.scene.web.WebHistory 实例源码

项目:desktop-gmail-client    文件:ZoomInMailView.java   
public void goBack(){
    final WebHistory history = webEngine.getHistory();
    ObservableList<WebHistory.Entry> entryList = history.getEntries();
    int currentIndex = history.getCurrentIndex();
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            try {
                history.go(-1);
            }catch(Exception e){
                webEngine.loadContent(body);
            }
        }
    });
}
项目:marathonv5    文件:HTMLView.java   
public HTMLView() {
    viewport = ToolBarContainer.createDefaultContainer(Orientation.RIGHT);
    webView = new WebView();
    viewport.setContent(webView);
    VLToolBar bar = new VLToolBar();
    Button openInBrowser = FXUIUtils.createButton("open-in-browser", "Open in External Browser", true);
    Button prevPage = FXUIUtils.createButton("prev", "Previous Page", false);
    WebHistory history = webView.getEngine().getHistory();
    prevPage.setOnAction((event) -> {
        history.go(-1);
    });
    bar.add(prevPage);
    Button nextPage = FXUIUtils.createButton("next", "Next Page", false);
    nextPage.setOnAction((event) -> {
        history.go(1);
    });
    bar.add(nextPage);
    openInBrowser.setOnAction((event) -> {
        try {
            URI uri = ProjectHTTPDServer.getURI(fileHandler.getCurrentFile().toPath());
            if (uri != null)
                Desktop.getDesktop().browse(uri);
            else
                Desktop.getDesktop().open(fileHandler.getCurrentFile());
        } catch (IOException e) {
            e.printStackTrace();
        }
    });
    bar.add(openInBrowser);
    history.currentIndexProperty().addListener((ob, o, n) -> {
        nextPage.setDisable(n.intValue() == history.getEntries().size() - 1);
        prevPage.setDisable(n.intValue() == 0);
    });
    viewport.getToolBarPanel().add(bar);
}
项目:educational-plugin    文件:StudyBrowserWindow.java   
private void addButtonsAvailabilityListeners(JButton backButton, JButton forwardButton) {
  Platform.runLater(() -> myEngine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
    if (newState == Worker.State.SUCCEEDED) {
      final WebHistory history = myEngine.getHistory();
      boolean isGoBackAvailable = history.getCurrentIndex() > 0;
      boolean isGoForwardAvailable = history.getCurrentIndex() < history.getEntries().size() - 1;
      ApplicationManager.getApplication().invokeLater(() -> {
        backButton.setEnabled(isGoBackAvailable);
        forwardButton.setEnabled(isGoForwardAvailable);
      });
    }
  }));
}
项目:sbc-qsystem    文件:FInfoDialogWeb.java   
public String goBack() {
    final WebHistory history = webEngine.getHistory();
    ObservableList<WebHistory.Entry> entryList = history.getEntries();
    int currentIndex = history.getCurrentIndex();
    //    Out("currentIndex = "+currentIndex);
    //    Out(entryList.toString().replace("],","]\n"));
    if (currentIndex > 0) {
        Platform.runLater(() -> {
            history.go(-1);
        });
    }
    return entryList.get(currentIndex > 0 ? currentIndex - 1 : currentIndex).getUrl();
}
项目:sbc-qsystem    文件:FInfoDialogWeb.java   
public String goForward() {
    final WebHistory history = webEngine.getHistory();
    ObservableList<WebHistory.Entry> entryList = history.getEntries();
    int currentIndex = history.getCurrentIndex();
    //    Out("currentIndex = "+currentIndex);
    //    Out(entryList.toString().replace("],","]\n"));
    if (currentIndex < entryList.size() - 1) {
        Platform.runLater(() -> {
            history.go(1);
        });
    }
    return entryList
        .get(currentIndex < entryList.size() - 1 ? currentIndex + 1 : currentIndex)
        .getUrl();
}
项目:sbc-qsystem    文件:BrowserFX.java   
public String goBack() {
    final WebHistory history = webEngine.getHistory();
    ObservableList<WebHistory.Entry> entryList = history.getEntries();
    int currentIndex = history.getCurrentIndex();
    //    Out("currentIndex = "+currentIndex);
    //    Out(entryList.toString().replace("],","]\n"));
    Platform.runLater(() -> {
        history.go(-1);
    });
    return entryList.get(currentIndex > 0 ? currentIndex - 1 : currentIndex).getUrl();
}
项目:sbc-qsystem    文件:BrowserFX.java   
public String goForward() {
    final WebHistory history = webEngine.getHistory();
    ObservableList<WebHistory.Entry> entryList = history.getEntries();
    int currentIndex = history.getCurrentIndex();
    //    Out("currentIndex = "+currentIndex);
    //    Out(entryList.toString().replace("],","]\n"));
    Platform.runLater(() -> {
        history.go(1);
    });
    return entryList
        .get(currentIndex < entryList.size() - 1 ? currentIndex + 1 : currentIndex)
        .getUrl();
}
项目:mars-sim    文件:BrowserJFX.java   
@SuppressWarnings("restriction")
public String getCurrentURL() {
       //history = engine.getHistory();
       ObservableList<WebHistory.Entry> entryList = history.getEntries();
       int currentIndex = history.getCurrentIndex();
       String txt = null;
       if (currentIndex >=0 ) {
        txt = entryList.get(currentIndex).getUrl();
        //System.out.println("currentIndex is " + currentIndex + " url is " + txt);
        //Platform.runLater(() -> { history.go(0);} );
       }
       return txt;
     }
项目:Wallet    文件:OneNameControllerDisplay.java   
public String goBack()
    {    
      final WebHistory history = engine.getHistory();
      ObservableList<WebHistory.Entry> entryList=history.getEntries();
      int currentIndex=history.getCurrentIndex();
//      Out("currentIndex = "+currentIndex);
//      Out(entryList.toString().replace("],","]\n"));

      Platform.runLater(new Runnable() { public void run() { history.go(-1); } });
      return entryList.get(currentIndex>0?currentIndex-1:currentIndex).getUrl();
    }
项目:Wallet    文件:OneNameControllerDisplay.java   
public String goForward()
    {    
      final WebHistory history=engine.getHistory();
      ObservableList<WebHistory.Entry> entryList=history.getEntries();
      int currentIndex=history.getCurrentIndex();
//      Out("currentIndex = "+currentIndex);
//      Out(entryList.toString().replace("],","]\n"));

      Platform.runLater(new Runnable() { public void run() { history.go(1); } });
      return entryList.get(currentIndex<entryList.size()-1?currentIndex+1:currentIndex).getUrl();
    }
项目:JavaFX-Web-Browser    文件:WebBrowserTabController.java   
/**
 * @return the history
 */
public WebHistory getHistory() {
    return history;
}
项目:JavaFX-Web-Browser    文件:WebBrowserTabController.java   
/**
 * @param history
 *            the history to set
 */
public void setHistory(WebHistory history) {
    this.history = history;
}