Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelsea committed Dec 21, 2011
0 parents commit 89cff0e
Show file tree
Hide file tree
Showing 41 changed files with 3,281 additions and 0 deletions.
Binary file added lib/PDFRenderer-0.9.1.jar
Binary file not shown.
Binary file added lib/image4j.jar
Binary file not shown.
32 changes: 32 additions & 0 deletions package.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
rem Windows build script.
rem Currently only builds the standalone app jar as the signing function doesn't work for javafxpackager (http://javafx-jira.kenai.com/browse/RT-18246)

rem cleanup the output directories
rd /S /Q out
rd /S /Q dist
rd /S /Q dist-web
rd /S /Q dist-signed

rem create the compile output directory
mkdir out

rem compile the source
"%JDK_HOME%\bin\javac" src\main\java\org\jewelsea\willow\*.java -classpath "%JAVAFX_SDK_HOME%\rt\lib\jfxrt.jar;lib\*" -d out

rem copy the resources to the output
xcopy /S src\main\resources\* out\*

rem package the app as a click to run jar
"%JAVAFX_SDK_HOME%\bin\javafxpackager" -createjar -appclass org.jewelsea.willow.Willow -srcdir out -classpath lib\image4j.jar;lib\PDFRenderer-0.9.1.jar -outdir dist -runtimeversion 2.0 -outfile willow.jar -v

rem copy the lib files to the distribution
mkdir dist\lib
xcopy /S lib dist\lib

rem package the app as a webstart app and applet
rem "%JAVAFX_SDK_HOME%\bin\javafxpackager" -deploy -outdir dist-web -outfile Willow -width 1121 -height 600 -name Willow -appclass org.jewelsea.willow.Willow.class -v -srcdir dist -srcfiles Willow.jar;lib\image4j.jar;lib\PDFRenderer-0.9.1.jar -v

rem sign the app
rem "%JAVAFX_SDK_HOME%\bin\javafxpackager" -signjar -outdir dist-signed -keyStore willow.jks -storePass willow -alias willow -keypass willow -srcdir dist


169 changes: 169 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (C) 2011 Schlichtherle IT Services
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jewelsea</groupId>
<artifactId>willow</artifactId>
<version>0.1</version>

<name>willow</name>
<description>A JavaFX Web Browser</description>

<properties>
<exec.mainClass>org.jewelsea.willow.Willow</exec.mainClass>
<pdfrenderer.jar>${project.build.directory}/../lib/PDFRenderer-0.9.1.jar</pdfrenderer.jar>
<javafx.runtime.lib.jar>${env.JAVAFX_SDK_HOME}/rt/lib/jfxrt.jar</javafx.runtime.lib.jar>
<javafx.tools.ant.jar>${env.JAVAFX_SDK_HOME}/tools/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>
</properties>

<dependencies>
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>pdf-renderer</artifactId>
<version>0.9.1</version>
<scope>system</scope>
<systemPath>${pdfrenderer.jar}</systemPath>
</dependency>
<dependency>
<groupId>org.jclarion</groupId>
<artifactId>image4j</artifactId>
<version>0.7</version>
</dependency>
<dependency>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
<version>2.0</version>
<scope>system</scope>
<systemPath>${javafx.runtime.lib.jar}</systemPath>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.0.3</version>
</requireMavenVersion>
<requireJavaVersion>
<version>1.6</version>
</requireJavaVersion>
<requireProperty>
<property>env.JAVAFX_HOME</property>
<message>You must set the environment variable JAVAFX_HOME to the installation directory of the JavaFX 2.0 SDK!</message>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<includes>
<include>**/*Test.class</include>
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>create-launcher-jar</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target xmlns:fx="javafx:com.sun.javafx.tools.ant">
<taskdef
uri="javafx:com.sun.javafx.tools.ant"
resource="com/sun/javafx/tools/ant/antlib.xml"
classpath="${javafx.tools.ant.jar}"/>
<fx:application id="fxApp"
name="${project.name}"
mainClass="${exec.mainClass}"/>
<fx:jar destfile="${project.build.directory}/${project.build.finalName}-launcher">
<fx:application refid="fxApp"/>
<fx:fileset dir="${project.build.directory}/classes"/>
</fx:jar>
<attachartifact file="${project.build.directory}/${project.build.finalName}-launcher.jar"
classifier="launcher"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
</descriptors>
<archive>
<manifestEntries>
<JavaFX-Version>2.0</JavaFX-Version>
<JavaFX-Application-Class>${exec.mainClass}</JavaFX-Application-Class>
<Main-Class>com/javafx/main/Main</Main-Class>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
39 changes: 39 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Willow - A web browser.

Author: John Smith
[email protected]


Build Pre-requisites
--------------------
JDK 1.7.0_02+
JavaFX SDK 2.0.2+


Build Instructions - Maven
--------------------------
Maven build of a browser application =>
set the environment variable JAVAFX_SDK_HOME to the location of your JavaFX 2.0 SDK install, for example:
> set JAVAFX_SDK_HOME=C:\Program Files (x86)\Oracle\JavaFX 2.0 SDK

run a maven build on the project root directory (contains a pom.xml file).
> mvn package

run the browser
> target\willow-0.1-jar-with-dependencies.jar


Build Instructions - Windows Command Line
-----------------------------------------
If developing using a command line build =>
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_02"

set the environment variable JAVAFX_SDK_HOME to the location of your JavaFX SDK install, for example:
> set JAVAFX_SDK_HOME="C:\Program Files (x86)\Oracle\JavaFX 2.0 SDK"

compile and package the application
> package.bat

run the browser
> dist\willow.jar
42 changes: 42 additions & 0 deletions src/main/assembly/jar-with-dependencies.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (C) 2011 Schlichtherle IT Services
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-->
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<unpack>true</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<useProjectAttachments>true</useProjectAttachments>
</dependencySet>
<dependencySet>
<scope>system</scope>
<unpack>true</unpack>
<includes>
<include>org.swinglabs:pdf-renderer</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>
87 changes: 87 additions & 0 deletions src/main/java/org/jewelsea/willow/BenchPanel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package org.jewelsea.willow;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.TitledPane;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;

/** Sidebar panel for showing Benchmark information */
public class BenchPanel {
public static TitledPane createPanel(final Willow chrome) {
// create a layout container for the panel.
VBox benchPanel = new VBox();
benchPanel.setSpacing(5);
benchPanel.setStyle("-fx-padding: 5");
TitledPane benchTitle = new TitledPane("Benchmarks", benchPanel);
benchTitle.setStyle("-fx-font-size: 16px;");

// info on benchmarks.
// format: name, link, icon, (if link and icon are empty, then defines a benchmark category).
final String[][] benchmarkLinks = {
{ "Compliance", "", "" },
{ "HTML 5 Test", "http://www.html5test.com", "HTML5_Badge_32.png"},
{ "Acid 3 Test", "http://acid3.acidtests.org/", "acid.png"},
{ "JavaScript Performance", "", "" },
{ "WebKit SunSpider", "http://www.webkit.org/perf/sunspider-0.9.1/sunspider-0.9.1/driver.html", "webkit.png"},
{ "Google V8", "http://v8.googlecode.com/svn/data/benchmarks/v5/run.html", "google.png"},
{ "Mozilla Kraken", "http://krakenbenchmark.mozilla.org/kraken-1.0/driver.html", "firefox_32.png"},
{ "Rendering Performance", "" },
{ "Bubble Mark", "http://bubblemark.com/dhtml.htm", "ball.png"},
{ "Guimark", "http://www.craftymind.com/factory/guimark/GUIMark_HTML4.html", "guimark.png"}
};

// create the panel contents and insert it into the panel.
ToggleGroup benchToggleGroup = new ToggleGroup();
boolean firstCategory = true;
for (final String[] link : benchmarkLinks) {
if ("".equals(link[1])) {
// a category of benchmarks.
final Label categoryLabel = new Label(link[0]);
categoryLabel.setStyle("-fx-text-fill: midnightblue; -fx-font-size: 16px;");
VBox.setMargin(categoryLabel, new Insets(firstCategory ? 1 : 8, 0, 0, 0));
benchPanel.getChildren().add(categoryLabel);
firstCategory = false;
} else {
// create a toggle button to navigate to the given benchmark.
final ToggleButton benchLink = new ToggleButton(link[0]);
benchLink.setStyle("-fx-font-size: 14px;");
benchLink.setAlignment(Pos.CENTER_LEFT);
benchLink.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent actionEvent) {
chrome.getBrowser().navTo(link[1]);
}
});
benchPanel.getChildren().add(benchLink);
benchLink.setMaxWidth(Double.MAX_VALUE);
VBox.setMargin(benchLink, new Insets(0, 5, 0, 5));

// place the link in a toggle group.
benchLink.setToggleGroup(benchToggleGroup);

// add a graphic to the link.
if (!link[2].equals("")) {
final Image image = new Image(Util.getResource(link[2]));
final ImageView imageView = new ImageView(image);
imageView.setPreserveRatio(true);
imageView.setFitHeight(16);
benchLink.setGraphic(imageView);
}
}
}

// add a spacer to pad out the panel.
final Region spacer = new Region();
spacer.setPrefHeight(5);
benchPanel.getChildren().add(spacer);

return benchTitle;
}
}
Loading

0 comments on commit 89cff0e

Please sign in to comment.