Add a clear button to make it easier to replace the key

This way the current key can be easily whacked and replaced with
the user's desired key.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-02-16 10:09:19 -08:00
parent dad5fed2d5
commit 8c21ea62c5
3 changed files with 16 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ public interface AccountConstants extends Constants {
String tabAgreements();
String buttonDeleteSshKey();
String buttonClearSshKeyInput();
String buttonAddSshKey();
String sshKeyInvalid();

View File

@@ -15,6 +15,7 @@ tabWebIdentities = Web Identities
tabAgreements = Agreements
buttonDeleteSshKey = Delete
buttonClearSshKeyInput = Clear
buttonAddSshKey = Add
sshKeyInvalid = Invalid Key

View File

@@ -42,6 +42,7 @@ import java.util.List;
class SshKeyPanel extends Composite {
private SshKeyTable keys;
private Button clearNew;
private Button addNew;
private TextArea addTxt;
private Button delSel;
@@ -74,13 +75,25 @@ class SshKeyPanel extends Composite {
addTxt.setCharacterWidth(80);
fp.add(addTxt);
final FlowPanel buttons = new FlowPanel();
fp.add(buttons);
clearNew = new Button(Util.C.buttonClearSshKeyInput());
clearNew.addClickListener(new ClickListener() {
public void onClick(final Widget sender) {
addTxt.setText("");
addTxt.setFocus(true);
}
});
buttons.add(clearNew);
addNew = new Button(Util.C.buttonAddSshKey());
addNew.addClickListener(new ClickListener() {
public void onClick(final Widget sender) {
doAddNew();
}
});
fp.add(addNew);
buttons.add(addNew);
body.add(fp);
}