Java Code Examples for com.vaadin.flow.component.html.Div#addClassName()
The following examples show how to use
com.vaadin.flow.component.html.Div#addClassName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Log.java From flow with Apache License 2.0 | 5 votes |
public void log(String msg) { Div div = new Div(); div.addClassName("log"); logCount++; div.setText(logCount + ". " + msg); add(div); }
Example 2
Source File: BasicComponentView.java From flow with Apache License 2.0 | 5 votes |
@Override protected void onShow() { getElement().getStyle().set("margin", "1em"); getElement().setAttribute("id", "root"); Text text = new Text(TEXT); Input input = new Input(); input.setPlaceholder("Synchronized on change event"); NativeButton button = new NativeButton(BUTTON_TEXT, e -> { Div greeting = new Div(); greeting.addClassName("thankYou"); String buttonText = e.getSource().getElement().getText(); greeting.setText("Thank you for clicking \"" + buttonText + "\" at (" + e.getClientX() + "," + e.getClientY() + ")! The field value is " + input.getValue()); greeting.addClickListener(e2 -> remove(greeting)); add(greeting); }); Div helloWorld = new Div(); helloWorld.setText(DIV_TEXT); helloWorld.addClassName("hello"); helloWorld.setId("hello-world"); helloWorld.addClickListener(e -> { helloWorld.setText("Stop touching me!"); helloWorld.getElement().getClassList().clear(); }); Style s = helloWorld.getElement().getStyle(); s.set("color", "red"); s.set("fontWeight", "bold"); add(text, helloWorld, button, input); }
Example 3
Source File: PolymerPropertyChangeEventView.java From flow with Apache License 2.0 | 5 votes |
private void propertyChanged(PropertyChangeEvent event) { Div div = new Div(); div.setText("New property value: '" + event.getValue() + "', old property value: '" + event.getOldValue() + "'"); div.addClassName("change-event"); add(div); }
Example 4
Source File: PolymerPropertyMutationInObserverView.java From flow with Apache License 2.0 | 5 votes |
private Div getValueDiv(String eventOldValue, String eventValue) { Div div = new Div(); div.setText(String.format( "Event old value: %s, event value: %s, current model value: %s", eventOldValue, eventValue, getModel().getText())); div.addClassName("model-value"); return div; }
Example 5
Source File: RefreshCloseConnectionView.java From flow with Apache License 2.0 | 4 votes |
private void log(String msg) { Div div = new Div(); div.setText(msg); div.addClassName("log"); add(div); }
Example 6
Source File: PushWithPreserveOnRefreshView.java From flow with Apache License 2.0 | 4 votes |
private void log(String msg) { Div div = new Div(); div.addClassName("log"); div.setText(msg); add(div); }
Example 7
Source File: PreserveOnRefreshShortcutView.java From flow with Apache License 2.0 | 4 votes |
private void handleClick() { Div div = new Div(); div.addClassName("info"); div.setText("Clicked"); add(div); }