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

📄 sectionpanel.java

📁 emboss的linux版本的源代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
          lab[nf].add(bxlab);          pan.add(textf[h]);          pan.add(lab[nf]);        }        else if(att.startsWith("seqset"))         {          inSeq[h] = new SetInFileCard(sectionPane,h,db,                              "Multiple Sequence Filename",                              appName,inSeqAttr,true,mysettings);          pan.add(inSeq[h]);        }        else if(att.startsWith("sequence") || att.startsWith("seqall"))        {          String tit = parseAcd.getInfoParamValue(nf);          if(tit.equals(""))            tit = "Sequence Filename";          inSeq[h] = new SetInFileCard(sectionPane,h,db,tit,                                appName,inSeqAttr,true,mysettings);          pan.add(inSeq[h]);        }        else if(att.startsWith("filelist"))        {          filelist[h] = new ListFilePanel(15,mysettings);          pan.add(filelist[h]);          pan.add(Box.createVerticalStrut(100));        }        else if(att.startsWith("range"))        {          pan.add(rangeField[h]);          pan.add(lab[nf]);        }        else if(att.startsWith("bool"))        {//        checkBox[h] = new JCheckBox();          if(parseAcd.isDefaultParamValueStr(nf))            if(parseAcd.getDefaultParamValueStr(nf).equalsIgnoreCase("Y") ||               parseAcd.getDefaultParamValueStr(nf).equalsIgnoreCase("Yes") )              checkBox[h].setSelected(true);          pan.add(checkBox[h]);          pan.add(lab[nf]);        }        else if(att.startsWith("report"))        {          // possible report formats          rf = new ReportFormat(parseAcd,nf);          pan.add(rf.getComboPopup());          pan.add(new LabelTextBox(" Report format ("+                             rf.getDefaultFormat()+")",                             ReportFormat.getToolTip()));          section.add(rf.getReportCheckBox());        }        else if(att.startsWith("align"))        {          af = new AlignFormat(parseAcd,nf);          pan.add(af.getComboPopup());          pan.add(new LabelTextBox(" Align format ("+                           af.getDefaultFormat()+")",                           af.getToolTip()));        }        else if(att.startsWith("list") || att.startsWith("select"))        {          String list[];          if(att.startsWith("list"))            list = parseAcd.getList(nf);          else            list = parseAcd.getSelect(nf);          double max = 1.;          if(parseAcd.isMaxParamValue(nf))            max = Double.parseDouble(parseAcd.getMaxParam(nf));          if(max > 1.0)          {            multiOption[h] = new JList(list);            multiOption[h].setSelectionMode               (ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);                Vector def = parseAcd.getListOrSelectDefault();            int selectedIndeces[] = new int[def.size()];            for(int i=0;i<def.size();i++)              selectedIndeces[i] = ((Integer)def.get(i)).intValue();            multiOption[h].setSelectedIndices(selectedIndeces);            JScrollPane scrollPane = new JScrollPane(multiOption[h]);            Dimension d = new Dimension(150,100);            scrollPane.setMinimumSize(d);            scrollPane.setMaximumSize(d);            scrollPane.setPreferredSize(d);            pan.add(scrollPane);          }          else          {            fieldOption[h] = new JembossComboPopup(list);            Vector def = parseAcd.getListOrSelectDefault();            for(int i=0;i<def.size();i++)              fieldOption[h].setSelectedIndex( ((Integer)def.get(i)).intValue() );            Dimension d = fieldOption[h].getPreferredSize();            d = new Dimension(150,(int)d.getHeight());                        fieldOption[h].setMaximumSize(d);            fieldOption[h].setPreferredSize(d);            pan.add(fieldOption[h]);          }          pan.add(lab[nf]);        }        pan.add(Box.createHorizontalGlue());        section.add(Box.createVerticalStrut(10));      }//using jni?      if(AdvancedOptions.prefjni.isSelected())        checkDependents(section,envp);      if((att.startsWith("seqset") || att.startsWith("seqall")||          att.startsWith("sequence")) && !isInp )      {        section.add(new Separator(new Dimension(350,10)));        section.add(Box.createVerticalStrut(10));      }      nf++;      if(nf<numofFields)      {        att = parseAcd.getParameterAttribute(nf,0).toLowerCase();        varName = parseAcd.getParamValueStr(nf, 0);      }    }    nf++;    if(numberOfParameters >0)  // ensure there are parameters     {                          // in this section      sectionPane.add(section);      sectionBox = new Box(BoxLayout.X_AXIS);      sectionResize(sectionPane);      sectionBox.add(Box.createRigidArea(new Dimension(2,0)));      sectionBox.add(sectionPane);      sectionBox.add(Box.createHorizontalGlue());    }      }  /** Get the report format */  protected ReportFormat getReportFormat() { return rf; }  /**  *  * Determine if report formats are used in the EMBOSS program  * @return	true if a report format is used  *  */  protected boolean isReportFormat()  {    if(rf==null)      return false;    return true;  }  /** Get the alignment format */  protected AlignFormat getAlignFormat() { return af; }    /**  *  * Determine if alignment formats are used in the EMBOSS program  * @return     true if a alignment format is used  *  */  protected boolean isAlignFormat()  {    if(af==null)      return false;    return true;  }  /** get the panel for this section */  protected JPanel getSectionPanel() { return sectionPane; }  /** get the box or this section    */  protected Box getSectionBox() { return sectionBox; }  /** @return     true if the input section  */  protected boolean isInputSection() { return isInp; }  /** @return     true if the output section */  protected boolean isOutputSection() { return isOut; }  /** @return     true if the required section */  protected boolean isRequiredSection() { return isReq; }  /** @return     true if the advanced section */  protected boolean isAdvancedSection() { return isAdv; }  /** @return     true if the additional section */  protected boolean isAdditionalSection() { return isAdd; }  /**   *  * Get the current field   * @return 	current field number  *  */  protected int getFieldNum() { return nf; }  /**  *  * Set the application title panel  * @param des	short description of the program  * @param p3	JPanel for the ACD form  *  */  private void setAppTitle(String des, JPanel p3)  {    appName = parseAcd.getParamValueStr(nf,0).toUpperCase();    Box bylabP = new Box(BoxLayout.Y_AXIS);    Box bxlabP = new Box(BoxLayout.X_AXIS);      JScrollPane mainScroller = (JScrollPane)(p3.getParent().getParent().getParent());    JPanel jTitle = new JPanel(new BorderLayout());    jTitle.setBackground(Color.white);    final ApplicationNamePanel namePanel = new ApplicationNamePanel(                                              appName,10,18,18);    bxlabP.add(namePanel);    bxlabP.add(Box.createHorizontalGlue());    bylabP.add(bxlabP);    JLabel labP = new JLabel(des);    labP.setFont(labfont);    bxlabP = new Box(BoxLayout.X_AXIS);    bxlabP.add(Box.createHorizontalStrut(10));    bxlabP.add(labP);    bxlabP.add(Box.createHorizontalGlue());    bylabP.add(bxlabP);    jTitle.add(bylabP, BorderLayout.WEST);    mainScroller.setColumnHeaderView(jTitle);  }  /**  *  * Get the min, max and default values for a field in  * the ACD as a string representation in the form   * (min: max: default:)  * @param min		minimum value for parameter   * @param max		maximum value for parameter  * @param def		default value for parameter  * @param nfield	field number in ACD  * @return		string of (min: max: default:) if specified  *  */  private String getMinMaxDefault(String min,String max,                                 String def, int nfield)  {    String l = new String("");    if(parseAcd.isMinParamValue(nfield) && min == null)      min = parseAcd.getMinParam(nfield);    if(parseAcd.isMaxParamValue(nfield) && max == null)      max = parseAcd.getMaxParam(nfield);    if(parseAcd.isDefaultParamValueStr(nfield) && def == null)      def = parseAcd.getDefaultParamValueStr(nfield);    if(min != null && !min.startsWith("$")                    && !min.startsWith("@"))     {      l = l.concat("(min:" + min);      if(parseAcd.isMaxParamValue(nfield)                   && !max.startsWith("$")                   && !max.startsWith("@"))        l = l.concat(" max:" + max);      if(parseAcd.isDefaultParamValueStr(nfield)                          && !def.startsWith("$")                          && !def.startsWith("@")                          && !def.equals(""))        l = l.concat(" default:" + def + ") ");      else        l = l.concat(") ");    }    else if(parseAcd.isMaxParamValue(nfield)                      && !max.startsWith("$")                     && !max.startsWith("@"))    {      l = l.concat("(max:" + max);      if(parseAcd.isDefaultParamValueStr(nfield)                         && !def.startsWith("$")                         && !def.startsWith("@")                          && !def.equals(""))        l = l.concat(" default:" + def + ") ");      else        l = l.concat(") ");    }    else if(parseAcd.isDefaultParamValueStr(nfield)                             && !def.startsWith("$")                            && !def.startsWith("@")                            && !def.equals(""))    {      l = l.concat("(default:" + def + ") ");    }    else    {      if(parseAcd.isMinParamValue(nfield) ||          parseAcd.isMaxParamValue(nfield) ||         parseAcd.isDefaultParamValueStr(nfield) )        l = "";      else        l = null;    }    return l;  }  /**  *  * Checks for dependent variables and adds in action listeners  * @param section	form container for parameters  *  */  private void checkDependents(Box section, final String[] envp)  {    final Cursor cbusy = new Cursor(Cursor.WAIT_CURSOR);    final Cursor cdone = new Cursor(Cursor.DEFAULT_CURSOR);    final String att = parseAcd.getParameterAttribute(nf,0).toLowerCase();    final String varName = parseAcd.getParamValueStr(nf,0);    final String valS = parseAcd.getParamValueStr(nf,0).toLowerCase();    final int nff = nf;    if(parseAcd.isDependents(valS,nf,numofFields))     {      final int h = parseAcd.getGuiHandleNumber(nf);      final int nod = parseAcd.getNumOfDependents();      final Dependent dep[] = parseAcd.getDependents();      if (att.startsWith("seqset") || att.startsWith("seqall")||          att.startsWith("sequence") )       {        Box left = new Box(BoxLayout.X_AXIS);        JButton upload = new JButton("LOAD SEQUENCE ATTRIBUTES");        upload.setToolTipText(                "After entering your sequence above, click here. This\n" +                "will display the input parameters for " + appName + "\n" +                "that are dependent on the sequence attributes.");        upload.setForeground(Color.red);        Dimension d = upload.getPreferredSize();        upload.setPreferredSize(new Dimension(maxSectionWidth,                                          (int)d.getHeight()));        left.add(upload);        left.add(Box.createHorizontalGlue());        section.add(left);        section.add(Box.createVerticalStrut(10));        final SetInFileCard sifc = inSeq[h];        upload.addActionListener(new ActionListener()        {          public void actionPerformed(ActionEvent e)          {            f.setCursor(cbusy);            String fc = null;            String fname;            if(sifc.isFileName() || sifc.isListFile())            {              if(sifc.isListFile())                fname = sifc.getSequence(1);              else                fname = sifc.getFileChosen();              fc = AjaxUtil.getFileOrDatabaseForAjax(fname,db,f,withSoap);            }            else                                     // Cut-n-Paste            {              fc = sifc.getCutNPasteText();              if(!withSoap)              {                String cwd = System.getProperty("user.dir");                String tmp = null;                try                {                  File tf;                  try                  {                    if(mysettings.isCygwin())                      tmp = mysettings.getCygwinRoot()+System.getProperty("file.separator")+"tmp";                    else                      tmp = System.getProperty("java.io.tmpdir");                    tf = File.createTempFile("attr", ".jembosstmp", new File(tmp));                  }                  catch(IOException ioe)                  {                    tf = File.createTempFile("attr", ".jembosstmp",                                                new File(cwd));                  }                  PrintWriter out = new PrintWriter(new FileWriter(tf));                  out.println(fc);                  out.close();                  fc = tf.getCanonicalPath();                }                catch (IOException ioe)                {                  JOptionPane.showMessageDialog(null,                       "Cannot write to\n"+                       tmp+"\n"+                       "or\n"+                       cwd,                       "Problem creating a temporary file!", JOptionPane.ERROR_MESSAGE);                }              }            }            if(!withSoap && fc!=null)    //Ajax without SOAP            {              boolean ok = true;              Ajax aj = null;              if(mysettings.isCygwin())                ok = cygwinSeqAttr(fc,envp,att);              else              {

⌨️ 快捷键说明

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