| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| LogComboBoxModel |
|
| 1.0;1 |
| 1 | package org.jtheque.core.managers.view.impl.components.model; | |
| 2 | ||
| 3 | import org.jtheque.core.managers.Managers; | |
| 4 | import org.jtheque.core.managers.event.IEventManager; | |
| 5 | import org.jtheque.utils.collections.CollectionUtils; | |
| 6 | ||
| 7 | import javax.swing.DefaultComboBoxModel; | |
| 8 | import java.util.List; | |
| 9 | ||
| 10 | /* | |
| 11 | * This file is part of JTheque. | |
| 12 | * | |
| 13 | * JTheque is free software: you can redistribute it and/or modify | |
| 14 | * it under the terms of the GNU General Public License as published by | |
| 15 | * the Free Software Foundation, either version 3 of the License. | |
| 16 | * | |
| 17 | * JTheque is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
| 24 | */ | |
| 25 | ||
| 26 | /** | |
| 27 | * A combo box model to displays the event logs. | |
| 28 | * | |
| 29 | * @author Baptiste Wicht | |
| 30 | */ | |
| 31 | public final class LogComboBoxModel extends DefaultComboBoxModel { | |
| 32 | private final List<String> logs; | |
| 33 | ||
| 34 | /** | |
| 35 | * Construct a new LogComboBoxModel. | |
| 36 | */ | |
| 37 | public LogComboBoxModel() { | |
| 38 | 0 | super(); |
| 39 | ||
| 40 | 0 | logs = CollectionUtils.copyOf(Managers.getManager(IEventManager.class).getLogs()); |
| 41 | 0 | } |
| 42 | ||
| 43 | @Override | |
| 44 | public Object getElementAt(int index) { | |
| 45 | 0 | return logs.get(index); |
| 46 | } | |
| 47 | ||
| 48 | @Override | |
| 49 | public int getSize() { | |
| 50 | 0 | return logs.size(); |
| 51 | } | |
| 52 | ||
| 53 | } |