Skip to content

Commit

Permalink
refactor: run formatter (#4036)
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen authored Dec 20, 2024
1 parent d2e14b9 commit 6b430fc
Show file tree
Hide file tree
Showing 31 changed files with 155 additions and 119 deletions.
16 changes: 8 additions & 8 deletions articles/components/_input-field-common-features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ The following style variants can be applied:
// end::styles-intro[]


//tag::text-alignment[]
// tag::text-alignment[]
[#text-alignment]
.Text Alignment
[%collapsible]
Expand All @@ -229,30 +229,30 @@ Three different text alignments are supported: `left`, which is the default; `ce
Right-alignment is recommended for numerical values when presented in vertical groups. This tends to aid interpretation and comparison of values.
====
//end::text-alignment[]
// end::text-alignment[]


//tag::small-variant[]
// tag::small-variant[]
[#small-variant]
.Small Variant
[%collapsible]
====
The small variant can be used to make individual fields more compact. The default size of fields can be customized with <<{articles}/styling/lumo/lumo-style-properties#,style properties>>.
====
//end::small-variant[]
// end::small-variant[]


//tag::helper-above-field[]
// tag::helper-above-field[]
[#helper-above-field]
.Helper Above Field
[%collapsible]
====
The helper can be rendered above the field, and below the label.
====
//end::helper-above-field[]
// end::helper-above-field[]


//tag::borders[]
// tag::borders[]
[#borders]
.[since:com.vaadin:[email protected]]#Borders#
[%collapsible]
Expand All @@ -261,4 +261,4 @@ Borders can be applied to the field surface by providing a value (e.g., `1px`) t
You can override the default border color with the `--vaadin-input-field-border-color` property.
====
//end::borders[]
// end::borders[]
16 changes: 8 additions & 8 deletions articles/components/_shared-code-snippets.adoc
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
//tag::aria-label-java[]
// tag::aria-label-java[]
// Associates external element as label:
NativeLabel label = new NativeLabel("This is the label");
label.setId("external-label");
field.setAriaLabelledBy("external-label");

// Invisible label for screen readers:
field.setAriaLabel("This is the label");
//end::aria-label-java[]
// end::aria-label-java[]


//tag::aria-label-typescript[]
// tag::aria-label-typescript[]
<!-- Associates external element as label: -->
<label id="external-label">This is the label</label>
<{tag-name} accessible-name-ref="external-label">...

<!-- Invisible label for screen readers: -->
<{tag-name} accessible-name="This is the label">...
//end::aria-label-typescript[]
// end::aria-label-typescript[]



//tag::aria-label-dtp-java[]
// tag::aria-label-dtp-java[]
// Invisible label for screen readers:
field.setAriaLabel("Meeting");
// Suffixes for sub-fields:
field.setDateAriaLabel("date"); // -> "Meeting date"
field.setDateAriaLabel("time"); // -> "Meeting time"
//end::aria-label-dtp-java[]
// end::aria-label-dtp-java[]


//tag::aria-label-dtp-typescript[]
// tag::aria-label-dtp-typescript[]
<!-- Invisible label for screen readers: -->
<date-time-picker accessible-name="Meeting">...
<!-- Suffixes for date and time sub-fields are set through the i18n object -->
//end::aria-label-dtp-typescript[]
// end::aria-label-dtp-typescript[]

Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ public BasicLayoutsExpandingItems() {
// end::snippet[]
layout.setPadding(true);
layout.add(item1);

Div item2 = new Div("Item 2");
item2.setClassName("example-item");
layout.add(item2);

Div item3 = new Div("Item 3");
item3.setClassName("example-item");
layout.add(item3);

this.add(layout);
this.setClassName("basic-layouts-example");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class BasicLayoutsHorizontalLayoutSpacing extends Div {
public BasicLayoutsHorizontalLayoutSpacing() {
add(new Paragraph("Horizontal layout without spacing:"));
// tag::snippet[]
// HorizontalLayout has spacing enabled by default, use setSpacing to disable it
// HorizontalLayout has spacing enabled by default, use setSpacing to
// disable it
HorizontalLayout layoutWithoutSpacing = new HorizontalLayout();
layoutWithoutSpacing.setSpacing(false);
// end::snippet[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public BasicLayoutsHorizontalLayoutWrapping() {
Div wrapItem5 = new Div("Item 5");
wrapItem5.setClassName("example-item");

layoutWithWrap.add(wrapItem1, wrapItem2, wrapItem3, wrapItem4, wrapItem5);
layoutWithWrap.add(wrapItem1, wrapItem2, wrapItem3, wrapItem4,
wrapItem5);

this.setClassName("basic-layouts-example");
this.add(layoutWithWrap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public BasicLayoutsPadding() {
parent.add(wrapper);

// tag::snippet[]
// VerticalLayout has padding enabled by default, use setPadding to disable it
// VerticalLayout has padding enabled by default, use setPadding to
// disable it
VerticalLayout layoutWithoutPadding = new VerticalLayout();
layoutWithoutPadding.setPadding(false);
// end::snippet[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public BasicLayoutsSpacing() {
parent.add(wrapper);

// tag::snippet[]
// VerticalLayout has spacing enabled by default, use setSpacing to disable it
// VerticalLayout has spacing enabled by default, use setSpacing to
// disable it
VerticalLayout layoutWithoutSpacing = new VerticalLayout();
layoutWithoutSpacing.setSpacing(false);
// end::snippet[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public BasicLayoutsVerticalLayoutWrapping() {
layoutWithoutWrap.setSpacing(true);
layoutWithoutWrap.setAlignItems(FlexComponent.Alignment.STRETCH);
layoutWithoutWrap.setHeight("200px");

Div item1 = new Div("Item 1");
item1.setClassName("example-item");
Div item2 = new Div("Item 2");
Expand All @@ -35,7 +35,7 @@ public BasicLayoutsVerticalLayoutWrapping() {
item3.setClassName("example-item");
Div item4 = new Div("Item 4");
item4.setClassName("example-item");

layoutWithoutWrap.add(item1, item2, item3, item4);
wrapper.add(layoutWithoutWrap);
parent.add(wrapper);
Expand All @@ -52,7 +52,7 @@ public BasicLayoutsVerticalLayoutWrapping() {
layoutWithWrap.setSpacing(true);
layoutWithWrap.setAlignItems(FlexComponent.Alignment.STRETCH);
layoutWithWrap.setHeight("200px");

Div wrapItem1 = new Div("Item 1");
wrapItem1.setClassName("example-item");
Div wrapItem2 = new Div("Item 2");
Expand All @@ -61,7 +61,7 @@ public BasicLayoutsVerticalLayoutWrapping() {
wrapItem3.setClassName("example-item");
Div wrapItem4 = new Div("Item 4");
wrapItem4.setClassName("example-item");

layoutWithWrap.add(wrapItem1, wrapItem2, wrapItem3, wrapItem4);
wrapper.add(layoutWithWrap);
parent.add(wrapper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class ContextMenuDisableOnClick extends Div {

public ContextMenuDisableOnClick() {
Paragraph paragraph = new Paragraph();
paragraph.setText("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.");
paragraph.setText(
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.");
add(paragraph);

ContextMenu menu = new ContextMenu(paragraph);
Expand All @@ -33,6 +34,7 @@ public ContextMenuDisableOnClick() {
});
}

public static class Exporter extends DemoExporter<ContextMenuDisableOnClick> { // hidden-source-line
public static class Exporter // hidden-source-line
extends DemoExporter<ContextMenuDisableOnClick> { // hidden-source-line
} // hidden-source-line
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public DashboardAnnouncements() {
conversions.setContent(createWidgetContent());
dashboard.add(conversions);

DashboardWidget visitorsByCountry = new DashboardWidget("Visitors by country");
DashboardWidget visitorsByCountry = new DashboardWidget(
"Visitors by country");
visitorsByCountry.setContent(createWidgetContent());
visitorsByCountry.setRowspan(2);
dashboard.add(visitorsByCountry);
Expand All @@ -43,24 +44,26 @@ public DashboardAnnouncements() {
catImage.setContent(createWidgetContent());
dashboard.add(catImage);

DashboardWidget visitorsByBrowser = new DashboardWidget("Visitors by browser");
DashboardWidget visitorsByBrowser = new DashboardWidget(
"Visitors by browser");
visitorsByBrowser.setContent(createWidgetContent());
visitorsByBrowser.setColspan(2);
dashboard.add(visitorsByBrowser);

// tag::snippet[]
// Live region for screen reader announcements. Changing its text content will result
// in a new announcement. This element is only visible for demonstration purposes. In
// your application you should visually hide it using CSS, for example by using the
// sr-only Lumo utility class:
// Live region for screen reader announcements. Changing its text
// content will result in a new announcement. This element is only
// visible for demonstration purposes. In your application you should
// visually hide it using CSS, for example by using the sr-only Lumo
// utility class:
// liveRegion.addClassName(LumoUtility.Accessibility.SCREEN_READER_ONLY)
Div liveRegion = new Div();
liveRegion.getElement().setAttribute("aria-live", "polite");
add(liveRegion);

// This event is fired when the user starts or stops editing a widget
dashboard.addItemSelectedChangedListener(event -> {
String title = ((DashboardWidget)event.getItem()).getTitle();
String title = ((DashboardWidget) event.getItem()).getTitle();
String selected = event.isSelected() ? "selected" : "deselected";

liveRegion.setText("Widget " + title + " " + selected);
Expand Down Expand Up @@ -88,9 +91,10 @@ public DashboardAnnouncements() {
dashboard.addItemMovedListener(event -> {
int position = event.getItems().indexOf(event.getItem()) + 1;
int total = event.getItems().size();
String title = ((DashboardWidget)event.getItem()).getTitle();
String title = ((DashboardWidget) event.getItem()).getTitle();

liveRegion.setText("Moved widget " + title + " to position " + position + " of " + total);
liveRegion.setText("Moved widget " + title + " to position "
+ position + " of " + total);
});

// This event is fired when the user resizes a widget
Expand All @@ -99,12 +103,13 @@ public DashboardAnnouncements() {
int rowspan = event.getItem().getRowspan();
String title = event.getItem().getTitle();

liveRegion.setText("Resized widget " + title + " to " + colspan + " columns, " + rowspan + " rows");
liveRegion.setText("Resized widget " + title + " to " + colspan
+ " columns, " + rowspan + " rows");
});

// This event is fired when the user removes a widget
dashboard.addItemRemovedListener(event -> {
String title = ((DashboardWidget)event.getItem()).getTitle();
String title = ((DashboardWidget) event.getItem()).getTitle();

liveRegion.setText("Removed widget " + title);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public DashboardBasic() {
conversions.setContent(createWidgetContent());
dashboard.add(conversions);

DashboardWidget visitorsByCountry = new DashboardWidget("Visitors by country");
DashboardWidget visitorsByCountry = new DashboardWidget(
"Visitors by country");
visitorsByCountry.setContent(createWidgetContent());
visitorsByCountry.setRowspan(2);
dashboard.add(visitorsByCountry);
Expand All @@ -40,7 +41,8 @@ public DashboardBasic() {
catImage.setContent(createWidgetContent());
dashboard.add(catImage);

DashboardWidget visitorsByBrowser = new DashboardWidget("Visitors by browser");
DashboardWidget visitorsByBrowser = new DashboardWidget(
"Visitors by browser");
visitorsByBrowser.setContent(createWidgetContent());
visitorsByBrowser.setColspan(2);
dashboard.add(visitorsByBrowser);
Expand Down
Loading

0 comments on commit 6b430fc

Please sign in to comment.