1 | |
package org.jtheque.films.view.impl.frames; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
import org.jtheque.core.managers.error.JThequeError; |
20 | |
import org.jtheque.core.managers.view.impl.frame.abstraction.SwingDialogView; |
21 | |
import org.jtheque.core.utils.ui.PanelBuilder; |
22 | |
import org.jtheque.films.utils.Constants.Properties.Film; |
23 | |
import org.jtheque.films.view.able.IChoiceFieldsView; |
24 | |
import org.jtheque.films.view.impl.actions.CloseViewAction; |
25 | |
import org.jtheque.films.view.impl.actions.auto.choice.AcValidateChoiceFieldsView; |
26 | |
|
27 | |
import javax.swing.JCheckBox; |
28 | |
import java.awt.Container; |
29 | |
import java.awt.Frame; |
30 | |
import java.util.Collection; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
public final class ChoiceFieldsView extends SwingDialogView implements IChoiceFieldsView { |
38 | |
private static final long serialVersionUID = -1071539900190775950L; |
39 | |
|
40 | |
private JCheckBox boxKind; |
41 | |
private JCheckBox boxRealizer; |
42 | |
private JCheckBox boxYear; |
43 | |
private JCheckBox boxDuration; |
44 | |
private JCheckBox boxActors; |
45 | |
private JCheckBox boxImage; |
46 | |
private JCheckBox boxResume; |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
public ChoiceFieldsView(Frame parent) { |
54 | 0 | super(parent); |
55 | |
|
56 | 0 | setContentPane(buildContentPane()); |
57 | 0 | pack(); |
58 | |
|
59 | 0 | setLocationRelativeTo(getOwner()); |
60 | 0 | } |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
private Container buildContentPane() { |
68 | 0 | PanelBuilder builder = new PanelBuilder(); |
69 | |
|
70 | 0 | boxKind = builder.addI18nCheckBox(Film.KIND, builder.gbcSet(0, 0)); |
71 | 0 | boxRealizer = builder.addI18nCheckBox(Film.REALIZER, builder.gbcSet(0, 1)); |
72 | 0 | boxYear = builder.addI18nCheckBox(Film.YEAR, builder.gbcSet(0, 2)); |
73 | 0 | boxDuration = builder.addI18nCheckBox(Film.DURATION, builder.gbcSet(0, 3)); |
74 | 0 | boxActors = builder.addI18nCheckBox(Film.ACTORS, builder.gbcSet(0, 4)); |
75 | 0 | boxImage = builder.addI18nCheckBox(Film.IMAGE, builder.gbcSet(0, 5)); |
76 | 0 | boxResume = builder.addI18nCheckBox(Film.RESUME, builder.gbcSet(0, 6)); |
77 | |
|
78 | 0 | builder.addButtonBar(builder.gbcSet(0, 7), new CloseViewAction("generic.view.actions.cancel", this), new AcValidateChoiceFieldsView()); |
79 | |
|
80 | 0 | return builder.getPanel(); |
81 | |
} |
82 | |
|
83 | |
@Override |
84 | |
public boolean isBoxKindSelected() { |
85 | 0 | return boxKind.isSelected(); |
86 | |
} |
87 | |
|
88 | |
@Override |
89 | |
public boolean isBoxRealizerSelected() { |
90 | 0 | return boxRealizer.isSelected(); |
91 | |
} |
92 | |
|
93 | |
@Override |
94 | |
public boolean isBoxYearSelected() { |
95 | 0 | return boxYear.isSelected(); |
96 | |
} |
97 | |
|
98 | |
@Override |
99 | |
public boolean isBoxDurationSelected() { |
100 | 0 | return boxDuration.isSelected(); |
101 | |
} |
102 | |
|
103 | |
@Override |
104 | |
public boolean isBoxActorsSelected() { |
105 | 0 | return boxActors.isSelected(); |
106 | |
} |
107 | |
|
108 | |
@Override |
109 | |
public boolean isBoxImageSelected() { |
110 | 0 | return boxImage.isSelected(); |
111 | |
} |
112 | |
|
113 | |
@Override |
114 | |
public boolean isBoxResumeSelected() { |
115 | 0 | return boxResume.isSelected(); |
116 | |
} |
117 | |
|
118 | |
@Override |
119 | |
protected void validate(Collection<JThequeError> errors) { |
120 | 0 | } |
121 | |
} |