Merge pull request #243 from bsinno/fix_button_color
Correct colour of cancel/save button in DialogWindows
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;
|
||||
@@ -378,11 +378,10 @@ public class CommonDialogWindow extends Window implements Serializable {
|
||||
buttonsLayout = new HorizontalLayout();
|
||||
buttonsLayout.setSizeFull();
|
||||
buttonsLayout.setSpacing(true);
|
||||
buttonsLayout.addStyleName("actionButtonsMargin");
|
||||
|
||||
createSaveButton();
|
||||
|
||||
createCancelButton();
|
||||
buttonsLayout.addStyleName("actionButtonsMargin");
|
||||
|
||||
addHelpLink();
|
||||
|
||||
@@ -411,9 +410,8 @@ 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();
|
||||
cancelButton.addStyleName("default-color");
|
||||
if (cancelButtonClickListener != null) {
|
||||
cancelButton.addClickListener(cancelButtonClickListener);
|
||||
}
|
||||
@@ -425,9 +423,8 @@ 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.addStyleName("default-color");
|
||||
saveButton.addClickListener(saveButtonClickListener);
|
||||
saveButton.setEnabled(false);
|
||||
buttonsLayout.addComponent(saveButton);
|
||||
|
||||
@@ -8,15 +8,16 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.decorators;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Button with icon decorator.
|
||||
*
|
||||
* Decorator class for a borderless Button with an icon.
|
||||
*/
|
||||
public class SPUIButtonStyleBorderWithIcon implements SPUIButtonDecorator {
|
||||
public class SPUIButtonStyleNoBorderWithIcon implements SPUIButtonDecorator {
|
||||
|
||||
private Button button;
|
||||
|
||||
@@ -24,23 +25,25 @@ public class SPUIButtonStyleBorderWithIcon implements SPUIButtonDecorator {
|
||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||
|
||||
this.button = button;
|
||||
|
||||
setButtonStyle(style, setStyle);
|
||||
setButtonIcon(icon);
|
||||
button.setSizeFull();
|
||||
|
||||
button.addStyleName(ValoTheme.LABEL_SMALL);
|
||||
button.setSizeFull();
|
||||
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
|
||||
setOrAddButtonStyle(style, setStyle);
|
||||
|
||||
setButtonIcon(icon);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
private void setButtonStyle(final String style, final boolean setStyle) {
|
||||
private void setOrAddButtonStyle(final String style, final boolean setStyle) {
|
||||
|
||||
if (style == null) {
|
||||
if (StringUtils.isEmpty(style)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (setStyle) {
|
||||
// overwrite all other styles
|
||||
button.setStyleName(style);
|
||||
} else {
|
||||
button.addStyleName(style);
|
||||
@@ -293,8 +293,4 @@
|
||||
padding-bottom: 12px !important;
|
||||
}
|
||||
|
||||
.v-button-default-color {
|
||||
color: #551f62;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,4 +56,5 @@
|
||||
.marginTop {
|
||||
margin-top: 20px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -164,5 +164,6 @@
|
||||
|
||||
.actionButtonsMargin {
|
||||
margin-top: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user