Changeset 829
- Timestamp:
- 02/04/14 22:59:03 (10 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/assets/style/jfx.css
r824 r829 3 3 * Author: ngw8 4 4 */ 5 #jfxbrowser { 6 -light-gray: rgb(245, 245, 245); 7 -dark-gray: rgb(10, 10, 10); 8 -highlight: #79b3d4; 9 -fx-accent: -highlight; 10 -fx-shadow-highlight-color: rgba(255,255, 255, 0.4); 11 -fx-base: #eee; 12 } 13 5 14 6 15 .browser-overlay .progress-indicator { … … 19 28 } 20 29 21 .button, .text-field 22 { 30 .button, .text-field { 23 31 -fx-background-radius: 2; 24 32 -fx-padding: 0.2em 1em 0.2em 1em; 25 33 } 26 34 27 . button.first, .text-field.first {28 -fx-background-radius: 2 0 0 2; 35 .first { 36 -fx-background-radius: 2 0 0 2; 29 37 } 30 38 31 . button.last, .text-field.last {39 .last { 32 40 -fx-background-radius: 0 2 2 0; 33 41 } … … 35 43 .custom-toolbar { 36 44 -fx-font-size: 12px; 37 -fx-background-color: linear-gradient(to bottom, rgb(230,230,230), rgba(200, 200,200));45 -fx-background-color: linear-gradient(to bottom, derive(-fx-base, -2%), derive(-fx-base, -12%)); 38 46 -fx-padding: 0.4em; 39 47 } 40 48 41 .hidden { 42 visibility: hidden; 49 .url-field { 50 -fx-background-color: transparent; 51 -fx-text-fill: -dark-gray; 43 52 } 53 54 .url-progress-bar .track { 55 -fx-background-color:-light-gray; 56 57 -fx-background-radius: 2 0 0 2; 58 59 } 60 61 .url-progress-bar .bar { 62 -fx-background-color: 63 -light-gray, -light-gray, 64 linear-gradient(to bottom, derive(-highlight,50%), derive(-highlight,30%)); /* actual color of the progess bit of the bar */ 65 -fx-background-insets: 1; 66 } 67 68 /* Used when the page has completed loading */ 69 .url-progress-bar.completed .bar { 70 -fx-background-color: 71 -light-gray, -light-gray, 72 transparent; /* actual color of the progess bit of the bar */ 73 } 74 -
trunk/src/org/expeditee/items/widgets/JfxBrowser.java
r824 r829 30 30 import javafx.scene.control.Button; 31 31 import javafx.scene.control.Label; 32 import javafx.scene.control.ProgressBar; 32 33 import javafx.scene.control.ProgressIndicator; 33 34 import javafx.scene.control.TextField; 35 import javafx.scene.effect.BlendMode; 34 36 import javafx.scene.input.KeyEvent; 35 37 import javafx.scene.input.MouseButton; … … 73 75 private WebEngine _webEngine; 74 76 private TextField _urlField; 77 private ProgressBar _urlProgressBar; 75 78 private StackPane _overlay; 76 79 … … 152 155 try { 153 156 StackPane mainLayout = new StackPane(); 157 mainLayout.setId("jfxbrowser"); 158 154 159 VBox vertical = new VBox(); 155 160 HBox horizontal = new HBox(); … … 167 172 168 173 this._urlField = new TextField(url); 169 this._urlField.getStyleClass().add("first"); 170 this._urlField.setMinWidth(0); 174 this._urlField.getStyleClass().addAll("first", "url-field"); 171 175 this._urlField.setMaxWidth(Double.MAX_VALUE); 172 176 this._urlField.setFocusTraversable(false); … … 180 184 convertButton.setMinWidth(Button.USE_PREF_SIZE); 181 185 convertButton.setFocusTraversable(false); 182 183 horizontal.getChildren().addAll(backButton, forwardButton, this._urlField, goButton, convertButton); 186 187 this._urlProgressBar = new ProgressBar(); 188 this._urlProgressBar.getStyleClass().addAll("first", "url-progress-bar"); 189 this._urlProgressBar.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); 190 191 StackPane urlbar = new StackPane(); 192 urlbar.getChildren().addAll(_urlProgressBar, this._urlField); 193 194 horizontal.getChildren().addAll(backButton, forwardButton, urlbar, goButton, convertButton); 184 195 185 196 HBox.setHgrow(backButton, Priority.NEVER); … … 187 198 HBox.setHgrow(convertButton, Priority.NEVER); 188 199 HBox.setHgrow(goButton, Priority.NEVER); 189 HBox.setHgrow( this._urlField, Priority.ALWAYS);200 HBox.setHgrow(urlbar, Priority.ALWAYS); 190 201 191 202 HBox.setMargin(goButton, new Insets(0, 5, 0, 0)); … … 198 209 VBox.setVgrow(this._webView, Priority.ALWAYS); 199 210 this._webEngine = this._webView.getEngine(); 211 212 this._urlProgressBar.progressProperty().bind(_webEngine.getLoadWorker().progressProperty()); 200 213 201 214 vertical.getChildren().addAll(horizontal, this._webView); … … 223 236 mainLayout.getChildren().addAll(vertical, this._overlay); 224 237 225 Scene scene = new Scene(mainLayout); 226 227 scene.getStylesheets().add(ClassLoader.getSystemResource("org/expeditee/assets/style/jfx.css").toString()); 228 238 final Scene scene = new Scene(mainLayout); 239 240 final String cssPath = "file:///G:/Programming/Expeditee/Expeditee/src/org/expeditee/assets/style/jfx.css"; // ClassLoader.getSystemResource("org/expeditee/assets/style/jfx.css").toString(); 241 scene.getStylesheets().add(cssPath); 242 229 243 this._panel.setScene(scene); 230 244 … … 258 272 navigateForward(); 259 273 } 274 }); 275 276 goButton.setOnAction(new EventHandler<ActionEvent>() { 277 278 @Override 279 public void handle(ActionEvent arg0) { 280 navigate(JfxBrowser.this._urlField.getText()); 281 } 260 282 }); 261 283 … … 396 418 // Updating the URL bar to display the URL of the page being loaded 397 419 JfxBrowser.this._urlField.setText(JfxBrowser.this._webEngine.getLocation()); 398 420 421 // Removing the style from the progress bar that causes it to hide 422 JfxBrowser.this._urlProgressBar.getStyleClass().remove("completed"); 399 423 break; 400 424 case SUCCEEDED: // SUCCEEDED 401 425 MessageBay.displayMessage("Finished loading page"); 426 JfxBrowser.this._urlProgressBar.getStyleClass().add("completed"); 402 427 break; 403 428 case CANCELLED: // CANCELLED
Note:
See TracChangeset
for help on using the changeset viewer.