Revision ff40fbae
Added by Andreas Kohlbecker over 1 year ago
src/main/java/eu/etaxonomy/cdm/addon/config/CdmVaadinConfiguration.java | ||
---|---|---|
61 | 61 |
import eu.etaxonomy.cdm.vaadin.ui.CdmBaseUI; |
62 | 62 |
import eu.etaxonomy.cdm.vaadin.ui.ConceptRelationshipUI; |
63 | 63 |
import eu.etaxonomy.cdm.vaadin.ui.DistributionStatusUI; |
64 |
import eu.etaxonomy.cdm.vaadin.ui.PasswordResetUI; |
|
64 | 65 |
import eu.etaxonomy.cdm.vaadin.ui.RegistrationUI; |
65 | 66 |
import eu.etaxonomy.cdm.vaadin.ui.StatusEditorUI; |
66 | 67 |
import eu.etaxonomy.vaadin.ui.annotation.EnableVaadinSpringNavigation; |
... | ... | |
202 | 203 |
return null; |
203 | 204 |
} |
204 | 205 |
|
206 |
@Bean |
|
207 |
@UIScope |
|
208 |
public PasswordResetUI passwordResetUI() { |
|
209 |
if(isUIEnabled(PasswordResetUI.class)){ |
|
210 |
registerRegistrationUiHibernateEventListeners(); |
|
211 |
return new PasswordResetUI(); |
|
212 |
} |
|
213 |
return null; |
|
214 |
} |
|
215 |
|
|
205 | 216 |
/** |
206 | 217 |
* this is only a quick implementation for testing, |
207 | 218 |
* TODO see also the NOTE on CdmListenerIntegrator class declaration for a prospective better solution |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/AbstractUI.java | ||
---|---|---|
78 | 78 |
@Override |
79 | 79 |
protected void init(VaadinRequest request) { |
80 | 80 |
|
81 |
logger.debug("init()");
|
|
81 |
logger.debug(this.getClass().getSimpleName() + ".init()");
|
|
82 | 82 |
registerErrorHandlers(); |
83 | 83 |
|
84 | 84 |
configureAccessDeniedView(); |
85 | 85 |
|
86 |
setContent((Component) getViewDisplay()); |
|
87 |
initContent(); |
|
86 |
assert getInitialViewName() != null; |
|
87 |
assert getViewDisplay() != null; |
|
88 |
|
|
89 |
logger.debug(this.getClass().getSimpleName() + ".init() ViewDisplay: " + getViewDisplay().getClass().getSimpleName() + ", initialViewName: " + getInitialViewName()); |
|
90 |
initAdditionalContent(); |
|
88 | 91 |
|
89 | 92 |
getNavigationManagerBean().setViewDisplay(getViewDisplay()); |
90 |
assert getInitialViewName() != null; |
|
91 | 93 |
getNavigationManagerBean().setDefaultViewName(getInitialViewName()); |
92 | 94 |
|
93 | 95 |
Responsive.makeResponsive(this); |
... | ... | |
115 | 117 |
Page.getCurrent().getStyles().add(registryCssFile); |
116 | 118 |
} |
117 | 119 |
|
118 |
|
|
119 | 120 |
uiEventBus.publish(this, new UIInitializedEvent()); |
120 |
|
|
121 | 121 |
} |
122 | 122 |
|
123 | 123 |
/** |
124 |
* @return The name of the initial view to |
|
124 |
* @return The name of the initial view to show
|
|
125 | 125 |
*/ |
126 | 126 |
abstract protected String getInitialViewName(); |
127 | 127 |
|
... | ... | |
144 | 144 |
* will for example be interesting when using the {@link ValoTheme.UI_WITH_MENU} |
145 | 145 |
* style. |
146 | 146 |
*/ |
147 |
abstract protected void initContent(); |
|
147 |
abstract protected void initAdditionalContent();
|
|
148 | 148 |
|
149 | 149 |
protected void registerErrorHandlers() { |
150 | 150 |
DelegatingErrorHandler delegatingErrorHander = new DelegatingErrorHandler(); |
... | ... | |
161 | 161 |
viewProvider.setAccessDeniedViewClass(RedirectToLoginView.class); |
162 | 162 |
} |
163 | 163 |
|
164 |
|
|
165 | 164 |
private String pageFragmentAsState() { |
166 | 165 |
Page page = Page.getCurrent(); |
167 | 166 |
String fragment = page.getUriFragment(); |
... | ... | |
172 | 171 |
return state; |
173 | 172 |
} |
174 | 173 |
|
175 |
|
|
176 |
|
|
177 |
|
|
178 | 174 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/RegistrationUI.java | ||
---|---|---|
11 | 11 |
import org.springframework.beans.factory.annotation.Autowired; |
12 | 12 |
import org.springframework.beans.factory.annotation.Qualifier; |
13 | 13 |
|
14 |
import com.flowingcode.vaadin.addons.errorwindow.WindowErrorHandler; |
|
15 | 14 |
import com.vaadin.annotations.Theme; |
16 | 15 |
import com.vaadin.annotations.Title; |
17 | 16 |
import com.vaadin.annotations.Viewport; |
... | ... | |
19 | 18 |
import com.vaadin.navigator.ViewDisplay; |
20 | 19 |
import com.vaadin.server.FontAwesome; |
21 | 20 |
import com.vaadin.server.VaadinRequest; |
22 |
import com.vaadin.server.VaadinSession; |
|
23 | 21 |
import com.vaadin.spring.annotation.SpringUI; |
22 |
import com.vaadin.ui.Component; |
|
24 | 23 |
import com.vaadin.ui.Label; |
25 | 24 |
import com.vaadin.ui.themes.ValoTheme; |
26 | 25 |
|
27 |
import eu.etaxonomy.cdm.database.PermissionDeniedException; |
|
28 | 26 |
import eu.etaxonomy.cdm.vaadin.debug.EntityCacheDebugger; |
29 |
import eu.etaxonomy.cdm.vaadin.event.error.DelegatingErrorHandler; |
|
30 |
import eu.etaxonomy.cdm.vaadin.event.error.ErrorTypeErrorHandlerWrapper; |
|
31 |
import eu.etaxonomy.cdm.vaadin.event.error.PermissionDeniedErrorHandler; |
|
32 | 27 |
import eu.etaxonomy.cdm.vaadin.toolbar.Toolbar; |
33 | 28 |
import eu.etaxonomy.cdm.vaadin.view.name.TaxonNamePopupEditor; |
34 | 29 |
import eu.etaxonomy.cdm.vaadin.view.registration.DashBoardView; |
... | ... | |
77 | 72 |
|
78 | 73 |
public static final String INITIAL_VIEW = DashBoardView.NAME; |
79 | 74 |
|
80 |
protected static final String UI_STYLE_NAME = ValoTheme.UI_WITH_MENU; |
|
81 |
|
|
82 | 75 |
public RegistrationUI() { |
83 | 76 |
super(); |
84 | 77 |
} |
85 | 78 |
|
86 | 79 |
@Override |
87 | 80 |
protected void init(VaadinRequest request) { |
88 |
|
|
89 | 81 |
super.init(request); |
90 |
|
|
91 |
addStyleName(UI_STYLE_NAME); |
|
92 | 82 |
if(entityCacheDebugger != null){ |
93 | 83 |
addShortcutListener(entityCacheDebugger.getShortcutListener()); |
94 | 84 |
} |
... | ... | |
100 | 90 |
} |
101 | 91 |
|
102 | 92 |
@Override |
103 |
protected void initContent() { |
|
93 |
protected void initAdditionalContent() { |
|
94 |
setContent((Component) getViewDisplay()); |
|
104 | 95 |
Label phycoBankLogo = new Label("PhycoBank"); |
105 | 96 |
phycoBankLogo.addStyleName("phycobank-green"); |
106 | 97 |
phycoBankLogo.addStyleName(ValoTheme.LABEL_HUGE); |
... | ... | |
116 | 107 |
} |
117 | 108 |
} |
118 | 109 |
|
119 |
@Override |
|
120 |
protected void registerErrorHandlers() { |
|
121 |
DelegatingErrorHandler delegatingErrorHander = new DelegatingErrorHandler(); |
|
122 |
WindowErrorHandler errorHandler = new WindowErrorHandler(this, RegistrationUIDefaults.ERROR_CONTACT_MESSAGE_LINE + "</br></br>" |
|
123 |
+ "<i>To help analyzing the problem please describe your actions that lead to this error and provide the error details from below in your email. " |
|
124 |
+ "You also might want to add a sreenshot of the browser page in error.</i>"); |
|
125 |
delegatingErrorHander.registerHandler(new ErrorTypeErrorHandlerWrapper<PermissionDeniedException>(PermissionDeniedException.class, new PermissionDeniedErrorHandler(this))); |
|
126 |
delegatingErrorHander.registerHandler(new ErrorTypeErrorHandlerWrapper<Exception>(Exception.class, errorHandler)); |
|
127 |
setErrorHandler(delegatingErrorHander); |
|
128 |
VaadinSession.getCurrent().setErrorHandler(delegatingErrorHander); |
|
129 |
} |
|
130 |
|
|
131 | 110 |
@Override |
132 | 111 |
public <T extends AbstractPopupEditor> String defaultStatusMarkup(Class<T> popupEditorClass){ |
133 | 112 |
if(popupEditorClass.equals(TaxonNamePopupEditor.class)){ |
Also available in: Unified diff
ref #9859 Password Recovery UI and view implemented