|
16 | 16 | import java.net.URL; |
17 | 17 |
|
18 | 18 | /** |
| 19 | + * This is used to create a CustomStage object as per user given definitions (using the methods of this class) |
| 20 | + * |
19 | 21 | * Created by oshan on 08-Mar-18. |
20 | 22 | * |
21 | 23 | * @author oshan |
@@ -51,69 +53,138 @@ public CustomStageBuilder() throws IOException{ |
51 | 53 | _STAGE_.setAlwaysOnTop(true); |
52 | 54 | } |
53 | 55 |
|
| 56 | + /** |
| 57 | + * Sets the title of the title-bar |
| 58 | + * |
| 59 | + * @param title title for the window |
| 60 | + * @return the current CustomStageBuilder object |
| 61 | + */ |
54 | 62 | public CustomStageBuilder setWindowTitle(String title){ |
55 | 63 | _STAGE_CONTROLLER_.setTitle(title); |
56 | 64 | return this; |
57 | 65 | } |
58 | 66 |
|
| 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 | + */ |
59 | 73 | public CustomStageBuilder setIcon(String path){ |
60 | 74 | _STAGE_.getIcons().add(new Image(path)); |
61 | 75 | return this; |
62 | 76 | } |
63 | 77 |
|
| 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 | + */ |
64 | 84 | public CustomStageBuilder setWindowColor(String color){ |
65 | 85 | _STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.WINDOW_COLOR,color); |
66 | 86 | return this; |
67 | 87 | } |
68 | 88 |
|
| 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 | + */ |
69 | 95 | public CustomStageBuilder setTitleColor(String color){ |
70 | 96 | _STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.TITLE_TEXT_FILL,color); |
71 | 97 | return this; |
72 | 98 | } |
73 | 99 |
|
| 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 | + */ |
74 | 106 | public CustomStageBuilder setButtonColor(String color){ |
75 | 107 | _STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.BUTTON_COLOR,color); |
76 | 108 | return this; |
77 | 109 | } |
78 | 110 |
|
| 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 | + */ |
79 | 117 | public CustomStageBuilder setButtonHoverColor(String color){ |
80 | 118 | _STAGE_CONTROLLER_.setStyle(CustomStageController.StageComponent.BUTTON_HOVER_COLOR,color); |
81 | 119 | return this; |
82 | 120 | } |
83 | 121 |
|
84 | 122 | /** |
85 | 123 | * Changes the default icons for the action buttons on Title-bar |
| 124 | + * |
86 | 125 | * @param close Icon for close button |
87 | 126 | * @param minimize Icon for minimize button |
88 | 127 | * @param maximize Window maximize (maximize button) icon |
89 | 128 | * @param restore Window restore (maximize button) icon |
90 | | - * @return Current builder |
| 129 | + * @return the current CustomStageBuilder object |
91 | 130 | */ |
92 | 131 | public CustomStageBuilder setActionIcons(@Nullable Image close, @Nullable Image minimize, @Nullable Image maximize, @Nullable Image restore){ |
93 | 132 | _STAGE_CONTROLLER_.setActionIcons(close,minimize,maximize,restore); |
94 | 133 | return this; |
95 | 134 | } |
96 | 135 |
|
| 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 | + */ |
97 | 146 | public CustomStageBuilder setDimensions(double minWidth,double minHeight,double maxWidth,double maxHeight){ |
98 | 147 | ResizeHelper.addResizeListener(_STAGE_,minWidth,minHeight,maxWidth,maxHeight); |
99 | 148 | return this; |
100 | 149 | } |
101 | 150 |
|
| 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 | + */ |
102 | 157 | public CustomStageBuilder setStyleSheet(URL path) { |
103 | 158 | _STAGE_CONTROLLER_.setStyleSheet(path); |
104 | 159 | return this; |
105 | 160 | } |
106 | 161 |
|
| 162 | + /** |
| 163 | + * Removes the navigation pane of the window |
| 164 | + * |
| 165 | + * @return the current CustomStageBuilder object |
| 166 | + */ |
107 | 167 | public CustomStageBuilder removeNavigationPane(){ |
108 | 168 | _STAGE_CONTROLLER_.removeNavigationPane(); |
109 | 169 | return this; |
110 | 170 | } |
111 | 171 |
|
| 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 | + */ |
112 | 178 | public CustomStageBuilder setNavigationPane(Pane navigationPane){ |
113 | 179 | _STAGE_CONTROLLER_.setNavigationPane(navigationPane); |
114 | 180 | return this; |
115 | 181 | } |
116 | 182 |
|
| 183 | + /** |
| 184 | + * Produces the CustomStage object as for the definitions given by the user |
| 185 | + * |
| 186 | + * @return the CustomStage |
| 187 | + */ |
117 | 188 | public CustomStage build(){ |
118 | 189 | _STAGE_CONTROLLER_.setActionAdapter(_ACTION_ADAPTER_); |
119 | 190 |
|
|
0 commit comments