org.ceryle.ui
Class FileExistsDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by org.ceryle.ui.FileExistsDialog
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class FileExistsDialog
extends JDialog

Extends JDialog providing a dialog box to be displayed when there is to be a document comparison, such as when a file exists on saving. The default dialog box provides seven buttons, each of which can be hidden:

The getSelected() method returns an int indicating which action was chosen.

Since:
JDK1.3
Version:
$Id: FileExistsDialog.java,v 3.9 2007-06-20 01:28:16 altheim Exp $
Author:
Murray Altheim
See Also:
Serialized Form

Nested Class Summary
 class FileExistsDialog.DialogDisposer
           
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int ACTION_AUTOSKIP
          Returned constant indicating 'Auto Skip.'
static int ACTION_CANCEL
          Returned constant indicating 'Cancel the operation.'
static int ACTION_OVERWRITE
          Returned constant indicating 'Overwrite.'
static int ACTION_OVERWRITE_ALL
          Returned constant indicating 'Overwrite All.'
static int ACTION_PROPOSE
          Returned constant indicating 'Propose Rename.'
static int ACTION_RENAME
          Returned constant indicating 'Rename.'
static int ACTION_SKIP
          Returned constant indicating 'Skip.'
protected  JButton btn_autoskip
           
protected  JButton btn_cancel
           
protected  JButton btn_overwrite
           
protected  JButton btn_overwrite_all
           
protected  JButton btn_propose
           
protected  JButton btn_rename
           
protected  JButton btn_skip
           
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FileExistsDialog()
          Constructor for a modal dialog box for selecting amongst a group of dialog buttons.
 
Method Summary
 JPanel createCenterPanel()
          Returns the center panel containing the comparison view.
 String formatSize(int size)
          Returns a file size string modified by either 'KB' or 'MB', as appropriate.
 int getSelected()
          Returns an int indicating which button was selected.
 void setButtonsVisible(boolean rename, boolean propose, boolean skip, boolean autoskip, boolean overwrite, boolean overwriteall)
          Sets the visibility of the first six buttons based on the supplied boolean values.
 void setNorthFile(File north)
          Sets the north panel metadata from the provided File to allow comparison.
 void setNorthMessage(String message)
          Sets the north panel message to the provided String.
 void setNorthXNode(String cid, String nid, XNode xnode)
          Sets the north panel metadata from the provided XNode to allow comparison.
 void setSouthDocument(MetadataPanel meta)
          Sets the south panel information from the supplied MetadataPanel to allow comparison of the current document.
 void setSouthFile(File south)
          Sets the south panel file information to allow comparison of the provided Files.
 void setSouthMessage(String message)
          Sets the south panel message to the provided String.
 void setSouthXNode(String cid, String nid, XNode xnode, String systemId)
          Sets the south panel metadata from the provided XNode to allow comparison.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, 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, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION_CANCEL

public static final int ACTION_CANCEL
Returned constant indicating 'Cancel the operation.'

See Also:
Constant Field Values

ACTION_OVERWRITE_ALL

public static final int ACTION_OVERWRITE_ALL
Returned constant indicating 'Overwrite All.'

See Also:
Constant Field Values

ACTION_OVERWRITE

public static final int ACTION_OVERWRITE
Returned constant indicating 'Overwrite.'

See Also:
Constant Field Values

ACTION_SKIP

public static final int ACTION_SKIP
Returned constant indicating 'Skip.'

See Also:
Constant Field Values

ACTION_AUTOSKIP

public static final int ACTION_AUTOSKIP
Returned constant indicating 'Auto Skip.'

See Also:
Constant Field Values

ACTION_PROPOSE

public static final int ACTION_PROPOSE
Returned constant indicating 'Propose Rename.'

See Also:
Constant Field Values

ACTION_RENAME

public static final int ACTION_RENAME
Returned constant indicating 'Rename.'

See Also:
Constant Field Values

btn_rename

protected JButton btn_rename

btn_propose

protected JButton btn_propose

btn_skip

protected JButton btn_skip

btn_autoskip

protected JButton btn_autoskip

btn_overwrite

protected JButton btn_overwrite

btn_overwrite_all

protected JButton btn_overwrite_all

btn_cancel

protected JButton btn_cancel
Constructor Detail

FileExistsDialog

public FileExistsDialog()
Constructor for a modal dialog box for selecting amongst a group of dialog buttons. If the checkbox label is non-null, a checkbox will be added along the bottom left of the dialog.

Method Detail

getSelected

public int getSelected()
Returns an int indicating which button was selected. Values include ACTION_RENAME, ACTION_PROPOSE, ACTION_SKIP, ACTION_AUTOSKIP, ACTION_OVERWRITE, ACTION_OVERWRITE_ALL, and ACTION_CANCEL (-1).


formatSize

public String formatSize(int size)
Returns a file size string modified by either 'KB' or 'MB', as appropriate.


setNorthMessage

public void setNorthMessage(String message)
Sets the north panel message to the provided String. This supports HTML markup. This should be set last, since some of the other methods write to the north label.


setNorthFile

public void setNorthFile(File north)
Sets the north panel metadata from the provided File to allow comparison.


setNorthXNode

public void setNorthXNode(String cid,
                          String nid,
                          XNode xnode)
Sets the north panel metadata from the provided XNode to allow comparison. The north XNode is used to display an existing XNode in a comparison.


setSouthMessage

public void setSouthMessage(String message)
Sets the south panel message to the provided String. This should be set last, since some of the other methods write to the south label.


setSouthFile

public void setSouthFile(File south)
Sets the south panel file information to allow comparison of the provided Files.


setSouthDocument

public void setSouthDocument(MetadataPanel meta)
Sets the south panel information from the supplied MetadataPanel to allow comparison of the current document.


setSouthXNode

public void setSouthXNode(String cid,
                          String nid,
                          XNode xnode,
                          String systemId)
Sets the south panel metadata from the provided XNode to allow comparison. The systemId parameter is optional; if null, a database URI will be created.

The south XNode is used to display an XNode being imported or otherwise proposed as a replacement.


setButtonsVisible

public void setButtonsVisible(boolean rename,
                              boolean propose,
                              boolean skip,
                              boolean autoskip,
                              boolean overwrite,
                              boolean overwriteall)
Sets the visibility of the first six buttons based on the supplied boolean values.


createCenterPanel

public JPanel createCenterPanel()
Returns the center panel containing the comparison view. This is a north-south divided panel containing icons and text describing the two files or resources to be compared.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.