AuthenticationPanel: able to hide the "remember password" checkbox.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Sun, 24 Apr 2011 11:26:52 +0000 (15:26 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Sun, 24 Apr 2011 12:13:03 +0000 (16:13 +0400)
platform/platform-api/src/com/intellij/util/net/AuthenticationPanel.java

index efa183c96145d539debbfd548b85e99a4462571a..4eb9231efe9d838ca6b413041173de35c06b4fdb 100644 (file)
@@ -38,13 +38,19 @@ public class AuthenticationPanel extends JPanel {
    * @param login             Initial login value.
    * @param password          Initial password value.
    * @param rememberPassword  Default value for the 'remember password' checkbox.
+   * If true, the checkbox will be selected; if false, the checkbox won't be selected; if null, there will be no checkbox for remembering
+   * password.
    */
-  public AuthenticationPanel(@Nullable String description, @Nullable String login, @Nullable String password, boolean rememberPassword) {
+  public AuthenticationPanel(@Nullable String description, @Nullable String login, @Nullable String password, @Nullable Boolean rememberPassword) {
     add(myMainPanel);
     myDescriptionLabel.setText(description);
     myLoginTextField.setText(login);
     myPasswordTextField.setText(password);
-    rememberPasswordCheckBox.setSelected(rememberPassword);
+    if (rememberPassword == null) {
+      rememberPasswordCheckBox.setVisible(false);
+    } else {
+      rememberPasswordCheckBox.setSelected(rememberPassword);
+    }
   }
 
   public String getLogin () {