Skip to content

Commit

Permalink
add sample
Browse files Browse the repository at this point in the history
refs #441
  • Loading branch information
tomsontom committed Jan 17, 2022
1 parent c2414ac commit f25c0d7
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 0 deletions.
7 changes: 7 additions & 0 deletions demos/org.eclipse.fx.ui.panes.demo/.classpath
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions demos/org.eclipse.fx.ui.panes.demo/.gitignore
@@ -0,0 +1 @@
/bin/
28 changes: 28 additions & 0 deletions demos/org.eclipse.fx.ui.panes.demo/.project
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.fx.ui.panes.demo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
8 changes: 8 additions & 0 deletions demos/org.eclipse.fx.ui.panes.demo/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Demo
Bundle-SymbolicName: org.eclipse.fx.ui.panes.demo
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.eclipse.fx.ui.panes.demo
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.fx.ui.panes;bundle-version="3.7.1"
4 changes: 4 additions & 0 deletions demos/org.eclipse.fx.ui.panes.demo/build.properties
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
@@ -0,0 +1,97 @@
package org.eclipse.fx.ui.panes.demo;

import org.eclipse.fx.ui.panes.SashPane;
import org.eclipse.fx.ui.panes.SashPane.FixedSashItem;

import javafx.application.Application;
import javafx.beans.value.ObservableBooleanValue;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TitledPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class SashPaneDemo extends Application {

public static void main(String[] args) {
launch(args);
}

@Override
public void start(Stage primaryStage) throws Exception {
TabPane root = new TabPane();
root.getTabs().add(createSimpleStartVertical());
root.getTabs().add(createSimpleEndVertical());

Scene s = new Scene(root, 800, 600);
primaryStage.setScene(s);
primaryStage.show();
}

private Tab createSimpleStartVertical() {
SashPane pane = new SashPane();
VBox.setVgrow(pane, Priority.ALWAYS);
pane.setHorizontal(false);

pane.getItems().add(new StackPane(new Label("Content")));
pane.getItems().add(createGroupNode());

StackPane root = new StackPane(pane);

return new Tab("Simple - Start - Vertical", root);
}

private Tab createSimpleEndVertical() {
SashPane pane = new SashPane();
VBox.setVgrow(pane, Priority.ALWAYS);
pane.setHorizontal(false);

pane.getItems().add(createGroupNode());
pane.getItems().add(new StackPane(new Label("Content")));

StackPane root = new StackPane(pane);

return new Tab("Simple - End - Vertical", root);
}

private Tab createComplex3() {
SashPane pane = new SashPane();
VBox.setVgrow(pane, Priority.ALWAYS);
pane.setHorizontal(false);
pane.getItems().add(new StackPane(new Label("Top")));
TitledPane titlePane = createGroupNode();
pane.getItems().add(titlePane);
pane.getItems().add(new StackPane(new Label("Bottom")));

StackPane root = new StackPane(pane);

return new Tab("Simple - Start - Vertical", root);
}

private TitledPane createGroupNode() {
VBox content = new VBox(new Label("Content"));
content.setPadding(new Insets(30));
// content.setPrefHeight(1000);
// content.setMaxHeight(1000);
TitledPane pane = new SashTitlePane("Sample", content);
return pane;
}

class SashTitlePane extends TitledPane implements FixedSashItem {
public SashTitlePane(String title, Node content) {
super(title, content);
}

@Override
public ObservableBooleanValue fixed() {
return expandedProperty().not();
}

}
}

0 comments on commit f25c0d7

Please sign in to comment.