From: <ha...@us...> - 2011-10-12 11:45:19
|
Revision: 16334 http://jmol.svn.sourceforge.net/jmol/?rev=16334&view=rev Author: hansonr Date: 2011-10-12 11:45:08 +0000 (Wed, 12 Oct 2011) Log Message: ----------- version=12.3.2_dev # code: JmolPromptInterface replaced with apiPlatform call Modified Paths: -------------- trunk/Jmol/src/org/jmol/api/ApiPlatform.java trunk/Jmol/src/org/jmol/awt/Display.java trunk/Jmol/src/org/jmol/awt/Platform.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Viewer.java Removed Paths: ------------- trunk/Jmol/src/org/jmol/api/JmolPromptInterface.java trunk/Jmol/src/org/jmol/console/JmolPrompt.java Modified: trunk/Jmol/src/org/jmol/api/ApiPlatform.java =================================================================== --- trunk/Jmol/src/org/jmol/api/ApiPlatform.java 2011-10-12 11:43:32 UTC (rev 16333) +++ trunk/Jmol/src/org/jmol/api/ApiPlatform.java 2011-10-12 11:45:08 UTC (rev 16334) @@ -12,6 +12,8 @@ boolean hasFocus(Object display); + String prompt(String label, String data, String[] list, boolean asButtons); + void repaint(Object display); void requestFocusInWindow(Object display); Deleted: trunk/Jmol/src/org/jmol/api/JmolPromptInterface.java =================================================================== --- trunk/Jmol/src/org/jmol/api/JmolPromptInterface.java 2011-10-12 11:43:32 UTC (rev 16333) +++ trunk/Jmol/src/org/jmol/api/JmolPromptInterface.java 2011-10-12 11:45:08 UTC (rev 16334) @@ -1,8 +0,0 @@ -package org.jmol.api; - -public interface JmolPromptInterface { - - public abstract String prompt(String label, String data, String[] list, - boolean asButtons); - -} Modified: trunk/Jmol/src/org/jmol/awt/Display.java =================================================================== --- trunk/Jmol/src/org/jmol/awt/Display.java 2011-10-12 11:43:32 UTC (rev 16333) +++ trunk/Jmol/src/org/jmol/awt/Display.java 2011-10-12 11:45:08 UTC (rev 16334) @@ -8,7 +8,10 @@ import java.awt.Toolkit; import java.awt.image.MemoryImageSource; +import javax.swing.JOptionPane; + import org.jmol.api.JmolViewer; +import org.jmol.util.TextFormat; import org.jmol.viewer.JmolConstants; /** @@ -77,5 +80,24 @@ d.setCursor(Cursor.getPredefinedCursor(c)); } + public static String prompt(String label, String data, String[] list, + boolean asButtons) { + try { + if (!asButtons) + return JOptionPane.showInputDialog(label, data); + if (data != null) + list = TextFormat.split(data, "|"); + int i = JOptionPane.showOptionDialog(null, label, "Jmol prompt", + JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, + list, list[0]); + // ESCAPE will close the panel with no option selected. + return (data == null ? "" + i : i == JOptionPane.CLOSED_OPTION ? "null" + : list[i]); + } catch (Throwable e) { + return "null"; + } + } + + } Modified: trunk/Jmol/src/org/jmol/awt/Platform.java =================================================================== --- trunk/Jmol/src/org/jmol/awt/Platform.java 2011-10-12 11:43:32 UTC (rev 16333) +++ trunk/Jmol/src/org/jmol/awt/Platform.java 2011-10-12 11:45:08 UTC (rev 16334) @@ -19,6 +19,11 @@ return Display.hasFocus(display); } + public String prompt(String label, String data, String[] list, + boolean asButtons) { + return Display.prompt(label, data, list, asButtons); + } + public void requestFocusInWindow(Object display) { Display.requestFocusInWindow(display); } Deleted: trunk/Jmol/src/org/jmol/console/JmolPrompt.java =================================================================== --- trunk/Jmol/src/org/jmol/console/JmolPrompt.java 2011-10-12 11:43:32 UTC (rev 16333) +++ trunk/Jmol/src/org/jmol/console/JmolPrompt.java 2011-10-12 11:45:08 UTC (rev 16334) @@ -1,60 +0,0 @@ -/* $RCSfile$ - * $Author: hansonr $ - * $Date: 2009-06-25 02:42:30 -0500 (Thu, 25 Jun 2009) $ - * $Revision: 11113 $ - * - * Copyright (C) 2004-2005 The Jmol Development Team - * - * Contact: jmo...@li..., www.jmol.org - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ -package org.jmol.console; - -import javax.swing.JOptionPane; - -import org.jmol.api.JmolPromptInterface; -import org.jmol.util.TextFormat; - - -public class JmolPrompt implements JmolPromptInterface { - - /** - * note: THIS CLASS SHOULD ONLY BE INVOKED USING - * (JmolPromptInterface) Interface.getOptionInterface("awt.console.JmolPrompt") - */ - public JmolPrompt() { - // required for reflection - } - - public String prompt(String label, String data, String[] list, - boolean asButtons) { - try { - if (!asButtons) - return JOptionPane.showInputDialog(label, data); - if (data != null) - list = TextFormat.split(data, "|"); - int i = JOptionPane.showOptionDialog(null, label, "Jmol prompt", - JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, - list, list[0]); - // ESCAPE will close the panel with no option selected. - return (data == null ? "" + i : i == JOptionPane.CLOSED_OPTION ? "null" - : list[i]); - } catch (Throwable e) { - return "null"; - } - } - -} Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2011-10-12 11:43:32 UTC (rev 16333) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2011-10-12 11:45:08 UTC (rev 16334) @@ -3,6 +3,8 @@ version=12.3.2_dev +# code: JmolPromptInterface replaced with apiPlatform call + # ============================================================================= #version=12.3.1 Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2011-10-12 11:43:32 UTC (rev 16333) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2011-10-12 11:45:08 UTC (rev 16334) @@ -54,7 +54,6 @@ import org.jmol.api.JmolCallbackListener; import org.jmol.api.JmolImageCreatorInterface; import org.jmol.api.JmolModelKitInterface; -import org.jmol.api.JmolPromptInterface; import org.jmol.api.JmolRendererInterface; import org.jmol.api.JmolScriptEditorInterface; import org.jmol.api.JmolSelectionListener; @@ -9847,9 +9846,7 @@ public String prompt(String label, String data, String[] list, boolean asButtons) { - JmolPromptInterface jpi = (JmolPromptInterface) Interface - .getOptionInterface("console.JmolPrompt"); - return (jpi == null ? "null" : jpi.prompt(label, data, list, asButtons)); + return apiPlatform.prompt(label, data, list, asButtons); } String getMenuName(int i) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |