Class 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:
  • Field Details

  • Constructor Details

    • AdvancedOAuthPropertiesPanel

      Constructs a new AdvancedOAuthPropertiesPanel.
      Parameters:
      oauthVersion - The OAuth version to make the panel for
  • Method Details

    • build

      protected final void build()
    • label

      private static JLabel label(String text, JosmTextField field)
      Creates the label of a field, which has the tool tip of the field.
      Parameters:
      text - the text of the label
      field - the field
      Returns:
      the label
    • setToolTips

      private void setToolTips()
      Explains each field, for the fields and their labels.
    • fireParametersChanged

      private void 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

      public void setAccessToken(String accessToken)
      Sets the access token to be displayed.
      Parameters:
      accessToken - the access token, or null if there is none
      Since:
      19707
    • isUseDefaultSettings

      public boolean 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:
      true if "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

      protected boolean hasCustomSettings()
    • confirmOverwriteCustomSettings

      protected boolean confirmOverwriteCustomSettings()
    • resetToDefaultSettings

      protected void resetToDefaultSettings()
    • setChildComponentsVisible

      protected void setChildComponentsVisible(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. The access token is not one of them, and is always shown.
      Parameters:
      visible - true to 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. Unlike getAdvancedParameters(), 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

      public void setAdvancedParameters(IOAuthParameters parameters)
      Sets the advanced parameters to be displayed
      Parameters:
      parameters - the advanced parameters. Must not be null.
      Throws:
      IllegalArgumentException - if parameters is null.
    • initialize

      public void initialize(String paramApiUrl)
      Initializes the panel from the values in the preferences preferences.
      Parameters:
      paramApiUrl - the API URL. Must not be null.
      Throws:
      IllegalArgumentException - if paramApiUrl is null
    • rememberPreferences

      public void rememberPreferences()
      Remembers the current values in the preferences pref: 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

      public void setApiUrl(String apiUrl)
      Sets the URL of the OSM API for which this panel is currently displaying OAuth properties.
      Parameters:
      apiUrl - the api URL
      Since:
      5422