Changeset 888 for trunk/src/org/expeditee/items/widgets
- Timestamp:
- 02/14/14 01:55:45 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/JfxBrowser.java
r887 r888 48 48 import javafx.scene.layout.StackPane; 49 49 import javafx.scene.layout.VBox; 50 import javafx.scene.text.Font; 50 51 import javafx.scene.web.WebEngine; 51 52 import javafx.scene.web.WebView; … … 89 90 private Button _forwardButton; 90 91 private Button _backButton; 92 private Button _stopButton; 93 private Button _goButton; 91 94 private Button _convertButton; 92 95 private ToggleButton _readableModeButton; … … 102 105 static { 103 106 Platform.setImplicitExit(false); 107 108 Font.loadFont(ClassLoader.getSystemResourceAsStream("org/expeditee/assets/resources/fonts/fontawesome/fontawesome-webfont.ttf"), 12); 104 109 105 110 try { … … 179 184 horizontal.getStyleClass().add("custom-toolbar"); 180 185 181 this._backButton = new Button("Back"); 186 this._backButton = new Button("\uf060"); 187 this._backButton.setTooltip(new Tooltip("Back")); 182 188 this._backButton.setMinWidth(Button.USE_PREF_SIZE); 189 this._backButton.setMaxHeight(Double.MAX_VALUE); 183 190 this._backButton.setFocusTraversable(false); 184 this._backButton.getStyleClass().add ("first");191 this._backButton.getStyleClass().addAll("first", "fa"); 185 192 186 193 this._backButton.setDisable(true); 187 188 this._forwardButton = new Button("Forward"); 194 195 this._forwardButton = new Button("\uf061"); 196 this._forwardButton.setTooltip(new Tooltip("Forward")); 189 197 this._forwardButton.setMinWidth(Button.USE_PREF_SIZE); 198 this._forwardButton.setMaxHeight(Double.MAX_VALUE); 190 199 this._forwardButton.setFocusTraversable(false); 191 this._forwardButton.getStyleClass().add ("last");200 this._forwardButton.getStyleClass().addAll("last", "fa"); 192 201 193 202 this._urlField = new TextField(url); 194 this._urlField.getStyleClass().add All("first","url-field");203 this._urlField.getStyleClass().add("url-field"); 195 204 this._urlField.setMaxWidth(Double.MAX_VALUE); 196 205 this._urlField.setFocusTraversable(false); 197 198 Button goButton = new Button("Go"); 199 goButton.getStyleClass().add("last"); 200 goButton.setMinWidth(Button.USE_PREF_SIZE); 201 goButton.setFocusTraversable(false); 206 207 this._stopButton = new Button("\uF00D"); 208 this._stopButton.setTooltip(new Tooltip("Stop loading the page")); 209 this._stopButton.getStyleClass().addAll("url-button", "url-cancel-button", "fa"); 210 this._stopButton.setMinWidth(Button.USE_PREF_SIZE); 211 this._stopButton.setMaxHeight(Double.MAX_VALUE); 212 StackPane.setAlignment(this._stopButton, Pos.CENTER_RIGHT); 213 this._stopButton.setFocusTraversable(false); 214 215 this._goButton = new Button("\uf061"); 216 this._goButton.setTooltip(new Tooltip("Load the entered address")); 217 this._goButton.getStyleClass().addAll("url-button", "url-go-button", "fa"); 218 this._goButton.setMinWidth(Button.USE_PREF_SIZE); 219 this._goButton.setMaxHeight(Double.MAX_VALUE); 220 StackPane.setAlignment(this._goButton, Pos.CENTER_RIGHT); 221 this._goButton.setFocusTraversable(false); 202 222 203 223 this._readableModeButton = new ToggleButton(); … … 214 234 215 235 this._urlProgressBar = new ProgressBar(); 216 this._urlProgressBar.getStyleClass().add All("first","url-progress-bar");236 this._urlProgressBar.getStyleClass().add("url-progress-bar"); 217 237 this._urlProgressBar.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); 218 238 219 239 StackPane urlbar = new StackPane(); 220 urlbar.getChildren().addAll(_urlProgressBar, this._urlField );240 urlbar.getChildren().addAll(_urlProgressBar, this._urlField, this._stopButton, this._goButton); 221 241 222 horizontal.getChildren().addAll(this._backButton, this._forwardButton, urlbar, goButton,this._readableModeButton, this._convertButton);242 horizontal.getChildren().addAll(this._backButton, this._forwardButton, urlbar, this._readableModeButton, this._convertButton); 223 243 224 244 HBox.setHgrow(this._backButton, Priority.NEVER); 225 245 HBox.setHgrow(this._forwardButton, Priority.NEVER); 226 246 HBox.setHgrow(this._convertButton, Priority.NEVER); 227 HBox.setHgrow(goButton, Priority.NEVER);228 247 HBox.setHgrow(this._readableModeButton, Priority.NEVER); 229 248 HBox.setHgrow(urlbar, Priority.ALWAYS); 230 249 231 HBox.setMargin(goButton, new Insets(0, 5, 0, 0)); 232 HBox.setMargin(this._readableModeButton, new Insets(0, 5, 0, 0)); 250 HBox.setMargin(this._readableModeButton, new Insets(0, 5, 0, 5)); 233 251 HBox.setMargin(this._forwardButton, new Insets(0, 5, 0, 0)); 234 252 … … 328 346 }); 329 347 330 goButton.setOnAction(new EventHandler<ActionEvent>() { 348 this._stopButton.setOnAction(new EventHandler<ActionEvent>() { 349 350 @Override 351 public void handle(ActionEvent arg0) { 352 JfxBrowser.this._webEngine.getLoadWorker().cancel(); 353 } 354 }); 355 356 this._goButton.setOnAction(new EventHandler<ActionEvent>() { 331 357 332 358 @Override … … 494 520 JfxBrowser.this._urlProgressBar.getStyleClass().remove("completed"); 495 521 522 JfxBrowser.this._stopButton.setVisible(true); 523 JfxBrowser.this._goButton.setVisible(false); 524 496 525 if (JfxBrowser.this._webEngine.getHistory().getCurrentIndex() + 1 >= JfxBrowser.this._webEngine.getHistory().getEntries().size()) { 497 526 JfxBrowser.this._forwardButton.setDisable(true); … … 523 552 JfxBrowser.this._convertButton.setDisable(false); 524 553 JfxBrowser.this._readableModeButton.setDisable(false); 554 JfxBrowser.this._stopButton.setVisible(false); 555 JfxBrowser.this._goButton.setVisible(true); 525 556 break; 526 557 case FAILED: // FAILED 527 558 MessageBay.displayMessage("Failed to load page"); 559 JfxBrowser.this._stopButton.setVisible(false); 560 JfxBrowser.this._goButton.setVisible(true); 528 561 break; 529 562 }
Note:
See TracChangeset
for help on using the changeset viewer.