| 1 | |
package org.jtheque.core.managers.view.impl.components.panel; |
| 2 | |
|
| 3 | |
import org.jtheque.core.managers.update.Updatable; |
| 4 | |
import org.jtheque.core.managers.view.able.components.IUpdatablesPanelView; |
| 5 | |
import org.jtheque.core.managers.view.impl.actions.module.UpdateUpdatableAction; |
| 6 | |
import org.jtheque.core.managers.view.impl.components.model.UpdatableListModel; |
| 7 | |
import org.jtheque.core.managers.view.impl.components.renderers.UpdatableListRenderer; |
| 8 | |
import org.jtheque.core.utils.ui.PanelBuilder; |
| 9 | |
import org.jtheque.utils.ui.GridBagUtils; |
| 10 | |
|
| 11 | |
import javax.swing.JList; |
| 12 | |
import javax.swing.JPanel; |
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
public final class UpdatablesPanel extends JPanel implements IUpdatablesPanelView { |
| 36 | |
private final JList updatablesList; |
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
public UpdatablesPanel(){ |
| 42 | 0 | super(); |
| 43 | |
|
| 44 | 0 | PanelBuilder builder = new PanelBuilder(this); |
| 45 | |
|
| 46 | 0 | updatablesList = builder.addList(new UpdatableListModel(), new UpdatableListRenderer(), builder.gbcSet(0, 0, GridBagUtils.BOTH, GridBagUtils.FIRST_LINE_START)); |
| 47 | |
|
| 48 | 0 | builder.addButtonBar(builder.gbcSet(0, 1, GridBagUtils.HORIZONTAL, GridBagUtils.FIRST_LINE_START), |
| 49 | |
new UpdateUpdatableAction()); |
| 50 | 0 | } |
| 51 | |
|
| 52 | |
@Override |
| 53 | |
public Updatable getSelectedUpdatable() { |
| 54 | 0 | return (Updatable) updatablesList.getSelectedValue(); |
| 55 | |
} |
| 56 | |
} |