⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buildprogrammenu.java

📁 emboss的linux版本的源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                    currentApp = setForm(e,f,scrollProgForm,numProgs,p2,                             mysettings,cwd,allAcd,allDes,withSoap);                    f.setCursor(cdone);                  }                });              }              else if(e.getActionCommand().equals("EDIT"))                favorites.edit(allAcd);              else                currentApp = setForm(e,f,scrollProgForm,numProgs,p2,                             mysettings,cwd,allAcd,allDes,withSoap);              f.setCursor(cdone);            }          });        }// main menu        JMenuItem mi[] = new JMenuItem[numProgs];        mi = progs.getMenuItems();        int nm = progs.getNumberMenuItems();// create action listeners into menu to build Jemboss program forms        for(int i=0; i<nm;i++)        {          mi[i].addActionListener(new ActionListener()          {            public void actionPerformed(ActionEvent e)            {              f.setCursor(cbusy);              currentApp= setForm(e,f,scrollProgForm,numProgs,p2,                          mysettings,cwd,allAcd,allDes,withSoap);              f.setCursor(cdone);            }          });          if(withSoap)          {            JFrame splashf = splashing.getSplashFrame();            if(splashf.isVisible())              splashf.toFront();          }        }// program scroll list        final JList progList = new JList(allAcd);        JScrollPane scrollPane = new JScrollPane(progList);        Box alphaPane = new Box(BoxLayout.Y_AXIS);        Box alphaTextPane = new Box(BoxLayout.X_AXIS);        alphaPane.add(Box.createRigidArea(new Dimension(0,10)));        alphaTextPane.add(new JLabel("GoTo:"));        alphaTextPane.add(Box.createRigidArea(new Dimension(5,0)));        final JTextField alphaTextPaneEntry = new JTextField(12);        alphaTextPaneEntry.setMaximumSize(new Dimension(100,20));        //scroll program list on typing         alphaTextPaneEntry.getDocument().addDocumentListener(new DocumentListener()        {          public void insertUpdate(DocumentEvent e)          {            updateScroll();          }          public void removeUpdate(DocumentEvent e)           {            updateScroll();          }          public void changedUpdate(DocumentEvent e) {}          public void updateScroll()          {            for(int k=0;k<numProgs;k++)              if(allAcd[k].startsWith(alphaTextPaneEntry.getText()))              {                progList.ensureIndexIsVisible(k);                progList.setSelectionBackground(Color.cyan);                progList.setSelectedIndex(k);                break;              }          }        });        //load program form on carriage return        alphaTextPaneEntry.addActionListener(new ActionListener()        {          public void actionPerformed(ActionEvent e)          {            f.setCursor(cbusy);            int index = progList.getSelectedIndex();            p2.removeAll();            currentApp = index;            String acdText = getAcdText(allAcd[index],mysettings,                                                       withSoap);            BuildJembossForm bjf = new BuildJembossForm(allDes[index],                                  db,allAcd[index],envp,cwd,                                  acdText,withSoap,p2,mysettings,f);            scrollProgForm.setViewportView(p2);               JViewport vp = scrollProgForm.getViewport();            vp.setViewPosition(new Point(0,0));            f.setCursor(cdone);          }        });        alphaTextPane.add(alphaTextPaneEntry);        alphaPane.add(alphaTextPane);        alphaPane.add(scrollPane);        p1.add(alphaPane, BorderLayout.CENTER);        Dimension dp1 = p1.getMinimumSize();        dp1 = new Dimension((int)dp1.getWidth()-10,(int)dp1.getHeight());        p1.setPreferredSize(dp1);        p1.setMaximumSize(dp1);        p1.setMinimumSize(dp1);// search tool bar        final JRadioButton radioAND = new JRadioButton("AND");        JRadioButton radioOR  = new JRadioButton("OR");        Font fnt = new Font("SansSerif", Font.BOLD, 10);        radioAND.setFont(fnt);        radioOR.setFont(fnt);        radioAND.setSelected(true);                                                                                                    ButtonGroup group = new ButtonGroup();        group.add(radioAND);        group.add(radioOR);        JToolBar toolBar = new JToolBar(JToolBar.VERTICAL);        final JTextField search = new JTextField(12);        search.addActionListener(new ActionListener()        {          public void actionPerformed(ActionEvent e)          {            new KeywordSearch(search,woss,mysettings,withSoap,                              radioAND.isSelected());          }        });        Box bacross = Box.createHorizontalBox();        JLabel keyw = new JLabel("Keyword Search");        keyw.setFont(fnt);        bacross.add(keyw);        JButton go = new JButton("GO");        go.setFont(new Font("monospaced", Font.BOLD, 10));        go.setMargin(new Insets(0,0,0,0));        go.setForeground(new Color(0,51,102));        go.addActionListener(new ActionListener()        {          public void actionPerformed(ActionEvent e)          {            new KeywordSearch(search,woss,mysettings,withSoap,                              radioAND.isSelected());          }        });        bacross.add(Box.createHorizontalStrut(2));        bacross.add(go);        bacross.add(Box.createHorizontalGlue());        toolBar.add(bacross);        toolBar.add(search);        bacross = Box.createHorizontalBox();        bacross.add(radioAND);        bacross.add(radioOR);        bacross.add(Box.createHorizontalGlue());        toolBar.add(bacross);        p1.add(toolBar, BorderLayout.SOUTH);// put on the logo        ClassLoader cl = this.getClass().getClassLoader();        ImageIcon jlo = new ImageIcon(                  cl.getResource("images/Jemboss_logo_large.gif"));        JLabel jlablogo = new JLabel(jlo);         JPanel pFront = new JPanel();        pFront.setBackground(Color.white);        pFront.add(jlablogo);// ensure fill the screen here as pform is BorderLayout.WEST        int pwidth = (int)(f.getSize().getWidth()-p1.getSize().getWidth())-14;        Dimension d = new Dimension(pwidth,100);        pform.setPreferredSize(d);        pform.setMinimumSize(d);        jlablogo.setPreferredSize(jform);        p2.add(pFront);        progList.setSelectionBackground(Color.cyan);// create listener to build Jemboss program forms        MouseListener mouseListener = new MouseAdapter()        {          public void mouseClicked(MouseEvent e)          {//          System.gc();            f.setCursor(cbusy);            JList source = (JList)e.getSource();            source.setSelectionBackground(Color.cyan);            int index = source.getSelectedIndex();            p2.removeAll();            currentApp = index;            String acdText = getAcdText(allAcd[index],mysettings,                                                       withSoap);            BuildJembossForm bjf = new BuildJembossForm(allDes[index],                                  db,allAcd[index],envp,cwd,                                  acdText,withSoap,p2,mysettings,f);            scrollProgForm.setViewportView(p2);            JViewport vp = scrollProgForm.getViewport();            vp.setViewPosition(new Point(0,0));            f.setCursor(cdone);          }        };        progList.addMouseListener(mouseListener);        p1.setVisible(false);        p1.setVisible(true);      }    };    groupworker.start();  }  private int setForm(ActionEvent e, JFrame f, JScrollPane scrollProgForm,                      int numProgs, ScrollPanel p2, JembossParams mysettings,                       String cwd, String allAcd[], String allDes[],                      boolean withSoap)  {//  JMenuItem source = (JMenuItem)(e.getSource());                      String p = e.getActionCommand();    int ind = p.indexOf(" ");    if(ind > -1)      p = p.substring(0,ind).trim();                                                                                                         for(int k=0;k<numProgs;k++)    {      if(p.equalsIgnoreCase(allAcd[k]))      {        p2.removeAll();        currentApp = k;        String acdText = getAcdText(allAcd[k],mysettings,                                               withSoap);        BuildJembossForm bjf = new BuildJembossForm(allDes[k],                      db,allAcd[k],envp,cwd,acdText,                      withSoap,p2,mysettings,f);        scrollProgForm.setViewportView(p2);        JViewport vp = scrollProgForm.getViewport();        vp.setViewPosition(new Point(0,0));        break;      }    }    return currentApp;  }  /**  *  * List of available EMBOSS databases  * @return 	list of databases  *  */  protected static String[] getDatabaseList()  {    return db;  }  /**  *  * Contains all scoring matrix files  *  */  public static Vector getMatrices()  {    return matrices;  }  /**  *  * Contains all codon usage tables  *  */  public static Vector getCodonUsage()  {    return codons;  }  /**  *  * Get the contents of an ACD file in the form of a String  * @param applName		application name  * @param mysettings		jemboss properties  * @param withSoap		true if in client-server mode  * @return	 		String representation of the ACD  *  */  private String getAcdText(String applName, JembossParams mysettings,                             boolean withSoap)  {    String acdText = new String("");    String line;    if(!withSoap)    {      String acdDirToParse = mysettings.getAcdDirToParse();      String acdToParse = acdDirToParse.concat(applName).concat(".acd");      try      {        BufferedReader in = new BufferedReader(new FileReader(acdToParse));        StringBuffer buff = new StringBuffer();                while((line = in.readLine()) != null)          buff = buff.append(line + "\n");        in.close();        acdText = buff.toString();      }      catch (IOException e)      {        System.out.println("BuildProgramMenu: Cannot read acd file " + acdText);      }    }    else     {      if(acdStore.containsKey(applName+".acd"))      {        Object obj = acdStore.get(applName+".acd");        if(obj.getClass().getName().equals("java.lang.String"))          acdText = (String)obj;        else          acdText = new String((byte[])obj); //      System.out.println("Retrieved "+applName+" acd file from cache");      }      else      {        GetACD progacd = new GetACD(applName,mysettings);        acdText = progacd.getAcd();//      System.out.println("Retrieved "+applName+" acd file via soap");        acdStore.put(applName+".acd",acdText);      }    }    return acdText;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -