1919import javafx .stage .Stage ;
2020import javafx .stage .StageStyle ;
2121import lk .vivoxalabs .customstage .tools .ActionAdapter ;
22+ import lk .vivoxalabs .customstage .tools .NavigationType ;
2223
2324import java .awt .*;
2425import java .net .URL ;
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 */
3534public 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
0 commit comments