org.openscience.chimetojmol
Class ChimePanel

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.chimetojmol.ChimePanel
All Implemented Interfaces:
ActionListener, ItemListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class ChimePanel
extends JPanel
implements ItemListener, ActionListener

See Also:
Serialized Form

Nested Class Summary
 
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  JButton browseButton
           
private  Checkbox checkFilenames
           
private  Checkbox checkSigned
           
private  Checkbox checkSubs
           
private  JTextField chimePath
           
private  JFileChooser chooser
           
private  boolean doFixFilenames
           
private  boolean doSubdirectories
           
private  boolean doUseSigned
           
private static Pattern embed1
           
private static Pattern embed2
           
private  JButton goButton
           
private  JTextArea logArea
           
private  JScrollPane logScrollPane
           
private  File myDir
           
private  int nDir
           
private  int nFiles
           
private  File oldDir
           
private  List<File> pages
           
private  String rootDir
           
 
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
ChimePanel()
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
private  void addJmolFiles(String rootDir)
           
private  void copyDirectory(String level, File sourceLocation, File targetLocation, boolean justChecking)
           
private  boolean copyFile(String level, File f1, File f2, boolean justChecking)
           
static boolean deleteDirectory(File directory)
           
private  void doBrowse()
           
private  void doGo()
           
private  String fixChime(String data, boolean isHtml)
           
private  String fixFileName(File f)
           
private  String fixFileNames(String data, boolean isHtml)
           
private  String fixFileNames(String data, String what, char term)
           
private  String getFileContents(File f)
           
(package private)  void getFileList()
           
(package private) static InputStream getResourceStream(String fileName)
           
 void itemStateChanged(ItemEvent e)
           
private  boolean justTransferFile(File f1, File f2, InputStream in)
           
private  void log(String string)
           
private  boolean processFile(String level, File f1, File f2, boolean processHtml, boolean processChime)
           
private  boolean putFileContents(File f, String html)
           
private  void showProgress()
           
private  void transferResource(File dir, String name, File dest, String nameOut)
           
 
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

chimePath

private JTextField chimePath

goButton

private JButton goButton

browseButton

private JButton browseButton

logArea

private JTextArea logArea

logScrollPane

private JScrollPane logScrollPane

chooser

private JFileChooser chooser

oldDir

private File oldDir

pages

private List<File> pages

nDir

private int nDir

nFiles

private int nFiles

checkSubs

private Checkbox checkSubs

checkFilenames

private Checkbox checkFilenames

checkSigned

private Checkbox checkSigned

doSubdirectories

private boolean doSubdirectories

doFixFilenames

private boolean doFixFilenames

doUseSigned

private boolean doUseSigned

myDir

private File myDir

rootDir

private String rootDir

embed1

private static Pattern embed1

embed2

private static Pattern embed2
Constructor Detail

ChimePanel

ChimePanel()
Method Detail

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

itemStateChanged

public void itemStateChanged(ItemEvent e)
Specified by:
itemStateChanged in interface ItemListener

log

private void log(String string)

getFileList

void getFileList()

doGo

private void doGo()

doBrowse

private void doBrowse()

copyDirectory

private void copyDirectory(String level,
                           File sourceLocation,
                           File targetLocation,
                           boolean justChecking)
                    throws IOException
Throws:
IOException

addJmolFiles

private void addJmolFiles(String rootDir)

transferResource

private void transferResource(File dir,
                              String name,
                              File dest,
                              String nameOut)

deleteDirectory

public static boolean deleteDirectory(File directory)

fixFileName

private String fixFileName(File f)

showProgress

private void showProgress()

copyFile

private boolean copyFile(String level,
                         File f1,
                         File f2,
                         boolean justChecking)

justTransferFile

private boolean justTransferFile(File f1,
                                 File f2,
                                 InputStream in)

processFile

private boolean processFile(String level,
                            File f1,
                            File f2,
                            boolean processHtml,
                            boolean processChime)

fixFileNames

private String fixFileNames(String data,
                            boolean isHtml)

fixFileNames

private String fixFileNames(String data,
                            String what,
                            char term)

fixChime

private String fixChime(String data,
                        boolean isHtml)
Parameters:
data -
isHtml -
Returns:
fixed Chime commands

getFileContents

private String getFileContents(File f)

putFileContents

private boolean putFileContents(File f,
                                String html)

getResourceStream

static InputStream getResourceStream(String fileName)