Esempio n. 1
0
  public void putHsLayout(int id) {
    Hashtable hs = sshare.userInfo();
    if (hs == null) return;
    String key, name;
    JComponent obj;
    PushpinIF pobj;

    for (int i = 0; i < keys.size(); i++) {
      key = (String) keys.get(i);
      obj = (JComponent) panes.get(key);
      if (obj != null && (obj instanceof PushpinIF)) {
        pobj = (PushpinIF) obj;
        name = "tabTool." + id + "." + pobj.getName() + ".";
        hs.put(name + "refY", new Float(pobj.getRefY()));
        hs.put(name + "refX", new Float(pobj.getRefX()));
        hs.put(name + "refH", new Float(pobj.getRefH()));
        key = "open";
        if (pobj.isHide()) key = "hide";
        else if (pobj.isClose()) key = "close";
        hs.put(name + "status", key);
      }
    }
    /*
    name = "tabTool."+id+".TabPanel.";
    key = pinPanel.getLastName();
    if (key != null)
       hs.put(name+"lastName", key);
    key = "open";
    if (pinPanel.isHide())
       key = "hide";
    else if (pinPanel.isClose())
       key = "close";
    hs.put(name+"status", key);
     */
  }
Esempio n. 2
0
  private void updateVpInfo() {

    String key;
    String vps;
    for (int j = 0; j < keys.size(); j++) {
      key = (String) keys.get(j);
      vps = (String) vpInfo.get(j);
      if (vps == null || vps.length() <= 0 || vps.equals("all")) {
        for (int i = 0; i < nviews; i++) {
          tp_paneInfo[i].put(key, "yes");
        }
      } else {
        for (int i = 0; i < nviews; i++) tp_paneInfo[i].put(key, "no");
        StringTokenizer tok = new StringTokenizer(vps, " ,\n");
        while (tok.hasMoreTokens()) {
          int vp = Integer.valueOf(tok.nextToken()).intValue();
          vp--;
          if (vp >= 0 && vp < nviews) {
            tp_paneInfo[vp].remove(key);
            tp_paneInfo[vp].put(key, "yes");
          }
        }
      }
    }
  }
    /** Returns the value in the proper format: "value". */
    protected String getValue(String strUser, String strValue) {

      ArrayList aListValues = WUtil.strToAList(strValue);
      String strNewValue = "";

      if (strValue == null || strValue.trim().length() <= 0) return "";

      String strPath =
          FileUtil.openPath("SYSPROF" + File.separator + strUser)
              + File.pathSeparator
              + FileUtil.openPath("USRPROF" + File.separator + strUser);
      HashMap hmUser = WFileUtil.getHashMap(strPath);

      for (int i = 0; i < aListValues.size(); i++) {
        strNewValue = (String) aListValues.get(i);
        if (strNewValue == null) strNewValue = "";

        // if the value is of the form: $home, then parse the value
        if (hmUser != null && strNewValue.indexOf('$') >= 0) {
          strValue = WFileUtil.parseValue(strNewValue, hmUser);
          if (strValue != null && strValue.trim().length() > 0) strNewValue = strValue;
        }
      }

      return strNewValue;
    }
Esempio n. 4
0
  public void switchLayout(int newId, boolean bLayout) {

    if (layoutId == newId) return;
    if (newId >= nviews) updateVpInfo(newId + 1);

    if (bSwitching) {
      return;
    }

    bSwitching = true;
    int oldId = layoutId;
    vpId = newId;
    layoutId = newId;

    recordCurrentLayout();
    VpLayoutInfo vInfo = Util.getViewArea().getLayoutInfo(oldId);
    if (vInfo != null) { // save current layout info
      vInfo.tp_selectedTab = tp_selectedTab;
      vInfo.setVerticalTabName(selectedTabName);
      // copyCurrentLayout(vInfo);
    }

    vInfo = Util.getViewArea().getLayoutInfo(newId);

    putHsLayout(oldId);
    if (bLayout) getHsLayout(vpId);

    for (int i = 0; i < toolList.size(); i++)
      ((VToolPanel) toolList.get(i)).switchLayout(newId, bLayout);

    if (bLayout) setCurrentLayout();
    /*
    if(comparePanelLayout(oldId, newId)) {
    setCurrentLayout();
           }
           if ((vInfo != null) && vInfo.bAvailable &&
    compareCurrentLayout(vInfo)) {
                  setCurrentLayout(vInfo);
           }

    for(int i=0; i< toolList.size(); i++)
        ((VToolPanel) toolList.get(i)).switchLayout(newId);
           */

    // setViewPort(newId);

    if (bLayout) setCurrentLayout(vInfo);

    updateValue();

    if (bLayout) {
      if (pinPanel.isOpen()) {
        if (!pinPanel.isVisible()) pinPanel.setVisible(true);
      } else pinPanel.setVisible(false);
    }
    validate();
    repaint();

    bSwitching = false;
  }
    protected void writeAuditTrail(String strPath, String strUser, StringBuffer sbValues) {
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      String strLine;
      ArrayList aListData = WUtil.strToAList(sbValues.toString(), false, "\n");
      StringBuffer sbData = sbValues;
      String strPnl = (this instanceof DisplayTemplate) ? "Data Template " : "Data Dir ";
      if (reader == null) {
        Messages.postDebug("Error opening file " + strPath);
        return;
      }

      try {
        while ((strLine = reader.readLine()) != null) {
          // if the line in the file is not in the arraylist,
          // then that line has been deleted
          if (!aListData.contains(strLine))
            WUserUtil.writeAuditTrail(new Date(), strUser, "Deleted " + strPnl + strLine);

          // remove the lines that are also in the file or those which
          // have been deleted.
          aListData.remove(strLine);
        }

        // Traverse through the remaining new lines in the arraylist,
        // and write it to the audit trail
        for (int i = 0; i < aListData.size(); i++) {
          strLine = (String) aListData.get(i);
          WUserUtil.writeAuditTrail(new Date(), strUser, "Added " + strPnl + strLine);
        }
        reader.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
Esempio n. 6
0
 private void setCompUpdatable() {
   for (int i = 0; i < objList.size(); i++) {
     JComponent obj = (JComponent) objList.get(i);
     if (obj != null) {
       if (obj instanceof XMLToolPanel) ((XMLToolPanel) obj).valueChanged();
     }
   }
 }
Esempio n. 7
0
 private void clearPanel() {
   tabbedPane.removeAll();
   tabbedToolPanel.removeAll();
   panes.clear();
   keys.clear();
   vpInfo.clear();
   toolList.clear();
   objList.clear();
   removeAllPushpinComp();
   for (int i = 0; i < nviews; i++) tp_paneInfo[i].clear();
 }
Esempio n. 8
0
  public void setCurrentLayout(int newId) {

    if (newId >= nviews) return;

    tabbedPane.removeAll();
    tabbedToolPanel.removeAll();
    String key;
    String currValue;
    JComponent obj;
    PushpinIF pobj;
    clearPushpinComp();
    for (int i = 0; i < keys.size(); i++) {
      key = (String) keys.get(i);
      currValue = (String) tp_paneInfo[newId].get(key);
      obj = (JComponent) panes.get(key);
      pobj = null;
      if (currValue.equals("yes") && obj != null) {
        if (obj instanceof PushpinIF) {
          pobj = (PushpinIF) obj;
          pobj.setAvailable(true);
          if (!pobj.isOpen()) {
            if (!pobj.isPopup()) obj = null;
          }
        }
        if (obj != null) {
          if (key.equals("Locator")) key = getLocatorName();
          tabbedPane.addTab(key, null, obj, "");
        }
        // tabbedPane.addTab(key, null, (JComponent)panes.get(key), "");
      }
    }

    if (tabbedPane.getTabCount() < 1) {
      pinPanel.setAvailable(false);
      pinPanel.setStatus("close");
      // setVisible(false);
      return;
    }

    pinPanel.setAvailable(true);
    pinPanel.setStatus("open");
    if (tabbedPane.getTabCount() == 1) {
      tabbedToolPanel.add(tabbedPane.getComponentAt(0));
      // tabbedToolPanel.add(tabbedPane);
    } else {
      tabbedToolPanel.add(tabbedPane);
    }
    setSelectedTab(tp_selectedTab, selectedTabName);

    tabbedToolPanel.validate();
    // repaint();
  }
    protected void clear(JComponent comp) {
      int nCompCount = comp.getComponentCount();
      ArrayList aListComps = new ArrayList();

      for (int i = 0; i < comp.getComponentCount(); i++) {
        Component compChild = comp.getComponent(i);
        if (compChild instanceof JComponent) {
          JComponent jcomp = (JComponent) compChild;
          if (jcomp instanceof JCheckBox || jcomp instanceof JTextField) aListComps.add(comp);
          else clear(jcomp);
        }
      }
      clear(aListComps);
    }
Esempio n. 10
0
  public void updateVpInfo(int n) {

    if (n == nviews) return;

    n = Math.min(n, maxViews);

    if (n > nviews) for (int i = nviews; i < n; i++) tp_paneInfo[i] = new Hashtable();

    nviews = n;

    updateVpInfo();

    for (int i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).updateVpInfo(n);
  }
Esempio n. 11
0
  public void saveUiLayout() {

    for (int i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).saveUiLayout();

    Hashtable hs = sshare.userInfo();
    /*
    if (hs == null || tabbedPane == null || tabbedPane.getTabCount() <= 0)
        return;
     */
    if (hs == null || tabbedPane == null) return;
    if (tabbedPane.getTabCount() > 0) {
      Integer hashValue = new Integer(tabbedPane.getSelectedIndex());
      hs.put("tabbedToolPanel", hashValue);
    }
    putHsLayout(vpId);
  }
Esempio n. 12
0
 public JComponent searchTool(String name, int id) {
   VToolPanel vp = null;
   int num = keys.size();
   if (num <= 0 || name == null) return null;
   name = Util.getLabelString(name);
   for (int i = 0; i < num; i++) {
     String key = (String) keys.get(i);
     JComponent obj = (JComponent) panes.get(key);
     if (obj instanceof VToolPanel) vp = (VToolPanel) obj;
     else if (name.equals(key) && obj != null) {
       String Value = (String) tp_paneInfo[id].get(key);
       if (Value.equals("yes")) {
         return obj;
       }
     }
   }
   return (JComponent) vp;
 }
Esempio n. 13
0
  public void initUiLayout() {

    getHsLayout(vpId);
    for (int i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).initUiLayout();

    initPanel();
    updatePinTabs();

    Hashtable hs = sshare.userInfo();
    if (hs == null || tabbedPane == null || tabbedPane.getTabCount() <= 0) return;
    Object obj = hs.get("tabbedToolPanel");
    if (obj == null) return;
    int indx = ((Integer) obj).intValue();
    if (indx < 0) return;
    // if(indx >= 0 && indx < tabbedPane.getTabCount())
    // tabbedPane.setSelectedIndex(indx);
    setSelectedTab(tp_selectedTab, null);
  }
Esempio n. 14
0
  /** When a new set of saved statements come in, refresh the menu of saved statements. */
  private void refreshSaveMenu() {
    ArrayList list;
    // first, delete what's already there
    for (; ; ) {
      Component comp = popup.getComponent(1);
      if (!(comp instanceof JMenuItem)) break;

      JMenuItem item = (JMenuItem) comp;
      if (item.getActionCommand().startsWith("save:")) popup.remove(1);
      else break;
    }
    StatementHistory history;
    history = sshare.statementHistory();
    // now insert the new list of saved statements
    list = history.getNamedStatementList();
    Color bgColor = Util.getBgColor();
    for (int i = 0; i < list.size(); i++) {
      ArrayList nameNlabel = (ArrayList) list.get(i);
      JMenuItem item = new JMenuItem("  " + (String) nameNlabel.get(1));
      item.setActionCommand("save:" + (String) nameNlabel.get(0));
      popup.add(item, 1);
      //	    item.setBackground(bgColor);
      item.addActionListener(popActionListener);
    }
  } // refreshSaveMenu()
Esempio n. 15
0
  public void getHsLayout(int id) {
    Hashtable hs = sshare.userInfo();
    if (hs == null) return;
    String key, name, status;
    Float fstr;
    float fv;

    for (int j = 0; j < keys.size(); j++) {
      key = (String) keys.get(j);
      JComponent obj = (JComponent) panes.get(key);
      if (obj instanceof PushpinIF) {
        PushpinIF pobj = (PushpinIF) obj;
        name = "tabTool." + id + "." + pobj.getName() + ".";
        fstr = (Float) hs.get(name + "refY");
        if (fstr != null) pobj.setRefY(fstr.floatValue());
        fstr = (Float) hs.get(name + "refX");
        if (fstr != null) pobj.setRefX(fstr.floatValue());
        fstr = (Float) hs.get(name + "refH");
        if (fstr != null) pobj.setRefH(fstr.floatValue());
        status = (String) hs.get(name + "status");
        if (status != null) pobj.setStatus(status);
      }
    }
  }
Esempio n. 16
0
 /**
  * Gets the list of the vnmrj users(operators) for the current unix user logged in
  *
  * @return the list of vnmrj users
  */
 protected Object[] getOperators() {
   String strUser = System.getProperty("user.name");
   User user = LoginService.getDefault().getUser(strUser);
   ArrayList<String> aListOperators = user.getOperators();
   if (aListOperators == null || aListOperators.isEmpty())
     aListOperators = new ArrayList<String>();
   Collections.sort(aListOperators);
   if (aListOperators.contains(strUser)) aListOperators.remove(strUser);
   aListOperators.add(0, strUser);
   return (aListOperators.toArray());
 }
Esempio n. 17
0
 protected void clear(ArrayList aListComps) {
   for (int i = 0; i < aListComps.size(); i++) {
     JComponent comp = (JComponent) aListComps.get(i);
     comp.removeAll();
   }
 }
Esempio n. 18
0
 public void addToLabel(DataField txf) {
   m_aListTxfLabel.add(txf);
 }
Esempio n. 19
0
 public void addToValue(DataField txf) {
   m_aListTxfValue.add(txf);
 }
Esempio n. 20
0
 public void clearArrays() {
   m_aListTxfLabel.clear();
   m_aListTxfValue.clear();
 }
Esempio n. 21
0
 public void clearLabelArray() {
   m_aListTxfLabel.clear();
 }
Esempio n. 22
0
 public void clearValueArray() {
   m_aListTxfValue.clear();
 }
Esempio n. 23
0
    /**
     * Write the file by writing the values from the labels, and the values list.
     *
     * @param strFile the file to be written.
     * @param aListLabels arraylist of texfields of labels.
     * @param aListValues arraylist of texfields of values.
     */
    protected void writeFile(
        String strUser, String strFile, ArrayList aListLabels, ArrayList aListValues) {
      String strPath = FileUtil.openPath(strFile);
      String strLabel = "";
      String strValue = "";
      StringBuffer sbValues = new StringBuffer();
      JTextField txfLabel = null;
      JTextField txfValue = null;
      boolean bNewFile = false;
      int nFDAMode = Util.getPart11Mode();

      // if it's the part11 pnl and the mode is nonFDA,
      // then don't write the file for this panel
      // the other way is not true.
      if (this instanceof DisplayParentDirectory) {
        if ((isPart11Pnl() && nFDAMode == Util.NONFDA)) {
          return;
        }
      }

      if (strPath == null) {
        strPath = FileUtil.savePath(strFile);
        bNewFile = true;
      }

      if (strPath == null || aListLabels == null) return;

      if (aListValues == null) aListValues = new ArrayList();

      // Get the list of the textfields for values and labels.
      int nLblSize = aListLabels.size();
      int nValueSize = aListValues.size();
      ArrayList<String> labelList = new ArrayList<String>();

      // Get the value from each textfield, and add it to the buffer.
      for (int i = 0; i < nLblSize; i++) {
        txfLabel = (JTextField) aListLabels.get(i);
        txfValue = (i < nValueSize) ? (JTextField) aListValues.get(i) : null;

        strLabel = (txfLabel != null) ? txfLabel.getText() : null;
        strValue = (txfValue != null) ? txfValue.getText() : "";

        // We need to be sure they don't have two data directories with
        // the same labels.  Save the label list if we are writing to
        // the "data" file.
        if (strFile.indexOf("data") != -1) {
          if (labelList.contains(strLabel)) {
            Messages.postError(
                "The Data Directory specifications "
                    + "must not have duplicate Label names. "
                    + "The Label \""
                    + strLabel
                    + "\" is duplicated.  "
                    + "Skipping the second instance.  Please "
                    + "specify a new Label.");
            continue;
          } else labelList.add(strLabel);
        }

        if (strLabel == null || strLabel.trim().length() <= 0 || strValue.equals(INFOSTR)) continue;

        // for user template tab, don't need to parse the value
        if (!(this instanceof DisplayTemplate)) strValue = getValue(strUser, strValue);
        strLabel = strLabel.trim();
        if (strValue != null) strValue = strValue.trim();

        // sbValues.append("\"");
        sbValues.append(strLabel);
        // sbValues.append("\"  ");

        sbValues.append(File.pathSeparator);
        sbValues.append(strValue);
        sbValues.append("\n");
      }

      if (Util.isPart11Sys()) writeAuditTrail(strPath, strUser, sbValues);

      // write the data to the file.
      BufferedWriter writer = WFileUtil.openWriteFile(strPath);
      WFileUtil.writeAndClose(writer, sbValues);

      // if it's a template file, then make it writable for everyone.
      if (bNewFile) {
        String strCmd = "chmod 755 ";
        if (this instanceof DisplayTemplate) strCmd = "chmod 777 ";
        if (Util.iswindows()) strPath = UtilB.windowsPathToUnix(strPath);
        String[] cmd = {WGlobal.SHTOOLCMD, WGlobal.SHTOOLOPTION, strCmd + strPath};
        WUtil.runScriptInThread(cmd);
      }
    }
Esempio n. 24
0
  public void fill() {
    int i;
    boolean bSameFile = true;
    File fd = null;
    VToolPanel toolPanel = null;

    String toolPanelFile = FileUtil.openPath("INTERFACE/TabbedToolPanel.xml");
    if (toolPanelFile != null) fd = new File(toolPanelFile);
    if (fd != null && fd.exists()) {
      bSameFile = false;
      if (buildFile != null && buildFile.equals(toolPanelFile)) {
        if (fd.lastModified() == dateOfbuildFile) // same file
        bSameFile = true;
      }
    }
    if (bSameFile) {
      for (i = 0; i < objList.size(); i++) {
        JComponent obj = (JComponent) objList.get(i);
        if (obj != null) {
          if (obj instanceof VToolPanel) toolPanel = (VToolPanel) obj;
          else {
            if (obj instanceof StatusListenerIF) ExpPanel.addStatusListener((StatusListenerIF) obj);
            else if (obj instanceof ExpListenerIF) ExpPanel.addExpListener((ExpListenerIF) obj);
          }
        }
      }
      if (toolPanel != null) toolPanel.fill();
      return;
    }
    for (i = 0; i < objList.size(); i++) {
      for (i = 0; i < objList.size(); i++) {
        JComponent obj = (JComponent) objList.get(i);
        if (obj != null) {
          if (obj instanceof VToolPanel) toolPanel = (VToolPanel) obj;
        }
      }
    }
    if (toolPanel != null) toolPanel.clearAll();

    buildFile = toolPanelFile;
    if (fd != null) dateOfbuildFile = fd.lastModified();

    clearPanel();
    try {
      SAXParserFactory spf = SAXParserFactory.newInstance();
      spf.setValidating(false); // set to true if we get DOCTYPE
      spf.setNamespaceAware(false); // set to true with referencing
      SAXParser parser = spf.newSAXParser();
      if (toolPanelFile == null) {
        /* get VToolPanel only */
        String key = "Locator";
        PushpinIF pObj;
        Constructor c = (Constructor) getTool(key);
        Object[] vargs = new Object[1];
        vargs[0] = sshare;
        if (c != null) {
          JComponent comp = (JComponent) c.newInstance(vargs);
          if (comp instanceof VToolPanel) {
            toolList.add(comp);
          }
          tabbedToolPanel.add(comp);
          objList.add(comp);
          if (!(comp instanceof PushpinIF)) {
            pObj = new PushpinObj(comp, pinPanel);
            // pObj.setTitle("Tool Panel");
            pObj.showPushPin(false);
            pObj.showTitle(false);
            // pObj.alwaysShowTab(true);
          } else pObj = (PushpinIF) comp;
          pObj.setContainer(pinPanel);
          pObj.setSuperContainer(pinPanel);
          addTabComp(pObj);
          panes.put(key, pObj);
          // panes.put(key,comp);
          keys.add(key);
          vpInfo.add("all");
          for (i = 0; i < nviews; i++) tp_paneInfo[i].put(key, "yes");
        }
      } else {
        parser.parse(new File(toolPanelFile), new MySaxHandler());
      }

    } catch (ParserConfigurationException pce) {
      System.out.println("The underlying parser does not support the " + "requested feature(s).");
    } catch (FactoryConfigurationError fce) {
      System.out.println("Error occurred obtaining SAX Parser Factory.");
    } catch (Exception e) {
      e.printStackTrace();
    }

    for (i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).fill();
  }
Esempio n. 25
0
  public void fillPopupMenu() {
    JMenuItem item;
    TextImageIcon textIcon;
    StatementHistory history;
    int rowCount = 0;
    int numRows = 0;
    Insets margin = new Insets(0, 0, 0, 0);

    // Get the font defined in the displayOptions panel for menus
    Font ft = DisplayOptions.getFont("Menu1");
    // We need a fairly small font, so make it 2 smaller.
    int size = ft.getSize();
    // If larger than 12, subtract 2
    if (size > 12) size -= 2;
    Font font = DisplayOptions.getFont(ft.getName(), ft.getStyle(), size);

    // This flag is used so that we only fill the menu when needed
    if (menuAlreadyFilled) return;

    menuAlreadyFilled = true;

    history = sshare.statementHistory();

    ArrayList list = history.getNamedStatementList();
    Color bgColor = Util.getBgColor();
    // Only show the Saved Statements section if there are some.
    if (list != null && list.size() != 0) {
      item = popup.add("Saved Statements");
      rowCount++;
      //	    item.setForeground(Color.blue);
      //	    item.setBackground(bgColor);
      item.setFont(font);
      item.setMargin(margin);
      popup.add(item);

      for (int i = 0; i < list.size(); i++) {
        ArrayList nameNlabel = (ArrayList) list.get(i);
        // first item in nameNlabel is name and second is label
        item = popup.add("  " + (String) nameNlabel.get(1));
        rowCount++;
        item.setActionCommand("save:" + (String) nameNlabel.get(0));
        //		item.setBackground(bgColor);
        item.addActionListener(popActionListener);
        item.setFont(font);
        item.setMargin(margin);
      }
    }
    // the rest of menu (return object types, statement types, etc.)
    ShufflerService shufflerService = sshare.shufflerService();
    ArrayList objTypes = shufflerService.getAllMenuObjectTypes();

    for (int i = 0; i < objTypes.size(); i++) {
      String objType = (String) objTypes.get(i);

      // Do not display menu for DB_AVAIL_SUB_TYPES
      if (objType.equals(Shuf.DB_AVAIL_SUB_TYPES)) continue;

      // addSeparator looks bad using GridLayout because it creates rows
      // and columns which are all equal in size.  It cannot have a row
      // with a separator which is a different height than the other
      // rectangles it creates. So just use dashes.
      item = popup.add(separator);
      item.setFont(font);
      item.setMargin(margin);
      rowCount++;
      item = popup.add(shufflerService.getCategoryLabel(objType));
      rowCount++;
      //	    item.setForeground(Color.blue);
      item.setActionCommand("title:" + objType);
      //	    item.setBackground(bgColor);
      item.addActionListener(popActionListener);
      item.setFont(font);
      item.setMargin(margin);

      ArrayList menuStrings = shufflerService.getmenuStringsThisObj(objType);

      // If current rowCount plus the next section size is too big,
      // specify the numRows to the current value of rowCount -1.
      // That is, put this next section in a new column.
      // 47 is emperical number of rows to fit 90% full screen.
      if (numRows == 0 && rowCount - 1 + menuStrings.size() > 44) {

        numRows = rowCount - 2;
      }

      for (int j = 0; j < menuStrings.size(); j++) {
        String menuString = (String) menuStrings.get(j);
        item = popup.add("  " + menuString);
        rowCount++;
        item.setActionCommand("command:" + objType + "/" + menuString);
        //		item.setBackground(bgColor);
        item.addActionListener(popActionListener);
        item.setFont(font);
        item.setMargin(margin);
      }
      // The spotter menu changes dynamically when
      // the list of saved statements changes.
      history.addStatementListener(
          new StatementAdapter() {
            public void saveListChanged() {
              refreshSaveMenu();
            }
          });
    }

    if (numRows == 0) numRows = rowCount;

    GridLayoutCol lm = new GridLayoutCol(numRows, 0);
    popup.setLayout(lm);
  }