Skip to content

Commit 1cd5507

Browse files
committed
v1.1.0 commit
1 parent a4ccc31 commit 1cd5507

File tree

8 files changed

+95
-27
lines changed

8 files changed

+95
-27
lines changed

CustomStage.iml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<exclude-output />
55
<content url="file://$MODULE_DIR$">
66
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7-
<excludeFolder url="file://$MODULE_DIR$/src/lk/vivoxalabs/customstage/test" />
87
</content>
98
<orderEntry type="inheritedJdk" />
109
<orderEntry type="sourceFolder" forTests="false" />

src/lk/vivoxalabs/customstage/CustomStage.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@
33
import javafx.application.Platform;
44
import javafx.scene.layout.Pane;
55
import javafx.stage.Stage;
6+
import lk.vivoxalabs.customstage.tools.NavigationType;
67
import lk.vivoxalabs.customstage.view.controller.CustomStageController;
78

89
import java.net.URL;
910

1011
/**
1112
* A fully user customizable JavaFX Stage
1213
* All of the customizing methods and methods which changing the appearance of the scene executed on
13-
* FX-threads so user does not have to call these methods inside a,
14-
* @code Platform.runLater(()->{//code})
15-
*
16-
* Created by oshan on 08-Mar-18.
14+
* FX-threads so user does not have to call these methods inside a Platform.runlater
1715
*
1816
* @author oshan
19-
* @version 1.0
17+
* @version 1.1.0
2018
*/
2119
public class CustomStage extends Stage {
2220
private final CustomStageController _STAGE_CONTROLLER_;
@@ -73,10 +71,20 @@ public void setStyleSheet(URL path) {
7371
/**
7472
* Sets a static navigation pane (right side of the window) attaching the pane given
7573
*
74+
* @param type where the navigationPane should be placed on the window (LEFT/RIGHT/TOP/BOTTOM)
7675
* @param navigationPane root pane of the navigation (fxml file)
7776
*/
78-
public void setNavigationPane(Pane navigationPane){
79-
Platform.runLater(()-> _STAGE_CONTROLLER_.setNavigationPane(navigationPane));
77+
public void setNavigationPane(NavigationType type, Pane navigationPane){
78+
Platform.runLater(()-> _STAGE_CONTROLLER_.setNavigationPane(type,navigationPane));
79+
}
80+
81+
/**
82+
* Removes the pointed navigationPane from the window
83+
*
84+
* @param type which navigationPane should be removed from the window (LEFT/RIGHT/TOP/BOTTOM)
85+
*/
86+
public void removeNavigationPane(NavigationType type){
87+
Platform.runLater(()->_STAGE_CONTROLLER_.removeNavigationPane(type));
8088
}
8189

8290
}

src/lk/vivoxalabs/customstage/CustomStageBuilder.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import javafx.scene.paint.Color;
99
import javafx.stage.StageStyle;
1010
import lk.vivoxalabs.customstage.tools.ActionAdapter;
11+
import lk.vivoxalabs.customstage.tools.NavigationType;
1112
import lk.vivoxalabs.customstage.tools.ResizeHelper;
1213
import lk.vivoxalabs.customstage.view.controller.CustomStageController;
1314

@@ -18,10 +19,8 @@
1819
/**
1920
* This is used to create a CustomStage object as per user given definitions (using the methods of this class)
2021
*
21-
* Created by oshan on 08-Mar-18.
22-
*
2322
* @author oshan
24-
* @version 1.0
23+
* @version 1.1.0
2524
*/
2625
public class CustomStageBuilder {
2726

@@ -160,23 +159,28 @@ public CustomStageBuilder setStyleSheet(URL path) {
160159
}
161160

162161
/**
163-
* Removes the navigation pane of the window
162+
* @deprecated this method does not need to be called from this builder class after v1.1.0
163+
*
164+
* Removes the left navigation pane of the window
164165
*
165166
* @return the current CustomStageBuilder object
167+
*
166168
*/
167169
public CustomStageBuilder removeNavigationPane(){
168170
_STAGE_CONTROLLER_.removeNavigationPane();
169171
return this;
170172
}
171173

174+
172175
/**
173-
* Sets a static navigation pane (right side of the window) attaching the pane given
176+
* Sets a static navigation pane (to the pointed location) attaching the pane given
174177
*
178+
* @param type where the navigationPane should be placed on the window (LEFT/RIGHT/TOP/BOTTOM)
175179
* @param navigationPane root pane of the navigation (fxml file)
176180
* @return the current CustomStageBuilder object
177181
*/
178-
public CustomStageBuilder setNavigationPane(Pane navigationPane){
179-
_STAGE_CONTROLLER_.setNavigationPane(navigationPane);
182+
public CustomStageBuilder setNavigationPane(NavigationType type, Pane navigationPane){
183+
_STAGE_CONTROLLER_.setNavigationPane(type,navigationPane);
180184
return this;
181185
}
182186

src/lk/vivoxalabs/customstage/tools/ActionAdapter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
/**
1111
* Controls all the action events of the window (close,maximize/restore,minimize)
1212
*
13-
* Created by oshan on 08-Mar-18.
14-
*
1513
* @author oshan
1614
* @version 1.0
1715
*/

src/lk/vivoxalabs/customstage/tools/NavigationType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
* @author oshan
55
*/
66
public enum NavigationType {
7+
RIGHT,LEFT,TOP,BOTTOM
78
}

src/lk/vivoxalabs/customstage/view/controller/CustomStageController.java

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import javafx.stage.Stage;
2020
import javafx.stage.StageStyle;
2121
import lk.vivoxalabs.customstage.tools.ActionAdapter;
22+
import lk.vivoxalabs.customstage.tools.NavigationType;
2223

2324
import java.awt.*;
2425
import java.net.URL;
@@ -27,10 +28,8 @@
2728
/**
2829
* Controller class of the CustomStage (fxml file) and is responsible for the behaviour of the CustomStage
2930
*
30-
* Created by oshan on 08-Mar-18.
31-
*
3231
* @author oshan
33-
* @version 1.0
32+
* @version 1.1.0
3433
*/
3534
public class CustomStageController implements Initializable {
3635

@@ -49,7 +48,7 @@ public class CustomStageController implements Initializable {
4948
@FXML
5049
private Button btnMax,btnClose,btnMin;
5150
@FXML
52-
private StackPane dynamicPane,navigationPane;
51+
private StackPane dynamicPane, left_navigationPane,right_navigationPane,top_navigationPane,bottom_navigationPane;
5352
@FXML
5453
private BorderPane containerPane;
5554
@FXML
@@ -134,12 +133,35 @@ public void setStyleSheet(URL path) {
134133
}
135134

136135
/**
137-
* Removes the navigation pane of the window
136+
* @deprecated use removeNavigationPane(NavigationType type) method instead
137+
*
138+
* Removes the left navigation pane of the window
138139
*/
139140
public void removeNavigationPane(){
140141
containerPane.getChildren().remove(containerPane.leftProperty().get());
141142
}
142143

144+
/**
145+
* Removes the pointed navigationPane from the window
146+
*
147+
* @param type which navigationPane should be removed from the window (LEFT/RIGHT/TOP/BOTTOM)
148+
*/
149+
public void removeNavigationPane(NavigationType type){
150+
switch (type){
151+
case LEFT:{
152+
containerPane.getChildren().remove(left_navigationPane);
153+
}break;
154+
case RIGHT:{
155+
containerPane.getChildren().remove(right_navigationPane);
156+
}case TOP:{
157+
containerPane.getChildren().remove(containerPane.topProperty().get());
158+
}break;
159+
case BOTTOM:{
160+
containerPane.getChildren().remove(containerPane.bottomProperty().get());
161+
}
162+
}
163+
}
164+
143165
/**
144166
* Changes the default icons for the action buttons on Title-bar
145167
*
@@ -167,11 +189,33 @@ public void setActionIcons(@Nullable Image close,@Nullable Image minimize,@Nulla
167189
/**
168190
* Sets a static navigation pane (right side of the window) attaching the pane given
169191
*
192+
* @param type where the navigationPane should be placed on the window (LEFT/RIGHT/TOP/BOTTOM)
170193
* @param navigationPane root pane of the navigation (fxml file)
171194
*/
172-
public void setNavigationPane(Pane navigationPane){
173-
this.navigationPane.getChildren().clear();
174-
this.navigationPane.getChildren().add(navigationPane);
195+
public void setNavigationPane(NavigationType type, Pane navigationPane){
196+
switch (type){
197+
case LEFT:{
198+
this.left_navigationPane.getChildren().clear();
199+
this.left_navigationPane.getChildren().add(navigationPane);
200+
containerPane.setLeft(left_navigationPane);
201+
}break;
202+
case RIGHT:{
203+
this.right_navigationPane.getChildren().clear();
204+
this.right_navigationPane.getChildren().add(navigationPane);
205+
containerPane.setRight(right_navigationPane);
206+
}break;
207+
case TOP:{
208+
this.top_navigationPane.getChildren().clear();
209+
this.top_navigationPane.getChildren().add(navigationPane);
210+
containerPane.setTop(top_navigationPane);
211+
}break;
212+
case BOTTOM:{
213+
this.bottom_navigationPane.getChildren().clear();
214+
this.bottom_navigationPane.getChildren().add(navigationPane);
215+
containerPane.setBottom(bottom_navigationPane);
216+
}
217+
}
218+
175219
}
176220

177221
@Override
@@ -216,6 +260,11 @@ public void initialize(URL location, ResourceBundle resources) {
216260
maximizeRestore(event);
217261
}
218262
});
263+
264+
containerPane.getChildren().remove(containerPane.leftProperty().get());
265+
containerPane.getChildren().remove(containerPane.rightProperty().get());
266+
containerPane.getChildren().remove(containerPane.topProperty().get());
267+
containerPane.getChildren().remove(containerPane.bottomProperty().get());
219268
}
220269

221270

src/lk/vivoxalabs/customstage/view/css/customstage.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#dynamicPane{}
2121

2222
/*The StackPane provided to place the navigation view*/
23-
#navigationPane{}
23+
.navigationPane{}
2424

2525
/*Title-bar of the window*/
2626
#titleBar{

src/lk/vivoxalabs/customstage/view/fxml/CustomStage.fxml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,20 @@
3232
</AnchorPane>
3333
<BorderPane fx:id="containerPane" layoutY="31.0" prefHeight="497.0" prefWidth="764.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="30.5">
3434
<left>
35-
<StackPane fx:id="navigationPane" prefHeight="498.0" prefWidth="280.0" BorderPane.alignment="CENTER" />
35+
<StackPane fx:id="left_navigationPane" prefHeight="498.0" prefWidth="280.0" styleClass="navigationPane" BorderPane.alignment="CENTER" />
3636
</left>
3737
<center>
3838
<StackPane fx:id="dynamicPane" prefHeight="498.0" prefWidth="563.0" BorderPane.alignment="CENTER" />
3939
</center>
40+
<right>
41+
<StackPane fx:id="right_navigationPane" prefHeight="498.0" prefWidth="280.0" styleClass="navigationPane" BorderPane.alignment="CENTER" />
42+
</right>
43+
<top>
44+
<StackPane fx:id="top_navigationPane" prefHeight="250.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
45+
</top>
46+
<bottom>
47+
<StackPane fx:id="bottom_navigationPane" prefHeight="250.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
48+
</bottom>
4049
</BorderPane>
4150

4251
</children>

0 commit comments

Comments
 (0)