1 /* $RCSfile$ 2 * $Author: hansonr $ 3 * $Date: 2012-07-21 10:12:08 -0500 (Sat, 21 Jul 2012) $ 4 * $Revision: 17376 $ 5 * 6 * Copyright (C) 2004-2005 The Jmol Development Team 7 * 8 * Contact: jmol-developers@lists.sf.net, www.jmol.org 9 * 10 * This library is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Lesser General Public 12 * License as published by the Free Software Foundation; either 13 * version 2.1 of the License, or (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with this library; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23 */ 24 package org.jmol.consolejs; 25 26 import org.jmol.api.JmolAbstractButton; 27 import org.jmol.api.JmolScriptEditorInterface; 28 import org.jmol.console.GenericConsole; 29 import org.jmol.viewer.Viewer; 30 31 32 /** 33 * 34 * An interface to Jmol.Console. 35 * 36 * keyboard events are returned to 37 * 38 * GenericConsole.processKey(kcode, kid, isControlDown); 39 * 40 * button events are returned to 41 * 42 * GenericConsole.doAction(source); 43 * 44 * 12/24/2012 45 * 46 * @author Bob Hanson hansonr@stolaf.edu 47 * 48 */ 49 public class AppletConsole extends GenericConsole { 50 AppletConsole()51 public AppletConsole() { 52 } 53 54 JSConsole jsConsole; 55 56 @Override start(Viewer vwr)57 public void start(Viewer vwr) { 58 setViewer(vwr); 59 setLabels(); 60 displayConsole(); // will call layoutWindow 61 } 62 63 @Override layoutWindow(String enabledButtons)64 protected void layoutWindow(String enabledButtons) { 65 /** 66 * Implement the window now in HTML. 67 * Also set up this.input and this.output. 68 * Console can stay hidden at this point. 69 * 70 * @j2sNative 71 * 72 * this.jsConsole = new Jmol.Console.JSConsole(this); 73 */ 74 { 75 } 76 setTitle(); 77 } 78 79 @Override setTitle()80 protected void setTitle() { 81 if (jsConsole != null) 82 jsConsole.setTitle(getLabel("title")); 83 } 84 85 @Override setVisible(boolean visible)86 public void setVisible(boolean visible) { 87 jsConsole.setVisible(visible); 88 } 89 90 @Override setButton(String text)91 protected JmolAbstractButton setButton(String text) { 92 /** 93 * @j2sNative 94 * 95 * return new Jmol.Console.Button(text); 96 */ 97 { 98 return null; 99 } 100 } 101 102 @Override dispose()103 public void dispose() { 104 setVisible(false); 105 } 106 107 @Override isMenuItem(Object source)108 protected boolean isMenuItem(Object source) { 109 //ignore -- no console menu in JSmol (yet) 110 return false; 111 } 112 113 @Override getScriptEditor()114 public JmolScriptEditorInterface getScriptEditor() { 115 //ignore -- no Script Editor in JSmol 116 return null; 117 } 118 119 @Override nextFileName(String stub, int nTab)120 protected String nextFileName(String stub, int nTab) { 121 //ignore 122 return null; 123 } 124 125 @Override newJMenu(String key)126 public Object newJMenu(String key) { 127 return null; 128 } 129 130 @Override newJMenuItem(String key)131 public Object newJMenuItem(String key) { 132 return null; 133 } 134 135 136 } 137