Spring Boot와 Vaadin의 full stack 어플리케이션 ( JPA, PostgreSQL )
Web Tech./Spring Framework 2017. 2. 24. 20:30Spring Boot와 Vaadin의 full stack 어플리케이션 ( JPA, PostgreSQL )
- Vaadin은 무멋인가?
2. 프로젝트 불러오기
package com.example;
import com.vaadin.annotation.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.UI;
@SpringUI
@Theme("valo")
public class TodoUI extends UI {
private VerticalLayout layout;
@Override
protected void init(VaadinRequest vaadinRequest) {
// 화면 구성 하기
setupLayout();
addHeader();
addForm();
addTodoList();
addActionButton();
}
}
private void setupLayout(){
layout = new VerticalLayout();
setContent(layout);
}
private void addHeader(){
Label header = new Label("TODO");layout.addComponent(header);
}
private void addForm(){
HorizontalLayout formLayout = new HorizontalLayout();TextField taskField = new TextField();
Button addButton = new Button("Add"); // 나중에 icon으로 변경
formLayout.addComponent(taskField, addButton);
layout.addComponent(formLayout);
}
private void addTodoList(){
//@Autowired TodoList todoList 추가
layout.addComponent(todoList);
}
@Component
public class TodoList extends VerticalLayout {
}
private void addActionButton() {
Button deleteButton = new Button("Delete completed");
layout.addComponent(deleteButton);
}
원문 : 동영상 강좌
https://www.youtube.com/watch?v=tnVKN25dIm8
-- 추가 꾸미기
private void setupLayout() {
...
layout.setSpacing(true);
layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
...
}
private void addHeader() {
...
header.addStyleName(ValoTheme.LABEL_H1);
header.setSizeUndefined();
...
}
private void addForm() {
...
formLayout.setSpacing(true);
formLayout.setWidth("80%");
}
private void addTodoList() {
...
todoList.setWidth("80%");
}
private void addActionButton() {
...
deleteButton.addClickListener(click->todoList.deleteCompleted());
}
* Vaadin Login Example
https://examples.javacodegeeks.com/enterprise-java/vaadin/vaadin-login-example/
'Web Tech. > Spring Framework' 카테고리의 다른 글
Vaadin Appication 만들기 (0) | 2017.03.08 |
---|---|
XSS ( Cross Site Scripting ) 제거 하기 ( 필터링 ) (0) | 2017.03.07 |
Maven을 윈도우10에 설치하기 (0) | 2017.02.24 |
Jenkins/젠킨스 설치, 빌드설정, Port변경 (2) | 2017.02.14 |
60초안에 리눅스 성능 분석하기 (0) | 2017.02.07 |