Dialog
Date: 2019-10-22

org.jmol.dialog

## Class Dialog

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JPanel
        - - org.jmol.dialog.Dialog

- All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, JmolDialogInterface

      public class Dialog
      extends javax.swing.JPanel
      implements JmolDialogInterface

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Dialog.ExportChoiceListener`
    `class` | `Dialog.QualityListener`
    `static class` | `Dialog.TypeFilter`

    - ### Nested classes/interfaces inherited from class javax.swing.JPanel

      `javax.swing.JPanel.AccessibleJPanel`

    - ### Nested classes/interfaces inherited from class javax.swing.JComponent

      `javax.swing.JComponent.AccessibleJComponent`

    - ### 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private javax.swing.JComboBox<java.lang.String>` | `cb`
    `(package private) java.lang.String` | `choice`
    `private static int` | `defaultChoice`
    `protected java.lang.String` | `dialogType`
    `(package private) java.lang.String` | `extension`
    `(package private) java.lang.String[]` | `extensions`
    `(package private) static boolean` | `haveTranslations`
    `protected java.lang.String[]` | `imageChoices`
    `(package private) static javax.swing.JFileChooser` | `imageChooser`
    `protected java.lang.String[]` | `imageExtensions`
    `protected java.lang.String` | `imageType`
    `(package private) java.io.File` | `initialFile`
    `protected java.lang.String` | `inputFileName`
    `private static boolean` | `isMac`
    `private static FileChooser` | `openChooser`
    `private FilePreview` | `openPreview`
    `protected java.lang.String` | `outputFileName`
    `(package private) javax.swing.JPanel` | `qPanelJPEG`
    `(package private) javax.swing.JPanel` | `qPanelPNG`
    `private javax.swing.JSlider` | `qSliderJPEG`
    `private javax.swing.JSlider` | `qSliderPNG`
    `protected int` | `qualityJ`
    `(package private) static int` | `qualityJPG`
    `protected int` | `qualityP`
    `(package private) static int` | `qualityPNG`
    `(package private) static javax.swing.JFileChooser` | `saveChooser`
    `protected Viewer` | `vwr`

    - ### Fields inherited from class javax.swing.JComponent

      `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

      `accessibleContext, 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

    Constructors
    Constructor and Description
    `Dialog()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) java.lang.String` | `closePreview()`
    `private void` | `createExportPanel(java.lang.String[] choices, java.lang.String[] extensions, java.lang.String type)`
    `private static boolean` | `doOverWrite(javax.swing.JFileChooser chooser, java.io.File file)`
    `java.lang.String` | `getFileNameFromDialog(Viewer v, java.lang.String dType, java.lang.String iFileName)`
    `java.lang.String` | `getImageFileNameFromDialog(Viewer vwr, java.lang.String fileName, java.lang.String type, java.lang.String[] imageChoices, java.lang.String[] imageExtensions, int qualityJPG0, int qualityPNG0)`
    `java.lang.String` | `getOpenFileNameFromDialog(java.util.Map<java.lang.String,java.lang.Object> vwrOptions, Viewer vwr, java.lang.String fileName, JmolAppAPI jmolApp, java.lang.String windowName, boolean allowAppend)`
    `int` | `getQuality(java.lang.String sType)`
    `java.lang.String` | `getSaveFileNameFromDialog(Viewer vwr, java.lang.String fileName, java.lang.String type)`
    `java.lang.String` | `getType()`
    `private static void` | `getXPlatformLook(javax.swing.JFileChooser fc)`
    `void` | `setImageInfo(int qualityJPG, int qualityPNG, java.lang.String imageType)`
    `void` | `setupUI(boolean forceNewTranslation)`
    `static void` | `setupUIManager()` Setup the UIManager (for i18n)
    `private java.io.File` | `showSaveDialog(java.awt.Component c, javax.swing.JFileChooser chooser, java.io.File file)`

    - ### 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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

    - #### extensions

          java.lang.String[] extensions

    - #### choice

          java.lang.String choice

    - #### extension

          java.lang.String extension

    - #### defaultChoice

          private static int defaultChoice

    - #### qualityJPG

          static int qualityJPG

    - #### qualityPNG

          static int qualityPNG

    - #### qSliderJPEG

          private javax.swing.JSlider qSliderJPEG

    - #### qSliderPNG

          private javax.swing.JSlider qSliderPNG

    - #### cb

          private javax.swing.JComboBox<java.lang.String> cb

    - #### qPanelJPEG

          javax.swing.JPanel qPanelJPEG

    - #### qPanelPNG

          javax.swing.JPanel qPanelPNG

    - #### imageChooser

          static javax.swing.JFileChooser imageChooser

    - #### saveChooser

          static javax.swing.JFileChooser saveChooser

    - #### openChooser

          private static FileChooser openChooser

    - #### openPreview

          private FilePreview openPreview

    - #### initialFile

          java.io.File initialFile

    - #### haveTranslations

          static boolean haveTranslations

    - #### isMac

          private static boolean isMac

    - #### imageChoices

          protected java.lang.String[] imageChoices

    - #### imageExtensions

          protected java.lang.String[] imageExtensions

    - #### outputFileName

          protected java.lang.String outputFileName

    - #### dialogType

          protected java.lang.String dialogType

    - #### inputFileName

          protected java.lang.String inputFileName

    - #### vwr

          protected Viewer vwr

    - #### qualityJ

          protected int qualityJ

    - #### qualityP

          protected int qualityP

    - #### imageType

          protected java.lang.String imageType

  - ### Constructor Detail

    - #### Dialog

          public Dialog()

  - ### Method Detail

    - #### getOpenFileNameFromDialog

          public java.lang.String getOpenFileNameFromDialog(java.util.Map<java.lang.String,java.lang.Object> vwrOptions,
                                                            Viewer vwr,
                                                            java.lang.String fileName,
                                                            JmolAppAPI jmolApp,
                                                            java.lang.String windowName,
                                                            boolean allowAppend)

      Specified by:
        `getOpenFileNameFromDialog` in interface `JmolDialogInterface`

    - #### closePreview

          java.lang.String closePreview()

    - #### getSaveFileNameFromDialog

          public java.lang.String getSaveFileNameFromDialog(Viewer vwr,
                                                            java.lang.String fileName,
                                                            java.lang.String type)

      Specified by:
        `getSaveFileNameFromDialog` in interface `JmolDialogInterface`

    - #### getImageFileNameFromDialog

          public java.lang.String getImageFileNameFromDialog(Viewer vwr,
                                                             java.lang.String fileName,
                                                             java.lang.String type,
                                                             java.lang.String[] imageChoices,
                                                             java.lang.String[] imageExtensions,
                                                             int qualityJPG0,
                                                             int qualityPNG0)

      Specified by:
        `getImageFileNameFromDialog` in interface `JmolDialogInterface`

    - #### createExportPanel

          private void createExportPanel(java.lang.String[] choices,
                                         java.lang.String[] extensions,
                                         java.lang.String type)

    - #### getType

          public java.lang.String getType()

      Specified by:
        `getType` in interface `JmolDialogInterface`
      Returns:
        The file type which contains the user's choice

    - #### getQuality

          public int getQuality(java.lang.String sType)

      Specified by:
        `getQuality` in interface `JmolDialogInterface`
      Parameters:
        `sType` - JPG or PNG
      Returns:
        The quality (on a scale from 0 to 100) of the JPEG. 0 to 9 for PNG image that is to be generated. Returns -1 if choice was not JPEG or PNG.

    - #### doOverWrite

          private static boolean doOverWrite(javax.swing.JFileChooser chooser,
                                             java.io.File file)

    - #### showSaveDialog

          private java.io.File showSaveDialog(java.awt.Component c,
                                              javax.swing.JFileChooser chooser,
                                              java.io.File file)

    - #### setupUI

          public void setupUI(boolean forceNewTranslation)

      Specified by:
        `setupUI` in interface `JmolDialogInterface`

    - #### setupUIManager

          public static void setupUIManager()

      Setup the UIManager (for i18n)

    - #### getXPlatformLook

          private static void getXPlatformLook(javax.swing.JFileChooser fc)

    - #### setImageInfo

          public void setImageInfo(int qualityJPG,
                                   int qualityPNG,
                                   java.lang.String imageType)

      Specified by:
        `setImageInfo` in interface `JmolDialogInterface`

    - #### getFileNameFromDialog

          public java.lang.String getFileNameFromDialog(Viewer v,
                                                        java.lang.String dType,
                                                        java.lang.String iFileName)

      Specified by:
        `getFileNameFromDialog` in interface `JmolDialogInterface`