Package org.openstreetmap.josm.gui.io
Class BasicUploadSettingsPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.openstreetmap.josm.gui.io.BasicUploadSettingsPanel
- All Implemented Interfaces:
ActionListener,FocusListener,ItemListener,KeyListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,TableModelListener
public class BasicUploadSettingsPanel
extends JPanel
implements ActionListener, FocusListener, ItemListener, KeyListener, TableModelListener
BasicUploadSettingsPanel allows to enter the basic parameters required for uploading data.
- Since:
- 2599
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final UploadTextComponentValidator.UploadAreaValidatorprivate final JLabelprivate final JCheckBoxthe checkbox to request feedback from other usersstatic final StringPreference name for the history of commentsstatic final StringPreference name for last used upload commentstatic final StringPreference name for the max age search comments may haveprivate final HistoryComboBoxthe history combo box for the upload commentprivate final HistoryComboBoxprivate final JLabelprivate booleana lock to prevent loops in notificationsprivate final UploadDialogModelthe changeset comment modelprivate final JCheckBoxprivate final UploadParameterSummaryPanelthe panel with a summary of the upload parametersstatic final StringPreference name for the history of sourcesprivate final JLabelprivate final UploadTextComponentValidator.UploadCommentValidatorprivate final UploadTextComponentValidator.UploadSourceValidatorFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidUpdate the model when the selection changes in a combobox.protected voidbuild()protected JPanelprotected JPanelvoidvoidUpdate the model and combobox history when a combobox editor loses focus.private StringGet a key's value from the model.Returns the default list of sources.private UploadDialogReturns the UplodDialog that is our ancestor(package private) static long(package private) static longstatic StringgetLastChangesetTagFromHistory(String historyKey, List<String> def) Get the topmost item from the history if not expired.(package private) StringAdd the "source" tagReturns the panel that displays a summary of data the user is about to upload.protected List<UploadTextComponentValidator>Returns the list ofUploadTextComponentValidatordefined by this panel.voidInitializes editing of upload comment.voidInitializes editing of upload source.voidinitLifeCycle(Map<String, String> map) Initializes this life cycle of the panel.voidUpdates the table editor model upon changes in the "review" checkbox.voidvoidvoidSet the focus directly to the upload button if "Enter" key is pressed in any combobox.voidRemembers the user input in the preference settingsvoidSave all outstanding edits to the model.private void(package private) voidsetUploadedPrimitives(List<OsmPrimitive> primitives) voidUpdates the controls upon changes in the table editor model.private voidupdateHistory(JTextField text) Updates the combobox histories when a combobox editor loses focus.private voidupdateModel(JTextField text) Updates the table editor model with changes in the comboboxes.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
COMMENT_HISTORY_KEY
Preference name for the history of comments- See Also:
-
COMMENT_LAST_USED_KEY
Preference name for last used upload comment- See Also:
-
COMMENT_MAX_AGE_KEY
Preference name for the max age search comments may have- See Also:
-
SOURCE_HISTORY_KEY
Preference name for the history of sources- See Also:
-
hcbUploadComment
the history combo box for the upload comment -
hcbUploadSource
-
obtainSourceAutomatically
-
pnlUploadParameterSummary
the panel with a summary of the upload parameters -
cbRequestReview
the checkbox to request feedback from other users -
areaValidatorFeedback
-
areaValidator
-
model
the changeset comment model -
uploadCommentFeedback
-
uploadCommentValidator
-
hcbUploadSourceFeedback
-
uploadSourceValidator
-
locked
a lock to prevent loops in notifications
-
-
Constructor Details
-
BasicUploadSettingsPanel
Creates the panel- Parameters:
model- The tag editor model.- Since:
- 18173 (signature)
-
-
Method Details
-
build
-
buildUploadCommentPanel
-
buildUploadSourcePanel
-
initLifeCycle
Initializes this life cycle of the panel. Adds the comment and source tags from history, and/or obtains the source from the layer if the user said so.- Parameters:
map- Map where tags are added to.- Since:
- 18173
-
get
Get a key's value from the model.- Parameters:
key- The key- Returns:
- The value or ""
- Since:
- 18173
-
getLastChangesetTagFromHistory
Get the topmost item from the history if not expired.- Parameters:
historyKey- The preferences key.def- A default history.- Returns:
- The history item (may be null).
- Since:
- 18173 (signature)
-
getSourceFromLayer
Add the "source" tag- Returns:
- The source from the layer info.
-
getDefaultSources
Returns the default list of sources.- Returns:
- the default list of sources
-
getUploadTextValidators
Returns the list ofUploadTextComponentValidatordefined by this panel.- Returns:
- the list of
UploadTextComponentValidatordefined by this panel. - Since:
- 17238
-
rememberUserInput
Remembers the user input in the preference settings -
initEditingOfUploadComment
Initializes editing of upload comment. -
initEditingOfUploadSource
Initializes editing of upload source. -
setUploadedPrimitives
-
getUploadParameterSummaryPanel
Returns the panel that displays a summary of data the user is about to upload.- Returns:
- the upload parameter summary panel
-
getHistoryMaxAgeKey
-
getHistoryLastUsedKey
-
updateHistory
Updates the combobox histories when a combobox editor loses focus.- Parameters:
text- TheJTextFieldof the combobox editor.
-
updateModel
Updates the table editor model with changes in the comboboxes. The lock prevents loops in change notifications, eg. the combobox notifies the table model and the table model notifies the combobox, which throws IllegalStateException.- Parameters:
text- TheJTextFieldof the combobox editor.
-
saveEdits
Save all outstanding edits to the model.- Since:
- 18173
- See Also:
-
getDialog
Returns the UplodDialog that is our ancestor- Returns:
- the UploadDialog or null
-
actionPerformed
Update the model when the selection changes in a combobox.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
e- The action event.
-
focusGained
- Specified by:
focusGainedin interfaceFocusListener
-
focusLost
Update the model and combobox history when a combobox editor loses focus.- Specified by:
focusLostin interfaceFocusListener
-
itemStateChanged
Updates the table editor model upon changes in the "review" checkbox.- Specified by:
itemStateChangedin interfaceItemListener
-
tableChanged
Updates the controls upon changes in the table editor model.- Specified by:
tableChangedin interfaceTableModelListener
-
keyTyped
Set the focus directly to the upload button if "Enter" key is pressed in any combobox.- Specified by:
keyTypedin interfaceKeyListener
-
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
setFocusToUploadButton
-