Revision c226920a
Added by Fabian Reimeier almost 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/component/distributionStatus/DistributionToolbar.java | ||
---|---|---|
24 | 24 |
import eu.etaxonomy.vaadin.ui.navigation.NavigationEvent; |
25 | 25 |
import eu.etaxonomy.vaadin.ui.navigation.NavigationManager; |
26 | 26 |
|
27 |
/** |
|
28 |
* A toolbar for the distribution app. Displayed at the top of the screen. |
|
29 |
*/ |
|
27 | 30 |
@SpringComponent("distributionToolbar") |
28 | 31 |
@ViewScope |
29 | 32 |
public class DistributionToolbar extends HorizontalLayout implements Serializable{ |
... | ... | |
72 | 75 |
// private final Authentication authentication; |
73 | 76 |
// private ExcelExporter exporter = new ExcelExporter(); |
74 | 77 |
|
78 |
/** |
|
79 |
* Constructs the toolbar. |
|
80 |
*/ |
|
75 | 81 |
@PostConstruct |
76 | 82 |
public void init() { |
77 | 83 |
setMargin(true); |
... | ... | |
109 | 115 |
updateAuthenticationButtons(); |
110 | 116 |
} |
111 | 117 |
|
118 |
/** |
|
119 |
* Called when authentication was successful. Updates the user menu buttons. |
|
120 |
* @param event |
|
121 |
*/ |
|
112 | 122 |
@EventBusListenerMethod |
113 | 123 |
public void onAuthenticationSuccessEvent(org.vaadin.spring.events.Event<AuthenticationSuccessEvent> event){ |
114 | 124 |
boolean isInitialized = userButton != null; |
... | ... | |
120 | 130 |
} |
121 | 131 |
} |
122 | 132 |
|
123 |
/**
|
|
124 |
* @param event
|
|
125 |
*/
|
|
133 |
/**
|
|
134 |
* Updates the user menu buttons on login and logout.
|
|
135 |
*/
|
|
126 | 136 |
protected void updateAuthenticationButtons() { |
127 | 137 |
if(userHelper.userIsAutheticated() && !userHelper.userIsAnnonymous()){ |
128 | 138 |
userButton.setCaption(userHelper.userName()); |
... | ... | |
154 | 164 |
uiEventBus.publish(this, new NavigationEvent("login", navigationManager.getCurrentViewName())); //$NON-NLS-1$ |
155 | 165 |
} |
156 | 166 |
|
157 |
|
|
167 |
/** |
|
168 |
* Logs the user out and closes the session. |
|
169 |
*/ |
|
158 | 170 |
private void performLogout() { |
159 | 171 |
userHelper.logout(); |
160 | 172 |
updateAuthenticationButtons(); |
161 | 173 |
navigationManager.reloadCurrentView(); |
162 | 174 |
} |
163 | 175 |
|
176 |
/** |
|
177 |
* The settings button. |
|
178 |
* @return |
|
179 |
*/ |
|
164 | 180 |
public Button getSettingsButton(){ |
165 | 181 |
return settingsButton; |
166 | 182 |
} |
167 | 183 |
|
184 |
/** |
|
185 |
* Button to open the {@link DistributionStatusSettingsConfigWindow}. |
|
186 |
* @return Button to display the {@link DistributionStatusSettingsConfigWindow}. |
|
187 |
*/ |
|
168 | 188 |
public Button getDistributionSettingsButton() { |
169 | 189 |
return distributionSettingsButton; |
170 | 190 |
} |
171 | 191 |
|
192 |
/** |
|
193 |
* Unused. |
|
194 |
* @return |
|
195 |
*/ |
|
172 | 196 |
public Button getEditButton() { |
173 | 197 |
return editButton; |
174 | 198 |
} |
175 | 199 |
|
200 |
/** |
|
201 |
* Unused. |
|
202 |
* @return |
|
203 |
*/ |
|
176 | 204 |
public Button getSaveButton() { |
177 | 205 |
return saveButton; |
178 | 206 |
} |
179 | 207 |
|
208 |
/** |
|
209 |
* Button to open the {@link DetailWindow}. |
|
210 |
* @return Button to open the {@link DetailWindow}. |
|
211 |
*/ |
|
180 | 212 |
public Button getDetailButton() { |
181 | 213 |
return detailButton; |
182 | 214 |
} |
183 | 215 |
|
184 |
public Button getHelpButton() { |
|
185 |
return helpButton; |
|
186 |
} |
|
216 |
/** |
|
217 |
* Button to open the {@link HelpWindow}. |
|
218 |
* @return Button to open the {@link HelpWindow}. |
|
219 |
*/ |
|
220 |
public Button getHelpButton() { |
|
221 |
return helpButton; |
|
222 |
} |
|
187 | 223 |
} |
Also available in: Unified diff
Documentation and refactoring