EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.dialog]

COVERAGE SUMMARY FOR SOURCE FILE [ChangeAccountPasswordPanel.java]

nameclass, %method, %block, %line, %
ChangeAccountPasswordPanel.java100% (3/3)100% (9/9)100% (134/134)100% (26/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ChangeAccountPasswordPanel100% (1/1)100% (5/5)100% (92/92)100% (20/20)
ChangeAccountPasswordPanel (WhiteBoardUserService, Account): void 100% (1/1)100% (61/61)100% (14/14)
accept (): Task 100% (1/1)100% (17/17)100% (2/2)
access$000 (ChangeAccountPasswordPanel): JPasswordField 100% (1/1)100% (3/3)100% (1/1)
access$100 (ChangeAccountPasswordPanel): WhiteBoardUserService 100% (1/1)100% (3/3)100% (1/1)
reset (): void 100% (1/1)100% (8/8)100% (3/3)
     
class ChangeAccountPasswordPanel$1100% (1/1)100% (2/2)100% (19/19)100% (3/3)
ChangeAccountPasswordPanel$1 (ChangeAccountPasswordPanel): void 100% (1/1)100% (6/6)100% (1/1)
contentUpdated (): void 100% (1/1)100% (13/13)100% (2/2)
     
class ChangeAccountPasswordPanel$2100% (1/1)100% (2/2)100% (23/23)100% (3/3)
ChangeAccountPasswordPanel$2 (ChangeAccountPasswordPanel, HiveGuiApplicationM... 100% (1/1)100% (11/11)100% (1/1)
doInBackground (): Void 100% (1/1)100% (12/12)100% (2/2)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard.dialog;
16 
17import javax.swing.JLabel;
18import javax.swing.JPasswordField;
19 
20import org.jdesktop.application.Action;
21import org.jdesktop.application.Task;
22 
23import net.sourceforge.hiveboard.Account;
24import net.sourceforge.hiveboard.WhiteBoardUserService;
25import net.sourceforge.hiveboard.command.AbstractTask;
26import net.sourceforge.hivegui.component.TextListener;
27 
28import zappini.designgridlayout.DesignGridLayout;
29 
30public class ChangeAccountPasswordPanel extends AbstractAccountPanel
31{
32        static private final String        NAME = "account-password";
33        
34        public ChangeAccountPasswordPanel(WhiteBoardUserService service, Account target)
35        {
36                super(NAME);
37                _service = service;
38                _account = target;
39 
40                _lblPassword.setName(NAME + "-new-password-label");
41                _pwfPassword.setName(NAME + "-new-password");
42 
43                _lblPassword.setLabelFor(_pwfPassword);
44 
45                DesignGridLayout layout = new DesignGridLayout(this); 
46                setLayout(layout);
47                layout.row().label(_lblPassword).add(_pwfPassword);
48            
49                TextListener listener = new TextListener()
50                {
51                        @Override protected void contentUpdated()
52                        {
53                                setAcceptEnabled(_pwfPassword.getPassword().length != 0);
54                        }
55                };
56                _pwfPassword.getDocument().addDocumentListener(listener);
57        }
58        
59        @Override public void reset()
60        {
61                _pwfPassword.setText("");
62                setAcceptEnabled(false);
63        }
64 
65        @Action(enabledProperty = "acceptEnabled", block = Task.BlockingScope.WINDOW)
66        public Task accept()
67        {
68                final String pwd = new String(_pwfPassword.getPassword());
69                return new AbstractTask<Void, Void>(_application, _parent)
70                {
71                        @Override protected Void doInBackground() throws Exception
72                        {
73                                _service.changeAccountPassword(_account.getId(), pwd);
74                                return null;
75                        }
76                };
77        }
78        
79        final private WhiteBoardUserService        _service;
80        final private JLabel                                _lblPassword = new JLabel();
81        final private JPasswordField                _pwfPassword = new JPasswordField(20);
82}

[all classes][net.sourceforge.hiveboard.dialog]
EMMA 2.0.5312 (C) Vladimir Roubtsov