Changed class name, and refactored the style logic (set / add style)
Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
@@ -25,7 +25,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleBorderWithIcon;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorderWithIcon;
|
||||
import org.eclipse.hawkbit.ui.layouts.AbstractCreateUpdateTagLayout;
|
||||
import org.eclipse.hawkbit.ui.management.targettable.TargetAddUpdateWindowLayout;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
@@ -411,7 +411,7 @@ public class CommonDialogWindow extends Window implements Serializable {
|
||||
|
||||
private void createCancelButton() {
|
||||
cancelButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.CANCEL_BUTTON, "Cancel", "", "", true,
|
||||
FontAwesome.TIMES, SPUIButtonStyleBorderWithIcon.class);
|
||||
FontAwesome.TIMES, SPUIButtonStyleNoBorderWithIcon.class);
|
||||
cancelButton.setSizeUndefined();
|
||||
if (cancelButtonClickListener != null) {
|
||||
cancelButton.addClickListener(cancelButtonClickListener);
|
||||
@@ -424,7 +424,7 @@ public class CommonDialogWindow extends Window implements Serializable {
|
||||
|
||||
private void createSaveButton() {
|
||||
saveButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.SAVE_BUTTON, "Save", "", "", true,
|
||||
FontAwesome.SAVE, SPUIButtonStyleBorderWithIcon.class);
|
||||
FontAwesome.SAVE, SPUIButtonStyleNoBorderWithIcon.class);
|
||||
saveButton.setSizeUndefined();
|
||||
saveButton.addClickListener(saveButtonClickListener);
|
||||
saveButton.setEnabled(false);
|
||||
|
||||
@@ -15,10 +15,9 @@ import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Button with icon decorator.
|
||||
*
|
||||
* Decorator class for a borderless Button with icon.
|
||||
*/
|
||||
public class SPUIButtonStyleBorderWithIcon implements SPUIButtonDecorator {
|
||||
public class SPUIButtonStyleNoBorderWithIcon implements SPUIButtonDecorator {
|
||||
|
||||
private Button button;
|
||||
|
||||
@@ -27,16 +26,30 @@ public class SPUIButtonStyleBorderWithIcon implements SPUIButtonDecorator {
|
||||
|
||||
this.button = button;
|
||||
|
||||
button.addStyleName(ValoTheme.LABEL_SMALL);
|
||||
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
|
||||
|
||||
setButtonStyle(style, setStyle);
|
||||
setButtonIcon(icon);
|
||||
|
||||
button.addStyleName(ValoTheme.LABEL_SMALL);
|
||||
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
|
||||
button.setSizeFull();
|
||||
|
||||
setButtonStyle(style, setStyle);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)) {
|
||||
@@ -45,6 +58,8 @@ public class SPUIButtonStyleBorderWithIcon implements SPUIButtonDecorator {
|
||||
|
||||
if (setStyle) {
|
||||
button.setStyleName(style);
|
||||
} else {
|
||||
button.addStyleName(style);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user