diff options
Diffstat (limited to 'src/com/google/gct/login/ui/GoogleLoginEmptyPanel.java')
-rw-r--r-- | src/com/google/gct/login/ui/GoogleLoginEmptyPanel.java | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/com/google/gct/login/ui/GoogleLoginEmptyPanel.java b/src/com/google/gct/login/ui/GoogleLoginEmptyPanel.java index f3e48da..ab83d9c 100644 --- a/src/com/google/gct/login/ui/GoogleLoginEmptyPanel.java +++ b/src/com/google/gct/login/ui/GoogleLoginEmptyPanel.java @@ -30,7 +30,6 @@ import java.util.Map; public class GoogleLoginEmptyPanel extends JPanel { private static final String ADD_ACCOUNT = "Add Account"; private static final String SIGN_IN = "Sign In"; - private JButton myAddAccountButton; private JBScrollPane myContentScrollPane; private JPanel myBottomPane; @@ -38,15 +37,19 @@ public class GoogleLoginEmptyPanel extends JPanel { super(new BorderLayout()); myContentScrollPane = new JBScrollPane(); - myAddAccountButton = new JButton(needsToSignIn() ? SIGN_IN : ADD_ACCOUNT); - AddAccountListener addAccountListener = new AddAccountListener(); - myAddAccountButton.addActionListener(addAccountListener); - myAddAccountButton.setHorizontalAlignment(SwingConstants.LEFT); + JButton addAccountButton = new JButton(needsToSignIn() ? SIGN_IN : ADD_ACCOUNT); + addAccountButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + doLogin(); + } + }); + addAccountButton.setHorizontalAlignment(SwingConstants.LEFT); //Create a panel to hold the buttons JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); - buttonPane.add(myAddAccountButton); + buttonPane.add(addAccountButton); buttonPane.add(Box.createHorizontalGlue()); buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); @@ -59,20 +62,9 @@ public class GoogleLoginEmptyPanel extends JPanel { private static boolean needsToSignIn() { Map<String, CredentialedUser> users = GoogleLogin.getInstance().getAllUsers(); - return users == null || users.isEmpty(); } - /** - * The action listener for {@code myAddAccountButton} - */ - private class AddAccountListener implements ActionListener { - @Override - public void actionPerformed(ActionEvent e) { - doLogin(); - } - } - protected void doLogin() { GoogleLogin.getInstance().logIn(); } |