public static JChemPaintPanel showInstance(IChemModel chemModel, String title, boolean debug) { JFrame f = new JFrame(title + " - JChemPaint"); chemModel.setID(title); f.addWindowListener(new JChemPaintPanel.AppCloser()); f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); JChemPaintPanel p = new JChemPaintPanel(chemModel, GUI_APPLICATION, debug, null, new ArrayList<String>()); f.setPreferredSize(new Dimension(800, 494)); //1.618 f.setJMenuBar(p.getJMenuBar()); f.add(p); f.pack(); Point point = GraphicsEnvironment.getLocalGraphicsEnvironment() .getCenterPoint(); int w2 = (f.getWidth() / 2); int h2 = (f.getHeight() / 2); f.setLocation(point.x - w2, point.y - h2); f.setVisible(true); frameList.add(f); return p; }
String att = atts.getQName(i); if (att.equals("id")) { currentChemModel.setID(atts.getValue(i));
String att = atts.getQName(i); if (att.equals("id")) { currentChemModel.setID(atts.getValue(i));
public void mousePressed(MouseEvent e) { Container applet = (Container)e.getSource(); while(!(applet instanceof JChemPaintEditorApplet || applet instanceof JChemPaintViewerApplet)){ applet=applet.getParent(); } if (e.getButton() == 1 && e.getClickCount() == 2 && applet instanceof JChemPaintViewerApplet) if (!getJexf().isShowing()) { final JChemPaintPanel p = new JChemPaintPanel(theJcpp.getChemModel(),JChemPaintEditorApplet.GUI_APPLET,debug,JChemPaintAbstractApplet.this, blacklist); p.setName("appletframe"); p.setShowInsertTextField(false); p.getChemModel().setID("JChemPaint Editor"); getJexf(); jexf.setTitle("JChemPaint Editor"); jexf.add(p); jexf.pack(); jexf.setVisible(true); jexf.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { JChemPaintAbstractApplet.this.setChemModel(p.getChemModel()); } }); } } });
jcpPanel.setIsAlreadyAFile(outFile); if(outFile!=null){ jcpPanel.getChemModel().setID(outFile.getName()); if(jcpPanel instanceof JChemPaintPanel) ((JChemPaintPanel)jcpPanel).setTitle(outFile.getName());
@Test public void testChemModeID() throws Exception { StringWriter writer = new StringWriter(); IChemModel chemModel = new ChemModel(); chemModel.setID("cm0"); CMLWriter cmlWriter = new CMLWriter(writer); cmlWriter.write(chemModel); cmlWriter.close(); String cmlContent = writer.toString(); logger.debug("****************************** testReactionCustomization()"); logger.debug(cmlContent); logger.debug("******************************"); Assert.assertTrue(cmlContent.indexOf("<list convention=\"cdk:model\" id=\"cm0") != -1); }