Refactor methodname and method call order
Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
@@ -15,7 +15,7 @@ import com.vaadin.ui.Button;
|
|||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorator class for a borderless Button with icon.
|
* Decorator class for a borderless Button with an icon.
|
||||||
*/
|
*/
|
||||||
public class SPUIButtonStyleNoBorderWithIcon implements SPUIButtonDecorator {
|
public class SPUIButtonStyleNoBorderWithIcon implements SPUIButtonDecorator {
|
||||||
|
|
||||||
@@ -25,38 +25,25 @@ public class SPUIButtonStyleNoBorderWithIcon implements SPUIButtonDecorator {
|
|||||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||||
|
|
||||||
this.button = button;
|
this.button = button;
|
||||||
|
button.setSizeFull();
|
||||||
|
|
||||||
button.addStyleName(ValoTheme.LABEL_SMALL);
|
button.addStyleName(ValoTheme.LABEL_SMALL);
|
||||||
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
|
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
|
||||||
|
setOrAddButtonStyle(style, setStyle);
|
||||||
|
|
||||||
setButtonStyle(style, setStyle);
|
|
||||||
setButtonIcon(icon);
|
setButtonIcon(icon);
|
||||||
|
|
||||||
button.setSizeFull();
|
|
||||||
|
|
||||||
setButtonStyle(style, setStyle);
|
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void setOrAddButtonStyle(final String style, final boolean setStyle) {
|
||||||
* It is possible to add or set a new style to the button. If a new style is
|
|
||||||
* set the other styles (LABEL_SMALL and BUTTON_BORDERLESS_COLORED) will be
|
|
||||||
* overwritten
|
|
||||||
*
|
|
||||||
* @param style
|
|
||||||
* styleName
|
|
||||||
* @param setStyle
|
|
||||||
* boolean: Trigger if the style should be added or replace the
|
|
||||||
* other styles
|
|
||||||
*/
|
|
||||||
private void setButtonStyle(final String style, final boolean setStyle) {
|
|
||||||
|
|
||||||
if (StringUtils.isEmpty(style)) {
|
if (StringUtils.isEmpty(style)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setStyle) {
|
if (setStyle) {
|
||||||
|
// overwrite all other styles
|
||||||
button.setStyleName(style);
|
button.setStyleName(style);
|
||||||
} else {
|
} else {
|
||||||
button.addStyleName(style);
|
button.addStyleName(style);
|
||||||
|
|||||||
Reference in New Issue
Block a user