Created application main panel and separated Controller class
This commit is contained in:
@@ -44,7 +44,7 @@ public class PuckDetection extends DeviceBase{
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
if (chrono.isTimeout(3000)){
|
||||
setState(State.Offline);
|
||||
MainPanel.getInstance().clearPuckStates();
|
||||
Controller.getInstance().clearPuckStates();
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
@@ -71,14 +71,14 @@ public class PuckDetection extends DeviceBase{
|
||||
String contents = subscriber.recvStr();
|
||||
//System.out.println(contents);
|
||||
processMessage(contents);
|
||||
if (MainPanel.getInstance()!=null){
|
||||
MainPanel.getInstance().repaint();
|
||||
if (Controller.getInstance()!=null){
|
||||
Controller.getInstance().getMainFrame().repaint();
|
||||
}
|
||||
setState(State.Ready);
|
||||
chrono = new Chrono();
|
||||
}
|
||||
} finally{
|
||||
MainPanel.getInstance().clearPuckStates();
|
||||
Controller.getInstance().clearPuckStates();
|
||||
subscriber.close();
|
||||
context.term();
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class PuckDetection extends DeviceBase{
|
||||
String[] tokens = line.split(" ");
|
||||
int id = Integer.valueOf(tokens[0].substring(1));
|
||||
present.add(id);
|
||||
PuckState puck = MainPanel.getInstance().getPuckState(id);
|
||||
PuckState puck = Controller.getInstance().getPuckState(id);
|
||||
if (tokens.length<3){
|
||||
puck.clear();
|
||||
} else {
|
||||
@@ -106,10 +106,10 @@ public class PuckDetection extends DeviceBase{
|
||||
getLogger().log(Level.INFO, null, ex);
|
||||
}
|
||||
}
|
||||
for (int i=1; i<= MainPanel.NUMBER_OF_PUCKS; i++){
|
||||
for (int i=1; i<= Controller.NUMBER_OF_PUCKS; i++){
|
||||
if (!Arr.containsEqual(present.toArray(), i)){
|
||||
try{
|
||||
MainPanel.getInstance().getPuckState(i).clear();
|
||||
Controller.getInstance().getPuckState(i).clear();
|
||||
} catch (Exception ex){
|
||||
getLogger().log(Level.INFO, null, ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user