Updated NetLogClient to disable all UI elements when disconnected

This commit is contained in:
Ziver Koc 2013-05-28 09:03:01 +00:00
parent bfcab133de
commit b298aadd68
7 changed files with 35 additions and 27 deletions

View file

@ -162,7 +162,7 @@ public class DBQueue<E> implements Queue<E>{
} }
public Iterator<E> iterator() { public Iterator<E> iterator() {
// TODO Auto-generated method stub // TODO: Auto-generated method stub
return null; return null;
} }

View file

@ -22,7 +22,7 @@
</Label> </Label>
<Region HBox.Hgrow="ALWAYS" /> <Region HBox.Hgrow="ALWAYS" />
<Separator orientation="VERTICAL" prefHeight="200.0" valignment="CENTER" /> <Separator orientation="VERTICAL" prefHeight="200.0" valignment="CENTER" />
<Label fx:id="logCountLable" text="80"> <Label fx:id="logCountLabel" text="0">
<graphic> <graphic>
<Label text="Log Count:" /> <Label text="Log Count:" />
</graphic> </graphic>
@ -69,8 +69,8 @@
<Region HBox.Hgrow="ALWAYS" /> <Region HBox.Hgrow="ALWAYS" />
<Group id="Group"> <Group id="Group">
<children> <children>
<Label layoutX="0.0" layoutY="-7.0" text="Log Level: " /> <Label fx:id="levelLabel" layoutX="0.0" layoutY="-7.0" text="Log Level: " />
<ComboBox layoutX="60.0" layoutY="-9.0" onAction="#handleLevelChanged"> <ComboBox fx:id="levelComboBox" layoutX="60.0" layoutY="-9.0" onAction="#handleLevelChanged">
<items> <items>
<FXCollections fx:factory="observableArrayList"> <FXCollections fx:factory="observableArrayList">
<String fx:value="01 - ERROR" /> <String fx:value="01 - ERROR" />
@ -86,8 +86,8 @@
</Group> </Group>
<Group id="Group"> <Group id="Group">
<children> <children>
<Label alignment="CENTER_RIGHT" layoutX="0.0" layoutY="-7.0" prefWidth="60.0" text="Interval: " /> <Label fx:id="intervalLabel" alignment="CENTER_RIGHT" layoutX="0.0" layoutY="-7.0" prefWidth="60.0" text="Interval: " />
<ComboBox layoutX="65.0" layoutY="-9.0" onAction="#handleIntervalChanged"> <ComboBox fx:id="intervalComboBox" layoutX="65.0" layoutY="-9.0" onAction="#handleIntervalChanged">
<items> <items>
<FXCollections fx:factory="observableArrayList"> <FXCollections fx:factory="observableArrayList">
<String fx:value="Instant" /> <String fx:value="Instant" />

View file

@ -48,7 +48,7 @@ public class NetLogGuiClient extends Application{
@Override @Override
public void start(Stage stage) throws Exception { public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("NetLoggerClient.fxml")); Parent root = FXMLLoader.load(getClass().getResource("NetLogClient.fxml"));
stage.setTitle("NetLoggerClient ("+VERSION+")"); stage.setTitle("NetLoggerClient ("+VERSION+")");
stage.setScene(new Scene(root)); stage.setScene(new Scene(root));
@ -79,7 +79,7 @@ public class NetLogGuiClient extends Application{
public NetLoggerClientTab(String host, int port) throws IOException{ public NetLoggerClientTab(String host, int port) throws IOException{
this.setText( host+":"+port ); this.setText( host+":"+port );
Parent tabRoot = FXMLLoader.load(getClass().getResource("NetLoggerClientInstance.fxml")); Parent tabRoot = FXMLLoader.load(getClass().getResource("NetLogClientInstance.fxml"));
this.setContent(tabRoot); this.setContent(tabRoot);
AnchorPane.setRightAnchor(tabRoot, 0.0); AnchorPane.setRightAnchor(tabRoot, 0.0);
//this.setOnClosed(new EventHandler<Event>() { //this.setOnClosed(new EventHandler<Event>() {

View file

@ -26,19 +26,13 @@ import java.util.ResourceBundle;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javafx.scene.control.*;
import zutil.log.LogUtil; import zutil.log.LogUtil;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.event.Event; import javafx.event.Event;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableRow;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.TableView;
import javafx.scene.control.Label;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.util.Callback; import javafx.util.Callback;
@ -52,9 +46,13 @@ public class NetLogGuiClientInstance implements Initializable, NetLogListener {
// UI elements // UI elements
@FXML private ToggleButton pauseButton; @FXML private ToggleButton pauseButton;
@FXML private Label logCountLabel; @FXML private Label levelLabel;
@FXML private ProgressBar progressBar; @FXML private ComboBox levelComboBox;
@FXML private Label errorLabel; @FXML private Label intervalLabel;
@FXML private ComboBox intervalComboBox;
@FXML private ProgressBar progressBar;
@FXML private Label errorLabel;
@FXML private Label logCountLabel;
@FXML private TableView<NetLogMessage> logTable; @FXML private TableView<NetLogMessage> logTable;
@FXML private TableColumn<NetLogMessage, Long> logTimestampColumn; @FXML private TableColumn<NetLogMessage, Long> logTimestampColumn;
@ -101,6 +99,7 @@ public class NetLogGuiClientInstance implements Initializable, NetLogListener {
public void handleLogMessage(NetLogMessage msg) { public void handleLogMessage(NetLogMessage msg) {
if(status == Status.RUNNING){ if(status == Status.RUNNING){
logTable.getItems().add(msg); logTable.getItems().add(msg);
logCountLabel.setText(""+Integer.parseInt(logCountLabel.getText())+1);
} }
} }
@ -163,8 +162,17 @@ public class NetLogGuiClientInstance implements Initializable, NetLogListener {
pauseButton.setText("Unpause"); pauseButton.setText("Unpause");
} }
else if(status == Status.DISCONNECTED){ else if(status == Status.DISCONNECTED){
progressBar.setProgress(0); pauseButton.setDisable(true);
pauseButton.disableProperty(); levelLabel.setDisable(true);
levelComboBox.setDisable(true);
intervalLabel.setDisable(true);
intervalComboBox.setDisable(true);
logTable.setDisable(true);
exceptionTable.setDisable(true);
progressBar.setProgress(0);
logCountLabel.setDisable(true);
} }
} }

View file

@ -76,9 +76,9 @@ public class Tick {
*/ */
public static char increment(char c){ public static char increment(char c){
switch(Character.toLowerCase(c)){ switch(Character.toLowerCase(c)){
case 'z': return 'å'; case 'z': return 'å';
case 'å': return 'ä'; case 'å': return 'ä';
case 'ä': return 'ö'; case 'ä': return 'ö';
} }
c = (char)(Character.toLowerCase(c) + 1); c = (char)(Character.toLowerCase(c) + 1);
if(isAlfa(c)){ if(isAlfa(c)){
@ -122,9 +122,9 @@ public class Tick {
case 'x': case 'x':
case 'y': case 'y':
case 'z': case 'z':
case 'å': case 'å':
case 'ä': case 'ä':
case 'ö': return true; case 'ö': return true;
default: return false; default: return false;
} }
} }