Skip to content

Commit

Permalink
Updated to jdk 8 minimum requirement.
Browse files Browse the repository at this point in the history
Later JavaFX versions caused different behaviour for the app which prevented it from working correctly with those versions.

The majority of those issues have been fixed.
  • Loading branch information
lilyshard authored and lilyshard committed Oct 31, 2013
1 parent e0189a6 commit bb79e85
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 290 deletions.
4 changes: 2 additions & 2 deletions package.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rem Windows build script (requires Java JDK 7u11 or later)
rem Windows build script (requires Java JDK 8b113 or later)

rem cleanup the output directories
rd /S /Q out
Expand All @@ -9,7 +9,7 @@ rd /S /Q dist-signed
rem create the compile output directory
mkdir out

set JDK_HOME=C:\Program Files\Java\jdk1.7.0_11
set JDK_HOME=C:\Program Files\Java\jdk1.8.0

rem compile the source
"%JDK_HOME%\bin\javac"^
Expand Down
7 changes: 3 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
<exec.mainClass>org.jewelsea.willow.Willow</exec.mainClass>
<pdfrenderer.jar>${project.basedir}/lib/PDFRenderer-0.9.1.jar</pdfrenderer.jar>
<javafx.min.version>2.2</javafx.min.version>
<jdk.home>/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home</jdk.home>
<javafx.home>${java.home}</javafx.home> <!-- override if your javafx is sourced from a different jdk then your maven build execution jre -->
<javafx.runtime.lib.jar>${javafx.home}/lib/jfxrt.jar</javafx.runtime.lib.jar>
<javafx.tools.ant.jar>${javafx.home}/../lib/ant-javafx.jar</javafx.tools.ant.jar>
<jdk.home>/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home</jdk.home>
<javafx.runtime.lib.jar>${jdk.home}/jre/lib/ext/jfxrt.jar</javafx.runtime.lib.jar>
<javafx.tools.ant.jar>${jdk.home}/lib/ant-javafx.jar</javafx.tools.ant.jar>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ [email protected]

Build Pre-requisites
--------------------
JDK 1.7.0_11+
JDK 1.8b113+


Build Instructions - Maven
Expand All @@ -22,7 +22,7 @@ Build Instructions - Windows Command Line
-----------------------------------------
If developing using a command line build =>
edit package.bat and set the environment variable JDK_HOME to the location of your JDK install, for example:
> set JDK_HOME=C:\Program Files (x86)\Java\jdk1.7.0_11
> set JDK_HOME=C:\Program Files (x86)\Java\jdk1.8.0

compile and package the application
> package.bat
Expand Down
31 changes: 15 additions & 16 deletions src/main/java/org/jewelsea/willow/BrowserWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
import javafx.scene.input.*;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.scene.web.PromptData;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView;
import javafx.scene.web.*;
import javafx.stage.FileChooser;
import javafx.util.Callback;

import javax.swing.*;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
Expand Down Expand Up @@ -114,14 +112,19 @@ public void handle(KeyEvent keyEvent) {

// monitor the location url, and if it is a pdf file, then create a pdf viewer for it.
getLocField().textProperty().addListener(new ChangeListener<String>() {
@Override public void changed(ObservableValue<? extends String> observableValue, String oldLoc, String newLoc) {
@Override public void changed(ObservableValue<? extends String> observableValue, String oldLoc, final String newLoc) {
if (newLoc.endsWith(".pdf")) {
try {
final PDFViewer pdfViewer = new PDFViewer(false); // todo try icepdf viewer instead...
pdfViewer.openFile(new URL(newLoc));
} catch (Exception ex) {
// just fail to open a bad pdf url silently - no action required.
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
final PDFViewer pdfViewer = new PDFViewer(false); // todo try icepdf viewer instead...
pdfViewer.openFile(new URL(newLoc));
} catch (Exception ex) {
// just fail to open a bad pdf url silently - no action required.
}
}
});
}
String downloadableExtension = null; // todo I wonder how to find out from WebView which documents it could not process so that I could trigger a save as for them?
String[] downloadableExtensions = { ".doc", ".xls", ".zip", ".tgz", ".jar" };
Expand Down Expand Up @@ -509,10 +512,6 @@ private void overlayView(Node dialogNode) {

// todo cleanup the javascript prompt handlers as their code could be collapsed.
// todo log jira issue on browser load work progress not being updated.
// todo file rfe for icon support.
// todo cleanup history code.
// todo add better favicon support (not just for icos, but for pngs, etc.)
// todo how to set the save filename.
// todo file an jira bug request - modifying the list of items in a context menu makes the menus focus model go strange (doesn't appear to...)
// https://lh3.googleusercontent.com/BylHWQYWZPJtG8OHypz_rfWOEZS9nKh-96uCm-njWlS9vRxPIYOPJ-30XAdDf0U-_cfLz_S3Kg=s128-h128-e365
// http://www.mozilla.org/images/projects/firebug.png
// todo file an jira bug request - modifying the list of items in a context menu makes the menus focus model go strange (doesn't appear to...)
2 changes: 2 additions & 0 deletions src/main/java/org/jewelsea/willow/History.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,5 @@ private MenuItem createMenuItem(final String loc, final int navPointer) {
return nextMenuItem;
}
}

// todo webview now has a built in history, so most of the logic in this class can likely be replaced.
50 changes: 29 additions & 21 deletions src/main/java/org/jewelsea/willow/NavTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import javafx.animation.Animation;
import javafx.animation.Transition;
import javafx.application.Platform;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Control;
import javafx.scene.control.Tooltip;
import javafx.scene.effect.ColorAdjust;
import javafx.scene.effect.InnerShadow;
Expand Down Expand Up @@ -110,45 +113,50 @@ public void handle(ActionEvent actionEvent) {
sidebarButton.setGraphic(sidebarGraphic);
sidebarButton.setTooltip(new Tooltip("Play sidebar hide and seek"));
sidebarButton.setStyle("-fx-font-weight: bold;");
sidebarButton.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent actionEvent) {
// hide sidebar.
final double startWidth = chrome.getSidebarDisplay().getWidth();
final Animation hideSidebar = new Transition() {
final DoubleProperty startWidth = new SimpleDoubleProperty();

// todo java 8 has a weird background issue on resize - file bug
// hide sidebar.
final Animation hideSidebar = new Transition() {
{ setCycleDuration(Duration.millis(250)); }
protected void interpolate(double frac) {
final double curWidth = startWidth * (1.0 - frac);
chrome.getSidebarDisplay().setPrefWidth(curWidth);
chrome.getSidebarDisplay().setTranslateX(-startWidth + curWidth);
final double curWidth = startWidth.get() * (1.0 - frac);
chrome.getSidebarDisplay().setPrefWidth(curWidth); // todo resize a spacing underlay to allow the scene to adjust.
chrome.getSidebarDisplay().setTranslateX(-startWidth.get() + curWidth);
}
};
hideSidebar.onFinishedProperty().set(new EventHandler<ActionEvent>() {
};
hideSidebar.onFinishedProperty().set(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent actionEvent) {
chrome.getSidebarDisplay().setVisible(false);
chrome.getSidebarDisplay().setVisible(false);
}
});
});

// show sidebar.
final Animation showSidebar = new Transition() {
// show sidebar.
final Animation showSidebar = new Transition() {
{ setCycleDuration(Duration.millis(250)); }
protected void interpolate(double frac) {
chrome.getSidebarDisplay().setVisible(true);
final double curWidth = startWidth * frac;
chrome.getSidebarDisplay().setPrefWidth(curWidth);
chrome.getSidebarDisplay().setTranslateX(-startWidth + curWidth);
final double curWidth = startWidth.get() * frac;
chrome.getSidebarDisplay().setPrefWidth(curWidth);
chrome.getSidebarDisplay().setTranslateX(-startWidth.get() + curWidth);
}
};
};

sidebarButton.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent actionEvent) {
chrome.getSidebarDisplay().setMinWidth(Control.USE_PREF_SIZE);

if (showSidebar.statusProperty().get().equals(Animation.Status.STOPPED) && hideSidebar.statusProperty().get().equals(Animation.Status.STOPPED)) {
if (chrome.getSidebarDisplay().isVisible()) {
startWidth.set(chrome.getSidebarDisplay().getWidth());
hideSidebar.play();
} else {
chrome.getSidebarDisplay().setVisible(true);
showSidebar.play();
}
}
}
});

final Button fullscreenButton = new Button();
fullscreenButton.setTooltip(new Tooltip("Go huge"));
final ImageView fullscreenGraphic = new ImageView(new Image(Util.getResource("1325834738_gtk-fullscreen.png")));
Expand Down Expand Up @@ -179,7 +187,7 @@ protected void interpolate(double frac) {
final InnerShadow innerShadow = new InnerShadow();
innerShadow.setColor(Color.ANTIQUEWHITE);
navPane.setEffect(innerShadow);

return navPane;
}
}
Expand Down
25 changes: 15 additions & 10 deletions src/main/java/org/jewelsea/willow/SideBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ public class SideBar {
// "http://mugtug.com/sketchpad/", sketchpad doesn't work too well, so disabled it.
// "http://radikalfx.com/files/collage/demo.html" collage is pretty boring, so disabled it.
};
private final ScrollPane sideBarScroll;

/** Create a private contructor so you can only create a sidebar via factory methods */
private SideBar(VBox bar, VBox progressHolder) {
this.bar = bar;
/** Create a private contructor so you can only create a sidebar via factory methods */
private SideBar(final VBox bar, VBox progressHolder) {
this.bar = bar;
this.progressHolder = progressHolder;
this.sideBarScroll = new ScrollPane(bar);
sideBarScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
sideBarScroll.getStyleClass().add("sidebar-scroll");
}
private final VBox bar;
private final VBox progressHolder;
Expand Down Expand Up @@ -208,7 +212,7 @@ public static SideBar createSidebar(final Willow chrome) {
}
}
);

// create a firebug button.
final Button firebugButton = Util.createIconButton(
"Firebug",
Expand All @@ -220,12 +224,12 @@ public static SideBar createSidebar(final Willow chrome) {
}
}
);

// create a box for displaying navigation options.
VBox navigationBox = new VBox();
navigationBox.setSpacing(5);
navigationBox.setStyle("-fx-padding: 5");
navigationBox.getChildren().addAll(homeButton, historyButton, bookmarksButton, readerButton, fontsizer); // todo fontSize disabled until it is working.
navigationBox.getChildren().addAll(homeButton, historyButton, bookmarksButton, readerButton, fontsizer);
final TitledPane navPanel = new TitledPane("Navigation", navigationBox);
navPanel.getStyleClass().add("sidebar-panel");

Expand All @@ -250,7 +254,7 @@ public static SideBar createSidebar(final Willow chrome) {
// create a box for benchmark control.
final TitledPane benchPanel = BenchPanel.createPanel(chrome);
benchPanel.setExpanded(false);

// size all of the panes similarly.
navPanel.prefWidthProperty().bind(benchPanel.prefWidthProperty());
devPanel.prefWidthProperty().bind(benchPanel.prefWidthProperty());
Expand Down Expand Up @@ -289,13 +293,14 @@ private static boolean createBookmark(final Willow chrome, ContextMenu bookmarks
bookmarksMenu.getItems().add(menuItem);
return true;
}

public ScrollPane getScroll() {
return sideBarScroll;
}
}

// todo add an autohide to the bar if it hasn't been used for a while.
// todo add a full screen browsing mode.
// todo fully open sidebar makes the navbar scroll off the top of the screen.
// todo history in the sidebar should actually be chrome wide rather than browser tab specific.
// todo some kind of persistence framework is needed.

// todo file jira ability to set the initial offset of a slider
// todo file jira custom slider formatting does not work.
11 changes: 7 additions & 4 deletions src/main/java/org/jewelsea/willow/TabManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

/** Manages a set of active browser windows */
public class TabManager {

final private double TAB_PANE_WIDTH = 400;

/** representation of the current browser. */
final private ReadOnlyObjectWrapper<BrowserWindow> browser = new ReadOnlyObjectWrapper<BrowserWindow>();
public BrowserWindow getBrowser() { return browser.get(); }
Expand Down Expand Up @@ -48,7 +51,7 @@ public TabManager(TextField locField) {

// create a browser tab pane with a custom tab closing policy which does not allow the last tab to be closed.
tabPane.setTabMinWidth(50);
tabPane.setTabMaxWidth(500);
tabPane.setTabMaxWidth(TAB_PANE_WIDTH);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
tabPane.getTabs().addListener(new ListChangeListener<Tab>() {
@Override public void onChanged(Change<? extends Tab> change) {
Expand All @@ -57,7 +60,7 @@ public TabManager(TextField locField) {
for (int i = 1; i < tabs.size(); i++) {
tabs.get(i).setClosable(true);
}
tabPane.setTabMaxWidth(Math.max(50, 500.0 / Math.max(1, tabPane.getTabs().size() * 0.7))); // todo work out a good max width // todo file jira setting max width on a initialTab pane is buggy as the close symbol is not usable if you change initialTab from closable to not closable. // todo file jira on initialTab pane set policy for closing icon display.
tabPane.setTabMaxWidth(Math.max(50, TAB_PANE_WIDTH / Math.max(1, tabPane.getTabs().size() * 0.7))); // todo work out a good max width // todo file jira setting max width on a initialTab pane is buggy as the close symbol is not usable if you change initialTab from closable to not closable. // todo file jira on initialTab pane set policy for closing icon display.
}
});

Expand Down Expand Up @@ -116,8 +119,8 @@ public BrowserTab() {

// put some dummy invisible content in the tab otherwise it doesn't show because it has no dimensions. // todo file jira?
Pane spacer = new StackPane();
spacer.setMinWidth(500);
spacer.setMaxWidth(500); // todo hmm I wonder what the max width really ought to be because this default is not right.
spacer.setMinWidth(TAB_PANE_WIDTH + 35);
spacer.setMaxWidth(TAB_PANE_WIDTH + 35);
setContent(spacer);

// add the tab
Expand Down
Loading

0 comments on commit bb79e85

Please sign in to comment.