Skip to content

Commit

Permalink
Merge pull request #7 from FlorianKirmaier/master
Browse files Browse the repository at this point in the history
Our Changes to the Sampler for the JPro-Demo-Page
  • Loading branch information
aalmiray authored Nov 22, 2018
2 parents e596325 + 87f83c3 commit c3879ee
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 58 deletions.
7 changes: 7 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ stylesheet that closely resembles the original while being custom tailored for J
It's worth mentioning that Twitter Bootstrap delivers more than just a standardized look for common widgets. It also
provides new widgets, behavior and a grid system. Some of these features may be ported at a later stage to BootstrapFX.

There is an link:https://demos.jpro.one/bootstrapfx.html[online-version] available at link:https://www.jpro.one/[jpro.one].

== Installing

You can get the latest version of **BootstrapFX** directly from link:https://bintray.com[Bintray's JCenter] repository or Maven Central.
Expand Down Expand Up @@ -146,6 +148,11 @@ $ ./gradlew build
[source]
----
$ ./gradlew :sampler:run
----
. Run the sampler application with link:https://www.jpro.one/[JPro] by invoking the following command
[source]
----
$ ./gradlew :sampler-jpro:jproRun
----

== Supported CSS Classes
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ buildscript {
repositories {
jcenter()
maven { url 'https://plugins.gradle.org/m2/' }
maven {
url "https://sandec.bintray.com/repo"
}
}

dependencies {
Expand All @@ -34,6 +37,7 @@ buildscript {
classpath 'org.kordamp.gradle:stats-gradle-plugin:0.2.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
classpath 'net.nemerosa:versioning:2.7.1'
classpath "com.sandec.jpro:jpro-plugin-gradle:2018.1.8"
}
}

Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ def includeProject = { String projectDirName, String projectName ->

includeProject 'subprojects', 'bootstrapfx-core'
includeProject 'subprojects', 'sampler'
includeProject 'subprojects', 'sampler-jpro'
30 changes: 30 additions & 0 deletions subprojects/sampler-jpro/sampler-jpro.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2015-2018 Andres Almiray
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

apply plugin: 'application'
apply plugin: 'com.sandec.jpro'

mainClassName = 'org.kordamp.bootstrapfx.SamplerJPro'

dependencies {
compile project(':sampler')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2015-2018 Andres Almiray
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.kordamp.bootstrapfx;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

/**
* @author Florian Kirmaier
*/
public class SamplerJPro extends Application {
@Override
public void start(Stage primaryStage) throws Exception {

StackPane innerPane = new StackPane(new DemoTabPane());
innerPane.setMaxWidth(1000);
innerPane.setMaxHeight(600);
innerPane.setStyle("-fx-background-color: #ddd; -fx-background-radius: 10;");
StackPane outerPane = new StackPane(innerPane);
outerPane.setStyle("-fx-background-image: url('/org/kordamp/bootstrapfx/ambient-background.jpg');" +
"-fx-background-size: cover;");

Scene scene = new Scene(outerPane);
scene.getStylesheets().addAll(
"org/kordamp/bootstrapfx/bootstrapfx.css",
"org/kordamp/bootstrapfx/sampler.css",
"org/kordamp/bootstrapfx/xml-highlighting.css");

primaryStage.setTitle("BootstrapFX Sampler");
primaryStage.setScene(scene);
primaryStage.show();
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions subprojects/sampler/sampler.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ mainClassName = 'org.kordamp.bootstrapfx.Sampler'
dependencies {
compile project(':bootstrapfx-core')
compile 'org.fxmisc.richtext:richtextfx:0.9.1'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.kordamp.bootstrapfx;

import javafx.fxml.FXMLLoader;
import javafx.geometry.Side;
import javafx.scene.Node;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.StackPane;
import org.apache.commons.io.IOUtils;

import java.net.URL;

public class DemoTabPane extends StackPane {

public DemoTabPane() throws Exception {
URL location = getClass().getResource("sampler.fxml");
FXMLLoader fxmlLoader = new FXMLLoader(location);
TabPane tabPane = fxmlLoader.load();

tabPane.getTabs().add(new DemoTab("Buttons", "buttons.fxml"));
tabPane.getTabs().add(new DemoTab("Labels", "labels.fxml"));
tabPane.getTabs().add(new DemoTab("Alerts", "alerts.fxml"));
tabPane.getTabs().add(new DemoTab("Panels", "panels.fxml"));
tabPane.getTabs().add(new DemoTab("Headings", "text.fxml"));
tabPane.getTabs().add(new DemoTab("Progress Bars", "progressbars.fxml"));
tabPane.getTabs().add(new DemoTab("Tooltips ", "tooltips.fxml"));
tabPane.getTabs().add(new DemoTab("Text ", "text2.fxml"));
tabPane.getTabs().add(new DemoTab("Paragraph ", "paragraph.fxml"));
tabPane.getTabs().add(new DemoTab("Button Groups ", "button_groups.fxml"));
tabPane.getTabs().add(new DemoTab("SplitMenuButtons", "split_menu_buttons.fxml"));

getChildren().add(tabPane);
}

private static class DemoTab extends Tab {
private DemoTab(String title, String sourceFile) throws Exception {
super(title);
setClosable(false);

TabPane content = new TabPane();
setContent(content);
content.setSide(Side.BOTTOM);

Tab widgets = new Tab("Widgets");
widgets.setClosable(false);
URL location = getClass().getResource(sourceFile);
FXMLLoader fxmlLoader = new FXMLLoader(location);
Node node = fxmlLoader.load();
widgets.setContent(node);

Tab source = new Tab("Source");
source.setClosable(false);
XMLEditor editor = new XMLEditor();
editor.setEditable(false);

String text = IOUtils.toString(getClass().getResourceAsStream(sourceFile));
editor.setText(text);
source.setContent(editor);

content.getTabs().addAll(widgets, source);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,78 +22,25 @@
package org.kordamp.bootstrapfx;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Side;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.stage.Stage;

import java.net.URL;
import java.nio.file.Paths;

import static java.nio.file.Files.lines;
import static java.util.stream.Collectors.joining;

public class Sampler extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
URL location = getClass().getResource("sampler.fxml");
FXMLLoader fxmlLoader = new FXMLLoader(location);
TabPane tabPane = fxmlLoader.load();

tabPane.getTabs().add(new DemoTab("Buttons", "buttons.fxml"));
tabPane.getTabs().add(new DemoTab("Labels", "labels.fxml"));
tabPane.getTabs().add(new DemoTab("Alerts", "alerts.fxml"));
tabPane.getTabs().add(new DemoTab("Panels", "panels.fxml"));
tabPane.getTabs().add(new DemoTab("Headings", "text.fxml"));
tabPane.getTabs().add(new DemoTab("Progress Bars", "progressbars.fxml"));
tabPane.getTabs().add(new DemoTab("Tooltips ", "tooltips.fxml"));
tabPane.getTabs().add(new DemoTab("Text ", "text2.fxml"));
tabPane.getTabs().add(new DemoTab("Paragraph ", "paragraph.fxml"));
tabPane.getTabs().add(new DemoTab("Button Groups ", "button_groups.fxml"));
tabPane.getTabs().add(new DemoTab("SplitMenuButtons", "split_menu_buttons.fxml"));

Scene scene = new Scene(tabPane);
Scene scene = new Scene(new DemoTabPane());
scene.getStylesheets().addAll(
"org/kordamp/bootstrapfx/bootstrapfx.css",
"org/kordamp/bootstrapfx/sampler.css",
"org/kordamp/bootstrapfx/xml-highlighting.css");
"org/kordamp/bootstrapfx/bootstrapfx.css",
"org/kordamp/bootstrapfx/sampler.css",
"org/kordamp/bootstrapfx/xml-highlighting.css");

primaryStage.setTitle("BootstrapFX Sampler");
primaryStage.setScene(scene);
//primaryStage.sizeToScene();
primaryStage.setWidth(1024);
primaryStage.show();
}

private static class DemoTab extends Tab {
private DemoTab(String title, String sourceFile) throws Exception {
super(title);
setClosable(false);

TabPane content = new TabPane();
setContent(content);
content.setSide(Side.BOTTOM);

Tab widgets = new Tab("Widgets");
widgets.setClosable(false);
URL location = getClass().getResource(sourceFile);
FXMLLoader fxmlLoader = new FXMLLoader(location);
Node node = fxmlLoader.load();
widgets.setContent(node);

Tab source = new Tab("Source");
source.setClosable(false);
XMLEditor editor = new XMLEditor();
editor.setEditable(false);

String text = lines(Paths.get(getClass().getResource(sourceFile).toURI())).collect(joining("\n"));
editor.setText(text);
source.setContent(editor);

content.getTabs().addAll(widgets, source);
}
}

}

0 comments on commit c3879ee

Please sign in to comment.