Changeset 44 in tmcsimulator for trunk/src/tmcsim/cadsimulator/viewer
- Timestamp:
- 06/23/2016 06:30:20 PM (10 years ago)
- Location:
- trunk/src/tmcsim/cadsimulator/viewer
- Files:
-
- 4 added
- 4 edited
-
CADConsoleViewer.java (added)
-
CADSimulatorViewer.java (modified) (9 diffs)
-
DVDInfoPanel.java (modified) (7 diffs)
-
MediaStatusPanel.java (modified) (2 diffs)
-
SimulationStatusPanel.java (modified) (12 diffs)
-
model/CADMediaStatus.java (added)
-
model/CADSimulatorModel.java (added)
-
model/CADSimulatorStatus.java (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/cadsimulator/viewer/CADSimulatorViewer.java
r36 r44 6 6 import java.awt.event.KeyEvent; 7 7 import java.awt.event.WindowEvent; 8 import java.io.IOException; 9 import java.util.Observable; 10 import java.util.Properties; 11 import java.util.logging.Level; 12 import java.util.logging.Logger; 8 13 import javax.swing.JFrame; 9 14 import javax.swing.JMenu; … … 13 18 import javax.swing.JTabbedPane; 14 19 import javax.swing.KeyStroke; 15 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate;16 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate;17 20 import tmcsim.cadsimulator.viewer.actions.ExitAction; 18 import tmcsim.c ommon.CADEnums.PARAMICS_STATUS;19 import tmcsim.c ommon.CADEnums.SCRIPT_STATUS;20 import tmcsim. common.RevisionNumber;21 import tmcsim.cadsimulator.viewer.model.CADMediaStatus; 22 import tmcsim.cadsimulator.viewer.model.CADSimulatorStatus; 23 import tmcsim.interfaces.CADViewer; 21 24 22 25 /** … … 30 33 */ 31 34 @SuppressWarnings("serial") 32 public class CADSimulatorViewer extends JFrame 35 public class CADSimulatorViewer extends JFrame implements CADViewer 33 36 { 34 37 … … 45 48 */ 46 49 private ConfigStatusPanel configPanel; 50 47 51 /** 48 52 * Constructor. 49 53 */ 50 51 54 public CADSimulatorViewer() 52 55 { 53 super("CAD Simulator"); 56 super(); 57 setTitle("CAD Simulator " + getAppVersion()); 54 58 55 59 initComponents(); … … 57 61 58 62 /** 59 * @see SimulationStatusPanel 63 * Read the version number from the application properties. The file 64 * 'application.properties' is generated by build.xml. 65 * 66 * @return a version string obtained from application.properties file, or 67 * "Version: unknown" if an IOerror prevents us from reading the file. 60 68 */ 61 p ublic void connectClient()69 private String getAppVersion() 62 70 { 63 simulationPanel.connectClient(); 64 } 65 66 /** 67 * @see SimulationStatusPanel 68 */ 69 public void disconnectClient() 70 { 71 simulationPanel.disconnectClient(); 72 } 73 74 /** 75 * @see SimulationStatusPanel 76 */ 77 public void setSimManagerStatus(boolean connection) 78 { 79 simulationPanel.setSimManagerStatus(connection); 80 } 81 82 /** 83 * @see SimulationStatusPanel 84 */ 85 public void setTime(long seconds) 86 { 87 simulationPanel.setTime(seconds); 88 } 89 90 /** 91 * @see SimulationStatusPanel 92 */ 93 public void setScriptStatus(SCRIPT_STATUS newStatus) 94 { 95 simulationPanel.setScriptStatus(newStatus); 96 } 97 98 /** 99 * @see SimulationStatusPanel 100 */ 101 public void setParamicsStatus(PARAMICS_STATUS newStatus) 102 { 103 simulationPanel.setParamicsStatus(newStatus); 104 } 105 106 /** 107 * @see SimulationStatusPanel 108 */ 109 public void setParamicsNetworkLoaded(String networkID) 110 { 111 simulationPanel.setParamicsNetworkLoaded(networkID); 112 } 113 114 /** 115 * @see MediaStatusPanel 116 */ 117 public void updateDVDStatus(DVDStatusUpdate update) 118 { 119 mediaPanel.updateDVDStatus(update); 120 } 121 122 /** 123 * @see MediaStatusPanel 124 */ 125 public void updateDVDTitle(DVDTitleUpdate update) 126 { 127 mediaPanel.updateDVDTitle(update); 71 String propfilename = "/tmcsim/application.properties"; 72 String propKey = "Application.revision"; 73 String version = "unknown"; 74 try 75 { 76 Properties props = new Properties(); 77 props.load(this.getClass().getResourceAsStream(propfilename)); 78 version = (String) props.get(propKey); 79 } catch (IOException ex) 80 { 81 Logger.getLogger("tmcsim/cadsimulator").log(Level.SEVERE, 82 "CADSimulatorView.getAppVersion()", 83 "IOError reading " + propfilename); 84 } 85 return "revision: " + version; 128 86 } 129 87 … … 147 105 if (evt.getID() == WindowEvent.WINDOW_CLOSING) 148 106 { 149 int option = JOptionPane.showConfirmDialog(null,150 "Closing the CAD Simulator will stop the current "151 + "simulation. Do you wish to continue exiting?",152 "Confirm Exit",153 JOptionPane.YES_NO_OPTION);154 155 if (option != JOptionPane.NO_OPTION)156 {157 System.exit(0);158 }107 // int option = JOptionPane.showConfirmDialog(null, 108 // "Closing the CAD Simulator will stop the current " 109 // + "simulation. Do you wish to continue exiting?", 110 // "Confirm Exit", 111 // JOptionPane.YES_NO_OPTION); 112 // 113 // if (option != JOptionPane.NO_OPTION) 114 // { 115 System.exit(0); 116 // } 159 117 } 160 118 } … … 196 154 public void actionPerformed(java.awt.event.ActionEvent evt) 197 155 { 198 String ver = RevisionNumber.getString();156 String ver = "";//RevisionNumber.getString(); 199 157 JOptionPane.showMessageDialog(rootPane, "Version: " + ver, "About", JOptionPane.INFORMATION_MESSAGE); 200 158 } … … 208 166 pack(); 209 167 setResizable(true); 168 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 210 169 } 211 170 private JTabbedPane cadSimTabbedPane; … … 213 172 private JMenu fileMenu; 214 173 private JMenuItem exitMenuItem; 174 175 @Override 176 public void update(Observable obs, Object obj) 177 { 178 if (obs instanceof CADSimulatorStatus) 179 { 180 simulationPanel.refresh(obs); 181 } 182 if (obs instanceof CADMediaStatus) 183 { 184 mediaPanel.refresh(obs); 185 } 186 } 215 187 } -
trunk/src/tmcsim/cadsimulator/viewer/DVDInfoPanel.java
r2 r44 2 2 3 3 import java.awt.Dimension; 4 5 4 import javax.swing.BorderFactory; 6 5 import javax.swing.Box; … … 10 9 import javax.swing.JTable; 11 10 import javax.swing.JTextField; 12 13 11 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 14 12 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; … … 17 15 18 16 /** 19 * DVDInfoPanel is a GUI component used in the CADSimulatorViewer. The panel20 * displays information regarding the DVD player's connection information. 21 * One table on the panel shows all DVD title that have been played or22 * repeated. A second table shows all DVD status updates that have been23 * received from the controller.24 * 17 * DVDInfoPanel is a GUI component used in the CADSimulatorViewer. The panel 18 * displays information regarding the DVD player's connection information. One 19 * table on the panel shows all DVD title that have been played or repeated. A 20 * second table shows all DVD status updates that have been received from the 21 * controller. 22 * 25 23 * @author Matthew Cechini 26 * @version 24 * @version 27 25 */ 28 26 @SuppressWarnings("serial") 29 public class DVDInfoPanel extends JPanel { 27 public class DVDInfoPanel extends JPanel 28 { 30 29 31 /** DVD player connection info. */ 32 private String connInfo = null; 33 34 /** Table model for the title table. */ 30 /** 31 * DVD player connection info. 32 */ 33 public final String connInfo; 34 /** 35 * Table model for the title table. 36 */ 35 37 private DVDTitleTableModel titleTableModel; 38 /** 39 * Table to display DVD title plays and repeats. 40 */ 41 private JTable titleTable; 42 /** 43 * Table model for the Status table. 44 */ 45 private DVDStatusTableModel statusTableModel; 46 /** 47 * Table to display DVD status updates. 48 */ 49 private JTable statusTable; 36 50 37 /** Table to display DVD title plays and repeats. */38 private JTable titleTable;39 40 /** Table model for the Status table. */41 private DVDStatusTableModel statusTableModel;42 43 /** Table to display DVD status updates. */44 private JTable statusTable;45 46 47 51 /** 48 * Constructor. Initialize the panel GUI components.49 * 52 * Constructor. Initialize the panel GUI components. 53 * 50 54 * @param connectionInfo DVD player connection info. 51 55 */ 52 public DVDInfoPanel(String connectionInfo) { 56 public DVDInfoPanel(String connectionInfo) 57 { 53 58 connInfo = connectionInfo; 54 59 55 60 initComponents(); 56 } 57 61 } 62 58 63 /** 59 64 * This method updates the DVD status table with the new update object. 65 * 60 66 * @param update Update DVD Status update. 61 67 */ 62 public void updateDVDStatus(DVDStatusUpdate update) { 68 public void updateDVDStatus(DVDStatusUpdate update) 69 { 63 70 statusTableModel.addStatusUpdate(update); 64 71 } … … 66 73 /** 67 74 * This method updates the DVD title table with the new update object. 75 * 68 76 * @param update Update DVD Status update. 69 77 */ 70 public void updateDVDTitle(DVDTitleUpdate update) { 78 public void updateDVDTitle(DVDTitleUpdate update) 79 { 71 80 titleTableModel.addTitleUpdate(update); 72 81 } 73 82 74 83 /** 75 84 * Initialize the GUI components. 76 85 */ 77 private void initComponents() { 86 private void initComponents() 87 { 78 88 79 89 connInfoLbl = new JLabel("Connection Info:"); 80 90 connInfoLbl.setAlignmentX(Box.LEFT_ALIGNMENT); 81 connInfoTF = new JTextField(connInfo);91 connInfoTF = new JTextField(connInfo); 82 92 connInfoTF.setColumns(30); 83 93 connInfoTF.setAlignmentX(Box.LEFT_ALIGNMENT); 84 94 connInfoTF.setEditable(false); 85 95 86 96 Box connInfoBox = Box.createVerticalBox(); 87 97 connInfoBox.add(connInfoLbl); 88 98 connInfoBox.add(connInfoTF); 89 99 connInfoBox.setAlignmentX(Box.CENTER_ALIGNMENT); 90 100 91 101 titleTableModel = new DVDTitleTableModel(); 92 titleTable = new JTable(titleTableModel); 93 titleTable.getTableHeader().setReorderingAllowed(false); 94 95 for(int c = 0; c < titleTable.getColumnCount(); c++) { 102 titleTable = new JTable(titleTableModel); 103 titleTable.getTableHeader().setReorderingAllowed(false); 104 105 for (int c = 0; c < titleTable.getColumnCount(); c++) 106 { 96 107 titleTable.getColumnModel().getColumn(c).setMinWidth( 97 108 titleTableModel.getColumnMinWidth(c)); … … 102 113 titleTable.getColumnModel().getColumn(c).setResizable(true); 103 114 } 104 105 titlePane = new JScrollPane();115 116 titlePane = new JScrollPane(); 106 117 titlePane.setAlignmentX(Box.CENTER_ALIGNMENT); 107 118 //titlePane.setMinimumSize(new Dimension(,)); 108 titlePane.setPreferredSize(new Dimension(425, 225)); 119 titlePane.setPreferredSize(new Dimension(425, 225)); 109 120 titlePane.setViewportView(titleTable); 110 121 titlePane.setBorder(BorderFactory.createTitledBorder( 111 BorderFactory.createRaisedBevelBorder(), "Title Updates"));122 BorderFactory.createRaisedBevelBorder(), "Title Updates")); 112 123 113 124 statusTableModel = new DVDStatusTableModel(); 114 statusTable = new JTable(statusTableModel); 115 statusTable.getTableHeader().setReorderingAllowed(false); 116 117 for(int c = 0; c < statusTable.getColumnCount(); c++) { 125 statusTable = new JTable(statusTableModel); 126 statusTable.getTableHeader().setReorderingAllowed(false); 127 128 for (int c = 0; c < statusTable.getColumnCount(); c++) 129 { 118 130 statusTable.getColumnModel().getColumn(c).setMinWidth( 119 131 statusTableModel.getColumnMinWidth(c)); … … 124 136 statusTable.getColumnModel().getColumn(c).setResizable(true); 125 137 } 126 127 statusPane = new JScrollPane();138 139 statusPane = new JScrollPane(); 128 140 statusPane.setAlignmentX(Box.CENTER_ALIGNMENT); 129 141 //statusPane.setMinimumSize(new Dimension(,)); 130 statusPane.setPreferredSize(new Dimension(425, 150)); 142 statusPane.setPreferredSize(new Dimension(425, 150)); 131 143 statusPane.setViewportView(statusTable); 132 144 statusPane.setBorder(BorderFactory.createTitledBorder( 133 145 BorderFactory.createRaisedBevelBorder(), "Status Updates")); 134 146 135 147 Box panelBox = Box.createVerticalBox(); 136 148 panelBox.add(connInfoBox); … … 139 151 panelBox.add(Box.createVerticalStrut(10)); 140 152 panelBox.add(statusPane); 141 panelBox.setBorder(BorderFactory.createEmptyBorder(5, 5,5,5));142 153 panelBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 154 143 155 add(panelBox); 144 156 } 145 146 157 private JScrollPane titlePane; 147 158 private JScrollPane statusPane; 148 149 159 private JLabel connInfoLbl; 150 151 160 private JTextField connInfoTF; 152 161 } -
trunk/src/tmcsim/cadsimulator/viewer/MediaStatusPanel.java
r2 r44 1 1 package tmcsim.cadsimulator.viewer; 2 2 3 import java.util.Iterator; 4 import java.util.Observable; 3 5 import java.util.TreeMap; 4 5 6 import javax.swing.JPanel; 6 7 import javax.swing.JTabbedPane; 7 8 8 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 9 9 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; 10 import tmcsim.cadsimulator.viewer.model.CADMediaStatus; 10 11 11 12 /** 12 * MediaStatusPanel is a GUI object used for displaying information 13 * for DVD connections created by the CAD Simulator. Tabs for each 14 * DVD are created and information is displayed on a DVDInfoPanel. 15 * All status and title updates are sent to the corresponding 16 * DVDInfoPanel. The DVDs are referenced by connection info, which 17 * is unique to each DVD player. 18 * 19 * @author Matthew Cechini 20 * @version 13 * MediaStatusPanel is a GUI object used for displaying information for DVD 14 * connections created by the CAD Simulator. Tabs for each DVD are created and 15 * information is displayed on a DVDInfoPanel. All status and title updates are 16 * sent to the corresponding DVDInfoPanel. The DVDs are referenced by connection 17 * info, which is unique to each DVD player. 18 * 19 * @author jdalbey 21 20 */ 22 21 @SuppressWarnings("serial") 23 public class MediaStatusPanel extends JPanel { 24 25 /** Map of DVDInfoPanels(values) referenced by a DVD's connection info(key). */ 22 public class MediaStatusPanel extends JPanel 23 { 24 25 /** 26 * Map of DVDInfoPanels(values) referenced by a DVD's connection info(key). 27 */ 26 28 private TreeMap<String, DVDInfoPanel> dvdPanels = null; 27 29 28 30 /** 29 * Constructor. Initialize data and GUI components.31 * Constructor. Initialize data and GUI components. 30 32 */ 31 public MediaStatusPanel() { 33 public MediaStatusPanel() 34 { 32 35 33 dvdPanels = new TreeMap<String, DVDInfoPanel>();34 36 dvdPanels = new TreeMap<String, DVDInfoPanel>(); 37 35 38 initComponents(); 36 39 } 37 40 41 public void refresh(Observable obs) 42 { 43 CADMediaStatus status = (CADMediaStatus) obs; 44 Iterator<DVDInfoPanel> iter = status.getDVDlist(); 45 // Remove existing tabs before adding them all back 46 mediaTabs.removeAll(); 47 // add a new tab for each dvd panel 48 while (iter.hasNext()) 49 { 50 DVDInfoPanel item = iter.next(); 51 mediaTabs.addTab( 52 "DVD " + (Integer.parseInt(item.connInfo 53 .substring(item.connInfo 54 .indexOf(":") + 1)) % 3000), 55 dvdPanels.get(item.connInfo)); 56 } 57 // mediaTabs.addTab( 58 // "DVD " + (Integer.parseInt(update.connectionInfo 59 // .substring(update.connectionInfo 60 // .indexOf(":") + 1)) % 3000), 61 // dvdPanels.get(update.connectionInfo)); 62 63 } 64 38 65 /** 39 * Updates the current DVDInfoPanel with the status update. 40 * If a panel does not current exist, create one and add 41 * a new tab. 42 * 66 * Updates the current DVDInfoPanel with the status update. If a panel does 67 * not current exist, create one and add a new tab. 68 * 43 69 * @param update DVD status update. 44 70 */ 45 public void updateDVDStatus(DVDStatusUpdate update) { 46 if(dvdPanels.get(update.connectionInfo) == null) { 71 public void updateDVDStatus(DVDStatusUpdate update) 72 { 73 if (dvdPanels.get(update.connectionInfo) == null) 74 { 47 75 dvdPanels.put(update.connectionInfo, new DVDInfoPanel( 48 76 update.connectionInfo)); … … 50 78 mediaTabs.addTab( 51 79 "DVD " + (Integer.parseInt(update.connectionInfo 52 .substring(update.connectionInfo53 .indexOf(":")+1)) % 3000),80 .substring(update.connectionInfo 81 .indexOf(":") + 1)) % 3000), 54 82 dvdPanels.get(update.connectionInfo)); 55 83 } 56 57 84 85 58 86 dvdPanels.get(update.connectionInfo).updateDVDStatus(update); 59 87 } 60 88 61 89 /** 62 * Updates the current DVDInfoPanel with the title update. 63 * If a panel does not current exist, create one and add 64 * a new tab. 65 * 90 * Updates the current DVDInfoPanel with the title update. If a panel does 91 * not current exist, create one and add a new tab. 92 * 66 93 * @param update DVD title update. 67 94 */ 68 public void updateDVDTitle(DVDTitleUpdate update) { 69 if(dvdPanels.get(update.connectionInfo) == null) { 95 public void updateDVDTitle(DVDTitleUpdate update) 96 { 97 if (dvdPanels.get(update.connectionInfo) == null) 98 { 70 99 dvdPanels.put(update.connectionInfo, new DVDInfoPanel(update.connectionInfo)); 71 72 mediaTabs.addTab("DVD " + dvdPanels.size(), 100 101 mediaTabs.addTab("DVD " + dvdPanels.size(), 73 102 dvdPanels.get(update.connectionInfo)); 74 103 } 75 104 76 105 dvdPanels.get(update.connectionInfo).updateDVDTitle(update); 77 106 } 78 107 79 108 /** 80 109 * Initialize GUI components. 81 110 */ 82 private void initComponents() { 111 private void initComponents() 112 { 83 113 mediaTabs = new JTabbedPane(); 84 114 85 115 add(mediaTabs); 86 116 } 87 88 117 private JTabbedPane mediaTabs; 89 90 118 } -
trunk/src/tmcsim/cadsimulator/viewer/SimulationStatusPanel.java
r36 r44 5 5 import java.awt.Dimension; 6 6 import java.awt.Font; 7 import java.util.logging.Handler; 8 import java.util.logging.Level; 9 import java.util.logging.LogRecord; 10 import java.util.logging.Logger; 7 import java.util.Observable; 11 8 import javax.swing.BorderFactory; 12 9 import javax.swing.Box; … … 19 16 import javax.swing.border.EtchedBorder; 20 17 import javax.swing.border.TitledBorder; 18 import tmcsim.cadsimulator.viewer.model.CADSimulatorStatus; 21 19 import tmcsim.common.CADEnums.PARAMICS_STATUS; 22 20 import tmcsim.common.CADEnums.SCRIPT_STATUS; … … 37 35 * </ul> 38 36 * 39 * @author Matthew Cechini 37 * @author Matthew Cechini, jdalbey 40 38 * @version 41 39 */ … … 45 43 46 44 /** 47 * Logging Handler to listen for Information and Error messages logged for 48 * the CAD Simulator. Received LogRecords are displayed in the info or error 49 * message Text Area. 50 * 51 * @author Matthew Cechini 52 */ 53 private class SimulatorErrorHandler extends Handler 54 { 55 56 public void close() throws SecurityException 57 { 58 } 59 60 public void flush() 61 { 62 } 63 64 public void publish(LogRecord rec) 65 { 66 StringBuffer msgBuffer = new StringBuffer(); 67 68 msgBuffer.append(rec.getSourceClassName() + "." 69 + rec.getSourceMethodName() + " = " 70 + rec.getMessage()); 71 72 if (rec.getLevel() == Level.INFO) 73 { 74 infoMessagesTA.setText(infoMessagesTA.getText() 75 + msgBuffer.toString() + "\n"); 76 } else 77 { 78 errorMessagesTA.setText(errorMessagesTA.getText() 79 + msgBuffer.toString() + "\n"); 80 } 81 } 45 * Refresh this view 46 * 47 * @param obs the Observable we are watching 48 */ 49 public void refresh(Observable obs) 50 { 51 CADSimulatorStatus status = (CADSimulatorStatus) obs; 52 termConnectedTF.setText(String.valueOf(status.getNumClients())); 53 String yesno = "No"; 54 // Should we show yes or no? 55 if (status.isSimManagerConnected()) 56 { 57 yesno = "Yes"; 58 } 59 managerConnectedTF.setText(yesno); 60 simulationClockLabel.setText(status.getCurrentTime()); 61 setScriptStatus(status.getScriptStatus()); 62 setParamicsStatus(status.getParamicsStatus()); 63 64 String netText = status.getParmicsNetworkID(); 65 if (netText.length() == 0) 66 { 67 netText = "None"; 68 } 69 setParamicsNetworkLoaded(netText); 70 71 String msgOut = status.getInfoMessages(); 72 infoMessagesTA.setText(msgOut); 73 errorMessagesTA.setText(status.getErrorMessages()); 82 74 } 83 75 /** … … 85 77 */ 86 78 private int numClientsConnected = 0; 87 /**88 * Logging ErrorHandler.89 */90 private SimulatorErrorHandler errorHandler;91 79 92 80 /** … … 102 90 initMessagesPanes(); 103 91 104 errorHandler = new SimulatorErrorHandler(); 105 Logger.getLogger("tmcsim.cadsimulator").addHandler(errorHandler); 106 107 CADSimulatorViewerBox = Box.createVerticalBox(); 108 CADSimulatorViewerBox.add(simulationTimeAndStatusBox); 109 CADSimulatorViewerBox.add(additionalInfoBox); 110 CADSimulatorViewerBox.add(infoMessagesPane); 111 CADSimulatorViewerBox.add(errorMessagesPane); 112 113 add(CADSimulatorViewerBox); 114 } 115 116 /** 117 * Method is called when a CAD Client disconnects from the CAD Simulator. 118 * The displayed number of connected clients is incremented by one. 119 */ 120 public void connectClient() 121 { 122 123 numClientsConnected++; 124 125 termConnectedTF.setText(String.valueOf(numClientsConnected)); 126 } 127 128 /** 129 * Method is called when a CAD Client disconnects from the CAD Simulator. 130 * The displayed number of connected clients is decremented by one. 131 */ 132 public void disconnectClient() 133 { 134 135 if (numClientsConnected > 0) 136 { 137 numClientsConnected--; 138 } 139 140 termConnectedTF.setText(String.valueOf(numClientsConnected)); 141 } 142 143 /** 144 * Method is called when Simulation Manager connects or disconnects. 145 * 146 * @param connection True if simulation manager is connected, false if not. 147 */ 148 public void setSimManagerStatus(boolean connection) 149 { 150 151 if (connection) 152 { 153 managerConnectedTF.setText("Yes"); 154 } else 155 { 156 managerConnectedTF.setText("No"); 157 } 158 159 } 160 161 /** 162 * Method called to convert current simulation time (parameter long value) 163 * to a string of format H:MM:SS. Time is then updated on GUI. 164 * 165 * @param seconds Long value of current time 166 */ 167 public void setTime(long seconds) 168 { 169 String time = new String(); 170 long timeSegment; 171 172 timeSegment = seconds / 3600; 173 time += String.valueOf(timeSegment) + ":"; 174 175 seconds = seconds % 3600; 176 177 timeSegment = seconds / 60; 178 if (timeSegment < 10) 179 { 180 time += "0"; 181 } 182 183 time += String.valueOf(timeSegment) + ":"; 184 seconds = seconds % 60; 185 186 timeSegment = seconds; 187 if (timeSegment < 10) 188 { 189 time += "0"; 190 } 191 192 time += String.valueOf(timeSegment); 193 194 simulationClockLabel.setText(time); 195 92 // errorHandler = new SimulatorErrorHandler(); 93 // Logger.getLogger("tmcsim.cadsimulator").addHandler(errorHandler); 94 95 cadSimulatorViewerBox = Box.createVerticalBox(); 96 cadSimulatorViewerBox.add(simulationTimeAndStatusBox); 97 cadSimulatorViewerBox.add(additionalInfoBox); 98 cadSimulatorViewerBox.add(infoMessagesPane); 99 cadSimulatorViewerBox.add(errorMessagesPane); 100 101 add(cadSimulatorViewerBox); 196 102 } 197 103 … … 206 112 protected void displayError(String errorMessage) 207 113 { 114 // Do we clear or append? 208 115 if (errorMessage == null) 209 116 { 210 117 errorMessagesTA.setText(""); 211 } else 118 } 119 else 212 120 { 213 121 errorMessagesTA.append(errorMessage + "\n"); … … 253 161 * </table> 254 162 */ 255 p ublicvoid setScriptStatus(SCRIPT_STATUS newStatus)256 { 257 163 private void setScriptStatus(SCRIPT_STATUS newStatus) 164 { 165 // Display text based on status value 258 166 switch (newStatus) 259 167 { … … 291 199 * or dropped. 292 200 */ 293 p ublicvoid setParamicsStatus(PARAMICS_STATUS newStatus)294 { 295 201 private void setParamicsStatus(PARAMICS_STATUS newStatus) 202 { 203 // Display text based on status value 296 204 switch (newStatus) 297 205 { … … 310 218 * @param networkID Unique ID for Paramics network that has been loaded. 311 219 */ 312 p ublicvoid setParamicsNetworkLoaded(String networkID)220 private void setParamicsNetworkLoaded(String networkID) 313 221 { 314 222 networkLoadedTF.setText(networkID); … … 325 233 simulationStatus = new JLabel("Simulation Status"); 326 234 simulationStatusText = new JLabel("No Script"); 235 simulationStatusText.setName("simulationStatusText"); 327 236 328 237 simulationTime.setLayout(new BorderLayout()); … … 470 379 private Box paramicsConnectedBox; 471 380 private Box networkLoadedBox; 472 private Box CADSimulatorViewerBox;381 private Box cadSimulatorViewerBox; 473 382 private Box simulationTimeAndStatusBox; 474 383 private Box simulationStatusBox;
Note: See TracChangeset
for help on using the changeset viewer.
