Skip to content

Commit

Permalink
Moved the JPro-App to an own subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianKirmaier committed Nov 20, 2018
1 parent 30c4547 commit 2518a7e
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 70 deletions.
5 changes: 5 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ $ ./gradlew build
[source]
----
$ ./gradlew :sampler:run
----
. Run the sampler application with JPro (https://www.jpro.one/) by invoking the following command
[source]
----
$ ./gradlew :sampler:run
----

== Supported CSS Classes
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,52 @@
/*
* 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;

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: 0 additions & 1 deletion subprojects/sampler/sampler.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/

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

mainClassName = 'org.kordamp.bootstrapfx.Sampler'

Expand Down
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,89 +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.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

import java.net.URL;
import java.nio.file.Paths;
import org.apache.commons.io.IOUtils;

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"));

StackPane innerPane = new StackPane(tabPane);
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 scene = new Scene(new DemoTabPane());
scene.getStylesheets().addAll(
"org/kordamp/bootstrapfx/bootstrapfx.css",
"org/kordamp/bootstrapfx/sampler.css",
"org/kordamp/bootstrapfx/xml-highlighting.css");
"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 = IOUtils.toString(getClass().getResourceAsStream(sourceFile));
editor.setText(text);
source.setContent(editor);

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

}

0 comments on commit 2518a7e

Please sign in to comment.