Skip to content

Commit 25512a5

Browse files
committed
Added javadoc
1 parent a3ecb68 commit 25512a5

File tree

12 files changed

+410
-271
lines changed

12 files changed

+410
-271
lines changed

.idea/workspace.xml

Lines changed: 247 additions & 268 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/lk/vivoxalabs/customstage/CustomStage.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
import javafx.stage.Stage;
66
import lk.vivoxalabs.customstage.view.controller.CustomStageController;
77

8-
import java.io.IOException;
98
import java.net.URL;
109

1110
/**
11+
* A fully user customizable JavaFX Stage
12+
* 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 Platform.runLater(()->)
14+
*
1215
* Created by oshan on 08-Mar-18.
1316
*
1417
* @author oshan
@@ -21,26 +24,56 @@ public class CustomStage extends Stage {
2124
_STAGE_CONTROLLER_ = controller;
2225
}
2326

27+
/**
28+
* Changes the current view of the Stage to the given view (pane)
29+
*
30+
* @param pane root pane of the loaded fxml view
31+
*/
2432
public void changeScene(Pane pane){
2533
_STAGE_CONTROLLER_.changeScene(pane);
2634
}
2735

36+
/**
37+
* Sets the title of the title-bar
38+
*
39+
* @param title title for the window
40+
*/
2841
public void setWindowTitle(String title){
2942
Platform.runLater(()-> _STAGE_CONTROLLER_.setTitle(title));
3043
}
3144

45+
/**
46+
* Changes the color of the window
47+
*
48+
* @param color name/hex/rgb/rgba value of the color
49+
*/
3250
public void setWindowColor(String color){
3351
Platform.runLater(()-> _STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.WINDOW_COLOR,color));
3452
}
3553

54+
/**
55+
* Changes the color of the color in title-bar
56+
*
57+
* @param color name/hex/rgb/rgba value of the color
58+
*/
3659
public void setTitleColor(String color){
3760
Platform.runLater(()-> _STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.TITLE_TEXT_FILL,color));
3861
}
3962

63+
/**
64+
* Style the CustomStage as to the user given stylesheet
65+
*
66+
* @param path URL of the stylesheet
67+
*/
4068
public void setStyleSheet(URL path) {
4169
_STAGE_CONTROLLER_.setStyleSheet(path);
4270
}
4371

72+
/**
73+
* Sets a static navigation pane (right side of the window) attaching the pane given
74+
*
75+
* @param navigationPane root pane of the navigation (fxml file)
76+
*/
4477
public void setNavigationPane(Pane navigationPane){
4578
Platform.runLater(()-> _STAGE_CONTROLLER_.setNavigationPane(navigationPane));
4679
}

src/lk/vivoxalabs/customstage/CustomStageBuilder.java

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import java.net.URL;
1717

1818
/**
19+
* This is used to create a CustomStage object as per user given definitions (using the methods of this class)
20+
*
1921
* Created by oshan on 08-Mar-18.
2022
*
2123
* @author oshan
@@ -51,69 +53,138 @@ public CustomStageBuilder() throws IOException{
5153
_STAGE_.setAlwaysOnTop(true);
5254
}
5355

56+
/**
57+
* Sets the title of the title-bar
58+
*
59+
* @param title title for the window
60+
* @return the current CustomStageBuilder object
61+
*/
5462
public CustomStageBuilder setWindowTitle(String title){
5563
_STAGE_CONTROLLER_.setTitle(title);
5664
return this;
5765
}
5866

67+
/**
68+
* The icon for the window to be showed on taskbar
69+
*
70+
* @param path path of the image
71+
* @return the current CustomStageBuilder object
72+
*/
5973
public CustomStageBuilder setIcon(String path){
6074
_STAGE_.getIcons().add(new Image(path));
6175
return this;
6276
}
6377

78+
/**
79+
* Changes the color of the window
80+
*
81+
* @param color name/hex/rgb/rgba value of the color
82+
* @return the current CustomStageBuilder object
83+
*/
6484
public CustomStageBuilder setWindowColor(String color){
6585
_STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.WINDOW_COLOR,color);
6686
return this;
6787
}
6888

89+
/**
90+
* Changes the color of the color in title-bar
91+
*
92+
* @param color name/hex/rgb/rgba value of the color
93+
* @return the current CustomStageBuilder object
94+
*/
6995
public CustomStageBuilder setTitleColor(String color){
7096
_STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.TITLE_TEXT_FILL,color);
7197
return this;
7298
}
7399

100+
/**
101+
* Changes the color of the close, minimize and maximize/restore buttons
102+
*
103+
* @param color name/hex/rgb/rgba value of the color
104+
* @return the current CustomStageBuilder object
105+
*/
74106
public CustomStageBuilder setButtonColor(String color){
75107
_STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.BUTTON_COLOR,color);
76108
return this;
77109
}
78110

111+
/**
112+
* Changes the color of the minimize and maximize/restore buttons on hover (close button's color won't change)
113+
*
114+
* @param color name/hex/rgb/rgba value of the color
115+
* @return the current CustomStageBuilder object
116+
*/
79117
public CustomStageBuilder setButtonHoverColor(String color){
80118
_STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.BUTTON_HOVER_COLOR,color);
81119
return this;
82120
}
83121

84122
/**
85123
* Changes the default icons for the action buttons on Title-bar
124+
*
86125
* @param close Icon for close button
87126
* @param minimize Icon for minimize button
88127
* @param maximize Window maximize (maximize button) icon
89128
* @param restore Window restore (maximize button) icon
90-
* @return Current builder
129+
* @return the current CustomStageBuilder object
91130
*/
92131
public CustomStageBuilder setActionIcons(@Nullable Image close, @Nullable Image minimize, @Nullable Image maximize, @Nullable Image restore){
93132
_STAGE_CONTROLLER_.setActionIcons(close,minimize,maximize,restore);
94133
return this;
95134
}
96135

136+
/**
137+
* Sets the maximum and minimum resizing values for the window.
138+
* However, these values does not affect maximize buttons behavior.
139+
*
140+
* @param minWidth Minimum width of window
141+
* @param minHeight Minimum height of window
142+
* @param maxWidth Maximum width of window
143+
* @param maxHeight Maximum height of window
144+
* @return the current CustomStageBuilder object
145+
*/
97146
public CustomStageBuilder setDimensions(double minWidth,double minHeight,double maxWidth,double maxHeight){
98147
ResizeHelper.addResizeListener(_STAGE_,minWidth,minHeight,maxWidth,maxHeight);
99148
return this;
100149
}
101150

151+
/**
152+
* Style the CustomStage as to the user given stylesheet
153+
*
154+
* @param path URL of the stylesheet
155+
* @return the current CustomStageBuilder object
156+
*/
102157
public CustomStageBuilder setStyleSheet(URL path) {
103158
_STAGE_CONTROLLER_.setStyleSheet(path);
104159
return this;
105160
}
106161

162+
/**
163+
* Removes the navigation pane of the window
164+
*
165+
* @return the current CustomStageBuilder object
166+
*/
107167
public CustomStageBuilder removeNavigationPane(){
108168
_STAGE_CONTROLLER_.removeNavigationPane();
109169
return this;
110170
}
111171

172+
/**
173+
* Sets a static navigation pane (right side of the window) attaching the pane given
174+
*
175+
* @param navigationPane root pane of the navigation (fxml file)
176+
* @return the current CustomStageBuilder object
177+
*/
112178
public CustomStageBuilder setNavigationPane(Pane navigationPane){
113179
_STAGE_CONTROLLER_.setNavigationPane(navigationPane);
114180
return this;
115181
}
116182

183+
/**
184+
* Produces the CustomStage object as for the definitions given by the user
185+
*
186+
* @return the CustomStage
187+
*/
117188
public CustomStage build(){
118189
_STAGE_CONTROLLER_.setActionAdapter(_ACTION_ADAPTER_);
119190

0 commit comments

Comments
 (0)