Skip to content

Commit

Permalink
Add javadoc and update README.md
Browse files Browse the repository at this point in the history
1. Add class javadoc to ResponsivePane and TreeNodeView;
2. Enhance README documentation
  • Loading branch information
leewyatt committed Apr 10, 2024
1 parent 90bebe4 commit 05e59d5
Show file tree
Hide file tree
Showing 11 changed files with 216 additions and 88 deletions.
252 changes: 181 additions & 71 deletions README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class ResponsivePaneApp extends Application {

private final ResponsivePane sideBarPane = new ResponsivePane();
private final ResponsivePane responsivePane = new ResponsivePane();

private StackPane mainContent;
private Region smallSidebar;
Expand All @@ -28,7 +28,7 @@ public void start(Stage stage) throws Exception {
Label widthLabel = new Label();
widthLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
widthLabel.setStyle("-fx-background-color: pink; -fx-alignment: center; -fx-padding: 5px 10px;");
widthLabel.textProperty().bind(Bindings.createStringBinding(() -> String.format("SideBarPane: %.0f x %.0f", sideBarPane.getWidth(), sideBarPane.getHeight()), sideBarPane.widthProperty(), sideBarPane.heightProperty()));
widthLabel.textProperty().bind(Bindings.createStringBinding(() -> String.format("ResponsivePane: %.0f x %.0f", responsivePane.getWidth(), responsivePane.getHeight()), responsivePane.widthProperty(), responsivePane.heightProperty()));

mainContent = new StackPane(widthLabel);
mainContent.setStyle("-fx-background-color: #eeeeee;");
Expand All @@ -42,15 +42,15 @@ public void start(Stage stage) throws Exception {
largeSidebar.setPrefSize(150, 150);
largeSidebar.setStyle("-fx-background-color: rgba(43,83,241,0.5); -fx-border-color: white; -fx-border-insets: 1px;");

sideBarPane.setSmallSidebar(smallSidebar);
sideBarPane.setLargeSidebar(largeSidebar);
sideBarPane.setContent(mainContent);
sideBarPane.setForceLargeSidebarDisplay(true);
sideBarPane.setLargeSidebarCoversSmall(false);
sideBarPane.setGap(10);
sideBarPane.setStyle("-fx-background-color: white;");
responsivePane.setSmallSidebar(smallSidebar);
responsivePane.setLargeSidebar(largeSidebar);
responsivePane.setContent(mainContent);
responsivePane.setForceLargeSidebarDisplay(true);
responsivePane.setLargeSidebarCoversSmall(false);
responsivePane.setGap(10);
responsivePane.setStyle("-fx-background-color: white;");

BorderPane borderPane = new BorderPane(sideBarPane);
BorderPane borderPane = new BorderPane(responsivePane);
borderPane.setRight(createControlPanel());

Scene scene = new Scene(borderPane);
Expand All @@ -74,18 +74,18 @@ public Side fromString(String s) {
return null;
}
});
sideComboBox.valueProperty().bindBidirectional(sideBarPane.sideProperty());
sideComboBox.valueProperty().bindBidirectional(responsivePane.sideProperty());
sideComboBox.setMaxWidth(Double.MAX_VALUE);

Spinner<Double> gapSpinner = new Spinner<>(0, 10, 0, 2);
sideBarPane.gapProperty().bind(gapSpinner.valueProperty());
responsivePane.gapProperty().bind(gapSpinner.valueProperty());
gapSpinner.setMaxWidth(Double.MAX_VALUE);

CheckBox largeSidebarCoverCheckBox = new CheckBox("Large Covers Small");
largeSidebarCoverCheckBox.selectedProperty().bindBidirectional(sideBarPane.largeSidebarCoversSmallProperty());
largeSidebarCoverCheckBox.selectedProperty().bindBidirectional(responsivePane.largeSidebarCoversSmallProperty());

CheckBox forceLargeDisplayCheckBox = new CheckBox("Force Display Large");
forceLargeDisplayCheckBox.selectedProperty().bindBidirectional(sideBarPane.forceLargeSidebarDisplayProperty());
forceLargeDisplayCheckBox.selectedProperty().bindBidirectional(responsivePane.forceLargeSidebarDisplayProperty());

VBox controlBox = new VBox(new Label("Side"), sideComboBox, new Label("Gap"), gapSpinner,
new Label("Content PrefSize"), createSizeInfoField(mainContent), new Label("Small Sidebar PrefSize"),
Expand Down
Binary file added gemsfx/docs/circle-progress-indicator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gemsfx/docs/email-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gemsfx/docs/limited-text-area.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gemsfx/docs/multi-column-list-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gemsfx/docs/power-pane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gemsfx/docs/responsive-pane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gemsfx/docs/tree-node-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions gemsfx/src/main/java/com/dlsc/gemsfx/ResponsivePane.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@
import java.util.List;
import java.util.Objects;

/**
* ResponsivePane is a container that allows for responsive behavior of a sidebar and a main content panel.
* Depending on the specified position of the sidebar (LEFT or RIGHT), it will automatically adjust its visibility
* based on the width of the pane. When the window width is narrow, the sidebar is hidden, and only the content panel is shown.
* When the window width is moderate, both a small sidebar and a large sidebar, along with the content panel, are displayed.
* When the window width is wide, only the large sidebar is shown.
* Similarly, if the sidebar is positioned at the TOP or BOTTOM, its visibility will be adjusted based on the height of the pane.
* However, it is also possible to force the sidebar to be displayed regardless of the window size.
*
*/
public class ResponsivePane extends Pane {

private static final Side DEFAULT_SIDE = Side.LEFT;
Expand Down
14 changes: 11 additions & 3 deletions gemsfx/src/main/java/com/dlsc/gemsfx/treeview/TreeNodeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
import java.util.List;
import java.util.Objects;


/**
* A visual control for displaying trees.
* <p>
* Built on the {@link TreeNode} class, this control visualizes hierarchical structures, allowing nodes to have children.
* <p>
* Customizable in layout, alignment, and style, it's ideal for representing data like file systems or organizational charts.
*/
public class TreeNodeView<T> extends Control {
private static final int DEFAULT_CELL_WIDTH = 60;
private static final int DEFAULT_CELL_HEIGHT = 30;
Expand Down Expand Up @@ -282,7 +290,7 @@ public void setVgap(double vgap) {
this.vgap.set(vgap);
}

private final DoubleProperty nodeLineGap = new StyleableDoubleProperty(DEFAULT_NODE_LINE_GAP){
private final DoubleProperty nodeLineGap = new StyleableDoubleProperty(DEFAULT_NODE_LINE_GAP) {
@Override
public CssMetaData<? extends Styleable, Number> getCssMetaData() {
return StyleableProperties.NODE_LINE_GAP;
Expand Down Expand Up @@ -356,7 +364,7 @@ public enum LayoutType {
COMPACT;
}

private final ObjectProperty<LayoutType> layoutType = new StyleableObjectProperty<>(DEFAULT_LAYOUT_TYPE){
private final ObjectProperty<LayoutType> layoutType = new StyleableObjectProperty<>(DEFAULT_LAYOUT_TYPE) {
@Override
public CssMetaData<? extends Styleable, LayoutType> getCssMetaData() {
return StyleableProperties.LAYOUT_TYPE;
Expand Down Expand Up @@ -404,7 +412,7 @@ public enum LayoutDirection {
BOTTOM_TO_TOP;
}

private final ObjectProperty<LayoutDirection> layoutDirection = new StyleableObjectProperty<>(DEFAULT_LAYOUT_DIRECTION){
private final ObjectProperty<LayoutDirection> layoutDirection = new StyleableObjectProperty<>(DEFAULT_LAYOUT_DIRECTION) {
@Override
public CssMetaData<? extends Styleable, LayoutDirection> getCssMetaData() {
return StyleableProperties.LAYOUT_DIRECTION;
Expand Down

0 comments on commit 05e59d5

Please sign in to comment.