ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/conient/uk/org/iscream/cms/conient/HostDisplayPanel.java
(Generate patch)

Comparing projects/cms/source/conient/uk/org/iscream/cms/conient/HostDisplayPanel.java (file contents):
Revision 1.11 by ajm, Mon Jan 29 12:51:17 2001 UTC vs.
Revision 1.12 by ajm, Sat Feb 3 19:19:27 2001 UTC

# Line 45 | Line 45 | public class HostDisplayPanel extends JPanel {
45      public HostDisplayPanel() {
46          // set up the Panel
47          setLayout(new BorderLayout());
48 <        _east.add(_timeToHeartBeat);
48 >
49 >        _heartbeatTimer = new PacketTimer(Integer.parseInt(Configuration.getInstance().getProperty("Host.TCPUpdateTime")));
50 >        _dataTimer = new PacketTimer(Integer.parseInt(Configuration.getInstance().getProperty("Host.UDPUpdateTime")));
51 >        _east.add(_heartbeatTimer);
52 >        _west.add(_dataTimer);
53 >
54          add(_east, "East");
55 +        add(_west, "West");
56          add(_center, "Center");
57          
58          // add all the DataComponents that we know about
# Line 95 | Line 101 | public class HostDisplayPanel extends JPanel {
101          
102          // a simple way to handle heatbeats - this WILL change
103          if ((packet.getParam("packet.attributes.type")).equals("heartbeat")) {
104 <            _timeToHeartBeat.setValue(_max);
104 >            _heartbeatTimer.reset();
105 >            if(_heartbeatTimerThread == null){
106 >                _heartbeatTimerThread = new Thread(_heartbeatTimer);
107 >                _heartbeatTimerThread.start();
108 >            }
109          
110          // must be a normal data packet, update the display
111 <        } else {
112 <            _timeToHeartBeat.setValue(_timeToHeartBeat.getValue() - 1);
111 >        } else if((packet.getParam("packet.attributes.type")).equals("data")) {
112 >            _dataTimer.reset();
113 >            if(_dataTimerThread == null){
114 >                _dataTimerThread = new Thread(_dataTimer);
115 >                _dataTimerThread.start();
116 >            }
117              
118              // iterate over the packets data
119              Set packetSet = packet.getSet();
# Line 118 | Line 132 | public class HostDisplayPanel extends JPanel {
132                  try {
133                      ((DataComponent) _components.get(dataKey)).setValue(packet.getParam(dataKey));
134                  } catch (DataFormatException e) {
135 <                    Conient.addMessage("WARNING: " + e.getMessage());
135 >                    Conient.addMessage("WARNING{host display}: " + e.getMessage());
136                      displaySucessful = false;
137                  }
138              }
# Line 168 | Line 182 | public class HostDisplayPanel extends JPanel {
182       *
183       */
184      private boolean displaySucessful = true;
185 +    
186      /**
187 <     * The east panel, currently used for the heartbeat ticker.
187 >     * The east panel, currently used for the heartbeat timer.
188       */
189      private final JPanel _east = new JPanel();
190  
191      /**
192 +     * The west panel, currently used for the data timer.
193 +     */
194 +    private final JPanel _west = new JPanel();
195 +
196 +    /**
197       * The centre panel, where all the data is displayed.
198       */
199      private final JPanel _center = new JPanel();
# Line 181 | Line 201 | public class HostDisplayPanel extends JPanel {
201          _center.setLayout(new BoxLayout(_center, BoxLayout.Y_AXIS));
202      }
203      
204 <    /**
205 <     * The minimum value of the heatbeat progress bar
206 <     */
207 <    private int _min = 0;
204 >    private final PacketTimer _heartbeatTimer;
205 >    private final PacketTimer _dataTimer;
206 >    private Thread _heartbeatTimerThread = null;
207 >    private Thread _dataTimerThread = null;
208      
189    /**
190     * The maximum value of the heatbeat progress bar
191     */
192    private int _max = 6;
193    
194    /**
195     * This progress bar indicates time till next heartbeat.
196     */
197    private JProgressBar _timeToHeartBeat = new JProgressBar(JProgressBar.VERTICAL, _min, _max);
198    {
199        _timeToHeartBeat.setValue(_max);
200    }
201
209   //---STATIC ATTRIBUTES---
210      
211   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines