Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- MSSQL
- xPlatform
- window
- tomcat
- plugin
- NPM
- mapreduce
- JavaScript
- react
- Express
- mybatis
- Eclipse
- R
- table
- SPC
- Python
- hadoop
- Sqoop
- 공정능력
- IntelliJ
- Spring
- SQL
- vaadin
- Kotlin
- Java
- es6
- SSL
- Android
- 보조정렬
- GIT
Archives
- Today
- Total
DBILITY
vaadin flow updating page title on navigation 본문
반응형
공식 사이트 문서를 참조하여 작성하였다.
navigation이 이루어지는 동안 페이지 title을 업데이트하는 방법은 두 가지가 있다.
@PageTitle Annotation을 이용하는 방법과 HasDymamicTitle interface를 구현하는 방법이 있으며, 이 두 가지 접근법은 상호 배타적이라 동일 class에 구현 시 runtime exception이 발생한다.
@PageTitle Annotation은 가장 편리한 방법으로 Component class에 설정하게 되며, 실제 존재하는 navigation target에 대해서만 인식한다. 상위class나 상위 view는 고려되지 않는다.
@PageTitle("home")
class HomeView extends Div {
HomeView(){
setText("This is the home view");
}
}
HasDynamicTitle interface를 구현하는 방법은 개발자가 runtime시 변경할 수 있게 허용한다.
@Route(value = "blog")
class BlogPost extends Component
implements HasDynamicTitle, HasUrlParameter<Long> {
private String title = "";
@Override
public String getPageTitle() {
return title;
}
@Override
public void setParameter(BeforeEvent event,
@OptionalParameter Long parameter) {
if (parameter != null) {
title = "Blog Post #" + parameter;
} else {
title = "Blog Home";
}
}
}반응형
'front-end & ui > vaadin flow' 카테고리의 다른 글
| vaadin flow - grid (0) | 2018.09.11 |
|---|---|
| vaadin flow - using vaadin components (0) | 2018.09.11 |
| vaadin flow getting registered routes (0) | 2018.09.11 |
| vaadin flow router exception handling (0) | 2018.09.10 |
| vaadin flow navigating between routes (0) | 2018.09.10 |
Comments