chemaxon.marvin.applet
Class AbstractMarvinApplet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by chemaxon.marvin.applet.AbstractMarvinApplet
All Implemented Interfaces:
chemaxon.marvin.applet.MAppletIface, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer
Direct Known Subclasses:
JMSketch, JMView

public abstract class AbstractMarvinApplet
extends javax.swing.JApplet
implements chemaxon.marvin.applet.MAppletIface, java.awt.event.MouseListener, java.beans.PropertyChangeListener

Abstract applet implementation, for common applet functionalities.

Since:
Marvin 5.3
Version:
Marvin 5.6.0 27/06/2011
Author:
Istvan Fajth
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int debug
           
protected  chemaxon.marvin.common.swing.MolPanel panel
           
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
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
AbstractMarvinApplet()
           
 
Method Summary
protected abstract  void createGUI()
           
 void destroy()
           
protected
<T> T
enqueueForPrivilegedProcessing(java.lang.String methodName, java.lang.Object object, T retval, java.lang.Object... params)
           
protected  java.lang.String evaluateChemicalTerms0(java.lang.String expr, chemaxon.struc.Molecule mol)
           
protected  javax.swing.JApplet getAppletInBrowser()
           
 java.lang.String getAppletInfo()
           
 java.net.URL getCodeBase()
           
protected abstract  chemaxon.marvin.common.swing.MolPanel getPanel()
           
 java.lang.String getParameter(java.lang.String name)
           
 void init()
          Initializes the applet.
 boolean isChemicalTermsExpressionSyntaxError()
          Returns true, if the last Chemical Terms expression evaluated by the evaluateChemicalTerms(String, int) applet method is a syntactically not correct expression.
 void mouseClicked(java.awt.event.MouseEvent ev)
          Does nothing.
 void mouseEntered(java.awt.event.MouseEvent ev)
          Does nothing.
 void mouseExited(java.awt.event.MouseEvent ev)
          Does nothing.
 void mousePressed(java.awt.event.MouseEvent ev)
          Does nothing.
 void mouseReleased(java.awt.event.MouseEvent ev)
          Does nothing.
 void propertyChange(java.beans.PropertyChangeEvent ev)
          Invoke propertyChange(prop) JavaScript method on applet's page.
protected  void setPanel(chemaxon.marvin.common.swing.MolPanel panel)
           
 void setParentApplet(javax.swing.JApplet launcher)
          Sets the parent applet object in which the JMView applet is embedded.
 void start()
          Starts the applet.
 void stop()
           
 int validateMoleculeStr(java.lang.String str)
          Evaluates the given string and determine if Marvin is able to import it as a Molecule or not.
 int validateMoleculeStr(java.lang.String str, java.lang.String format)
          Evaluates the given string and determine if Marvin is able to import it as a Molecule or not.
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.applet.Applet
getAppletContext, getAudioClip, getAudioClip, getDocumentBase, getImage, getImage, getLocale, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

panel

protected chemaxon.marvin.common.swing.MolPanel panel

debug

protected int debug
Constructor Detail

AbstractMarvinApplet

public AbstractMarvinApplet()
Method Detail

enqueueForPrivilegedProcessing

protected <T> T enqueueForPrivilegedProcessing(java.lang.String methodName,
                                               java.lang.Object object,
                                               T retval,
                                               java.lang.Object... params)

setParentApplet

public void setParentApplet(javax.swing.JApplet launcher)
Description copied from interface: chemaxon.marvin.applet.MAppletIface
Sets the parent applet object in which the JMView applet is embedded. The parent must be set if embedding the JMView applet into another applet, otherwise the parent has to be null. It defaults to null. If the applet is embeded into another applet, the followings have taken care of

Specified by:
setParentApplet in interface chemaxon.marvin.applet.MAppletIface

getAppletInBrowser

protected javax.swing.JApplet getAppletInBrowser()

getCodeBase

public java.net.URL getCodeBase()
Overrides:
getCodeBase in class java.applet.Applet

getParameter

public java.lang.String getParameter(java.lang.String name)
Overrides:
getParameter in class java.applet.Applet

getPanel

protected abstract chemaxon.marvin.common.swing.MolPanel getPanel()

setPanel

protected void setPanel(chemaxon.marvin.common.swing.MolPanel panel)

getAppletInfo

public java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent ev)
Invoke propertyChange(prop) JavaScript method on applet's page. Only for internal usage.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Since:
Marvin 5.0 08/29/2007

init

public void init()
Initializes the applet.

Overrides:
init in class java.applet.Applet

start

public void start()
Starts the applet.

Overrides:
start in class java.applet.Applet

stop

public void stop()
Overrides:
stop in class java.applet.Applet

destroy

public void destroy()
Overrides:
destroy in class java.applet.Applet

createGUI

protected abstract void createGUI()

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent ev)
Does nothing. @param ev the event object

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent ev)
Does nothing. @param ev the event object

Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent ev)
Does nothing. @param ev the event object

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent ev)
Does nothing. @param ev the event object

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent ev)
Does nothing. @param ev the event object

Specified by:
mouseReleased in interface java.awt.event.MouseListener

evaluateChemicalTerms0

protected java.lang.String evaluateChemicalTerms0(java.lang.String expr,
                                                  chemaxon.struc.Molecule mol)

isChemicalTermsExpressionSyntaxError

public boolean isChemicalTermsExpressionSyntaxError()
Returns true, if the last Chemical Terms expression evaluated by the evaluateChemicalTerms(String, int) applet method is a syntactically not correct expression. If there were not any Chemical Terms expression evaluated before, the method returns false.

Specified by:
isChemicalTermsExpressionSyntaxError in interface chemaxon.marvin.applet.MAppletIface
Returns:
true, if the last evaluated Chemical Terms expression is syntactically not correct
Since:
Marvin 5.1.2
See Also:
JMSketch.evaluateChemicalTerms(String), JMView.evaluateChemicalTerms(String, int)

validateMoleculeStr

public int validateMoleculeStr(java.lang.String str)
Evaluates the given string and determine if Marvin is able to import it as a Molecule or not. In debug mode, the method writes the stack trace of the import exception to the java console.

Specified by:
validateMoleculeStr in interface chemaxon.marvin.applet.MAppletIface
Parameters:
str - the molecule source
Returns:
  • 0 if the structure is valid.
  • 1 if the structure is not in recognizable format

validateMoleculeStr

public int validateMoleculeStr(java.lang.String str,
                               java.lang.String format)
Evaluates the given string and determine if Marvin is able to import it as a Molecule or not. In debug mode, the method writes the stack trace of the import exception to the java console.

Specified by:
validateMoleculeStr in interface chemaxon.marvin.applet.MAppletIface
Parameters:
str - the molecule source
format - the file format of the molecule source
Returns:
  • 0 if the structure is valid.
  • 1 if the structure is not in recognizable format