Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

DisplayPanel.java

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

Generated on Fri Sep 16 18:05:55 2005 for SCT DAQ/DCS Software - Java by doxygen 1.3.5