-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e3d1e7
commit 128da8c
Showing
20 changed files
with
2,335 additions
and
1,021 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
demo-v14/src/main/java/org/vaadin/miki/demo/builders/CanModifyTextBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.vaadin.miki.demo.builders; | ||
|
||
import com.vaadin.flow.component.Component; | ||
import com.vaadin.flow.component.button.Button; | ||
import com.vaadin.flow.component.html.Span; | ||
import com.vaadin.flow.component.orderedlayout.FlexComponent; | ||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout; | ||
import org.vaadin.miki.demo.ContentBuilder; | ||
import org.vaadin.miki.demo.Order; | ||
import org.vaadin.miki.markers.CanModifyText; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.ZoneOffset; | ||
import java.util.function.Consumer; | ||
|
||
@Order(12) | ||
public class CanModifyTextBuilder implements ContentBuilder<CanModifyText> { | ||
|
||
@Override | ||
public void buildContent(CanModifyText component, Consumer<Component[]> callback) { | ||
final Button addTextFromServer = new Button("Replace selection", event -> | ||
component.modifyText(String.format("(utc epoch time is %d)", LocalDateTime.now().toEpochSecond(ZoneOffset.UTC))) | ||
); | ||
final HorizontalLayout layout = new HorizontalLayout(new Span("Select something (or not) in the field above, then press the button: "), addTextFromServer); | ||
layout.setAlignItems(FlexComponent.Alignment.CENTER); | ||
callback.accept(new Component[]{layout}); | ||
} | ||
} |
Oops, something went wrong.