Skip to content

Commit

Permalink
Changes in channel settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tainfante committed Jan 31, 2018
1 parent d18cf72 commit 8d93999
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 30 deletions.
71 changes: 43 additions & 28 deletions src/mainwindow/Channel.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,44 @@ public void initialize(URL location, ResourceBundle resources) {
public void onNameKeyPressed(KeyEvent keyEvent) {
if(keyEvent.getCode() == KeyCode.ENTER){
try{
name=nameText.getText();
channel=channelBox.getSelectionModel().getSelectedItem();
channel=channelBox.getSelectionModel().getSelectedItem();
switch (channel) {
case "Channel 1":
Chart.getInstance().channelUpdateWithoutColor(1, name, units);
break;
case "Channel 2":
Chart.getInstance().channelUpdateWithoutColor(2, name, units);
break;
case "Channel 3":
Chart.getInstance().channelUpdateWithoutColor(3, name,units);
break;
case "Channel 4":
Chart.getInstance().channelUpdateWithoutColor(4, name,units);
break;
case "Channel 5":
Chart.getInstance().channelUpdateWithoutColor(5, name,units);
break;
case "Channel 6":
Chart.getInstance().channelUpdateWithoutColor(6, name ,units);
break;
case "Channel 7":
Chart.getInstance().channelUpdateWithoutColor(7, name,units);
break;
case "Channel 8":
Chart.getInstance().channelUpdateWithoutColor(8, name,units);
break;
if(!nameText.getText().isEmpty()){
name=nameText.getText();
channel=channelBox.getSelectionModel().getSelectedItem();
if(!unitText.getText().isEmpty()){
units="["+unitText.getText()+"]";
}
else{
units="";
}

switch (channel) {
case "Channel 1":
Chart.getInstance().channelUpdateWithoutColor(1, name, units);
break;
case "Channel 2":
Chart.getInstance().channelUpdateWithoutColor(2, name, units);
break;
case "Channel 3":
Chart.getInstance().channelUpdateWithoutColor(3, name,units);
break;
case "Channel 4":
Chart.getInstance().channelUpdateWithoutColor(4, name,units);
break;
case "Channel 5":
Chart.getInstance().channelUpdateWithoutColor(5, name,units);
break;
case "Channel 6":
Chart.getInstance().channelUpdateWithoutColor(6, name ,units);
break;
case "Channel 7":
Chart.getInstance().channelUpdateWithoutColor(7, name,units);
break;
case "Channel 8":
Chart.getInstance().channelUpdateWithoutColor(8, name,units);
break;
}
}

}
catch(NullPointerException exe){
Alert alert = new Alert(Alert.AlertType.ERROR);
Expand All @@ -91,6 +100,12 @@ public void onUnitKeyPressed(KeyEvent keyEvent) {
try{
if(!unitText.getText().isEmpty()){
units="["+unitText.getText()+"]";
if(!nameText.getText().isEmpty()){
name=nameText.getText();
}
else{
name="";
}
}
channel=channelBox.getSelectionModel().getSelectedItem();
switch (channel) {
Expand Down
2 changes: 1 addition & 1 deletion src/mainwindow/Chart.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public int numberOfSamples() {

public boolean update() {

if (null != series1) {
if (null != series1 && series1.getData().size()>samples) {
return series1.getData().size() > samples;
}
else return false;
Expand Down
2 changes: 1 addition & 1 deletion src/plot/Plot.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void run() {
break;
case 4:
if (null != series5.getData())
if (series5.getData().get(0) != null) {
if (series5.getData().get(0) != null ) {
series5.getData().remove(0, removeData);
}
break;
Expand Down

0 comments on commit 8d93999

Please sign in to comment.