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

COVERAGE SUMMARY FOR SOURCE FILE [ParticipantCommands.java]

nameclass, %method, %block, %line, %
ParticipantCommands.java100% (3/3)100% (7/7)98%  (99/101)93%  (14/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ParticipantCommands100% (1/1)100% (3/3)96%  (51/53)89%  (8/9)
removeParticipant (): Task 100% (1/1)95%  (36/38)83%  (5/6)
ParticipantCommands (): void 100% (1/1)100% (3/3)100% (1/1)
setParticipantWriter (): Task 100% (1/1)100% (12/12)100% (2/2)
     
class ParticipantCommands$1100% (1/1)100% (2/2)100% (24/24)100% (3/3)
ParticipantCommands$1 (ParticipantCommands, HiveGuiApplicationMain, Participa... 100% (1/1)100% (10/10)100% (1/1)
doInBackground (): Void 100% (1/1)100% (14/14)100% (2/2)
     
class ParticipantCommands$2100% (1/1)100% (2/2)100% (24/24)100% (3/3)
ParticipantCommands$2 (ParticipantCommands, HiveGuiApplicationMain, Participa... 100% (1/1)100% (10/10)100% (1/1)
doInBackground (): Void 100% (1/1)100% (14/14)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.command;
16 
17import org.jdesktop.application.Action;
18import org.jdesktop.application.Task;
19 
20import net.sourceforge.hiveboard.util.Participant;
21import net.sourceforge.hivegui.message.UserChoice;
22 
23public class ParticipantCommands extends AbstractCommandHolder
24{
25        @Action(enabledProperty = PARTICIPANT_TOKEN_SETTABLE, block = Task.BlockingScope.WINDOW)
26        public Task        setParticipantWriter()
27        {
28                final Participant current = _guiContext.getParticipant();
29                return new AbstractTask<Void, Void>(_application)
30                {
31                        @Override protected Void doInBackground() throws Exception
32                        {
33                                _service.giveToken(current.getBoard().getId(), current.getAccount().getId());
34                                return null;
35                        }
36                };
37        }
38        
39        @Action(enabledProperty = PARTICIPANT_REMOVABLE, block = Task.BlockingScope.WINDOW)
40        public Task        removeParticipant()
41        {
42                final Participant current = _guiContext.getParticipant();
43                // Get initiator's confirmation if participant is currently present
44                if (current.isPresent())
45                {
46                        UserChoice choice = showMessage("confirm-remove-participant", 
47                                                                                        current.getAccount().getVisa(),
48                                                                                        current.getBoard().getName());
49                        if (choice == UserChoice.CANCEL)
50                        {
51                                return null;
52                        }
53                }
54                return new AbstractTask<Void, Void>(_application)
55                {
56                        @Override protected Void doInBackground() throws Exception
57                        {
58                                _service.removeParticipant(        current.getBoard().getId(),
59                                                                                        current.getAccount().getId());
60                                return null;
61                        }
62                };
63        }
64}

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