Changeset 829


Ignore:
Timestamp:
02/04/14 22:59:03 (10 years ago)
Author:
ngw8
Message:

More updates to jfxbrowser appearance - added progress bar behind URL bar, + minor CSS changes. Made go button actually work.

Location:
trunk/src/org/expeditee
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/assets/style/jfx.css

    r824 r829  
    33 * Author: ngw8
    44 */
     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
    514
    615.browser-overlay .progress-indicator {   
     
    1928}
    2029
    21 .button, .text-field
    22 {
     30.button, .text-field {
    2331    -fx-background-radius: 2;
    2432    -fx-padding: 0.2em 1em 0.2em 1em;
    2533}
    2634
    27 .button.first, .text-field.first {
    28     -fx-background-radius: 2 0 0 2;   
     35.first {
     36    -fx-background-radius: 2 0 0 2;
    2937}
    3038
    31 .button.last, .text-field.last {
     39.last {
    3240    -fx-background-radius: 0 2 2 0;
    3341}
     
    3543.custom-toolbar {
    3644    -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%));       
    3846    -fx-padding: 0.4em;
    3947}
    4048
    41 .hidden {
    42     visibility: hidden;
     49.url-field {
     50    -fx-background-color: transparent;
     51    -fx-text-fill: -dark-gray;
    4352}
     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  
    3030import javafx.scene.control.Button;
    3131import javafx.scene.control.Label;
     32import javafx.scene.control.ProgressBar;
    3233import javafx.scene.control.ProgressIndicator;
    3334import javafx.scene.control.TextField;
     35import javafx.scene.effect.BlendMode;
    3436import javafx.scene.input.KeyEvent;
    3537import javafx.scene.input.MouseButton;
     
    7375        private WebEngine _webEngine;
    7476        private TextField _urlField;
     77        private ProgressBar _urlProgressBar;
    7578        private StackPane _overlay;
    7679       
     
    152155                try {
    153156                        StackPane mainLayout = new StackPane();
     157                        mainLayout.setId("jfxbrowser");
     158                       
    154159                        VBox vertical = new VBox();
    155160                        HBox horizontal = new HBox();
     
    167172
    168173                        this._urlField = new TextField(url);
    169                         this._urlField.getStyleClass().add("first");
    170                         this._urlField.setMinWidth(0);
     174                        this._urlField.getStyleClass().addAll("first", "url-field");
    171175                        this._urlField.setMaxWidth(Double.MAX_VALUE);
    172176                        this._urlField.setFocusTraversable(false);
     
    180184                        convertButton.setMinWidth(Button.USE_PREF_SIZE);
    181185                        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);
    184195
    185196                        HBox.setHgrow(backButton, Priority.NEVER);
     
    187198                        HBox.setHgrow(convertButton, Priority.NEVER);
    188199                        HBox.setHgrow(goButton, Priority.NEVER);
    189                         HBox.setHgrow(this._urlField, Priority.ALWAYS);
     200                        HBox.setHgrow(urlbar, Priority.ALWAYS);
    190201                       
    191202                        HBox.setMargin(goButton, new Insets(0, 5, 0, 0));
     
    198209                        VBox.setVgrow(this._webView, Priority.ALWAYS);
    199210                        this._webEngine = this._webView.getEngine();
     211                       
     212                        this._urlProgressBar.progressProperty().bind(_webEngine.getLoadWorker().progressProperty());
    200213
    201214                        vertical.getChildren().addAll(horizontal, this._webView);
     
    223236                        mainLayout.getChildren().addAll(vertical, this._overlay);
    224237                       
    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               
    229243                        this._panel.setScene(scene);
    230244                       
     
    258272                    navigateForward();
    259273                }
     274                        });
     275                       
     276                        goButton.setOnAction(new EventHandler<ActionEvent>() {
     277                               
     278                                @Override
     279                                public void handle(ActionEvent arg0) {
     280                    navigate(JfxBrowser.this._urlField.getText());
     281                                }
    260282                        });
    261283                       
     
    396418                                                // Updating the URL bar to display the URL of the page being loaded
    397419                                                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");
    399423                                                break;
    400424                                        case SUCCEEDED: // SUCCEEDED
    401425                                                MessageBay.displayMessage("Finished loading page");
     426                                                JfxBrowser.this._urlProgressBar.getStyleClass().add("completed");
    402427                                                break;
    403428                                        case CANCELLED: // CANCELLED
Note: See TracChangeset for help on using the changeset viewer.