| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| CoverFormatComboBoxModel |
|
| 1.0;1 |
| 1 | package org.jtheque.films.view.impl.models.combo; | |
| 2 | ||
| 3 | import org.jtheque.core.managers.view.impl.components.model.SimpleComboBoxModel; | |
| 4 | import org.jtheque.core.utils.CoreUtils; | |
| 5 | import org.jtheque.films.services.able.ICoverService; | |
| 6 | import org.jtheque.films.services.impl.utils.cover.Format; | |
| 7 | import org.jtheque.utils.collections.CollectionUtils; | |
| 8 | ||
| 9 | /* | |
| 10 | * This file is part of JTheque. | |
| 11 | * | |
| 12 | * JTheque is free software: you can redistribute it and/or modify | |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation, either version 3 of the License. | |
| 15 | * | |
| 16 | * JTheque is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
| 23 | */ | |
| 24 | ||
| 25 | /** | |
| 26 | * A combo box model to display a list of format. | |
| 27 | * | |
| 28 | * @author Baptiste Wicht | |
| 29 | */ | |
| 30 | public final class CoverFormatComboBoxModel extends SimpleComboBoxModel<Format> { | |
| 31 | /** | |
| 32 | * Construct a new CoverFormatComboBoxModel. | |
| 33 | */ | |
| 34 | public CoverFormatComboBoxModel() { | |
| 35 | 0 | super(); |
| 36 | ||
| 37 | 0 | ICoverService coverService = CoreUtils.getBean("coverService"); |
| 38 | ||
| 39 | 0 | setElements(coverService.getFormats()); |
| 40 | 0 | } |
| 41 | ||
| 42 | /** | |
| 43 | * Select the first element. | |
| 44 | */ | |
| 45 | public void selectFirst() { | |
| 46 | 0 | setSelectedItem(CollectionUtils.first(getObjects())); |
| 47 | 0 | } |
| 48 | } |