1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.module.mail.app.main; |
35 |
|
|
36 |
|
import info.magnolia.i18nsystem.SimpleTranslator; |
37 |
|
import info.magnolia.ui.vaadin.form.FormViewReduced; |
38 |
|
import info.magnolia.ui.vaadin.layout.SmallAppLayout; |
39 |
|
|
40 |
|
import javax.inject.Inject; |
41 |
|
import com.vaadin.ui.Button; |
42 |
|
import com.vaadin.ui.Button.ClickEvent; |
43 |
|
import com.vaadin.ui.Button.ClickListener; |
44 |
|
import com.vaadin.ui.Component; |
45 |
|
import com.vaadin.ui.CssLayout; |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 8 |
Complexity Density: 0.33 |
|
50 |
|
public class MailMainViewImpl implements MailMainView { |
51 |
|
|
52 |
|
private final SmallAppLayout root = new SmallAppLayout(); |
53 |
|
private FormViewReduced formView; |
54 |
|
private CssLayout cssLayout; |
55 |
|
private Listener listener; |
56 |
|
private SimpleTranslator translator; |
57 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
0 |
@Inject... |
59 |
|
public MailMainViewImpl(SimpleTranslator translator) { |
60 |
0 |
this.translator = translator; |
61 |
|
} |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
|
63 |
0 |
@Override... |
64 |
|
public void build() { |
65 |
0 |
Button saveButton = new Button(translator.translate("mail.app.main.button.save.caption")); |
66 |
0 |
saveButton.addStyleName("v-button-smallapp"); |
67 |
0 |
saveButton.addStyleName("commit"); |
68 |
|
|
69 |
0 |
saveButton.addClickListener(new ClickListener() { |
70 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
0 |
@Override... |
72 |
|
public void buttonClick(ClickEvent event) { |
73 |
0 |
getListener().save(); |
74 |
|
} |
75 |
|
}); |
76 |
|
|
77 |
0 |
Button resetButton = new Button(translator.translate("mail.app.main.button.reset.caption")); |
78 |
0 |
resetButton.addStyleName("v-button-smallapp"); |
79 |
0 |
resetButton.addClickListener(new ClickListener() { |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0 |
@Override... |
82 |
|
public void buttonClick(ClickEvent event) { |
83 |
0 |
getListener().reset(); |
84 |
|
} |
85 |
|
}); |
86 |
|
|
87 |
0 |
CssLayout buttonLayout = new CssLayout(); |
88 |
0 |
buttonLayout.addStyleName("v-csslayout-smallapp-actions"); |
89 |
0 |
buttonLayout.addComponent(saveButton); |
90 |
0 |
buttonLayout.addComponent(resetButton); |
91 |
|
|
92 |
0 |
cssLayout = new CssLayout(); |
93 |
0 |
cssLayout.addComponent(formView.asVaadinComponent()); |
94 |
0 |
cssLayout.addComponent(buttonLayout); |
95 |
|
|
96 |
0 |
root.setDescription(translator.translate("mail.app.main.description")); |
97 |
0 |
root.addSection(cssLayout); |
98 |
|
} |
99 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
0 |
@Override... |
101 |
|
public Component asVaadinComponent() { |
102 |
0 |
return root; |
103 |
|
} |
104 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
105 |
0 |
@Override... |
106 |
|
public void showValidation(boolean visible) { |
107 |
0 |
formView.showValidation(visible); |
108 |
|
} |
109 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
110 |
|
@Override... |
111 |
|
public boolean isValid() { |
112 |
|
return formView.isValid(); |
113 |
|
} |
114 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
115 |
0 |
@Override... |
116 |
|
public void setFormViewReduced(FormViewReduced formView) { |
117 |
0 |
if (this.formView != null) { |
118 |
0 |
cssLayout.replaceComponent(this.formView.asVaadinComponent(), formView.asVaadinComponent()); |
119 |
|
} |
120 |
0 |
this.formView = formView; |
121 |
|
} |
122 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
123 |
|
@Override... |
124 |
|
public void setListener(Listener listener) { |
125 |
|
this.listener = listener; |
126 |
|
} |
127 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
128 |
|
public Listener getListener() {... |
129 |
|
return listener; |
130 |
|
} |
131 |
|
|
132 |
|
} |