Skip to content

Commit

Permalink
some unittests written, lots of refactoring and making it pretier
Browse files Browse the repository at this point in the history
  • Loading branch information
Crydust committed Jan 4, 2013
1 parent c433d20 commit 7dbe9e8
Show file tree
Hide file tree
Showing 13 changed files with 616 additions and 162 deletions.
257 changes: 129 additions & 128 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -1,128 +1,129 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=BlogReader
application.vendor=kristof
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
compile.on.save=true
compile.on.save.unsupported.javafx=true
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/BlogReader.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.jsr305-2.0.1.jar=lib/jsr305-2.0.1.jar
includes=**
# Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects
jar.archive.disabled=true
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${javafx.runtime}/lib/jfxrt.jar:\
${javafx.runtime}/lib/deploy.jar:\
${javafx.runtime}/lib/javaws.jar:\
${javafx.runtime}/lib/plugin.jar:\
${file.reference.jsr305-2.0.1.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.7
javac.target=1.7
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
javafx.binarycss=false
javafx.deploy.adddesktopshortcut=false
javafx.deploy.addstartmenushortcut=false
javafx.deploy.allowoffline=true
# If true, application update mode is set to 'background', if false, update mode is set to 'eager'
javafx.deploy.backgroundupdate=false
javafx.deploy.embedJNLP=true
javafx.deploy.includeDT=true
javafx.deploy.installpermanently=false
javafx.deploy.permissionselevated=true
# Set true to prevent creation of temporary copy of deployment artifacts before each run (disables concurrent runs)
javafx.disable.concurrent.runs=false
# Set true to enable multiple concurrent runs of the same WebStart or Run-in-Browser project
javafx.enable.concurrent.external.runs=false
# This is a JavaFX project
javafx.enabled=true
javafx.fallback.class=com.javafx.main.NoJavaFXFallback
# Main class for JavaFX
javafx.main.class=blogreader.BlogReader
javafx.native.bundling.enabled=false
javafx.native.bundling.type=none
javafx.preloader.class=
# This project does not use Preloader
javafx.preloader.enabled=false
javafx.preloader.jar.filename=
javafx.preloader.jar.path=
javafx.preloader.project.path=
javafx.preloader.type=none
# Set true for GlassFish only. Rebases manifest classpaths of JARs in lib dir. Not usable with signed JARs.
javafx.rebase.libs=false
javafx.run.height=600
javafx.run.width=800
javafx.runtime=${platforms.JDK_1.7.javafx.runtime.home}
javafx.sdk=${platforms.JDK_1.7.javafx.sdk.home}
javafx.signing.enabled=true
javafx.signing.type=self
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
# Pre-JavaFX 2.0 WebStart is deactivated in JavaFX 2.0+ projects
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
# Main class for Java launcher
main.class=com.javafx.main.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=JDK_1.7
run.classpath=\
${dist.jar}:\
${javac.classpath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=BlogReader
application.vendor=kristof
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
compile.on.save=true
compile.on.save.unsupported.javafx=true
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/BlogReader.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.jsr305-2.0.1.jar=lib/jsr305-2.0.1.jar
includes=**
# Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects
jar.archive.disabled=true
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${javafx.runtime}/lib/jfxrt.jar:\
${javafx.runtime}/lib/deploy.jar:\
${javafx.runtime}/lib/javaws.jar:\
${javafx.runtime}/lib/plugin.jar:\
${file.reference.jsr305-2.0.1.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.7
javac.target=1.7
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit_4.classpath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
javafx.binarycss=false
javafx.deploy.adddesktopshortcut=false
javafx.deploy.addstartmenushortcut=false
javafx.deploy.allowoffline=true
# If true, application update mode is set to 'background', if false, update mode is set to 'eager'
javafx.deploy.backgroundupdate=false
javafx.deploy.embedJNLP=true
javafx.deploy.includeDT=true
javafx.deploy.installpermanently=false
javafx.deploy.permissionselevated=true
# Set true to prevent creation of temporary copy of deployment artifacts before each run (disables concurrent runs)
javafx.disable.concurrent.runs=false
# Set true to enable multiple concurrent runs of the same WebStart or Run-in-Browser project
javafx.enable.concurrent.external.runs=false
# This is a JavaFX project
javafx.enabled=true
javafx.fallback.class=com.javafx.main.NoJavaFXFallback
# Main class for JavaFX
javafx.main.class=blogreader.BlogReader
javafx.native.bundling.enabled=false
javafx.native.bundling.type=none
javafx.preloader.class=
# This project does not use Preloader
javafx.preloader.enabled=false
javafx.preloader.jar.filename=
javafx.preloader.jar.path=
javafx.preloader.project.path=
javafx.preloader.type=none
# Set true for GlassFish only. Rebases manifest classpaths of JARs in lib dir. Not usable with signed JARs.
javafx.rebase.libs=false
javafx.run.height=600
javafx.run.width=800
javafx.runtime=${platforms.JDK_1.7.javafx.runtime.home}
javafx.sdk=${platforms.JDK_1.7.javafx.sdk.home}
javafx.signing.enabled=true
javafx.signing.type=self
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
# Pre-JavaFX 2.0 WebStart is deactivated in JavaFX 2.0+ projects
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
# Main class for Java launcher
main.class=com.javafx.main.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=JDK_1.7
run.classpath=\
${dist.jar}:\
${javac.classpath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
34 changes: 30 additions & 4 deletions src/blogreader/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,31 @@ public class Controller implements Initializable {
private static final String DATE_FORMAT = "dd/MM/yyyy";
private static final String TITLE_PROPERTY_NAME = "title";
private static final String WEBVIEW_TEMPLATE = ""
+ "<!DOCTYPE html>%n"
+ "<html>%n"
+ "<head>%n"
+ "<style>%n"
+ "body {%n"
+ " font-size: 14px;%n"
+ " font-family: Arial, Helvetica, sans-serif;%n"
+ " font-size: 13px;%n"
+ " line-height: 1.4;%n"
+ " background: #fff;%n"
+ " color: #4c4c4c;%n"
+ "}%n"
+ "a {%n"
+ " color: #105cb6;%n"
+ " text-decoration: underline;%n"
+ "}%n"
+ "pre, code, tt {%n"
+ " font-size: 14px;%n"
+ " font-family: Consolas, 'andale mono', 'lucida console', monospace;%n"
+ " line-height: 1.5;"
+ "}%n"
+ "%n"
+ "pre {%n"
+ " border-left: 1px dotted #a8a8a8;%n"
+ " padding-left: 1.5em;%n"
+ " white-space : pre;%n"
+ "}%n"
+ "</style>%n"
+ "<script>%n"
Expand All @@ -69,7 +89,11 @@ public class Controller implements Initializable {
+ " }%n"
+ "}%n"
+ "</script>"
+ "%s";
+ "</head>%n"
+ "<body>%n"
+ "%s"
+ "</body>"
+ "</html>";
@FXML
private Label titleLabel;
@FXML
Expand All @@ -92,19 +116,21 @@ public void initialize(URL url, ResourceBundle rb) {
// * add selection listener
TableColumn titleColumn = new TableColumn();
titleColumn.setText(TITLE_COLUMN_TEXT);
titleColumn.setPrefWidth(400);
titleColumn.prefWidthProperty().bind(itemsTableView.widthProperty().subtract(200));
titleColumn.setCellValueFactory(new PropertyValueFactory<FeedItem, String>(TITLE_PROPERTY_NAME));

TableColumn pubDateColumn = new TableColumn();
pubDateColumn.setText(DATE_COLUMN_TEXT);
pubDateColumn.setPrefWidth(200);
pubDateColumn.setPrefWidth(180);
pubDateColumn.setCellValueFactory(new PubDateValueFactory());

itemsTableView.getColumns().add(titleColumn);
itemsTableView.getColumns().add(pubDateColumn);
itemsTableView.itemsProperty().bind(model.itemsProperty());
itemsTableView.getSelectionModel().selectedItemProperty()
.addListener(new SelectionChangeListener(itemWebView));



// initialize webview
// * disable the contextmenu
Expand Down
21 changes: 15 additions & 6 deletions src/blogreader/View.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@
<?import javafx.scene.web.*?>
<?import javafx.scene.control.cell.*?>

<VBox prefWidth="600" xmlns:fx="http://javafx.com/fxml" fx:controller="blogreader.Controller"
stylesheets="/blogreader/style.css">
<VBox xmlns:fx="http://javafx.com/fxml" fx:controller="blogreader.Controller"
prefWidth="600" prefHeight="480" stylesheets="/blogreader/style.css">
<children>
<Label fx:id="titleLabel" />
<TableView fx:id="itemsTableView" prefHeight="200" />
<WebView fx:id="itemWebView" prefHeight="200" />
<Button fx:id="linkButton" text="Read Full Post" onAction="#onLinkButtonClick" />
<Label fx:id="titleLabel" styleClass="big" />
<SplitPane orientation="VERTICAL">
<items>
<TableView fx:id="itemsTableView" />
<WebView fx:id="itemWebView" />
</items>
</SplitPane>
<AnchorPane>
<children>
<Button AnchorPane.topAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
fx:id="linkButton" styleClass="big" text="Read Full Post" onAction="#onLinkButtonClick" />
</children>
</AnchorPane>
</children>
</VBox>
2 changes: 1 addition & 1 deletion src/blogreader/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#title {
.big {
-fx-font-size: 20;
}
Loading

0 comments on commit 7dbe9e8

Please sign in to comment.