Skip to content

Commit

Permalink
make text entry modal dialog check-box option generic (drop reference…
Browse files Browse the repository at this point in the history
… to remember password)
  • Loading branch information
jjallaire committed Dec 7, 2011
1 parent 618f9ea commit 1fbe1bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public TextEntryModalDialog(String title,
String caption,
String defaultValue,
boolean usePasswordMask,
String rememberPasswordPrompt,
boolean rememberByDefault,
String extraOptionPrompt,
boolean extraOptionDefault,
boolean numbersOnly,
int selectionIndex,
int selectionLength, String okButtonCaption,
Expand All @@ -41,10 +41,10 @@ public TextEntryModalDialog(String title,
textBox_.setWidth("100%");
captionLabel_ = new Label(caption);

rememberPassword_ = new CheckBox(StringUtil.notNull(rememberPasswordPrompt));
rememberPassword_.setVisible(
!StringUtil.isNullOrEmpty(rememberPasswordPrompt));
rememberPassword_.setValue(rememberByDefault);
extraOption_ = new CheckBox(StringUtil.notNull(extraOptionPrompt));
extraOption_.setVisible(
!StringUtil.isNullOrEmpty(extraOptionPrompt));
extraOption_.setValue(extraOptionDefault);

if (okButtonCaption != null)
setOkButtonCaption(okButtonCaption);
Expand Down Expand Up @@ -80,7 +80,7 @@ protected Widget createMainWidget()
verticalPanel.setWidth(width_ + "px");
verticalPanel.add(captionLabel_);
verticalPanel.add(textBox_);
verticalPanel.add(rememberPassword_);
verticalPanel.add(extraOption_);
return verticalPanel;
}

Expand Down Expand Up @@ -127,17 +127,17 @@ protected boolean validate(String input)
return true ;
}

public boolean remember()
public boolean getExtraOption()
{
return rememberPassword_.getValue() != null
&& rememberPassword_.getValue();
return extraOption_.getValue() != null
&& extraOption_.getValue();
}


private int width_;
private Label captionLabel_;
private TextBox textBox_;
private CheckBox rememberPassword_;
private CheckBox extraOption_;
private final boolean numbersOnly_;
private final int selectionIndex_;
private final int selectionLength_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void execute(String input, ProgressIndicator indicator)
{
PasswordResult result = new PasswordResult();
result.password = input;
result.remember = pDialog.getValue().remember();
result.remember = pDialog.getValue().getExtraOption();
okOperation.execute(result, indicator);
}
},
Expand Down

0 comments on commit 1fbe1bf

Please sign in to comment.