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         default:
00281             guiControl.tablesDisplayPane.setSelectedSerialNo(thisCell.getSerialNo(),true);
00282         }
00283        
00284        }
00285 
00286      public void mouseExited(MouseEvent e){}
00287      public void mouseEntered(MouseEvent e){}
00288                          
00289 
00290      public void refreshDisplay(){
00291           redCell=null;
00292           repaint();
00293      }
00294 
00295     public void initPanelParameters() {  //must do this because config needs the panel size before it is painted
00296             dim = getSize();
00297             maxWidth = (int)dim.getWidth();
00298             config.setWindowSize(maxWidth,(int)dim.getHeight());
00299             }
00300 
00301 
00302     public void paintComponent(Graphics g){
00303 
00304         super.paintComponent(g);
00305         
00306 
00307         
00308         Graphics2D g2 = (Graphics2D)g;
00309         g2.setStroke(new BasicStroke(1.0f));
00310 
00311         if ( firstTime ) {
00312 //            dim = getSize();
00313             area = new Rectangle(dim);
00314 //            maxWidth = (int)dim.getWidth();
00315             firstTime = false;
00316             g2.setFont(displayTextFont);
00317             metrics = g2.getFontMetrics();
00318 //            config.setWindowSize(maxWidth,(int)dim.getHeight());
00319         }
00320         // Clears the rectangle that was previously drawn.
00321         g2.setPaint(Color.white);
00322         g2.fill(area);
00323 
00324         
00325         config.drawSCTViewOutline(g2,selectedView);
00326         drawTitle(g2);
00327         if(mouseLocationText!=null) drawMouseLocation(g2,mouseLocationText);
00328         drawGraphicsCells(g2);
00329         drawMouseSelections(g2);
00330 
00331     }
00332 
00333 
00334     
00335     public void drawGraphicsCells(Graphics2D g2) {
00336         ColorScale thisColorScale = guiControl.colorScalePane.getColorScale();
00337         if(selectedView<4) {
00338           for(Enumeration e = config.getSerialNumberMap(selectedView).elements(); e.hasMoreElements();) {
00339                ModuleCell thisCell = (ModuleCell) e.nextElement();
00340                if(thisCell.getSctComponent()!=selectedView) continue;
00341                g2.setPaint(thisCell.getColor());
00342                g2.fill((Polygon)thisCell);
00343                g2.setColor(Color.black);
00344                g2.draw((Polygon)thisCell);
00345                }
00346           }
00347          else {
00348           // for endcaps, must draw/paint middle ring first
00349           for(Enumeration e = config.getSerialNumberMap(selectedView).elements(); e.hasMoreElements();) {
00350                ModuleCell thisCell = (ModuleCell) e.nextElement();
00351                if(thisCell.getSctComponent()!=selectedView) continue;
00352                int ring = thisCell.getPosition();
00353                if(ring<13 || ring>22) continue;
00354                g2.setPaint(thisCell.getColor());
00355                g2.fill((Polygon)thisCell);
00356                g2.setColor(Color.black);
00357                g2.draw((Polygon)thisCell);
00358                }
00359           for(Enumeration e = config.getSerialNumberMap(selectedView).elements(); e.hasMoreElements();) {
00360                ModuleCell thisCell = (ModuleCell) e.nextElement();
00361                if(thisCell.getSctComponent()!=selectedView) continue;
00362                int ring = thisCell.getPosition();
00363                if(ring>=13 && ring<=22) continue;
00364                g2.setPaint(thisCell.getColor());
00365                g2.fill((Polygon)thisCell);
00366                g2.setColor(Color.black);
00367                g2.draw((Polygon)thisCell);
00368                }
00369            }
00370     }
00371 
00372    public void drawMouseSelections(Graphics2D g2) {
00373        if(redCell!=null) {
00374             g2.setColor(Color.red);
00375             g2.draw((Polygon)redCell);
00376           }
00377            if(draggedRectangle!=null) {
00378                g2.setColor(Color.red);
00379                g2.draw(draggedRectangle);
00380            }
00381           g2.setColor(Color.lightGray);
00382       }
00383 
00384 
00385 
00386     public void drawMouseLocation(Graphics2D g2, String mouseLocationText) {
00387         g2.setFont(displayTextFont);
00388 //        g2.setPaint(darkBlueColor);
00389         g2.setPaint(Color.white);
00390         metrics = g2.getFontMetrics();
00391         int stringWidth = metrics.stringWidth(mouseLocationText);
00392         int stringHeight = metrics.getHeight();
00393         g2.drawString(mouseLocationText,maxWidth/2+7*boxWidth - stringWidth-5,yOffSet+boxHeight-stringHeight);
00394     }
00395 
00396     public void drawTitle(Graphics2D g2) {
00397         g2.setPaint(Color.blue);
00398         int leftX = maxWidth/2-6*boxWidth;
00399         int rightX = maxWidth/2+7*boxWidth;
00400         Rectangle top = new Rectangle(leftX,0,13*boxWidth,yOffSet);
00401         g2.fill(top);
00402         leftX+=5;
00403 
00404         // left Title
00405         if(leftTitle!=null) leftTitle.drawText(g2, leftX, 0);
00406 
00407         // right Title
00408         int rightTitleWidth= 0;
00409         if(rightTitle!=null) rightTitleWidth = rightTitle.drawText(g2,rightX-5,1);
00410 
00411         // middle Title
00412         if(middleTitle!=null) middleTitle.drawText(g2,rightX-rightTitleWidth-20,1);
00413 
00414         g2.setFont(displayTextFont);
00415         g2.setPaint(Color.white);
00416         int y =yOffSet+boxHeight-g2.getFontMetrics().getHeight();
00417         g2.drawString(SCTViewNames[selectedView],leftX,y);
00418         int sWidth = g2.getFontMetrics().stringWidth(SCTViewNames[selectedView]);
00419 
00420 //        if(optionTitle!=null) optionTitle.drawCenteredText(g2,maxWidth/2-20,yOffSet+boxHeight);
00421         if(optionTitle!=null) g2.drawString(optionTitle.title,leftX+20+sWidth,y);
00422     }
00423 
00424 
00425     public void setSCTView(int view) {
00426         selectedView=view;
00427         guiControl.tablesDisplayPane.updateTables();
00428         }
00429     public void setDisplayOption(int displayOption) {
00430         this.displayOption=displayOption;
00431         guiControl.colorScalePane.setColorScale();
00432         setDisplayColors();
00433         refreshDisplay();
00434         guiControl.tablesDisplayPane.listTestResults();
00435         }
00436    public int getDisplayOption() {
00437         return displayOption;
00438         }
00439    public void resetDisplayOption() {
00440         displayOption=0;
00441         }
00442    public int getSCTView() {
00443         return selectedView;
00444         }
00445    public ModuleCell getLastClickedCell() {
00446         return lastClickedCell;
00447         }
00448 
00449     public void setDisplayColors() {
00450 //       System.out.println("**setDisplayColors**");
00451        TestSelection testSelection = guiControl.tablesDisplayPane.getTestSelection();
00452        IVTestSelection ivTestSelection = guiControl.tablesDisplayPane.getIVTestSelection();
00453        int testIndex = (testSelection!=null) ? testSelection.getTestIndex() : -1;
00454 
00455        int displayStatus = guiControl.displayStatus.getStatus();
00456        Map countMap = null;
00457        if(displayStatus==DisplayStatus.IS_MONITOR && testSelection!=null) countMap = guiControl.isInterface.isCounter.getModuleMap(guiControl.selectorPane.getDisplayParameterIndex(),testSelection.getRunScanRegex(),testSelection.isRetrievedData());
00458        Map dcsMap = null;
00459 //       if(displayStatus==DisplayStatus.DCS_DATA && guiControl.tablesDisplayPane.getTestControlObjectName()!=null) dcsMap=guiControl.isInterface.getDCSMap(guiControl.tablesDisplayPane.getTestControlObjectName());
00460        if(guiControl.tablesDisplayPane.getTestControlObjectName()!=null) dcsMap=guiControl.isInterface.getDCSMap(guiControl.tablesDisplayPane.getTestControlObjectName());
00461        int parameterIndex = guiControl.selectorPane.getDisplayParameterIndex();
00462        int mouseOption = guiControl.selectorPane.getMouseClickIndex();
00463 
00464        SummaryReader.DCSInfo dcsInfo;
00465 
00466 // enumerate through all modules
00467        MODULELOOP:
00468        for(Enumeration e = config.getSerialNumberMap(selectedView).elements(); e.hasMoreElements();) {
00469            ModuleCell thisCell = (ModuleCell) e.nextElement();
00470            String sn = thisCell.getSerialNo();
00471            Double theData=null;
00472            String header=null;
00473            switch(displayStatus) {
00474 // TEST_DATA *********************************
00475              case DisplayStatus.TEST_DATA:
00476                   if(testSelection!=null) header = testSelection.getResultObjectHeader();
00477                   if(header==null) {
00478                        fillCellData(thisCell,null);
00479                        continue MODULELOOP;                       
00480                        }    
00481                    dcsInfo = (dcsMap!=null) ? (SummaryReader.DCSInfo)dcsMap.get(sn) : null;
00482                    switch(displayOption) {
00483                      case 1: // SCTDB Data only    
00484                         header = testSelection.getSCTDBObjectHeader();
00485                         if((theData = guiControl.isInterface.getSCTDBData(header+sn,testIndex))==null) {
00486                             fillCellData(thisCell,null);
00487                             continue MODULELOOP;
00488                             }    
00489                         break;
00490                      case 2: // Compare SCTDB and ROD data
00491                          if((theData=guiControl.isInterface.getTestData(header,sn,testIndex,dcsInfo))==null) {
00492                              fillCellData(thisCell,null);
00493                              continue MODULELOOP;
00494                              }  
00495                           Double sctdbData;                    
00496                           if((sctdbData = guiControl.isInterface.getSCTDBData(testSelection.getSCTDBObjectHeader()+sn,testIndex))==null) {
00497                              fillCellData(thisCell,null);
00498                              continue MODULELOOP;
00499                              }    
00500                           double diff = Math.abs(theData.doubleValue()-sctdbData.doubleValue());
00501                           if(testIndex==TEST_FULLBYPASS && parameterIndex>2) theData=new Double(1.0);
00502                           else theData = (diff>testDataTolerances[testIndex][parameterIndex]) ? new Double(2.0) : new Double(1.0);
00503                           break;
00504                    case 0: // ROD Data only
00505                    default:
00506                          if((theData=guiControl.isInterface.getTestData(header,sn,testIndex,dcsInfo))==null) {
00507                             fillCellData(thisCell,null);
00508                             continue MODULELOOP;
00509                             }    
00510                     }
00511 
00512                 break;
00513 // IV_DATA***********************************************
00514              case DisplayStatus.IV_DATA:
00515                  if(ivTestSelection==null) {
00516                       fillCellData(thisCell,null);
00517                       continue MODULELOOP;
00518                       }
00519                  header = ivTestSelection.getResultObjectHeader();
00520                  if(header==null || (theData = guiControl.isInterface.getTestData(header,thisCell.getSerialNo(),TEST_IV,null))==null) {
00521                        fillCellData(thisCell,null);
00522                        continue MODULELOOP;
00523                        }   
00524                  break;
00525 
00526 // SCTDB ************************************************
00527              case DisplayStatus.SCTDB_DATA:
00528                  if(testSelection==null) {
00529                       fillCellData(thisCell,null);
00530                       continue MODULELOOP;
00531                       }
00532                  header = testSelection.getSCTDBObjectHeader();
00533                  if(header==null || (theData = guiControl.isInterface.getSCTDBData(header+thisCell.getSerialNo(),testIndex))==null) {
00534                        fillCellData(thisCell,null);
00535                        continue MODULELOOP;
00536                        }    
00537                 break;
00538 // SCTDB RodDAQ************************************************
00539              case DisplayStatus.SCTDB_RODDAQ_DATA:
00540                  if(testSelection==null) {
00541                       fillCellData(thisCell,null);
00542                       continue MODULELOOP;
00543                       }
00544                  header = testSelection.getSCTDBRodDaqObjectHeader();
00545                  if(header==null || (theData = guiControl.isInterface.getSCTDBData(header+thisCell.getSerialNo(),testIndex))==null) {
00546                        fillCellData(thisCell,null);
00547                        continue MODULELOOP;
00548                        }    
00549                 break;
00550 // DCS *************************************************
00551              case DisplayStatus.DCS_DATA: 
00552                 if((theData=guiControl.isInterface.getDCSData(sn,parameterIndex))==null) {
00553                            fillCellData(thisCell,null);
00554                            continue MODULELOOP;
00555                            }
00556 
00557                 break;
00558 // Display Manager ***************************************
00559              case DisplayStatus.IS_MONITOR:
00560                      if(testSelection==null || countMap==null) {
00561                             fillCellData(thisCell,null);
00562                             continue MODULELOOP;
00563                             }
00564                     theData = (countMap.containsKey(sn)) ? new Double(((java.util.List)countMap.get(sn)).size()) : new Double(0.);
00565 //                     theData = (moduleCountMap.containsKey(sn)) ? new Double(((Integer)moduleCountMap.get(sn)).intValue()) : new Double(0.);
00566                 break;
00567 // ModuleGroup *******************************************
00568              case DisplayStatus.MODULE_GROUP_SELECTION:
00569                   theData = new Double(thisCell.getModuleGroup());                   
00570              default:
00571                   fillCellData(thisCell,null);
00572            } 
00573           fillCellData(thisCell,theData);
00574           }
00575 // now define titles
00576         int displayedTestIndex = guiControl.isInterface.getListFilterIndex();
00577         int selectedTestIndex = (testSelection!=null) ? testSelection.getTestIndex() : -1;
00578         int runno = (testSelection!=null) ? testSelection.getRunNo() : -1;
00579         int scanno = (testSelection!=null) ? testSelection.getScanNo() : -1;
00580         String statusString="No Data";
00581         String runScanString="No Data";
00582         String dataDescription = guiControl.selectorPane.getDisplayParameter();
00583         String option = guiControl.selectorPane.getOption();
00584         switch(guiControl.displayStatus.getStatus()) {
00585            case DisplayStatus.TEST_DATA:
00586               statusString="Test Results";
00587               if(selectedTestIndex>=0) statusString=testMenuNames[selectedTestIndex]+" Result";
00588               else if(displayedTestIndex>=0) statusString=testMenuNames[displayedTestIndex]+" Result";
00589               leftTitle = new DisplayTitle(statusString,java.awt.Color.yellow,displayTitleFont);
00590               switch(displayOption) {
00591                 case 0:
00592                      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);
00593                     break;
00594                 case 1:
00595                      rightTitle = new DisplayTitle("SctDaq Reference",java.awt.Color.red,displayTitleFont);
00596                      break;
00597                 case 2:
00598                      rightTitle = new DisplayTitle("SctDaq Comparison",java.awt.Color.red,displayTitleFont);
00599                 default:
00600                 }
00601               middleTitle = (dataDescription!=null) ? new DisplayTitle(dataDescription, java.awt.Color.white,displayTitleFont) : null;
00602               optionTitle = (option!=null) ? new DisplayTitle(option,java.awt.Color.white,displayTextFont) : null;
00603               break;
00604             case DisplayStatus.IV_DATA:                            
00605               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);
00606               leftTitle = new DisplayTitle("IV Scans",java.awt.Color.yellow,displayTitleFont);
00607               middleTitle = (ivTestSelection!=null) ? new DisplayTitle(guiControl.selectorPane.getIVParameter(),java.awt.Color.white,displayTitleFont) : null;
00608               optionTitle = null;
00609               break;
00610             case DisplayStatus.SCTDB_DATA:
00611               statusString="SCTDAQ Reference Data";
00612               if(selectedTestIndex>=0) statusString=testMenuNames[selectedTestIndex];
00613               else if(displayedTestIndex>=0) statusString=testMenuNames[displayedTestIndex];
00614               leftTitle = new DisplayTitle(statusString,java.awt.Color.yellow,displayTitleFont);
00615               rightTitle= (runno!=-1) ? new DisplayTitle("SCTDAQ Reference",java.awt.Color.red,displayTitleFont) : new DisplayTitle("No Data",java.awt.Color.red,displayTitleFont);
00616               middleTitle = (dataDescription!=null) ? new DisplayTitle(dataDescription, java.awt.Color.white,displayTitleFont) : null;              
00617               optionTitle = (option!=null) ? new DisplayTitle(option,java.awt.Color.white,displayTextFont) : null;
00618               break;
00619             case DisplayStatus.SCTDB_RODDAQ_DATA:
00620               statusString="SctRodDaq Reference Data";
00621               if(selectedTestIndex>=0) statusString=testMenuNames[selectedTestIndex]+" (SCTDB)";
00622               else if(displayedTestIndex>=0) statusString=testMenuNames[displayedTestIndex]+" (SCTDB)";
00623               leftTitle = new DisplayTitle(statusString,java.awt.Color.yellow,displayTitleFont);
00624               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);
00625               middleTitle = (dataDescription!=null) ? new DisplayTitle(dataDescription, java.awt.Color.white,displayTitleFont) : null;              
00626               optionTitle = (option!=null) ? new DisplayTitle(option,java.awt.Color.white,displayTextFont) : null;
00627               break;
00628             case DisplayStatus.DCS_DATA:
00629               leftTitle= new DisplayTitle("Present DCS Conditions",java.awt.Color.yellow,displayTitleFont);
00630               rightTitle = null;
00631               optionTitle=null;
00632               middleTitle = (dataDescription!=null) ? new DisplayTitle(dataDescription, java.awt.Color.white,displayTitleFont) : null;
00633               break;
00634             case DisplayStatus.IS_MONITOR:
00635               leftTitle= new DisplayTitle("Data Manager",java.awt.Color.yellow,displayTitleFont);
00636               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);
00637               middleTitle = (dataDescription!=null) ? new DisplayTitle(dataDescription, java.awt.Color.white,displayTitleFont) : null;
00638               optionTitle=null;
00639               break;
00640             case DisplayStatus.MODULE_GROUP_SELECTION:
00641               leftTitle= new DisplayTitle("Module Group Selection",java.awt.Color.yellow,displayTitleFont);
00642               rightTitle=null;
00643               middleTitle= (option!=null) ? new DisplayTitle(option+" Count : "+Integer.toString(guiControl.tablesDisplayPane.getRowCount(1)),java.awt.Color.white,displayTitleFont) : null;
00644               optionTitle = null;
00645               break;
00646             default:
00647               leftTitle= new DisplayTitle("Display UNCONFIGURED",java.awt.Color.white,displayTitleFont);
00648               rightTitle=null;
00649               middleTitle=null;
00650               optionTitle=null;
00651             }
00652 
00653 
00654 
00655 
00656    }
00657 
00658     private void fillCellData(ModuleCell thisCell, Double theData) {
00659          if(theData==null) {
00660             thisCell.setData(null,java.awt.Color.white);
00661             return;
00662             }
00663          ColorScale thisColorScale;
00664          if((thisColorScale = guiControl.colorScalePane.getColorScale())!=null) thisCell.setData(theData,thisColorScale.getColor(theData));
00665          else thisCell.setData(null,java.awt.Color.white);
00666          }
00667 
00668 
00669 
00670 
00671 
00672 
00673  
00674 }

Generated on Thu Jul 15 09:55:41 2004 for SCT DAQ/DCS Software - Java by doxygen 1.3.5