Package org.openstreetmap.josm.gui.oauth
Class AdvancedOAuthPropertiesPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel
org.openstreetmap.josm.gui.oauth.AdvancedOAuthPropertiesPanel
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,Scrollable
Panel allowing the user to setup advanced OAuth parameters:
- Client ID
- Client secret
- Redirect URI
- Access token URL
- Authorize URL
- Access token, which can be pasted instead of authorizing JOSM
- Since:
- 2746
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classNested 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 Stringprivate final JCheckBoxprivate final JLabelprivate final OAuthVersionstatic final StringProperty fired whenever the parameters this panel would return change: the client id was edited, or "use default settings" was toggled.private final JosmTextFieldprivate final JosmTextFieldprivate final JosmTextFieldprivate final JosmTextFieldprivate final JosmTextFieldprivate final JosmTextFieldFields 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
ConstructorsConstructorDescriptionAdvancedOAuthPropertiesPanel(OAuthVersion oauthVersion) Constructs a newAdvancedOAuthPropertiesPanel. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidbuild()protected booleanprivate voidGet the access token as entered in the panel.Replies the OAuth parameters currently edited in this properties panel.Replies the OAuth parameters as currently displayed in this properties panel: the default ones are shown when "use default settings" is ticked, as far as they are known yet.Get the client id as entered in the panel, without falling back to the defaults.protected booleanvoidinitialize(String paramApiUrl) Initializes the panel from the values in the preferencespreferences.booleanDetermines if the panel is set to use the default parameters for the API URL rather than the values entered in its fields.private static JLabellabel(String text, JosmTextField field) Creates the label of a field, which has the tool tip of the field.voidRemembers the current values in the preferencespref: whether the server uses the default settings, and the settings entered if not.protected voidvoidsetAccessToken(String accessToken) Sets the access token to be displayed.voidsetAdvancedParameters(IOAuthParameters parameters) Sets the advanced parameters to be displayedvoidSets the URL of the OSM API for which this panel is currently displaying OAuth properties.protected voidsetChildComponentsVisible(boolean visible) Shows or hides the OAuth parameters: they are shown when the user enters them, that is when the default settings are not used.private voidExplains each field, for the fields and their labels.Methods inherited from class org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel
getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getVerticalScrollPaneMethods 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
-
PARAMETERS_CHANGED_PROP
Property fired whenever the parameters this panel would return change: the client id was edited, or "use default settings" was toggled. Listeners re-readgetAdvancedParameters().- Since:
- 19627
-
cbUseDefaults
-
tfClientId
-
tfClientSecret
-
tfRedirectUri
-
tfAccessTokenURL
-
tfAuthoriseURL
-
lblAccessToken
-
tfAccessToken
-
oauthVersion
-
ilUseDefault
-
apiUrl
-
-
Constructor Details
-
AdvancedOAuthPropertiesPanel
Constructs a newAdvancedOAuthPropertiesPanel.- Parameters:
oauthVersion- The OAuth version to make the panel for
-
-
Method Details
-
build
-
label
Creates the label of a field, which has the tool tip of the field.- Parameters:
text- the text of the labelfield- the field- Returns:
- the label
-
setToolTips
Explains each field, for the fields and their labels. -
fireParametersChanged
-
getAccessToken
Get the access token as entered in the panel.- Returns:
- the access token, without surrounding white space; empty if there is none
- Since:
- 19707
-
setAccessToken
Sets the access token to be displayed.- Parameters:
accessToken- the access token, ornullif there is none- Since:
- 19707
-
isUseDefaultSettings
Determines if the panel is set to use the default parameters for the API URL rather than the values entered in its fields.- Returns:
trueif "use default settings" is selected- Since:
- 19627
-
getEnteredClientId
Get the client id as entered in the panel, without falling back to the defaults.- Returns:
- the client id field's text, without surrounding white space
- Since:
- 19627
-
hasCustomSettings
-
confirmOverwriteCustomSettings
-
resetToDefaultSettings
-
setChildComponentsVisible
Shows or hides the OAuth parameters: they are shown when the user enters them, that is when the default settings are not used. The access token is not one of them, and is always shown.- Parameters:
visible-trueto show the parameters- Since:
- 19707
-
getAdvancedParameters
Replies the OAuth parameters currently edited in this properties panel.- Returns:
- the OAuth parameters
-
getDisplayedParameters
Replies the OAuth parameters as currently displayed in this properties panel: the default ones are shown when "use default settings" is ticked, as far as they are known yet. UnlikegetAdvancedParameters(), this never makes a network request, and some of the parameters may be empty. White space around the values, which is easily copied along with them, is left out: a client secret with a trailing space is refused by the server.- Returns:
- the OAuth parameters
- Since:
- 19707
-
setAdvancedParameters
Sets the advanced parameters to be displayed- Parameters:
parameters- the advanced parameters. Must not be null.- Throws:
IllegalArgumentException- if parameters is null.
-
initialize
Initializes the panel from the values in the preferencespreferences.- Parameters:
paramApiUrl- the API URL. Must not be null.- Throws:
IllegalArgumentException- if paramApiUrl is null
-
rememberPreferences
Remembers the current values in the preferencespref: whether the server uses the default settings, and the settings entered if not. Settings entered earlier are kept when the default settings are used, so that they are there again when they are needed again. -
setApiUrl
Sets the URL of the OSM API for which this panel is currently displaying OAuth properties.- Parameters:
apiUrl- the api URL- Since:
- 5422
-