Skip to content

Commit

Permalink
Fix bug , not reloading website after internet connection
Browse files Browse the repository at this point in the history
  • Loading branch information
goxr3plus committed Jan 13, 2018
1 parent 2ffb673 commit b434b2e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 42 deletions.
24 changes: 17 additions & 7 deletions resources/fxml/WebBrowserTabController.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ProgressIndicator?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.Tooltip?>
Expand Down Expand Up @@ -75,11 +76,6 @@
</cursor>
</Button>
<TextField fx:id="searchBar" promptText="Search..." style="-fx-background-radius: 45;" styleClass="jfx-text-area" HBox.hgrow="ALWAYS" />
<ComboBox fx:id="searchEngineComboBox" promptText="Search Engine">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</ComboBox>
<Button fx:id="goButton" mnemonicParsing="false" style="-fx-background-radius: 0 45 45 0;" text="Go">
<tooltip>
<Tooltip text="Load the Web Site" />
Expand All @@ -88,6 +84,14 @@
<Cursor fx:constant="HAND" />
</cursor>
</Button>
<ComboBox fx:id="searchEngineComboBox" promptText="Search Engine">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</ComboBox>
</children>
</HBox>
<!-- <SearchEngineComboBox fx:id="searchEngineComboBox" prefHeight="31.0" prefWidth="152.0" promptText="search engine">
Expand Down Expand Up @@ -115,11 +119,17 @@
</image>
</ImageView>
<Label styleClass="sideBarSectionLabel" text="Server not found" textAlignment="CENTER" wrapText="true" />
<TextArea editable="false" focusTraversable="false" maxHeight="-Infinity" maxWidth="-Infinity" mouseTransparent="true" prefHeight="156.0" prefWidth="587.0" text="&#10;1.Check the address for typing errors such as ww.example.com instead of www.example.com&#10;&#10;2.If you are unable to load any pages, check your computer’s network connection.&#10;&#10;3.If your computer or network is protected by a firewall or proxy, make sure that XR3Player is permitted to access the Web." wrapText="true" />
<JFXButton fx:id="tryAgain" buttonType="RAISED" ripplerFill="#fa0c0c" text="Try Again">
<TextArea editable="false" focusTraversable="false" maxHeight="-Infinity" maxWidth="-Infinity" mouseTransparent="true" text="&#10;1.Check the address for typing errors such as ww.example.com instead of www.example.com&#10;&#10;2.If you are unable to load any pages, check your computer’s network connection.&#10;&#10;3.If your computer or network is protected by a firewall or proxy, make sure that XR3Player is permitted to access the Web." wrapText="true">
<VBox.margin>
<Insets left="5.0" right="5.0" />
</VBox.margin></TextArea>
<JFXButton fx:id="tryAgain" buttonType="RAISED" contentDisplay="RIGHT" ripplerFill="#fa0c0c" text="Try Again">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
<graphic>
<ProgressIndicator fx:id="tryAgainIndicator" styleClass="dropbox-progress-indicator" visible="false" />
</graphic>
</JFXButton>
</children>
</VBox>
Expand Down
33 changes: 0 additions & 33 deletions src/main/java/assembly/assembly.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.Tab;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
Expand Down Expand Up @@ -96,6 +97,9 @@ public class WebBrowserTabController extends StackPane {

@FXML
private JFXButton tryAgain;

@FXML
private ProgressIndicator tryAgainIndicator;

// -------------------------------------------------------------

Expand Down Expand Up @@ -429,13 +433,19 @@ public VBox getErrorPane() {
*/
void checkForInternetConnection() {

//tryAgainIndicator
tryAgainIndicator.setVisible(true);

//Check for internet connection
Thread thread = new Thread(() -> {
boolean hasInternet = InfoTool.isReachableByPing("www.google.com");
Platform.runLater(() -> {
errorPane.setVisible(!hasInternet);
if (hasInternet)
reloadWebSite();
tryAgainIndicator.setVisible(false);

//Reload the website if it has internet
if(hasInternet)
reloadWebSite();
});
}, "Internet Connection Tester Thread");
thread.setDaemon(true);
Expand Down

0 comments on commit b434b2e

Please sign in to comment.