Package org.openstreetmap.josm.gui.io
Class SaveLayersDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- org.openstreetmap.josm.gui.io.SaveLayersDialog
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.event.TableModelListener
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
public class SaveLayersDialog extends javax.swing.JDialog implements javax.swing.event.TableModelListener
Dialog that pops up when the user closes a layer with modified data.It asks for confirmation that all modifications should be discarded and offer to save the layers to file or upload to server, depending on the type of layer.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
SaveLayersDialog.CancelAction
(package private) class
SaveLayersDialog.DiscardAndProceedAction
private static class
SaveLayersDialog.LayerListWarningMessagePanel
static class
SaveLayersDialog.Reason
The cause for requesting an action on unsaved modifications(package private) class
SaveLayersDialog.SaveAndProceedAction
protected class
SaveLayersDialog.SaveAndUploadTask
This is the asynchronous task which uploads modified layers to the server and saves them to files, if requested by the user.(package private) class
SaveLayersDialog.SaveSessionButtonAction
(package private) static class
SaveLayersDialog.UserAction
The action a user decided to take with respect to an operation(package private) class
SaveLayersDialog.WindowClosingAdapter
-
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description private SaveLayersDialog.UserAction
action
private SaveLayersDialog.CancelAction
cancelAction
private SaveLayersDialog.DiscardAndProceedAction
discardAndProceedAction
private SaveLayersModel
model
private UploadAndSaveProgressRenderer
pnlUploadLayers
private SaveLayersDialog.SaveAndProceedAction
saveAndProceedAction
private javax.swing.JButton
saveAndProceedActionButton
private SaveLayersDialog.SaveAndUploadTask
saveAndUploadTask
private SaveLayersDialog.SaveSessionButtonAction
saveSessionAction
-
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
-
-
Constructor Summary
Constructors Constructor Description SaveLayersDialog(java.awt.Component parent)
Constructs a newSaveLayersDialog
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
build()
builds the GUIprotected javax.swing.JPanel
buildButtonRow()
builds the button rowprotected void
cancelSafeAndUploadTask()
void
closeDialog()
Closes this dialog and frees all native screen resources.(package private) static boolean
confirmSaveLayerInfosOK(SaveLayersModel model)
SaveLayersModel
getModel()
SaveLayersDialog.UserAction
getUserAction()
protected void
launchSafeAndUploadTask()
void
prepareForSavingAndUpdatingLayers(SaveLayersDialog.Reason reason)
static boolean
saveUnsavedModifications(java.lang.Iterable<? extends Layer> selectedLayers, SaveLayersDialog.Reason reason)
Asks user to perform "save layer" operations (save on disk and/or upload data to server) before data layers deletion.protected void
setUserAction(SaveLayersDialog.UserAction action)
void
tableChanged(javax.swing.event.TableModelEvent e)
private static void
warn(java.lang.String msg, java.util.List<SaveLayerInfo> infos, java.lang.String title)
protected static void
warnLayersWithConflictsAndUploadRequest(java.util.List<SaveLayerInfo> infos)
protected static void
warnLayersWithIllegalFilesAndSaveRequest(java.util.List<SaveLayerInfo> infos)
protected static void
warnLayersWithoutFilesAndSaveRequest(java.util.List<SaveLayerInfo> infos)
-
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
model
private final SaveLayersModel model
-
action
private SaveLayersDialog.UserAction action
-
pnlUploadLayers
private final UploadAndSaveProgressRenderer pnlUploadLayers
-
saveAndProceedAction
private final SaveLayersDialog.SaveAndProceedAction saveAndProceedAction
-
saveSessionAction
private final SaveLayersDialog.SaveSessionButtonAction saveSessionAction
-
discardAndProceedAction
private final SaveLayersDialog.DiscardAndProceedAction discardAndProceedAction
-
cancelAction
private final SaveLayersDialog.CancelAction cancelAction
-
saveAndUploadTask
private transient SaveLayersDialog.SaveAndUploadTask saveAndUploadTask
-
saveAndProceedActionButton
private final javax.swing.JButton saveAndProceedActionButton
-
-
Constructor Detail
-
SaveLayersDialog
public SaveLayersDialog(java.awt.Component parent)
Constructs a newSaveLayersDialog
.- Parameters:
parent
- parent component
-
-
Method Detail
-
saveUnsavedModifications
public static boolean saveUnsavedModifications(java.lang.Iterable<? extends Layer> selectedLayers, SaveLayersDialog.Reason reason)
Asks user to perform "save layer" operations (save on disk and/or upload data to server) before data layers deletion.- Parameters:
selectedLayers
- The layers to check. Only instances ofAbstractModifiableLayer
are considered.reason
- the cause for requesting an action on unsaved modifications- Returns:
true
if there was nothing to save, or if the user wants to proceed to save operations.false
if the user cancels.- Since:
- 11093
-
build
protected void build()
builds the GUI
-
buildButtonRow
protected javax.swing.JPanel buildButtonRow()
builds the button row- Returns:
- the panel with the button row
-
prepareForSavingAndUpdatingLayers
public void prepareForSavingAndUpdatingLayers(SaveLayersDialog.Reason reason)
-
getUserAction
public SaveLayersDialog.UserAction getUserAction()
-
getModel
public SaveLayersModel getModel()
-
launchSafeAndUploadTask
protected void launchSafeAndUploadTask()
-
cancelSafeAndUploadTask
protected void cancelSafeAndUploadTask()
-
warn
private static void warn(java.lang.String msg, java.util.List<SaveLayerInfo> infos, java.lang.String title)
-
warnLayersWithConflictsAndUploadRequest
protected static void warnLayersWithConflictsAndUploadRequest(java.util.List<SaveLayerInfo> infos)
-
warnLayersWithoutFilesAndSaveRequest
protected static void warnLayersWithoutFilesAndSaveRequest(java.util.List<SaveLayerInfo> infos)
-
warnLayersWithIllegalFilesAndSaveRequest
protected static void warnLayersWithIllegalFilesAndSaveRequest(java.util.List<SaveLayerInfo> infos)
-
confirmSaveLayerInfosOK
static boolean confirmSaveLayerInfosOK(SaveLayersModel model)
-
setUserAction
protected void setUserAction(SaveLayersDialog.UserAction action)
-
closeDialog
public void closeDialog()
Closes this dialog and frees all native screen resources.
-
tableChanged
public void tableChanged(javax.swing.event.TableModelEvent e)
- Specified by:
tableChanged
in interfacejavax.swing.event.TableModelListener
-
-