FreeHEP API
Version v1.1

org.freehep.graphicsio.exportchooser
Class ExportDialog

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JFileChooser
                          |
                          +--org.freehep.graphicsio.exportchooser.ExportDialog
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class ExportDialog
extends JFileChooser

A dialog for exporting components in a variety of graphics formats. This version of the export dialog extends JFileChooser and is not completely portable. For an alternative implementation see SimpleExportDialog.

Version:
$Id: ExportDialog.java,v 1.3 2002/08/21 16:52:05 duns Exp $
Author:
Charles Loomis
See Also:
SimpleExportDialog, Serialized Form

Field Summary
protected  String[] exportClasses
           
protected  FileOptionsAccessory optionsAccessory
          The file options accessory used to display the options for a given file type.
 
Fields inherited from class javax.swing.JFileChooser
ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY, accessibleContext, ACCESSORY_CHANGED_PROPERTY, APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY, APPROVE_BUTTON_TEXT_CHANGED_PROPERTY, APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY, APPROVE_OPTION, APPROVE_SELECTION, CANCEL_OPTION, CANCEL_SELECTION, CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY, CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY, CUSTOM_DIALOG, DIALOG_TITLE_CHANGED_PROPERTY, DIALOG_TYPE_CHANGED_PROPERTY, DIRECTORIES_ONLY, DIRECTORY_CHANGED_PROPERTY, ERROR_OPTION, FILE_FILTER_CHANGED_PROPERTY, FILE_HIDING_CHANGED_PROPERTY, FILE_SELECTION_MODE_CHANGED_PROPERTY, FILE_SYSTEM_VIEW_CHANGED_PROPERTY, FILE_VIEW_CHANGED_PROPERTY, FILES_AND_DIRECTORIES, FILES_ONLY, MULTI_SELECTION_ENABLED_CHANGED_PROPERTY, OPEN_DIALOG, SAVE_DIALOG, SELECTED_FILE_CHANGED_PROPERTY, SELECTED_FILES_CHANGED_PROPERTY
 
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
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
ExportDialog()
           
ExportDialog(String creator)
          Creates a new ExportDialog with all known export filetypes.
ExportDialog(String creator, boolean addAllExportFileTypes)
          Creates a new ExportDialog with "Export..." as the title and as the "approve" button.
 
Method Summary
 void addAllExportFileTypes()
          Adds all known export filetypes alphabetically to dialog.
 void addExportFileType(ExportFileType newFileType)
          Add a ExportFileType to this dialog.
 void approveSelection()
          BUG FIX (Bug ID#4284488).
 void cancelSelection()
          BUG FIX (Bug ID#4284488).
 Dimension getPreferredSize()
          BUG FIX.
 void setCurrentDirectory(File dir)
          A bug (not clear) in JDK 1.1 with swing1.1.1 throws a NullPointerException at the first propertychange with a null value.
 boolean showDialog(Component parent)
          Returns true if a file was chosen and no problems occured.
 int showDialog(Component parent, String approveButtonText)
          BUG FIX (Bug ID#4284488).
 void showExportDialog(Component parent, Component saveTarget)
          Show this dialog and save component as the given file type.
 void showExportDialog(Component parent, Component[] saveTargets)
          Show this dialog and save component as the given file type.
 
Methods inherited from class javax.swing.JFileChooser
accept, addActionListener, addChoosableFileFilter, changeToParentDirectory, createDialog, ensureFileIsVisible, fireActionPerformed, getAcceptAllFileFilter, getAccessibleContext, getAccessory, getActionListeners, getApproveButtonMnemonic, getApproveButtonText, getApproveButtonToolTipText, getChoosableFileFilters, getControlButtonsAreShown, getCurrentDirectory, getDescription, getDialogTitle, getDialogType, getDragEnabled, getFileFilter, getFileSelectionMode, getFileSystemView, getFileView, getIcon, getName, getSelectedFile, getSelectedFiles, getTypeDescription, getUI, getUIClassID, isAcceptAllFileFilterUsed, isDirectorySelectionEnabled, isFileHidingEnabled, isFileSelectionEnabled, isMultiSelectionEnabled, isTraversable, paramString, removeActionListener, removeChoosableFileFilter, rescanCurrentDirectory, resetChoosableFileFilters, setAcceptAllFileFilterUsed, setAccessory, setApproveButtonMnemonic, setApproveButtonMnemonic, setApproveButtonText, setApproveButtonToolTipText, setControlButtonsAreShown, setDialogTitle, setDialogType, setDragEnabled, setFileFilter, setFileHidingEnabled, setFileSelectionMode, setFileSystemView, setFileView, setMultiSelectionEnabled, setSelectedFile, setSelectedFiles, setup, showOpenDialog, showSaveDialog, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, 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

exportClasses

protected String[] exportClasses

optionsAccessory

protected FileOptionsAccessory optionsAccessory
The file options accessory used to display the options for a given file type.

Constructor Detail

ExportDialog

public ExportDialog()

ExportDialog

public ExportDialog(String creator)
Creates a new ExportDialog with all known export filetypes.

Parameters:
creator - The "creator" to be written into the header of the file (may be null)

ExportDialog

public ExportDialog(String creator,
                    boolean addAllExportFileTypes)
Creates a new ExportDialog with "Export..." as the title and as the "approve" button.

Parameters:
creator - The "creator" to be written into the header of the file (may be null)
addAllExportFileTypes - if true adds all known export filetypes to dialog.
Method Detail

addAllExportFileTypes

public void addAllExportFileTypes()
Adds all known export filetypes alphabetically to dialog.


addExportFileType

public void addExportFileType(ExportFileType newFileType)
Add a ExportFileType to this dialog.


showExportDialog

public void showExportDialog(Component parent,
                             Component saveTarget)
Show this dialog and save component as the given file type.


showExportDialog

public void showExportDialog(Component parent,
                             Component[] saveTargets)
Show this dialog and save component as the given file type.


showDialog

public boolean showDialog(Component parent)
Returns true if a file was chosen and no problems occured. Returns false if aborted by user or due to an error.


getPreferredSize

public Dimension getPreferredSize()
BUG FIX. The default size of the file chooser is too small and cuts off the buttons and file type chooser. This enlarges the preferred size of this panel. While this fixes the current problem, this is not the optimal solution. The value 400 comes from MetalFileChooserUI.LIST_MIN_WIDTH The value 100 comes from MetalFileChooserUI.LIST_MIN_HEIGHT which is look and feel dependent!

Overrides:
getPreferredSize in class JComponent

setCurrentDirectory

public void setCurrentDirectory(File dir)
A bug (not clear) in JDK 1.1 with swing1.1.1 throws a NullPointerException at the first propertychange with a null value. We catch the null value here and set the home dir

Overrides:
setCurrentDirectory in class JFileChooser

showDialog

public int showDialog(Component parent,
                      String approveButtonText)
BUG FIX (Bug ID#4284488). Override this method to get correct return value.

Overrides:
showDialog in class JFileChooser

approveSelection

public void approveSelection()
BUG FIX (Bug ID#4284488). Override this method to get correct return value.

Overrides:
approveSelection in class JFileChooser

cancelSelection

public void cancelSelection()
BUG FIX (Bug ID#4284488). Override this method to get correct return value.

Overrides:
cancelSelection in class JFileChooser

FreeHEP API
Version v1.1

Copyright © 2000-2002 FreeHEP, All Rights Reserved.