org.openscience.jmol.app.jmolpanel
Class JmolPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.openscience.jmol.app.jmolpanel.JmolPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SplashInterface
Direct Known Subclasses:
Jmol

public class JmolPanel
extends JPanel
implements SplashInterface

See Also:
Serialized Form

Nested Class Summary
(package private)  class JmolPanel.AboutAction
           
private static class JmolPanel.ActionChangedListener
           
protected  class JmolPanel.AppCloser
          To shutdown when run as an application.
(package private)  class JmolPanel.AtomSetChooserAction
           
(package private)  class JmolPanel.CloseAction
           
(package private)  class JmolPanel.ConsoleAction
           
(package private)  class JmolPanel.CopyImageAction
          An Action to copy the current image into the clipboard.
(package private)  class JmolPanel.CopyScriptAction
           
(package private)  class JmolPanel.ExecuteScriptAction
           
(package private)  class JmolPanel.ExitAction
          Really lame implementation of an exit command
(package private)  class JmolPanel.ExportAction
           
(package private)  class JmolPanel.GaussianAction
           
(package private)  class JmolPanel.NewAction
           
(package private)  class JmolPanel.NewwinAction
           
(package private)  class JmolPanel.OpenAction
           
(package private)  class JmolPanel.OpenUrlAction
           
(package private)  class JmolPanel.PasteClipboardAction
           
(package private)  class JmolPanel.PovrayAction
           
(package private)  class JmolPanel.PrintAction
           
(package private)  class JmolPanel.RecentFilesAction
           
(package private)  class JmolPanel.ResizeAction
           
(package private)  class JmolPanel.ScriptEditorAction
           
(package private)  class JmolPanel.ScriptWindowAction
           
(package private)  class JmolPanel.ToWebAction
           
(package private)  class JmolPanel.UguideAction
           
(package private)  class JmolPanel.ViewMeasurementTableAction
           
(package private)  class JmolPanel.WhatsNewAction
           
(package private)  class JmolPanel.WriteAction
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static String aboutAction
           
(package private)  String appletContext
           
 AtomSetChooser atomSetChooser
           
private static String atomsetchooserAction
           
(package private) static String chemFileProperty
           
private static String closeAction
           
private  Hashtable commands
           
private static String CONSOLE_WINDOW_NAME
           
private static String consoleAction
           
protected  JFrame consoleframe
           
private  JmolPanel.CopyImageAction copyImageAction
           
private static String copyImageActionProperty
           
private  JmolPanel.CopyScriptAction copyScriptAction
           
private static String copyScriptActionProperty
           
private  Action[] defaultActions
          Actions defined by the Jmol class
(package private)  DisplayPanel display
           
private static String EDITOR_WINDOW_NAME
           
private static String editorAction
           
private  JmolPanel.ExecuteScriptAction executeScriptAction
           
private static String exitAction
           
private  JmolPanel.ExportAction exportAction
           
private static String exportActionProperty
           
private static String FILE_OPEN_WINDOW_NAME
           
protected  JFrame frame
           
private static String gaussianAction
           
protected  GaussianDialog gaussianDialog
           
(package private)  GuiMap guimap
           
(package private) static HistoryFile historyFile
           
(package private) static String[] imageChoices
           
(package private) static String[] imageExtensions
           
(package private)  String imageType
           
(package private)  JmolApp jmolApp
           
private  JMenuBar menubar
           
private  Hashtable menuItems
           
(package private)  JmolAdapter modelAdapter
           
private static String newAction
           
private static String newwinAction
           
private static int numWindows
           
private static String openAction
           
private static String openurlAction
           
private  JmolPanel.PasteClipboardAction pasteClipboardAction
           
private static String pasteClipboardActionProperty
           
(package private)  PropertyChangeSupport pcs
           
private  JmolPanel.PovrayAction povrayAction
           
private static String povrayActionProperty
           
private  PreferencesDialog preferencesDialog
           
private  JmolPanel.PrintAction printAction
           
private static String printActionProperty
           
(package private)  int qualityJPG
           
(package private)  int qualityPNG
           
(package private)  RecentFilesDialog recentFiles
           
private static String recentFilesAction
           
private static String resizeAction
           
private static Dimension screenSize
           
private static String SCRIPT_WINDOW_NAME
           
protected  JFrame sizeFrame
           
protected  SplashInterface splash
          Button group for toggle buttons in the toolbar.
(package private)  int startupHeight
           
(package private)  int startupWidth
           
(package private)  StatusBar status
           
protected  JToolBar toolbar
           
private  JmolPanel.ToWebAction toWebAction
           
private static String toWebActionProperty
           
private static String uguideAction
           
 JmolViewer viewer
          The data model.
private  JmolPanel.ViewMeasurementTableAction viewMeasurementTableAction
           
private static String WEB_MAKER_WINDOW_NAME
           
(package private)  WebExport webExport
           
private static String whatsnewAction
           
private  JmolPanel.WriteAction writeAction
           
private static String writeActionProperty
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JmolPanel(JmolApp jmolApp, Splash splash, JFrame frame, JmolPanel parent, int startupWidth, int startupHeight, String commandOptions, Point loc)
           
 
Method Summary
protected  void addHelpMenuBar(JMenuBar menuBar)
           
protected  void addMacrosMenuBar(JMenuBar menuBar)
           
protected  void addNormalMenuBar(JMenuBar menuBar)
           
(package private)  String createImageStatus(String fileName, String type, Object text_or_bytes, int quality)
          Starting with Jmol 11.8.RC5, this is just informational if type == null and null is returned, then it means "Jmol, you handle it"
protected  JMenu createMenu(String key)
          Create a menu for the app.
protected  JMenuBar createMenubar()
          Create the menubar for the app.
protected  JMenuItem createMenuItem(String cmd)
          This is the hook through which all menu items are created.
protected  Component createTool(String key)
          Hook through which every toolbar item is created.
private  JToolBar createToolbar()
          Create the toolbar.
protected  AbstractButton createToolbarButton(String key)
          Create a button to go inside of the toolbar.
(package private)  void createWebExport()
           
private  void dispose(JFrame f)
           
(package private)  void doClose()
           
protected  Action getAction(String cmd)
          Fetch the action that was created for the given command.
 Action[] getActions()
           
protected  Frame getFrame()
           
static Jmol getJmol(JmolApp jmolApp, JFrame frame)
           
protected  JMenuItem getMenuItem(String cmd)
          Fetch the menu item that was created for the given command.
(package private)  String getOpenFileNameFromDialog(String fileName)
           
static File getUserDirectory()
          Returns a new File referenced by the property 'user.dir', or null if the property is not defined.
(package private)  void notifyFileOpen(String fullPathName, String title)
           
 void print()
          added print command, so that it can be used by RasmolScriptHandler
(package private)  void report(String str)
           
(package private)  void resizeInnerPanel()
           
private  void say(String message)
           
(package private)  void setButtonMode(String string)
           
protected  void setupNewFrame(JmolViewer viewer)
           
private static void setWindow(String name, JFrame frame, JmolPanel jmol)
           
 void showStatus(String message)
           
protected static void startJmol(JmolApp jmolApp)
           
protected  String[] tokenize(String input)
          Take the given string and chop it up into a series of strings on whitespace boundries.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

viewer

public JmolViewer viewer
The data model.


modelAdapter

JmolAdapter modelAdapter

jmolApp

JmolApp jmolApp

display

DisplayPanel display

status

StatusBar status

gaussianDialog

protected GaussianDialog gaussianDialog

preferencesDialog

private PreferencesDialog preferencesDialog

recentFiles

RecentFilesDialog recentFiles

atomSetChooser

public AtomSetChooser atomSetChooser

executeScriptAction

private JmolPanel.ExecuteScriptAction executeScriptAction

frame

protected JFrame frame

sizeFrame

protected JFrame sizeFrame

guimap

GuiMap guimap

numWindows

private static int numWindows

screenSize

private static Dimension screenSize

startupWidth

int startupWidth

startupHeight

int startupHeight

pcs

PropertyChangeSupport pcs

CONSOLE_WINDOW_NAME

private static final String CONSOLE_WINDOW_NAME
See Also:
Constant Field Values

EDITOR_WINDOW_NAME

private static final String EDITOR_WINDOW_NAME
See Also:
Constant Field Values

SCRIPT_WINDOW_NAME

private static final String SCRIPT_WINDOW_NAME
See Also:
Constant Field Values

FILE_OPEN_WINDOW_NAME

private static final String FILE_OPEN_WINDOW_NAME
See Also:
Constant Field Values

WEB_MAKER_WINDOW_NAME

private static final String WEB_MAKER_WINDOW_NAME
See Also:
Constant Field Values

splash

protected SplashInterface splash
Button group for toggle buttons in the toolbar.


consoleframe

protected JFrame consoleframe

appletContext

String appletContext

historyFile

static HistoryFile historyFile

commands

private Hashtable commands

menuItems

private Hashtable menuItems

menubar

private JMenuBar menubar

toolbar

protected JToolBar toolbar

newwinAction

private static final String newwinAction
See Also:
Constant Field Values

openAction

private static final String openAction
See Also:
Constant Field Values

openurlAction

private static final String openurlAction
See Also:
Constant Field Values

newAction

private static final String newAction
See Also:
Constant Field Values

exportActionProperty

private static final String exportActionProperty
See Also:
Constant Field Values

closeAction

private static final String closeAction
See Also:
Constant Field Values

exitAction

private static final String exitAction
See Also:
Constant Field Values

aboutAction

private static final String aboutAction
See Also:
Constant Field Values

whatsnewAction

private static final String whatsnewAction
See Also:
Constant Field Values

uguideAction

private static final String uguideAction
See Also:
Constant Field Values

printActionProperty

private static final String printActionProperty
See Also:
Constant Field Values

recentFilesAction

private static final String recentFilesAction
See Also:
Constant Field Values

povrayActionProperty

private static final String povrayActionProperty
See Also:
Constant Field Values

writeActionProperty

private static final String writeActionProperty
See Also:
Constant Field Values

editorAction

private static final String editorAction
See Also:
Constant Field Values

consoleAction

private static final String consoleAction
See Also:
Constant Field Values

toWebActionProperty

private static final String toWebActionProperty
See Also:
Constant Field Values

atomsetchooserAction

private static final String atomsetchooserAction
See Also:
Constant Field Values

copyImageActionProperty

private static final String copyImageActionProperty
See Also:
Constant Field Values

copyScriptActionProperty

private static final String copyScriptActionProperty
See Also:
Constant Field Values

pasteClipboardActionProperty

private static final String pasteClipboardActionProperty
See Also:
Constant Field Values

gaussianAction

private static final String gaussianAction
See Also:
Constant Field Values

resizeAction

private static final String resizeAction
See Also:
Constant Field Values

exportAction

private JmolPanel.ExportAction exportAction

povrayAction

private JmolPanel.PovrayAction povrayAction

toWebAction

private JmolPanel.ToWebAction toWebAction

writeAction

private JmolPanel.WriteAction writeAction

printAction

private JmolPanel.PrintAction printAction

copyImageAction

private JmolPanel.CopyImageAction copyImageAction

copyScriptAction

private JmolPanel.CopyScriptAction copyScriptAction

pasteClipboardAction

private JmolPanel.PasteClipboardAction pasteClipboardAction

viewMeasurementTableAction

private JmolPanel.ViewMeasurementTableAction viewMeasurementTableAction

qualityJPG

int qualityJPG

qualityPNG

int qualityPNG

imageType

String imageType

defaultActions

private Action[] defaultActions
Actions defined by the Jmol class


imageChoices

static final String[] imageChoices

imageExtensions

static final String[] imageExtensions

webExport

WebExport webExport

chemFileProperty

static final String chemFileProperty
See Also:
Constant Field Values
Constructor Detail

JmolPanel

public JmolPanel(JmolApp jmolApp,
                 Splash splash,
                 JFrame frame,
                 JmolPanel parent,
                 int startupWidth,
                 int startupHeight,
                 String commandOptions,
                 Point loc)
Method Detail

startJmol

protected static void startJmol(JmolApp jmolApp)

getJmol

public static Jmol getJmol(JmolApp jmolApp,
                           JFrame frame)

setWindow

private static void setWindow(String name,
                              JFrame frame,
                              JmolPanel jmol)

showStatus

public void showStatus(String message)
Specified by:
showStatus in interface SplashInterface

report

void report(String str)

say

private void say(String message)

getActions

public Action[] getActions()
Returns:
A list of Actions that is understood by the upper level application

doClose

void doClose()

dispose

private void dispose(JFrame f)

setupNewFrame

protected void setupNewFrame(JmolViewer viewer)

getFrame

protected Frame getFrame()
Returns:
The hosting frame, for the file-chooser dialog.

createMenuItem

protected JMenuItem createMenuItem(String cmd)
This is the hook through which all menu items are created. It registers the result with the menuitem hashtable so that it can be fetched with getMenuItem().

Parameters:
cmd -
Returns:
Menu item created
See Also:
getMenuItem(java.lang.String)

getMenuItem

protected JMenuItem getMenuItem(String cmd)
Fetch the menu item that was created for the given command.

Parameters:
cmd - Name of the action.
Returns:
item created for the given command or null if one wasn't created.

getAction

protected Action getAction(String cmd)
Fetch the action that was created for the given command.

Parameters:
cmd - Name of the action.
Returns:
The action

createToolbar

private JToolBar createToolbar()
Create the toolbar. By default this reads the resource file for the definition of the toolbars.

Returns:
The toolbar

createTool

protected Component createTool(String key)
Hook through which every toolbar item is created.

Parameters:
key -
Returns:
Toolbar item

createToolbarButton

protected AbstractButton createToolbarButton(String key)
Create a button to go inside of the toolbar. By default this will load an image resource. The image filename is relative to the classpath (including the '.' directory if its a part of the classpath), and may either be in a JAR file or a separate file.

Parameters:
key - The key in the resource file to serve as the basis of lookups.
Returns:
Button

tokenize

protected String[] tokenize(String input)
Take the given string and chop it up into a series of strings on whitespace boundries. This is useful for trying to get an array of strings out of the resource file.

Parameters:
input - String to chop
Returns:
Strings chopped on whitespace boundries

createMenubar

protected JMenuBar createMenubar()
Create the menubar for the app. By default this pulls the definition of the menu from the associated resource file.

Returns:
Menubar

addMacrosMenuBar

protected void addMacrosMenuBar(JMenuBar menuBar)

addNormalMenuBar

protected void addNormalMenuBar(JMenuBar menuBar)

addHelpMenuBar

protected void addHelpMenuBar(JMenuBar menuBar)

createMenu

protected JMenu createMenu(String key)
Create a menu for the app. By default this pulls the definition of the menu from the associated resource file.

Parameters:
key -
Returns:
Menu created

setButtonMode

void setButtonMode(String string)

print

public void print()
added print command, so that it can be used by RasmolScriptHandler


createImageStatus

String createImageStatus(String fileName,
                         String type,
                         Object text_or_bytes,
                         int quality)
Starting with Jmol 11.8.RC5, this is just informational if type == null and null is returned, then it means "Jmol, you handle it"

Parameters:
fileName -
type -
text_or_bytes -
quality -
Returns:
null (you do it) or a message starting with OK or an error message

createWebExport

void createWebExport()

getUserDirectory

public static File getUserDirectory()
Returns a new File referenced by the property 'user.dir', or null if the property is not defined.

Returns:
a File to the user directory

getOpenFileNameFromDialog

String getOpenFileNameFromDialog(String fileName)

notifyFileOpen

void notifyFileOpen(String fullPathName,
                    String title)

resizeInnerPanel

void resizeInnerPanel()