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

COVERAGE SUMMARY FOR SOURCE FILE [NotificationListModel.java]

nameclass, %method, %block, %line, %
NotificationListModel.java100% (3/3)100% (5/5)100% (83/83)100% (16/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NotificationListModel100% (1/1)100% (1/1)100% (32/32)100% (7/7)
NotificationListModel (Channel, BoardRepository, IdentityHolder): void 100% (1/1)100% (32/32)100% (7/7)
     
class NotificationListModel$1100% (1/1)100% (2/2)100% (11/11)100% (3/3)
NotificationListModel$1 (NotificationListModel): void 100% (1/1)100% (6/6)100% (1/1)
pushEvent (Event): void 100% (1/1)100% (5/5)100% (2/2)
     
class NotificationListModel$2100% (1/1)100% (2/2)100% (40/40)100% (6/6)
NotificationListModel$2 (NotificationListModel, int, BoardRepository): void 100% (1/1)100% (12/12)100% (1/1)
passEvent (Event): boolean 100% (1/1)100% (28/28)100% (5/5)

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.view;
16 
17import net.sourceforge.hiveboard.Event;
18import net.sourceforge.hiveboard.EventType;
19import net.sourceforge.hiveboard.event.DeferredConsumer;
20import net.sourceforge.hiveboard.event.EventsPriorities;
21import net.sourceforge.hiveboard.main.IdentityHolder;
22import net.sourceforge.hiveboard.model.BoardRepository;
23import net.sourceforge.hiveevents.Channel;
24import net.sourceforge.hiveevents.Filter;
25import net.sourceforge.hivegui.table.DefaultDataListModel;
26 
27public class NotificationListModel extends DefaultDataListModel<Event>
28{
29        public NotificationListModel(        Channel<Event>                        eventChannel,
30                                                                        final BoardRepository        repository,
31                                                                        IdentityHolder                        holder)
32        {
33                super(Event.class, new EventComparator());
34                final int self = holder.getId();
35 
36                // Add events listeners
37                int priority = EventsPriorities.NOTIFICATION_LIST_UPDATE;
38                _consumer = new DeferredConsumer()
39                {
40                        @Override protected void pushEvent(Event event)
41                        {
42                                addRow(event);
43                        }
44                };
45                Filter<Event> filter = new Filter<Event>()
46                {
47                        public boolean        passEvent(Event event)
48                        {
49                                if (        event.getType() == EventType.EVT_GIVE_TOKEN
50                                        &&        event.getWho() == self)
51                                {
52                                        return true;
53                                }
54                                if (        event.getType() == EventType.EVT_REQUEST_TOKEN
55                                        &&        repository.getBoard(event.getWhere()).getInitiator() == self)
56                                {
57                                        return true;
58                                }
59                                return false;
60                        }
61                };
62                eventChannel.registerPushConsumer(priority, filter, _consumer);
63        }
64 
65        private final DeferredConsumer        _consumer;
66}

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