cdm-vaadin/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupView.java @ 14fd703d
1 |
package eu.etaxonomy.vaadin.mvp; |
---|---|
2 |
|
3 |
import com.vaadin.ui.Window; |
4 |
|
5 |
import eu.etaxonomy.vaadin.ui.view.PopupView; |
6 |
|
7 |
|
8 |
/**
|
9 |
* @author a.kohlbecker
|
10 |
* @since Apr 5, 2017
|
11 |
*
|
12 |
* @param <P>
|
13 |
*/
|
14 |
@SuppressWarnings("serial") |
15 |
public abstract class AbstractPopupView<P extends AbstractPresenter> extends AbstractView<P> implements PopupView { |
16 |
|
17 |
private Window window; |
18 |
|
19 |
protected void updateWindowCaption(String caption) { |
20 |
window.setCaption(caption); |
21 |
}
|
22 |
|
23 |
/**
|
24 |
* {@inheritDoc}
|
25 |
*/
|
26 |
@Override
|
27 |
public boolean isResizable() { |
28 |
return false; |
29 |
}
|
30 |
|
31 |
@Override
|
32 |
public boolean isClosable(){ |
33 |
return false; |
34 |
}
|
35 |
|
36 |
/**
|
37 |
* {@inheritDoc}
|
38 |
*/
|
39 |
@Override
|
40 |
public int getWindowWidth() { |
41 |
return -1; |
42 |
}
|
43 |
|
44 |
/**
|
45 |
* {@inheritDoc}
|
46 |
*/
|
47 |
@Override
|
48 |
public Unit getWindowWidthUnit() { |
49 |
return Unit.PIXELS; |
50 |
}
|
51 |
|
52 |
/**
|
53 |
* {@inheritDoc}
|
54 |
*
|
55 |
* <p>
|
56 |
* <b>NOTE:</b> setting 100% as default height. If the height
|
57 |
* would be undefined the window, will fit the size of
|
58 |
* the content and will sometimes exceed the height of the
|
59 |
* main window and will not get a scroll bar in this situation.
|
60 |
* see #6843
|
61 |
* </p>
|
62 |
*/
|
63 |
@Override
|
64 |
public int getWindowHeight() { |
65 |
return 100; |
66 |
}
|
67 |
|
68 |
/**
|
69 |
* {@inheritDoc}
|
70 |
*/
|
71 |
@Override
|
72 |
public Unit getWindowHeightUnit() { |
73 |
return Unit.PERCENTAGE; |
74 |
}
|
75 |
|
76 |
|
77 |
/**
|
78 |
* {@inheritDoc}
|
79 |
*/
|
80 |
@Override
|
81 |
public boolean isModal() { |
82 |
return false; |
83 |
}
|
84 |
|
85 |
/**
|
86 |
* {@inheritDoc}
|
87 |
*/
|
88 |
@Override
|
89 |
public boolean isWindowCaptionAsHtml() { |
90 |
return false; |
91 |
}
|
92 |
|
93 |
@Override
|
94 |
public void viewEntered(){ |
95 |
getPresenter().onViewEnter(); |
96 |
}
|
97 |
|
98 |
/* Methods which existed in the original version of the AbstractPopupView
|
99 |
* There are not needed here since the creation of the window and disposal
|
100 |
* is done by the NavigationManagerBean
|
101 |
@Override
|
102 |
protected void onViewReady() {
|
103 |
super.onViewReady();
|
104 |
|
105 |
window = new Window();
|
106 |
window.setWidth(getWindowPixelWidth(), Unit.PIXELS);
|
107 |
window.setModal(isModal());
|
108 |
window.setContent(this);
|
109 |
|
110 |
UI.getCurrent().addWindow(window);
|
111 |
}
|
112 |
|
113 |
public void close() {
|
114 |
window.close();
|
115 |
}
|
116 |
*/
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
}
|