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.resources.app.workbench.tools; |
35 |
|
|
36 |
|
import info.magnolia.event.EventBus; |
37 |
|
import info.magnolia.i18nsystem.SimpleTranslator; |
38 |
|
import info.magnolia.ui.api.view.View; |
39 |
|
import info.magnolia.ui.framework.overlay.ViewAdapter; |
40 |
|
import info.magnolia.ui.workbench.contenttool.ContentToolPresenter; |
41 |
|
|
42 |
|
import javax.inject.Inject; |
43 |
|
|
44 |
|
import com.vaadin.data.Property; |
45 |
|
import com.vaadin.ui.CheckBox; |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
@see |
51 |
|
@see |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.33 |
|
53 |
|
public class FilterClasspathResourcesToolPresenter implements ContentToolPresenter { |
54 |
|
|
55 |
|
public static final String LABEL = "resources.browser.filter.classpath.label"; |
56 |
|
public static final String DESCRIPTION = "resources.browser.filter.classpath.description"; |
57 |
|
|
58 |
|
private final EventBus eventBus; |
59 |
|
private final SimpleTranslator i18n; |
60 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
61 |
0 |
@Inject... |
62 |
|
public FilterClasspathResourcesToolPresenter(EventBus eventBus, SimpleTranslator translator) { |
63 |
0 |
this.eventBus = eventBus; |
64 |
0 |
this.i18n = translator; |
65 |
|
} |
66 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
67 |
0 |
@Override... |
68 |
|
public View start() { |
69 |
0 |
final CheckBox cb = new CheckBox(i18n.translate(LABEL)); |
70 |
0 |
cb.setDescription(i18n.translate(DESCRIPTION)); |
71 |
0 |
cb.setSizeUndefined(); |
72 |
0 |
cb.addValueChangeListener(new Property.ValueChangeListener() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
73 |
0 |
@Override... |
74 |
|
public void valueChange(Property.ValueChangeEvent event) { |
75 |
0 |
eventBus.fireEvent(new FilterClasspathResourcesEvent((Boolean) event.getProperty().getValue())); |
76 |
|
} |
77 |
|
}); |
78 |
0 |
cb.setValue(true); |
79 |
0 |
return new ViewAdapter(cb); |
80 |
|
} |
81 |
|
} |