00001 package DisplayGUI;
00002
00003 import java.awt.*;
00004 import java.awt.event.*;
00005 import java.awt.image.*;
00006 import javax.swing.*;
00007 import java.awt.Graphics2D.*;
00008 import java.awt.geom.*;
00009 import java.util.*;
00010 import GuiComponents.System.*;
00011
00012 public class DisplayPanel extends JPanel implements guiInterface, TestDataInfo {
00013 gui guiControl;
00014
00015 FontMetrics metrics;
00016 int maxWidth;
00017 private int displayOption=0;
00018
00019 private JMenu dataPopupMenu, sctdbPopupMenu;
00020
00021 private Rectangle draggedRectangle;
00022
00023 private boolean firstTime = true;
00024 private Rectangle area;
00025 private Dimension dim;
00026
00027 private ModuleCell redCell,lastClickedCell,popupCell;
00028 private String mouseLocationText, mouseLocationSN;
00029 private int lastClickedRodSlot=-1;
00030
00031 private DisplayTitle leftTitle, middleTitle, rightTitle, optionTitle;
00032
00033 ConfigurationInterface config;
00034
00035 private java.util.List changedModuleList;
00036
00037 public DisplayPanel(gui parent){
00038 guiControl=parent;
00039 setBackground(Color.white);
00040 addMouseMotionListener(this);
00041 addMouseListener(this);
00042 dim = getSize();
00043 maxWidth = (int)dim.getWidth();
00044
00045 setMinimumSize(new Dimension(14*boxWidth,yOffSet+58*boxHeight));
00046 setPreferredSize(new Dimension(14*boxWidth,yOffSet+58*boxHeight));
00047
00048 config = ConfigurationInterface.getInstance();
00049 config.setWindowSize(maxWidth,(int)dim.getHeight());
00050
00051 leftTitle = null;
00052 middleTitle = null;
00053 rightTitle = null;
00054 optionTitle=null;
00055
00056 changedModuleList = new ArrayList();
00057
00058
00059 }
00060
00061
00062
00063
00064
00065 public void mousePressed(MouseEvent e){
00066 if(guiControl.displayStatus.getStatus()!=DisplayStatus.MODULE_GROUP_SELECTION) return;
00067 if(guiControl.selectorPane.getDisplayParameterIndex()>0) return;
00068 draggedRectangle = new Rectangle(new Point(e.getX(),e.getY()));
00069 }
00070
00071
00072
00073 public void mouseDragged(MouseEvent e){
00074
00075
00076 if(guiControl.displayStatus.getStatus()!=DisplayStatus.MODULE_GROUP_SELECTION) return;
00077 if(guiControl.selectorPane.getDisplayParameterIndex()>0) return;
00078 redCell=null;
00079 int width = e.getX() - (int)draggedRectangle.getX();
00080 int height = e.getY() - (int)draggedRectangle.getY();
00081 int thisModuleGroup = guiControl.selectorPane.getMouseClickIndex();
00082
00083 if(width<0 || height<0) {
00084 int oldWidth = (int)draggedRectangle.getWidth();
00085 int oldHeight = (int)draggedRectangle.getHeight();
00086 draggedRectangle = new Rectangle(new Point(e.getX(),e.getY()),new Dimension(Math.abs(width)+oldWidth,Math.abs(height)+oldHeight));
00087 }
00088 else draggedRectangle.setSize(new Dimension(width,height));
00089
00090 config = ConfigurationInterface.getInstance();
00091 int viewCategoryIndex = guiControl.selectorPane.getViewCategoryIndex();
00092 for (java.util.Iterator m = config.getSerialNumberList(viewCategoryIndex,guiControl.selectorPane.getViewIndex()).iterator(); m.hasNext(); ) {
00093 String thisSN=(String)m.next();
00094 ModuleCell thisCell = config.getModuleCell(thisSN);
00095 if(thisCell.getPolygon(viewCategoryIndex).intersects(draggedRectangle)) {
00096 switch(e.getModifiers()) {
00097 case InputEvent.BUTTON2_MASK:
00098 case InputEvent.BUTTON3_MASK:
00099 if(thisCell.getModuleGroup()==thisModuleGroup) {
00100 thisCell.setModuleGroup(-1);
00101 changedModuleList.add(thisCell);
00102 }
00103 break;
00104 default:
00105 if(!thisCell.isSelected()) {
00106 thisCell.setModuleGroup(thisModuleGroup);
00107 changedModuleList.add(thisCell);
00108 }
00109 }
00110 }
00111 }
00112 if(guiControl.displayStatus.getStatus()==DisplayStatus.MODULE_GROUP_SELECTION && guiControl.selectorPane.getDisplayParameterIndex()==0) setDisplayColors();
00113
00114 repaint();
00115
00116 }
00117
00118
00119 public void mouseReleased(MouseEvent e){
00120 if(draggedRectangle!=null) {
00121 draggedRectangle=null;
00122 repaint();
00123 }
00124 if(guiControl.displayStatus.getStatus()==DisplayStatus.MODULE_GROUP_SELECTION && guiControl.selectorPane.getDisplayParameterIndex()==0 && changedModuleList.size()>0) {
00125 guiControl.tablesDisplayPane.updateTables();
00126 ConfigurationInterface.getInstance().updateModuleGroups(changedModuleList);
00127 changedModuleList.clear();
00128 }
00129 }
00130
00131
00132 public void mouseMoved(MouseEvent e){
00133 if(draggedRectangle!=null) return;
00134
00135 config = ConfigurationInterface.getInstance();
00136
00137 ModuleCell thisCell = config.getCell(guiControl.selectorPane.getViewCategoryIndex(),guiControl.selectorPane.getViewIndex(),e.getX(),e.getY());
00138 if(thisCell==null) {
00139 redCell = null;
00140 if(mouseLocationText!=null) {
00141 mouseLocationText = null;
00142 mouseLocationSN=null;
00143 repaint();
00144 }
00145 return;
00146 }
00147
00148
00149 if(thisCell==redCell) return;
00150 else {
00151
00152
00153 redCell = thisCell;
00154 }
00155
00156 String sn = thisCell.getSerialNo();
00157 String infoString = sn+" ("+config.getSNInfo(sn,SNInfo.ROD_CRATE)+","+config.getSNInfo(sn,SNInfo.ROD_NUMBER)+","+config.getSNInfo(sn,SNInfo.ROD_CHANNEL)+","+config.getSNInfo(sn,SNInfo.DCS_CRATE)+","+config.getSNInfo(sn,SNInfo.DCS_CHANNEL)+") ";
00158 switch(guiControl.displayStatus.getStatus()) {
00159 case DisplayStatus.IS_MONITOR:
00160 if(guiControl.tablesDisplayPane.getTestSelection()!=null && thisCell.getData()!=null) {
00161 mouseLocationText = new String(infoString+" : "+thisCell.getData().intValue());
00162 }
00163 break;
00164 case DisplayStatus.MODULE_GROUP_SELECTION:
00165 if(guiControl.selectorPane.getDisplayParameterIndex()>0) {
00166 ColorScale thisColorScale = guiControl.colorScalePane.getColorScale();
00167 if(thisColorScale!=null) mouseLocationText = new String(infoString+" : "+thisColorScale.getLabel(thisCell.getData()));
00168 else mouseLocationText = new String(infoString+" : No Data");
00169 }
00170 else {
00171 if(guiControl.selectorPane.getViewIndex()<4) mouseLocationText = new String(infoString+" MUR: "+thisCell.getMUR()+" Position: "+thisCell.getModulePosition());
00172 else mouseLocationText = new String(infoString+" MUR: "+thisCell.getMUR()+" Quad/Pos: "+thisCell.getQuadrant()+"/"+thisCell.getEndCapPosition());
00173 }
00174 break;
00175 default:
00176 ColorScale thisColorScale = guiControl.colorScalePane.getColorScale();
00177 if(thisColorScale!=null) mouseLocationText = new String(infoString+" : "+thisColorScale.getLabel(thisCell.getData()));
00178 else mouseLocationText = new String(infoString+" : No Data");
00179 break;
00180 }
00181
00182
00183 repaint();
00184 }
00185
00186
00187 public void mouseClicked(MouseEvent e){
00188
00189 config = ConfigurationInterface.getInstance();
00190 ModuleCell thisCell = config.getCell(guiControl.selectorPane.getViewCategoryIndex(),guiControl.selectorPane.getViewIndex(),e.getX(),e.getY());
00191 if(thisCell==null) {
00192 switch(e.getModifiers()) {
00193 case InputEvent.BUTTON2_MASK:
00194 case InputEvent.BUTTON3_MASK:
00195
00196 if(guiControl.selectorPane.getViewCategoryIndex()==ConfigurationInterface.RODCRATE_VIEWS) {
00197 int viewIndex = guiControl.selectorPane.getViewIndex();
00198 lastClickedRodSlot = config.getRodSlotNumber(viewIndex,e);
00199 switch(lastClickedRodSlot) {
00200 case -1: guiControl.menuActions.showPopupMenu(e); break;
00201 case 13: guiControl.menuActions.showTIMRegisterMenu(e); break;
00202 default:
00203 if(config.getASerialNumberForSlot(guiControl.selectorPane.getViewIndex(),lastClickedRodSlot)!=null) guiControl.menuActions.showRODMenu(e);
00204 else guiControl.menuActions.showPopupMenu(e);
00205 }
00206 }
00207 else guiControl.menuActions.showPopupMenu(e);
00208 break;
00209 default:
00210 }
00211 return;
00212 }
00213
00214 lastClickedCell = thisCell;
00215
00216 switch(guiControl.displayStatus.getStatus()) {
00217
00218 case DisplayStatus.MODULE_GROUP_SELECTION:
00219
00220 if(guiControl.selectorPane.getDisplayParameterIndex()>0) {
00221
00222 guiControl.tablesDisplayPane.resultsTable.setSelectedSerialNo(thisCell.getSerialNo(),true);
00223 switch(e.getModifiers()) {
00224 case InputEvent.BUTTON2_MASK:
00225 case InputEvent.BUTTON3_MASK:
00226 popupCell=thisCell;
00227 JPopupMenu pMenu = guiControl.guiMenus.getMenu(GuiMenus.MODULE_BOC).getPopupMenu();
00228 pMenu.show(e.getComponent(),e.getX(),e.getY());
00229 pMenu.setInvoker(guiControl.guiMenus.getMenu(GuiMenus.MODULE_BOC));
00230 break;
00231 default:
00232 }
00233
00234 }
00235
00236 else {
00237
00238 int thisModuleGroup =guiControl.selectorPane.getMouseClickIndex();
00239 switch(e.getModifiers()) {
00240 case InputEvent.BUTTON2_MASK:
00241 case InputEvent.BUTTON3_MASK:
00242 if(thisCell.getModuleGroup()==thisModuleGroup) {
00243 thisCell.setModuleGroup(-1);
00244 changedModuleList.add(thisCell);
00245 }
00246 break;
00247 default:
00248 if(!thisCell.isSelected()) {
00249 thisCell.setModuleGroup(thisModuleGroup);
00250 changedModuleList.add(thisCell);
00251 }
00252 }
00253
00254 repaint();
00255
00256 if(changedModuleList.size()>0) {
00257 guiControl.tablesDisplayPane.updateTables();
00258 config.updateModuleGroups(changedModuleList);
00259 changedModuleList.clear();
00260 }
00261
00262 }
00263 break;
00264
00265 case DisplayStatus.IS_MONITOR:
00266 guiControl.tablesDisplayPane.listISObjects(thisCell);
00267 guiControl.tablesDisplayPane.resultsTable.setSelectedSerialNo(thisCell.getSerialNo(),false);
00268 switch(e.getModifiers()) {
00269 case InputEvent.BUTTON2_MASK:
00270 case InputEvent.BUTTON3_MASK:
00271 popupCell=thisCell;
00272 JPopupMenu pMenu = guiControl.guiMenus.getMenu(GuiMenus.MODULE_DATA_MANAGER).getPopupMenu();
00273 pMenu.show(e.getComponent(),e.getX(),e.getY());
00274 pMenu.setInvoker(guiControl.guiMenus.getMenu(GuiMenus.MODULE_DATA_MANAGER));
00275 break;
00276 default:
00277 }
00278 break;
00279 case DisplayStatus.TEST_DATA:
00280 guiControl.tablesDisplayPane.resultsTable.setSelectedSerialNo(thisCell.getSerialNo(),true);
00281 switch(e.getModifiers()) {
00282 case InputEvent.BUTTON2_MASK:
00283 case InputEvent.BUTTON3_MASK:
00284 popupCell=thisCell;
00285 JPopupMenu pMenu = guiControl.guiMenus.getMenu(GuiMenus.MODULE_RESULTS).getPopupMenu();
00286 pMenu.show(e.getComponent(),e.getX(),e.getY());
00287 pMenu.setInvoker(guiControl.guiMenus.getMenu(GuiMenus.MODULE_RESULTS));
00288 break;
00289 default:
00290 }
00291 break;
00292 case DisplayStatus.SCTDB_DATA:
00293 case DisplayStatus.SCTDB_RODDAQ_DATA:
00294 guiControl.tablesDisplayPane.resultsTable.setSelectedSerialNo(thisCell.getSerialNo(),true);
00295 switch(e.getModifiers()) {
00296 case InputEvent.BUTTON2_MASK:
00297 case InputEvent.BUTTON3_MASK:
00298 popupCell=thisCell;
00299 JPopupMenu pMenu = guiControl.guiMenus.getMenu(GuiMenus.MODULE_SCTDB).getPopupMenu();
00300 pMenu.show(e.getComponent(),e.getX(),e.getY());
00301 pMenu.setInvoker(guiControl.guiMenus.getMenu(GuiMenus.MODULE_SCTDB));
00302 break;
00303 default:
00304 }
00305 break;
00306 case DisplayStatus.IV_DATA:
00307 guiControl.tablesDisplayPane.resultsTable.setSelectedSerialNo(thisCell.getSerialNo(),true);
00308 switch(e.getModifiers()) {
00309 case InputEvent.BUTTON2_MASK:
00310 case InputEvent.BUTTON3_MASK:
00311 popupCell=thisCell;
00312 JPopupMenu pMenu = guiControl.guiMenus.getMenu(GuiMenus.MODULE_IVSCAN).getPopupMenu();
00313 pMenu.show(e.getComponent(),e.getX(),e.getY());
00314 pMenu.setInvoker(guiControl.guiMenus.getMenu(GuiMenus.MODULE_IVSCAN));
00315 break;
00316 default:
00317 }
00318 break;
00319 case DisplayStatus.DCS_DATA:
00320 guiControl.tablesDisplayPane.resultsTable.setSelectedSerialNo(thisCell.getSerialNo(),true);
00321 switch(e.getModifiers()) {
00322 case InputEvent.BUTTON2_MASK:
00323 case InputEvent.BUTTON3_MASK:
00324 popupCell=thisCell;
00325 JPopupMenu pMenu = guiControl.guiMenus.getMenu(GuiMenus.MODULE_DCS).getPopupMenu();
00326 pMenu.show(e.getComponent(),e.getX(),e.getY());
00327 pMenu.setInvoker(guiControl.guiMenus.getMenu(GuiMenus.MODULE_DCS));
00328 break;
00329 default:
00330 }
00331
00332
00333 break;
00334 case DisplayStatus.PROBE_DATA:
00335 guiControl.tablesDisplayPane.resultsTable.setSelectedSerialNo(thisCell.getSerialNo(),true);
00336 switch(e.getModifiers()) {
00337 case InputEvent.BUTTON2_MASK:
00338 case InputEvent.BUTTON3_MASK:
00339 popupCell=thisCell;
00340 JPopupMenu pMenu = guiControl.guiMenus.getMenu(GuiMenus.MODULE_PROBE).getPopupMenu();
00341 pMenu.show(e.getComponent(),e.getX(),e.getY());
00342 pMenu.setInvoker(guiControl.guiMenus.getMenu(GuiMenus.MODULE_PROBE));
00343 break;
00344 default:
00345 }
00346
00347
00348 break;
00349 default:
00350 guiControl.tablesDisplayPane.resultsTable.setSelectedSerialNo(thisCell.getSerialNo(),true);
00351 }
00352
00353 }
00354
00355 public void mouseExited(MouseEvent e){}
00356 public void mouseEntered(MouseEvent e){}
00357
00358
00359 public void refreshDisplay(){
00360 redCell=null;
00361 repaint();
00362 }
00363
00364 public void initPanelParameters() {
00365 dim = getSize();
00366 maxWidth = (int)dim.getWidth();
00367 ConfigurationInterface.getInstance().setWindowSize(maxWidth,(int)dim.getHeight());
00368 }
00369
00370
00371 public void paintComponent(Graphics g){
00372
00373 super.paintComponent(g);
00374
00375 Graphics2D g2 = (Graphics2D)g;
00376 g2.setStroke(new BasicStroke(1.0f));
00377
00378 if ( firstTime ) {
00379
00380 area = new Rectangle(dim);
00381
00382 firstTime = false;
00383 g2.setFont(displayTextFont);
00384 metrics = g2.getFontMetrics();
00385
00386 }
00387
00388 g2.setPaint(Color.white);
00389 g2.fill(area);
00390
00391
00392 ConfigurationInterface.getInstance().drawViewOutline(g2,guiControl.selectorPane.getViewCategoryIndex(),guiControl.selectorPane.getViewIndex());
00393 drawTitle(g2);
00394 if(mouseLocationText!=null) drawMouseLocation(g2,mouseLocationText);
00395 drawGraphicsCells(g2);
00396 drawMouseSelections(g2);
00397
00398 }
00399
00400
00401
00402 public void drawGraphicsCells(Graphics2D g2) {
00403 ColorScale thisColorScale = guiControl.colorScalePane.getColorScale();
00404 config = ConfigurationInterface.getInstance();
00405 int viewCategoryIndex = guiControl.selectorPane.getViewCategoryIndex();
00406 switch(viewCategoryIndex) {
00407 case ConfigurationInterface.RODCRATE_VIEWS:
00408 for (java.util.Iterator m = config.getSerialNumberList(viewCategoryIndex,guiControl.selectorPane.getViewIndex()).iterator(); m.hasNext(); ) {
00409 String thisSN=(String)m.next();
00410 ModuleCell thisCell = config.getModuleCell(thisSN);
00411 g2.setPaint(thisCell.getColor());
00412 java.awt.Polygon thisP = thisCell.getPolygon(viewCategoryIndex);
00413 g2.fill(thisCell.getPolygon(viewCategoryIndex));
00414 g2.setColor(Color.black);
00415 g2.draw(thisCell.getPolygon(viewCategoryIndex));
00416 }
00417 break;
00418 case ConfigurationInterface.SCT_VIEWS:
00419 if(guiControl.selectorPane.getViewIndex()<4) {
00420 for (java.util.Iterator m = config.getSerialNumberList(viewCategoryIndex,guiControl.selectorPane.getViewIndex()).iterator(); m.hasNext(); ) {
00421 String thisSN=(String)m.next();
00422 ModuleCell thisCell = config.getModuleCell(thisSN);
00423 g2.setPaint(thisCell.getColor());
00424 g2.fill(thisCell.getPolygon(viewCategoryIndex));
00425 g2.setColor(Color.black);
00426 g2.draw(thisCell.getPolygon(viewCategoryIndex));
00427 }
00428 }
00429 else {
00430
00431 for (java.util.Iterator m = config.getSerialNumberList(guiControl.selectorPane.getViewCategoryIndex(),guiControl.selectorPane.getViewIndex()).iterator(); m.hasNext(); ) {
00432 String thisSN=(String)m.next();
00433 ModuleCell thisCell = config.getModuleCell(thisSN);
00434 int ring = thisCell.getPosition();
00435 if(ring<13 || ring>22) continue;
00436 g2.setPaint(thisCell.getColor());
00437 g2.fill(thisCell.getPolygon(viewCategoryIndex));
00438 g2.setColor(Color.black);
00439 g2.draw(thisCell.getPolygon(viewCategoryIndex));
00440 }
00441 for (java.util.Iterator m = config.getSerialNumberList(guiControl.selectorPane.getViewCategoryIndex(),guiControl.selectorPane.getViewIndex()).iterator(); m.hasNext(); ) {
00442 String thisSN=(String)m.next();
00443 ModuleCell thisCell = config.getModuleCell(thisSN);
00444 int ring = thisCell.getPosition();
00445 if(ring>=13 && ring<=22) continue;
00446 g2.setPaint(thisCell.getColor());
00447 g2.fill(thisCell.getPolygon(viewCategoryIndex));
00448 g2.setColor(Color.black);
00449 g2.draw(thisCell.getPolygon(viewCategoryIndex));
00450 }
00451 }
00452 break;
00453 default:
00454 }
00455 }
00456
00457 public void drawMouseSelections(Graphics2D g2) {
00458 if(redCell!=null) {
00459 g2.setColor(Color.red);
00460 g2.draw(redCell.getPolygon(guiControl.selectorPane.getViewCategoryIndex()));
00461 }
00462 if(draggedRectangle!=null) {
00463 g2.setColor(Color.red);
00464 g2.draw(draggedRectangle);
00465 }
00466 g2.setColor(Color.lightGray);
00467 }
00468
00469
00470
00471 public void drawMouseLocation(Graphics2D g2, String mouseLocationText) {
00472 g2.setFont(displayTextFont);
00473
00474 g2.setPaint(Color.white);
00475 metrics = g2.getFontMetrics();
00476 int stringWidth = metrics.stringWidth(mouseLocationText);
00477 int stringHeight = metrics.getHeight();
00478 g2.drawString(mouseLocationText,maxWidth/2+7*boxWidth - stringWidth-5,yOffSet+boxHeight-stringHeight);
00479 }
00480
00481 public void drawTitle(Graphics2D g2) {
00482 g2.setPaint(Color.blue);
00483 int leftX = maxWidth/2-6*boxWidth;
00484 int rightX = maxWidth/2+7*boxWidth;
00485 Rectangle top = new Rectangle(leftX,0,13*boxWidth,yOffSet);
00486 g2.fill(top);
00487 leftX+=5;
00488
00489
00490 if(leftTitle!=null) leftTitle.drawText(g2, leftX, 0);
00491
00492
00493 int rightTitleWidth= 0;
00494 if(rightTitle!=null) rightTitleWidth = rightTitle.drawText(g2,rightX-5,1);
00495
00496
00497 if(middleTitle!=null) middleTitle.drawText(g2,rightX-rightTitleWidth-20,1);
00498
00499 g2.setFont(displayTextFont);
00500 g2.setPaint(Color.white);
00501 int y =yOffSet+boxHeight-g2.getFontMetrics().getHeight();
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512 if(optionTitle!=null) g2.drawString(optionTitle.title,leftX,y);
00513 }
00514
00515
00516 public void setDisplayOption(int displayOption) {
00517 this.displayOption=displayOption;
00518 guiControl.colorScalePane.setColorScale();
00519 setDisplayColors();
00520 refreshDisplay();
00521 guiControl.tablesDisplayPane.listTestResults();
00522 }
00523 public int getDisplayOption() {
00524 return displayOption;
00525 }
00526 public void resetDisplayOption() {
00527 displayOption=0;
00528 }
00529 public ModuleCell getLastClickedCell() {
00530 return lastClickedCell;
00531 }
00532 public int getLastClickedRodSlot() {
00533 return lastClickedRodSlot;
00534 }
00535 public void setLastClickedCell(String sn) {
00536 lastClickedCell = ConfigurationInterface.getInstance().getModuleCell(sn);
00537 }
00538
00539 public void setDisplayColors() {
00540
00541 TestSelection testSelection = guiControl.tablesDisplayPane.getTestSelection();
00542 IVTestSelection ivTestSelection = guiControl.tablesDisplayPane.getIVTestSelection();
00543 int testIndex = (testSelection!=null) ? testSelection.getTestIndex() : -1;
00544
00545 int displayStatus = guiControl.displayStatus.getStatus();
00546 Map countMap = null;
00547 if(displayStatus==DisplayStatus.IS_MONITOR && testSelection!=null) countMap = guiControl.isInterface.isCounter.getModuleMap(guiControl.selectorPane.getDisplayParameterIndex(),testSelection.getRunScanRegex(),testSelection.isRetrievedData());
00548 Map dcsMap = null;
00549
00550 if(guiControl.tablesDisplayPane.getTestControlObjectName()!=null) dcsMap=guiControl.isInterface.getDCSMap(guiControl.tablesDisplayPane.getTestControlObjectName());
00551 int parameterIndex = guiControl.selectorPane.getDisplayParameterIndex();
00552 int mouseOption = guiControl.selectorPane.getMouseClickIndex();
00553
00554 SummaryReader.DCSInfo dcsInfo;
00555
00556 config = ConfigurationInterface.getInstance();
00557
00558
00559 MODULELOOP:
00560 for (java.util.Iterator m = config.getSerialNumberList(guiControl.selectorPane.getViewCategoryIndex(),guiControl.selectorPane.getViewIndex()).iterator(); m.hasNext(); ) {
00561 String sn=(String)m.next();
00562 ModuleCell thisCell = config.getModuleCell(sn);
00563 Double theData=null;
00564 String header=null;
00565 switch(displayStatus) {
00566
00567 case DisplayStatus.TEST_DATA:
00568 if(testSelection!=null) header = testSelection.getResultObjectHeader();
00569 if(header==null) {
00570 fillCellData(thisCell,null);
00571 continue MODULELOOP;
00572 }
00573 dcsInfo = (dcsMap!=null) ? (SummaryReader.DCSInfo)dcsMap.get(sn) : null;
00574 switch(displayOption) {
00575 case 1:
00576 header = testSelection.getSCTDBObjectHeader();
00577 if((theData = guiControl.isInterface.getSCTDBData(header+sn,testIndex))==null) {
00578 fillCellData(thisCell,null);
00579 continue MODULELOOP;
00580 }
00581 break;
00582 case 2:
00583 if((theData=guiControl.isInterface.getTestData(header,sn,testIndex,dcsInfo))==null) {
00584 fillCellData(thisCell,null);
00585 continue MODULELOOP;
00586 }
00587 Double sctdbData;
00588 if((sctdbData = guiControl.isInterface.getSCTDBData(testSelection.getSCTDBObjectHeader()+sn,testIndex))==null) {
00589 fillCellData(thisCell,null);
00590 continue MODULELOOP;
00591 }
00592 double diff = Math.abs(theData.doubleValue()-sctdbData.doubleValue());
00593 if(testIndex==TEST_FULLBYPASS && parameterIndex>2) theData=new Double(1.0);
00594 else theData = (diff>testDataTolerances[testIndex][parameterIndex]) ? new Double(2.0) : new Double(1.0);
00595 break;
00596 case 0:
00597 default:
00598 if((theData=guiControl.isInterface.getTestData(header,sn,testIndex,dcsInfo))==null) {
00599 fillCellData(thisCell,null);
00600 continue MODULELOOP;
00601 }
00602 }
00603
00604 break;
00605
00606 case DisplayStatus.IV_DATA:
00607 if(ivTestSelection==null) {
00608 fillCellData(thisCell,null);
00609 continue MODULELOOP;
00610 }
00611 header = ivTestSelection.getResultObjectHeader();
00612 if(header==null || (theData = guiControl.isInterface.getTestData(header,thisCell.getSerialNo(),TEST_IV,null))==null) {
00613 fillCellData(thisCell,null);
00614 continue MODULELOOP;
00615 }
00616 break;
00617
00618 case DisplayStatus.SCTDB_DATA:
00619 if(testSelection==null) {
00620 fillCellData(thisCell,null);
00621 continue MODULELOOP;
00622 }
00623 header = testSelection.getSCTDBObjectHeader();
00624 if(header==null || (theData = guiControl.isInterface.getSCTDBData(header+thisCell.getSerialNo(),testIndex))==null) {
00625 fillCellData(thisCell,null);
00626 continue MODULELOOP;
00627 }
00628 break;
00629
00630 case DisplayStatus.SCTDB_RODDAQ_DATA:
00631 if(testSelection==null) {
00632 fillCellData(thisCell,null);
00633 continue MODULELOOP;
00634 }
00635 header = testSelection.getSCTDBRodDaqObjectHeader();
00636 if(header==null || (theData = guiControl.isInterface.getSCTDBData(header+thisCell.getSerialNo(),testIndex))==null) {
00637 fillCellData(thisCell,null);
00638 continue MODULELOOP;
00639 }
00640 break;
00641
00642 case DisplayStatus.DCS_DATA:
00643 if((theData=guiControl.isInterface.getDCSData(sn,parameterIndex))==null) {
00644 fillCellData(thisCell,null);
00645 continue MODULELOOP;
00646 }
00647 break;
00648
00649 case DisplayStatus.PROBE_DATA:
00650 theData = SctApiInfo.getInstance().getProbeData(sn,mouseOption);
00651 break;
00652
00653 case DisplayStatus.IS_MONITOR:
00654 if(testSelection==null || countMap==null) {
00655 fillCellData(thisCell,null);
00656 continue MODULELOOP;
00657 }
00658 theData = (countMap.containsKey(sn)) ? new Double(((java.util.List)countMap.get(sn)).size()) : new Double(0.);
00659 break;
00660
00661 case DisplayStatus.MODULE_GROUP_SELECTION:
00662 if(parameterIndex>0) theData = SctApiInfo.getInstance().getProbeData(sn,mouseOption);
00663 else theData = new Double(thisCell.getModuleGroup());
00664 default:
00665 fillCellData(thisCell,null);
00666 }
00667 fillCellData(thisCell,theData);
00668 }
00669
00670 int displayedTestIndex = guiControl.isInterface.getListFilterIndex();
00671 int selectedTestIndex = (testSelection!=null) ? testSelection.getTestIndex() : -1;
00672 int runno = (testSelection!=null) ? testSelection.getRunNo() : -1;
00673 int scanno = (testSelection!=null) ? testSelection.getScanNo() : -1;
00674 String statusString="No Data";
00675 String runScanString="No Data";
00676 String dataDescription = guiControl.selectorPane.getDisplayParameter();
00677 String option = guiControl.selectorPane.getOption();
00678
00679 leftTitle = new DisplayTitle(DisplayStatus.statusNames[displayStatus],java.awt.Color.yellow,displayTitleFont);
00680 middleTitle = (dataDescription!=null) ? new DisplayTitle(dataDescription, java.awt.Color.white,displayTitleFont) : null;
00681 rightTitle=null;
00682 optionTitle=(option!=null) ? new DisplayTitle(option,java.awt.Color.white,displayTextFont) : null;
00683
00684 switch(displayStatus) {
00685 case DisplayStatus.TEST_DATA:
00686 switch(displayOption) {
00687 case 0:
00688 rightTitle = (runno!=-1) ? new DisplayTitle("Run "+Integer.toString(runno)+" Scan "+Integer.toString(scanno),java.awt.Color.yellow,displayTitleFont) : new DisplayTitle("No Data",java.awt.Color.red,displayTitleFont);
00689 break;
00690 case 1:
00691 rightTitle = new DisplayTitle("SctDaq Reference",java.awt.Color.red,displayTitleFont);
00692 break;
00693 case 2:
00694 rightTitle = new DisplayTitle("SctDaq Comparison",java.awt.Color.red,displayTitleFont);
00695 default:
00696 }
00697 break;
00698 case DisplayStatus.IV_DATA:
00699 rightTitle = (ivTestSelection!=null) ? new DisplayTitle("Run "+Integer.toString(ivTestSelection.getRunNo())+" Scan "+Integer.toString(ivTestSelection.getScanNo()),java.awt.Color.yellow,displayTitleFont) : new DisplayTitle("No Data",java.awt.Color.red,displayTitleFont);
00700 leftTitle = new DisplayTitle("IV Scans",java.awt.Color.yellow,displayTitleFont);
00701 middleTitle = (ivTestSelection!=null) ? new DisplayTitle(guiControl.selectorPane.getIVParameter(),java.awt.Color.white,displayTitleFont) : null;
00702 break;
00703 case DisplayStatus.SCTDB_DATA:
00704 statusString="SCTDAQ Reference Data";
00705 if(selectedTestIndex>=0) statusString=testMenuNames[selectedTestIndex];
00706 else if(displayedTestIndex>=0) statusString=testMenuNames[displayedTestIndex];
00707 leftTitle = new DisplayTitle(statusString,java.awt.Color.yellow,displayTitleFont);
00708 rightTitle= (runno!=-1) ? new DisplayTitle("SCTDAQ Reference",java.awt.Color.red,displayTitleFont) : new DisplayTitle("No Data",java.awt.Color.red,displayTitleFont);
00709 break;
00710 case DisplayStatus.SCTDB_RODDAQ_DATA:
00711 rightTitle = (runno!=-1) ? new DisplayTitle("Run "+Integer.toString(runno)+" Scan "+Integer.toString(scanno),java.awt.Color.yellow,displayTitleFont) : new DisplayTitle("No Data",java.awt.Color.red,displayTitleFont);
00712 break;
00713 case DisplayStatus.PROBE_DATA:
00714 leftTitle= new DisplayTitle("Module Probe Data",java.awt.Color.yellow,displayTitleFont);
00715 middleTitle = null;
00716 break;
00717 case DisplayStatus.IS_MONITOR:
00718 rightTitle = (runno!=-1) ? new DisplayTitle("Run "+Integer.toString(runno)+" Scan "+Integer.toString(scanno),java.awt.Color.yellow,displayTitleFont) : new DisplayTitle("No Data",java.awt.Color.red,displayTitleFont);
00719 break;
00720 case DisplayStatus.MODULE_GROUP_SELECTION:
00721 if(parameterIndex==0) middleTitle= (option!=null) ? new DisplayTitle(option+" Count : "+Integer.toString(guiControl.tablesDisplayPane.resultsTable.getRowCount()),java.awt.Color.white,displayTitleFont) : null;
00722 break;
00723 default:
00724 }
00725
00726 }
00727
00728 private void fillCellData(ModuleCell thisCell, Double theData) {
00729 if(theData==null) {
00730 thisCell.setData(null,java.awt.Color.white);
00731 return;
00732 }
00733 ColorScale thisColorScale;
00734 if((thisColorScale = guiControl.colorScalePane.getColorScale())!=null) thisCell.setData(theData,thisColorScale.getColor(theData));
00735 else thisCell.setData(null,java.awt.Color.white);
00736 }
00737
00738
00739
00740
00741
00742
00743
00744 }