|
3 | 3 | import com.vaadin.demo.DemoExporter; // hidden-source-line |
4 | 4 | import com.vaadin.flow.component.Unit; |
5 | 5 | import com.vaadin.flow.component.button.Button; |
6 | | -import com.vaadin.flow.component.button.ButtonVariant; |
7 | | -import com.vaadin.flow.component.datepicker.DatePicker; |
8 | | -import com.vaadin.flow.component.html.*; |
9 | | -import com.vaadin.flow.component.icon.Icon; |
10 | | -import com.vaadin.flow.component.icon.VaadinIcon; |
11 | | -import com.vaadin.flow.component.orderedlayout.FlexComponent; |
| 6 | +import com.vaadin.flow.component.card.Card; |
| 7 | +import com.vaadin.flow.component.html.Div; |
| 8 | +import com.vaadin.flow.component.markdown.Markdown; |
12 | 9 | import com.vaadin.flow.component.orderedlayout.Scroller; |
13 | | -import com.vaadin.flow.component.orderedlayout.VerticalLayout; |
14 | | -import com.vaadin.flow.component.textfield.TextArea; |
15 | | -import com.vaadin.flow.component.textfield.TextField; |
16 | 10 | import com.vaadin.flow.router.Route; |
17 | 11 |
|
18 | | -import java.time.LocalDate; |
19 | | - |
20 | 12 | @Route("scroller-basic") |
21 | | -public class ScrollerBasic extends VerticalLayout { |
| 13 | +public class ScrollerBasic extends Div { |
22 | 14 |
|
23 | | - public static final String PERSONAL_TITLE_ID = "personal-title"; |
24 | | - public static final String EMPLOYMENT_TITLE_ID = "employment-title"; |
| 15 | + private static final String EVENT_DETAILS = """ |
| 16 | +**Date & Time** |
25 | 17 |
|
26 | | - public ScrollerBasic() { |
27 | | - getStyle().set("border", "solid 1px var(--vaadin-border-color)"); |
28 | | - setHeight(400, Unit.PIXELS); |
29 | | - setMaxWidth(100, Unit.PERCENTAGE); |
30 | | - setPadding(false); |
31 | | - setSpacing(false); |
32 | | - setWidth(360, Unit.PIXELS); |
33 | | - setAlignItems(FlexComponent.Alignment.STRETCH); |
| 18 | +Saturday, July 19, 2025 |
| 19 | +9:00 AM – 5:00 PM (PDT) |
| 20 | +
|
| 21 | +**About This Event** |
| 22 | +
|
| 23 | +Join us for a full day of inspiring talks, hands-on workshops, and networking opportunities with industry leaders. Whether you're a seasoned developer or just starting out, there's something for everyone. |
| 24 | +
|
| 25 | +**Schedule** |
| 26 | +
|
| 27 | +- **9:00 AM** – Registration & Breakfast |
| 28 | +- **10:00 AM** – Opening Keynote |
| 29 | +- **11:30 AM** – Breakout Sessions |
| 30 | +- **1:00 PM** – Lunch & Networking |
| 31 | +- **2:30 PM** – Afternoon Workshops |
| 32 | +- **4:30 PM** – Closing Remarks & Raffle |
34 | 33 |
|
35 | | - // Header |
36 | | - Header header = new Header(); |
37 | | - header.getStyle().set("display", "flex").set("align-items", "center") |
38 | | - .set("gap", "1rem").set("padding", "1rem") |
39 | | - .set("border-bottom", "solid 1px #ccc"); |
| 34 | +**What to Bring** |
40 | 35 |
|
41 | | - H2 editEmployee = new H2("Edit employee"); |
42 | | - editEmployee.getStyle().set("font-size", "1.375rem"); |
| 36 | +- Photo ID for check-in |
| 37 | +- Laptop (optional, for workshops) |
| 38 | +- Business cards for networking |
43 | 39 |
|
44 | | - Icon arrowLeft = VaadinIcon.ARROW_LEFT.create(); |
45 | | - arrowLeft.getStyle().set("padding", "0.25rem"); |
46 | | - arrowLeft.getElement().setAttribute("aria-hidden", "true"); |
| 40 | +**Parking** |
47 | 41 |
|
48 | | - Anchor goBack = new Anchor("#", arrowLeft); |
49 | | - goBack.setAriaLabel("Go back"); |
| 42 | +Free parking available in Lot B. Street parking is limited. |
50 | 43 |
|
51 | | - header.add(goBack, editEmployee); |
52 | | - add(header); |
| 44 | +**Contact** |
| 45 | +
|
| 46 | +Questions? Email us at [email protected] |
| 47 | + """; |
| 48 | + |
| 49 | + public ScrollerBasic() { |
| 50 | + Card card = new Card(); |
| 51 | + card.setMaxWidth(400, Unit.PIXELS); |
| 52 | + |
| 53 | + card.setTitle("Summer Tech Conference 2025"); |
53 | 54 |
|
54 | 55 | // tag::snippet[] |
55 | | - // Personal information |
56 | | - H3 personalTitle = new H3("Personal information"); |
57 | | - personalTitle.getStyle().set("font-size", "1.125rem"); |
58 | | - personalTitle.setId(PERSONAL_TITLE_ID); |
59 | | - |
60 | | - TextField firstName = new TextField("First name"); |
61 | | - firstName.setWidthFull(); |
62 | | - |
63 | | - TextField lastName = new TextField("Last name"); |
64 | | - lastName.setWidthFull(); |
65 | | - |
66 | | - DatePicker birthDate = new DatePicker("Birthdate"); |
67 | | - birthDate.setInitialPosition(LocalDate.of(1990, 1, 1)); |
68 | | - birthDate.setWidthFull(); |
69 | | - |
70 | | - Section personalInformation = new Section(personalTitle, firstName, |
71 | | - lastName, birthDate); |
72 | | - personalInformation.getElement().setAttribute("aria-labelledby", |
73 | | - PERSONAL_TITLE_ID); |
74 | | - |
75 | | - // Employment information |
76 | | - H3 employmentTitle = new H3("Employment information"); |
77 | | - employmentTitle.getStyle().set("font-size", "1.125rem") |
78 | | - .set("margin-top", "1.5rem"); |
79 | | - employmentTitle.setId(EMPLOYMENT_TITLE_ID); |
80 | | - |
81 | | - TextField position = new TextField("Position"); |
82 | | - position.setWidthFull(); |
83 | | - |
84 | | - TextArea additionalInformation = new TextArea("Additional Information"); |
85 | | - additionalInformation.setWidthFull(); |
86 | | - |
87 | | - Section employmentInformation = new Section(employmentTitle, position, |
88 | | - additionalInformation); |
89 | | - employmentInformation.getElement().setAttribute("aria-labelledby", |
90 | | - EMPLOYMENT_TITLE_ID); |
91 | | - |
92 | | - Scroller scroller = new Scroller( |
93 | | - new Div(personalInformation, employmentInformation)); |
94 | | - scroller.getStyle().set("border-bottom", "solid 1px #ccc") |
95 | | - .set("padding", "1rem"); |
96 | | - scroller.setScrollDirection(Scroller.ScrollDirection.VERTICAL); |
97 | | - add(scroller); |
98 | | - // end::snippet[] |
| 56 | + Markdown markdown = new Markdown(EVENT_DETAILS); |
99 | 57 |
|
100 | | - // Footer |
101 | | - Button save = new Button("Save"); |
102 | | - save.addThemeVariants(ButtonVariant.LUMO_PRIMARY); |
| 58 | + Scroller scroller = new Scroller(markdown); |
| 59 | + scroller.addThemeName("overflow-indicators"); |
| 60 | + scroller.setMaxHeight(300, Unit.PIXELS); |
| 61 | + // end::snippet[] |
| 62 | + card.add(scroller); |
103 | 63 |
|
104 | | - Button reset = new Button("Reset"); |
105 | | - reset.addThemeVariants(ButtonVariant.LUMO_TERTIARY); |
| 64 | + Button addToCalendar = new Button("Add to calendar"); |
| 65 | + card.addToFooter(addToCalendar); |
106 | 66 |
|
107 | | - Footer footer = new Footer(save, reset); |
108 | | - footer.getStyle().set("display", "flex").set("gap", "0.5rem") |
109 | | - .set("padding", "0.5rem 1rem"); |
110 | | - add(footer); |
| 67 | + add(card); |
111 | 68 | } |
112 | 69 |
|
113 | 70 | public static class Exporter extends DemoExporter<ScrollerBasic> { // hidden-source-line |
|
0 commit comments