Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Use Radio-button-groups in FlexLayout demos #152

Merged
merged 1 commit into from
Jun 30, 2020
Merged

Conversation

anasmi
Copy link
Contributor

@anasmi anasmi commented Jun 17, 2020

For better readability and consistency with the Horizontal and Vertical demos, use RBG element to choose a property.

For better readability and consistency with the Horizontal and Vertical demos, use RBG element to choose a property.
// end-source-example

layout.setId("flex-layout-with-alignment-content");

Consumer<FlexLayout.ContentAlignment> changeLayout = alignment -> layout

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Replace this lambda with a method reference. rule

// end-source-example
Consumer<FlexLayout.FlexDirection> flexDirectionConsumer = flexDirection -> layout

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Replace this lambda with a method reference. rule

@@ -82,26 +81,23 @@ private void createFlexLayoutWithAlignmentContent() {
layout.setWidth("130px");
layout.setHeight("150px");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Define a constant instead of duplicating this literal "150px" 4 times. rule

// end-source-example

layout.setId("flex-layout-with-alignment-content");

Consumer<FlexLayout.ContentAlignment> changeLayout = alignment -> layout
.setAlignContent(alignment);
addCard("FlexLayout", "FlexLayout with alignment content", layout,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Define a constant instead of duplicating this literal "FlexLayout" 5 times. rule

@@ -82,26 +81,23 @@ private void createFlexLayoutWithAlignmentContent() {
layout.setWidth("130px");
layout.setHeight("150px");
layout.getStyle().set("border", "1px solid #9E9E9E");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Define a constant instead of duplicating this literal "1px solid #9E9E9E" 22 times. rule
CRITICAL Define a constant instead of duplicating this literal "border" 22 times. rule

@@ -82,26 +81,23 @@ private void createFlexLayoutWithAlignmentContent() {
layout.setWidth("130px");
layout.setHeight("150px");
layout.getStyle().set("border", "1px solid #9E9E9E");
layout.setWrapMode(FlexLayout.WrapMode.WRAP);
layout.setFlexWrap(FlexLayout.FlexWrap.WRAP);

Component component1 = createComponent(1, "#78909C");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Define a constant instead of duplicating this literal "#78909C" 19 times. rule

@@ -82,26 +81,23 @@ private void createFlexLayoutWithAlignmentContent() {
layout.setWidth("130px");
layout.setHeight("150px");
layout.getStyle().set("border", "1px solid #9E9E9E");
layout.setWrapMode(FlexLayout.WrapMode.WRAP);
layout.setFlexWrap(FlexLayout.FlexWrap.WRAP);

Component component1 = createComponent(1, "#78909C");
Component component2 = createComponent(2, "#546E7A");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Define a constant instead of duplicating this literal "#546E7A" 17 times. rule

// end-source-example

RadioButtonGroup<String> widths = new RadioButtonGroup<>();
widths.setItems("200px", "100%", "auto");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Define a constant instead of duplicating this literal "200px" 7 times. rule

@@ -82,26 +81,23 @@ private void createFlexLayoutWithAlignmentContent() {
layout.setWidth("130px");
layout.setHeight("150px");
layout.getStyle().set("border", "1px solid #9E9E9E");
layout.setWrapMode(FlexLayout.WrapMode.WRAP);
layout.setFlexWrap(FlexLayout.FlexWrap.WRAP);

Component component1 = createComponent(1, "#78909C");
Component component2 = createComponent(2, "#546E7A");
Component component3 = createComponent(3, "#37474F");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL Define a constant instead of duplicating this literal "#37474F" 15 times. rule

rbg.setRenderer(
new TextRenderer<>(enumValue -> enumValue.name().toLowerCase()));

rbg.addValueChangeListener(e -> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Remove useless curly braces around statement rule

@vaadin-bot
Copy link

SonarQube analysis reported 18 issues

  • CRITICAL 13 critical
  • MAJOR 2 major
  • MINOR 3 minor

Watch the comments in this conversation to review them.

7 extra issues

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. CRITICAL AbstractLayout.java#L61: Define a constant instead of duplicating this literal "Border-box" 3 times. rule
  2. CRITICAL OrderedLayoutView.java#L231: Define a constant instead of duplicating this literal "padding" 3 times. rule
  3. CRITICAL OrderedLayoutView.java#L238: Define a constant instead of duplicating this literal "HorizontalLayout" 8 times. rule
  4. CRITICAL OrderedLayoutView.java#L297: Define a constant instead of duplicating this literal "fontSize" 3 times. rule
  5. CRITICAL OrderedLayoutView.java#L479: Define a constant instead of duplicating this literal "VerticalLayout" 8 times. rule
  6. MAJOR OrderedLayoutView.java#L425: Call "Optional#isPresent()" before accessing the value. rule
  7. MAJOR OrderedLayoutView.java#L666: Call "Optional#isPresent()" before accessing the value. rule

@tmattsso tmattsso merged commit d5a7523 into master Jun 30, 2020
@tmattsso tmattsso deleted the refactor-flex-layout branch June 30, 2020 08:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants