private boolean optionRNADisplay() {
   // les options d'affichages generales
   if (_type.equals("gaspin")) {
     _vp.getVARNAUI().UIToggleGaspinMode();
   } else if (_type.equals("backbone")) {
     _vp.getVARNAUI().UISetBackboneColor();
   } else if (_type.equals("bonds")) {
     Color c = JColorChooser.showDialog(_vp, "Choose new bonds color", _vp.getBackground());
     if (c != null) {
       _vp.setDefaultBPColor(c);
       _vp.repaint();
     }
   } else if (_type.equals("basecolorforBP")) {
     if (_source != null) {
       if (_source instanceof JCheckBoxMenuItem) {
         JCheckBoxMenuItem check = (JCheckBoxMenuItem) _source;
         _vp.setUseBaseColorsForBPs(check.getState());
         _vp.repaint();
       }
     }
   } else if (_type.equals("bpstyle")) {
     _vp.getVARNAUI().UISetBPStyle();
   } else if (_type.equals("specialbasecolored")) {
     _vp.getVARNAUI().UIToggleColorSpecialBases();
   } else if (_type.equals("showwarnings")) {
     _vp.getVARNAUI().UIToggleShowWarnings();
   } else if (_type.equals("dashbasecolored")) {
     _vp.getVARNAUI().UIToggleColorGapsBases();
   } else if (_type.equals("numPeriod")) {
     _vp.getVARNAUI().UISetNumPeriod();
   } else if (_type.equals("eachKind")) {
     if (_vp.getRNA().get_listeBases() != null) {
       _vp.getVARNAUI().UIBaseTypeColor();
     } else {
       _vp.emitWarning("No base");
     }
   } else if (_type.equals("eachCouple")) {
     if (_vp.getRNA().get_listeBases() != null && _vp.getRNA().get_listeBases().size() != 0) {
       _vp.getVARNAUI().UIBasePairTypeColor();
     } else {
       _vp.emitWarning("No base");
     }
   } else if (_type.equals("eachBase")) {
     if (_vp.getRNA().get_listeBases() != null && _vp.getRNA().get_listeBases().size() != 0) {
       _vp.getVARNAUI().UIBaseAllColor();
     } else {
       _vp.emitWarning("No base");
     }
   } else if (_type.equals("specialBasesColor")) {
     _vp.getVARNAUI().UIPickSpecialBasesColor();
   } else if (_type.equals("dashBasesColor")) {
     _vp.getVARNAUI().UIPickGapsBasesColor();
   } else return colorBases();
   return true;
 }
 private boolean optionView() {
   if (_type.equals("background")) {
     _vp.getVARNAUI().UISetBackground();
   } else if (_type.equals("shownc")) {
     _vp.getVARNAUI().UIToggleShowNCBP();
   } else if (_type.equals("shownp")) {
     _vp.getVARNAUI().UIToggleShowNonPlanar();
   } else if (_type.equals("spaceBetweenBases")) {
     _vp.getVARNAUI().UISetSpaceBetweenBases();
   } else if (_type.equals("bpheightincrement")) {
     _vp.getVARNAUI().UISetBPHeightIncrement();
   } else if (_type.equals("borderSize")) {
     _vp.getVARNAUI().UISetBorder();
   } else if (_type.startsWith("zoom")) {
     if (_type.equals("zoom")) {
       _vp.getVARNAUI().UICustomZoom();
     } else {
       String factor = _type.substring("zoom".length());
       double pc = Integer.parseInt(factor);
       pc /= 100.0;
       _vp.setZoom(new Double(pc));
       _vp.repaint();
     }
   } else if (_type.equals("rotation")) {
     _vp.getVARNAUI().UIGlobalRotation();
   } else return false;
   return true;
 }
Beispiel #3
0
 public void actionPerformed(ActionEvent e) {
   _msbp.setEdge5(getEdge5());
   _msbp.setEdge3(getEdge3());
   _msbp.setStericity(getStericity());
   _vp.repaint();
 }
 private boolean colorBases() {
   // System.out.println(_type);
   ArrayList<Integer> listBase = new ArrayList<Integer>();
   String phrase = "Choose new " + _type;
   if (_color.equals("InnerColor")) {
     phrase += " inner color";
     Color c = JColorChooser.showDialog(_vp, phrase, VARNAConfig.BASE_INNER_COLOR_DEFAULT);
     if (c != null) {
       listBase = listSwitchType(_type);
       for (int i = 0; i < listBase.size(); i++) {
         _vp.getRNA().get_listeBases().get(listBase.get(i)).getStyleBase().setBaseInnerColor(c);
       }
       _vp.repaint();
     }
   } else if (_color.equals("OutlineColor")) {
     phrase += " outline color";
     Color c = JColorChooser.showDialog(_vp, phrase, VARNAConfig.BASE_OUTLINE_COLOR_DEFAULT);
     if (c != null) {
       listBase = listSwitchType(_type);
       for (int i = 0; i < listBase.size(); i++) {
         _vp.getRNA().get_listeBases().get(listBase.get(i)).getStyleBase().setBaseOutlineColor(c);
       }
       _vp.repaint();
     }
   } else if (_color.equals("NameColor")) {
     phrase += " name color";
     Color c = JColorChooser.showDialog(_vp, phrase, VARNAConfig.BASE_NAME_COLOR_DEFAULT);
     if (c != null) {
       listBase = listSwitchType(_type);
       for (int i = 0; i < listBase.size(); i++) {
         _vp.getRNA().get_listeBases().get(listBase.get(i)).getStyleBase().setBaseNameColor(c);
       }
       _vp.repaint();
     }
   } else if (_color.equals("NumberColor")) {
     phrase += " number color";
     Color c = JColorChooser.showDialog(_vp, phrase, VARNAConfig.BASE_NUMBER_COLOR_DEFAULT);
     if (c != null) {
       listBase = listSwitchType(_type);
       for (int i = 0; i < listBase.size(); i++) {
         _vp.getRNA().get_listeBases().get(listBase.get(i)).getStyleBase().setBaseNumberColor(c);
       }
       _vp.repaint();
     }
   } else if (_color.equals("BPColor")) {
     phrase += " base-pair color";
     Color c = JColorChooser.showDialog(_vp, phrase, VARNAConfig.BASE_NUMBER_COLOR_DEFAULT);
     if (c != null) {
       listBase = listSwitchType(_type);
       for (int i = 0; i < listBase.size(); i++) {
         for (ModeleBP msbp : _vp.getRNA().getBPsAt(listBase.get(i))) {
           if (msbp != null) {
             msbp.getStyle().setCustomColor(c);
           }
         }
       }
       _vp.repaint();
     }
   } else if (_color.equals("BPColor")) {
     phrase += " base-pair color";
     Color c = JColorChooser.showDialog(_vp, phrase, VARNAConfig.BASE_NUMBER_COLOR_DEFAULT);
     if (c != null) {
       listBase = listSwitchType(_type);
       for (int i = 0; i < listBase.size(); i++) {
         ModeleBase mb = _vp.getRNA().get_listeBases().get(listBase.get(i));
         if (mb.getElementStructure() != -1) {
           mb.getStyleBP().getStyle().setCustomColor(c);
         }
       }
       _vp.repaint();
     }
   } else if (_color.equals("BPThickness")) {
     listBase = listSwitchType(_type);
     // System.out.println(listBase.size());
     ArrayList<ModeleBP> styleBPs = new ArrayList<ModeleBP>();
     for (int i = 0; i < listBase.size(); i++) {
       ModeleBase mb = _vp.getRNA().get_listeBases().get(listBase.get(i));
       if (mb.getElementStructure() != -1) {
         styleBPs.add(mb.getStyleBP());
       }
     }
     VueBPThickness vbpt = new VueBPThickness(_vp, styleBPs);
     if (JOptionPane.showConfirmDialog(
             _vp, vbpt.getPanel(), "Set base pair(s) thickness", JOptionPane.OK_CANCEL_OPTION)
         != JOptionPane.OK_OPTION) {
       vbpt.restoreThicknesses();
       _vp.repaint();
     }
   } else return false;
   return true;
 }