Skip to content

Commit

Permalink
Step 3 | 03:22 | Place HorizontalSplitPanel and Grid instead of demo …
Browse files Browse the repository at this point in the history
…code
  • Loading branch information
amahdy committed Jun 1, 2017
1 parent f6e9142 commit c680896
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions src/main/java/org/vaadin/stepbystep/MyUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
import com.vaadin.annotations.Theme;
import com.vaadin.cdi.CDIUI;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Grid;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import org.vaadin.stepbystep.person.backend.Person;

/**
* This UI is the application entry point. A UI may either represent a browser window
Expand All @@ -20,21 +19,18 @@
@CDIUI("")
public class MyUI extends UI {

HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
Grid<Person> grid = new Grid<>(Person.class);

@Override
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout layout = new VerticalLayout();

final TextField name = new TextField();
name.setCaption("Type your name here:");

Button button = new Button("Click Me");
button.addClickListener( e -> {
layout.addComponent(new Label("Thanks " + name.getValue()
+ ", it works!"));
});

layout.addComponents(name, button);

setContent(layout);

splitPanel.setSizeFull();
grid.setSizeFull();

splitPanel.setFirstComponent(grid);

setContent(splitPanel);

}
}

0 comments on commit c680896

Please sign in to comment.