Changeset 10183 in josm for trunk/src/org/openstreetmap/josm/gui/oauth
- Timestamp:
- 2016-05-11T05:02:01+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/oauth
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/org/openstreetmap/josm/gui/oauth/AccessTokenInfoPanel.java ¶
r8510 r10183 18 18 /** 19 19 * Displays the key and the secret of an OAuth Access Token. 20 * 20 * @since 2746 21 21 */ 22 22 public class AccessTokenInfoPanel extends JPanel { 23 23 24 private JosmTextField tfAccessTokenKey; 25 private JosmTextField tfAccessTokenSecret; 26 private JCheckBox cbSaveAccessTokenInPreferences; 24 private final JosmTextField tfAccessTokenKey = new JosmTextField(); 25 private final JosmTextField tfAccessTokenSecret = new JosmTextField(); 26 private final JCheckBox cbSaveAccessTokenInPreferences = new JCheckBox(tr("Save Access Token in preferences")); 27 28 /** 29 * Constructs a new {@code AccessTokenInfoPanel}. 30 */ 31 public AccessTokenInfoPanel() { 32 build(); 33 } 27 34 28 35 protected final void build() { … … 39 46 gc.gridx = 1; 40 47 gc.weightx = 1.0; 41 add(tfAccessTokenKey = new JosmTextField(), gc);48 add(tfAccessTokenKey, gc); 42 49 tfAccessTokenKey.setEditable(false); 43 50 … … 51 58 gc.gridx = 1; 52 59 gc.weightx = 1.0; 53 add(tfAccessTokenSecret = new JosmTextField(), gc);60 add(tfAccessTokenSecret, gc); 54 61 tfAccessTokenSecret.setEditable(false); 55 62 … … 58 65 gc.gridy = 2; 59 66 gc.gridwidth = 2; 60 add(cbSaveAccessTokenInPreferences = new JCheckBox(tr("Save Access Token in preferences")), gc);67 add(cbSaveAccessTokenInPreferences, gc); 61 68 cbSaveAccessTokenInPreferences.setToolTipText(tr( 62 69 "<html>Select to save the Access Token in the JOSM preferences.<br>" … … 73 80 gc.gridwidth = 2; 74 81 add(new JPanel(), gc); 75 }76 77 public AccessTokenInfoPanel() {78 build();79 82 } 80 83 -
TabularUnified trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java ¶
r9917 r10183 44 44 public class AdvancedOAuthPropertiesPanel extends VerticallyScrollablePanel { 45 45 46 private JCheckBox cbUseDefaults; 47 private JosmTextField tfConsumerKey; 48 private JosmTextField tfConsumerSecret; 49 private JosmTextField tfRequestTokenURL; 50 private JosmTextField tfAccessTokenURL; 51 private JosmTextField tfAuthoriseURL; 52 private JosmTextField tfOsmLoginURL; 53 private JosmTextField tfOsmLogoutURL; 46 private final JCheckBox cbUseDefaults = new JCheckBox(tr("Use default settings")); 47 private final JosmTextField tfConsumerKey = new JosmTextField(); 48 private final JosmTextField tfConsumerSecret = new JosmTextField(); 49 private final JosmTextField tfRequestTokenURL = new JosmTextField(); 50 private final JosmTextField tfAccessTokenURL = new JosmTextField(); 51 private final JosmTextField tfAuthoriseURL = new JosmTextField(); 52 private final JosmTextField tfOsmLoginURL = new JosmTextField(); 53 private final JosmTextField tfOsmLogoutURL = new JosmTextField(); 54 54 private transient UseDefaultItemListener ilUseDefault; 55 55 private String apiUrl; … … 65 65 gc.insets = new Insets(0, 0, 3, 3); 66 66 gc.gridwidth = 2; 67 cbUseDefaults = new JCheckBox(tr("Use default settings"));68 67 add(cbUseDefaults, gc); 69 68 … … 76 75 gc.gridx = 1; 77 76 gc.weightx = 1.0; 78 add(tfConsumerKey = new JosmTextField(), gc);77 add(tfConsumerKey, gc); 79 78 SelectAllOnFocusGainedDecorator.decorate(tfConsumerKey); 80 79 … … 87 86 gc.gridx = 1; 88 87 gc.weightx = 1.0; 89 add(tfConsumerSecret = new JosmTextField(), gc);88 add(tfConsumerSecret, gc); 90 89 SelectAllOnFocusGainedDecorator.decorate(tfConsumerSecret); 91 90 … … 98 97 gc.gridx = 1; 99 98 gc.weightx = 1.0; 100 add(tfRequestTokenURL = new JosmTextField(), gc);99 add(tfRequestTokenURL, gc); 101 100 SelectAllOnFocusGainedDecorator.decorate(tfRequestTokenURL); 102 101 … … 109 108 gc.gridx = 1; 110 109 gc.weightx = 1.0; 111 add(tfAccessTokenURL = new JosmTextField(), gc);110 add(tfAccessTokenURL, gc); 112 111 SelectAllOnFocusGainedDecorator.decorate(tfAccessTokenURL); 113 112 … … 121 120 gc.gridx = 1; 122 121 gc.weightx = 1.0; 123 add(tfAuthoriseURL = new JosmTextField(), gc);122 add(tfAuthoriseURL, gc); 124 123 SelectAllOnFocusGainedDecorator.decorate(tfAuthoriseURL); 125 124 … … 133 132 gc.gridx = 1; 134 133 gc.weightx = 1.0; 135 add(tfOsmLoginURL = new JosmTextField(), gc);134 add(tfOsmLoginURL, gc); 136 135 SelectAllOnFocusGainedDecorator.decorate(tfOsmLoginURL); 137 136 … … 145 144 gc.gridx = 1; 146 145 gc.weightx = 1.0; 147 add(tfOsmLogoutURL = new JosmTextField(), gc);146 add(tfOsmLogoutURL, gc); 148 147 SelectAllOnFocusGainedDecorator.decorate(tfOsmLogoutURL); 149 148 -
TabularUnified trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java ¶
r10173 r10183 60 60 public class FullyAutomaticAuthorizationUI extends AbstractAuthorizationUI { 61 61 62 private JosmTextField tfUserName; 63 private JosmPasswordField tfPassword; 62 private final JosmTextField tfUserName = new JosmTextField(); 63 private final JosmPasswordField tfPassword = new JosmPasswordField(); 64 64 private transient UserNameValidator valUserName; 65 65 private transient PasswordValidator valPassword; 66 private AccessTokenInfoPanel pnlAccessTokenInfo; 66 private final AccessTokenInfoPanel pnlAccessTokenInfo = new AccessTokenInfoPanel(); 67 67 private OsmPrivilegesPanel pnlOsmPrivileges; 68 68 private JPanel pnlPropertiesPanel; … … 120 120 gc.gridx = 1; 121 121 gc.weightx = 1.0; 122 pnl.add(tfUserName = new JosmTextField(), gc);122 pnl.add(tfUserName, gc); 123 123 SelectAllOnFocusGainedDecorator.decorate(tfUserName); 124 124 valUserName = new UserNameValidator(tfUserName); … … 135 135 gc.gridx = 1; 136 136 gc.weightx = 1.0; 137 pnl.add(tfPassword = new JosmPasswordField(), gc);137 pnl.add(tfPassword, gc); 138 138 SelectAllOnFocusGainedDecorator.decorate(tfPassword); 139 139 valPassword = new PasswordValidator(tfPassword); … … 232 232 gc.gridy = 1; 233 233 gc.insets = new Insets(5, 0, 0, 0); 234 pnl.add(pnlAccessTokenInfo = new AccessTokenInfoPanel(), gc);234 pnl.add(pnlAccessTokenInfo, gc); 235 235 236 236 // the actions -
TabularUnified trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticPropertiesPanel.java ¶
r10073 r10183 19 19 public class FullyAutomaticPropertiesPanel extends JPanel { 20 20 21 private JosmTextField tfUserName; 22 private JosmPasswordField tfPassword; 23 24 protected final JPanel buildUserNamePasswordPanel() { 25 JPanel pnl = new JPanel(new GridBagLayout()); 26 GridBagConstraints gc = new GridBagConstraints(); 27 28 gc.anchor = GridBagConstraints.NORTHWEST; 29 gc.fill = GridBagConstraints.HORIZONTAL; 30 gc.weightx = 0.0; 31 gc.insets = new Insets(0, 0, 3, 3); 32 pnl.add(new JLabel(tr("Username: ")), gc); 33 34 gc.gridx = 1; 35 gc.weightx = 1.0; 36 pnl.add(tfUserName = new JosmTextField(), gc); 37 SelectAllOnFocusGainedDecorator.decorate(tfUserName); 38 UserNameValidator valUserName = new UserNameValidator(tfUserName); 39 valUserName.validate(); 40 41 gc.anchor = GridBagConstraints.NORTHWEST; 42 gc.fill = GridBagConstraints.HORIZONTAL; 43 gc.gridy = 1; 44 gc.gridx = 0; 45 gc.weightx = 0.0; 46 pnl.add(new JLabel(tr("Password: ")), gc); 47 48 gc.gridx = 1; 49 gc.weightx = 1.0; 50 pnl.add(tfPassword = new JosmPasswordField(), gc); 51 SelectAllOnFocusGainedDecorator.decorate(tfPassword); 52 53 return pnl; 54 } 21 private final JosmTextField tfUserName = new JosmTextField(); 22 private final JosmPasswordField tfPassword = new JosmPasswordField(); 55 23 56 24 /** … … 72 40 add(new JPanel(), gc); 73 41 } 42 43 protected final JPanel buildUserNamePasswordPanel() { 44 JPanel pnl = new JPanel(new GridBagLayout()); 45 GridBagConstraints gc = new GridBagConstraints(); 46 47 gc.anchor = GridBagConstraints.NORTHWEST; 48 gc.fill = GridBagConstraints.HORIZONTAL; 49 gc.weightx = 0.0; 50 gc.insets = new Insets(0, 0, 3, 3); 51 pnl.add(new JLabel(tr("Username: ")), gc); 52 53 gc.gridx = 1; 54 gc.weightx = 1.0; 55 pnl.add(tfUserName, gc); 56 SelectAllOnFocusGainedDecorator.decorate(tfUserName); 57 UserNameValidator valUserName = new UserNameValidator(tfUserName); 58 valUserName.validate(); 59 60 gc.anchor = GridBagConstraints.NORTHWEST; 61 gc.fill = GridBagConstraints.HORIZONTAL; 62 gc.gridy = 1; 63 gc.gridx = 0; 64 gc.weightx = 0.0; 65 pnl.add(new JLabel(tr("Password: ")), gc); 66 67 gc.gridx = 1; 68 gc.weightx = 1.0; 69 pnl.add(tfPassword, gc); 70 SelectAllOnFocusGainedDecorator.decorate(tfPassword); 71 72 return pnl; 73 } 74 74 } -
TabularUnified trunk/src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java ¶
r10073 r10183 34 34 35 35 /** 36 * This is an UI which supports a JOSM user to get an OAuth Access Token in a fully 37 * manual process. 36 * This is an UI which supports a JOSM user to get an OAuth Access Token in a fully manual process. 38 37 * 39 38 * @since 2746 … … 41 40 public class ManualAuthorizationUI extends AbstractAuthorizationUI { 42 41 43 private JosmTextField tfAccessTokenKey; 42 private final JosmTextField tfAccessTokenKey = new JosmTextField(); 44 43 private transient AccessTokenKeyValidator valAccessTokenKey; 45 private JosmTextField tfAccessTokenSecret; 44 private final JosmTextField tfAccessTokenSecret = new JosmTextField(); 46 45 private transient AccessTokenSecretValidator valAccessTokenSecret; 47 private JCheckBox cbSaveToPreferences; 48 private HtmlPanel pnlMessage; 46 private final JCheckBox cbSaveToPreferences = new JCheckBox(tr("Save Access Token in preferences")); 47 private final HtmlPanel pnlMessage = new HtmlPanel(); 49 48 private final transient Executor executor; 49 50 /** 51 * Constructs a new {@code ManualAuthorizationUI} for the given API URL. 52 * @param apiUrl The OSM API URL 53 * @param executor the executor used for running the HTTP requests for the authorization 54 * @since 5422 55 */ 56 public ManualAuthorizationUI(String apiUrl, Executor executor) { 57 super(apiUrl); 58 this.executor = executor; 59 build(); 60 } 50 61 51 62 protected JPanel buildAccessTokenPanel() { … … 61 72 gc.gridwidth = 2; 62 73 gc.insets = new Insets(0, 0, 5, 0); 63 pnlMessage = new HtmlPanel();64 74 pnlMessage.setText("<html><body>" 65 75 + tr("Please enter an OAuth Access Token which is authorized to access the OSM server " … … 77 87 gc.gridx = 1; 78 88 gc.weightx = 1.0; 79 pnl.add(tfAccessTokenKey = new JosmTextField(), gc);89 pnl.add(tfAccessTokenKey, gc); 80 90 SelectAllOnFocusGainedDecorator.decorate(tfAccessTokenKey); 81 91 valAccessTokenKey = new AccessTokenKeyValidator(tfAccessTokenKey); … … 91 101 gc.gridx = 1; 92 102 gc.weightx = 1.0; 93 pnl.add(tfAccessTokenSecret = new JosmTextField(), gc);103 pnl.add(tfAccessTokenSecret, gc); 94 104 SelectAllOnFocusGainedDecorator.decorate(tfAccessTokenSecret); 95 105 valAccessTokenSecret = new AccessTokenSecretValidator(tfAccessTokenSecret); … … 102 112 gc.gridwidth = 2; 103 113 gc.weightx = 1.0; 104 pnl.add(cbSaveToPreferences = new JCheckBox(tr("Save Access Token in preferences")), gc);114 pnl.add(cbSaveToPreferences, gc); 105 115 cbSaveToPreferences.setSelected(OAuthAccessTokenHolder.getInstance().isSaveToPreferences()); 106 116 … … 161 171 } 162 172 163 /**164 * Constructs a new {@code ManualAuthorizationUI} for the given API URL.165 * @param apiUrl The OSM API URL166 * @param executor the executor used for running the HTTP requests for the authorization167 * @since 5422168 */169 public ManualAuthorizationUI(String apiUrl, Executor executor) {170 super(apiUrl);171 this.executor = executor;172 build();173 }174 175 173 @Override 176 174 public boolean isSaveAccessTokenToPreferences() { -
TabularUnified trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java ¶
r10173 r10183 64 64 private final String apiUrl; 65 65 66 private AuthorizationProcedureComboBox cbAuthorisationProcedure; 66 private final AuthorizationProcedureComboBox cbAuthorisationProcedure = new AuthorizationProcedureComboBox(); 67 67 private FullyAutomaticAuthorizationUI pnlFullyAutomaticAuthorisationUI; 68 68 private SemiAutomaticAuthorizationUI pnlSemiAutomaticAuthorisationUI; … … 150 150 gc.gridwidth = 1; 151 151 gc.weightx = 1.0; 152 pnl.add(cbAuthorisationProcedure = new AuthorizationProcedureComboBox(), gc);152 pnl.add(cbAuthorisationProcedure, gc); 153 153 cbAuthorisationProcedure.addItemListener(new AuthorisationProcedureChangeListener()); 154 154 lbl.setLabelFor(cbAuthorisationProcedure); -
TabularUnified trunk/src/org/openstreetmap/josm/gui/oauth/OsmPrivilegesPanel.java ¶
r9059 r10183 17 17 public class OsmPrivilegesPanel extends VerticallyScrollablePanel { 18 18 19 private JCheckBox cbWriteApi; 20 private JCheckBox cbWriteGpx; 21 private JCheckBox cbReadGpx; 22 private JCheckBox cbWritePrefs; 23 private JCheckBox cbReadPrefs; 24 private JCheckBox cbModifyNotes; 19 private final JCheckBox cbWriteApi = new JCheckBox(); 20 private final JCheckBox cbWriteGpx = new JCheckBox(); 21 private final JCheckBox cbReadGpx = new JCheckBox(); 22 private final JCheckBox cbWritePrefs = new JCheckBox(); 23 private final JCheckBox cbReadPrefs = new JCheckBox(); 24 private final JCheckBox cbModifyNotes = new JCheckBox(); 25 26 /** 27 * Constructs a new {@code OsmPrivilegesPanel}. 28 */ 29 public OsmPrivilegesPanel() { 30 build(); 31 } 25 32 26 33 protected final void build() { … … 35 42 gc.weightx = 1.0; 36 43 gc.insets = new Insets(0, 0, 3, 3); 37 add(cbWriteApi = new JCheckBox(), gc);44 add(cbWriteApi, gc); 38 45 cbWriteApi.setText(tr("Allow to upload map data")); 39 46 cbWriteApi.setToolTipText(tr("Select to grant JOSM the right to upload map data on your behalf")); … … 43 50 // 44 51 gc.gridy = 1; 45 add(cbWriteGpx = new JCheckBox(), gc);52 add(cbWriteGpx, gc); 46 53 cbWriteGpx.setText(tr("Allow to upload GPS traces")); 47 54 cbWriteGpx.setToolTipText(tr("Select to grant JOSM the right to upload GPS traces on your behalf")); … … 51 58 // 52 59 gc.gridy = 2; 53 add(cbReadGpx = new JCheckBox(), gc);60 add(cbReadGpx, gc); 54 61 cbReadGpx.setText(tr("Allow to download your private GPS traces")); 55 62 cbReadGpx.setToolTipText(tr("Select to grant JOSM the right to download your private GPS traces into JOSM layers")); … … 59 66 // 60 67 gc.gridy = 3; 61 add(cbReadPrefs = new JCheckBox(), gc);68 add(cbReadPrefs, gc); 62 69 cbReadPrefs.setText(tr("Allow to read your preferences")); 63 70 cbReadPrefs.setToolTipText(tr("Select to grant JOSM the right to read your server preferences")); … … 67 74 // 68 75 gc.gridy = 4; 69 add(cbWritePrefs = new JCheckBox(), gc);76 add(cbWritePrefs, gc); 70 77 cbWritePrefs.setText(tr("Allow to write your preferences")); 71 78 cbWritePrefs.setToolTipText(tr("Select to grant JOSM the right to write your server preferences")); … … 73 80 74 81 gc.gridy = 5; 75 add(cbModifyNotes = new JCheckBox(), gc);82 add(cbModifyNotes, gc); 76 83 cbModifyNotes.setText(tr("Allow modifications of notes")); 77 84 cbModifyNotes.setToolTipText(tr("Select to grant JOSM the right to modify notes on your behalf")); … … 84 91 gc.weighty = 1.0; 85 92 add(new JPanel(), gc); 86 }87 88 /**89 * Constructs a new {@code OsmPrivilegesPanel}.90 */91 public OsmPrivilegesPanel() {92 build();93 93 } 94 94 -
TabularUnified trunk/src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java ¶
r10073 r10183 41 41 */ 42 42 public class SemiAutomaticAuthorizationUI extends AbstractAuthorizationUI { 43 private AccessTokenInfoPanel pnlAccessTokenInfo; 43 private final AccessTokenInfoPanel pnlAccessTokenInfo = new AccessTokenInfoPanel(); 44 44 private transient OAuthToken requestToken; 45 45 … … 217 217 private class RetrieveAccessTokenPanel extends JPanel { 218 218 219 private JosmTextField tfAuthoriseUrl; 219 private final JosmTextField tfAuthoriseUrl = new JosmTextField(); 220 220 221 221 /** … … 261 261 gc.gridx = 1; 262 262 gc.weightx = 1.0; 263 pnl.add(tfAuthoriseUrl = new JosmTextField(), gc);263 pnl.add(tfAuthoriseUrl, gc); 264 264 tfAuthoriseUrl.setEditable(false); 265 265 … … 340 340 gc.weightx = 1.0; 341 341 gc.gridwidth = 1; 342 pnl.add(pnlAccessTokenInfo = new AccessTokenInfoPanel(), gc);342 pnl.add(pnlAccessTokenInfo, gc); 343 343 pnlAccessTokenInfo.setSaveToPreferences( 344 344 OAuthAccessTokenHolder.getInstance().isSaveToPreferences()
Note:
See TracChangeset
for help on using the changeset viewer.