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.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
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.layouts.AbstractCreateUpdateTagLayout;
|
||||||
import org.eclipse.hawkbit.ui.management.targettable.TargetAddUpdateWindowLayout;
|
import org.eclipse.hawkbit.ui.management.targettable.TargetAddUpdateWindowLayout;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
@@ -378,11 +378,10 @@ public class CommonDialogWindow extends Window implements Serializable {
|
|||||||
buttonsLayout = new HorizontalLayout();
|
buttonsLayout = new HorizontalLayout();
|
||||||
buttonsLayout.setSizeFull();
|
buttonsLayout.setSizeFull();
|
||||||
buttonsLayout.setSpacing(true);
|
buttonsLayout.setSpacing(true);
|
||||||
|
buttonsLayout.addStyleName("actionButtonsMargin");
|
||||||
|
|
||||||
createSaveButton();
|
createSaveButton();
|
||||||
|
|
||||||
createCancelButton();
|
createCancelButton();
|
||||||
buttonsLayout.addStyleName("actionButtonsMargin");
|
|
||||||
|
|
||||||
addHelpLink();
|
addHelpLink();
|
||||||
|
|
||||||
@@ -411,9 +410,8 @@ public class CommonDialogWindow extends Window implements Serializable {
|
|||||||
|
|
||||||
private void createCancelButton() {
|
private void createCancelButton() {
|
||||||
cancelButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.CANCEL_BUTTON, "Cancel", "", "", true,
|
cancelButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.CANCEL_BUTTON, "Cancel", "", "", true,
|
||||||
FontAwesome.TIMES, SPUIButtonStyleBorderWithIcon.class);
|
FontAwesome.TIMES, SPUIButtonStyleNoBorderWithIcon.class);
|
||||||
cancelButton.setSizeUndefined();
|
cancelButton.setSizeUndefined();
|
||||||
cancelButton.addStyleName("default-color");
|
|
||||||
if (cancelButtonClickListener != null) {
|
if (cancelButtonClickListener != null) {
|
||||||
cancelButton.addClickListener(cancelButtonClickListener);
|
cancelButton.addClickListener(cancelButtonClickListener);
|
||||||
}
|
}
|
||||||
@@ -425,9 +423,8 @@ public class CommonDialogWindow extends Window implements Serializable {
|
|||||||
|
|
||||||
private void createSaveButton() {
|
private void createSaveButton() {
|
||||||
saveButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.SAVE_BUTTON, "Save", "", "", true,
|
saveButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.SAVE_BUTTON, "Save", "", "", true,
|
||||||
FontAwesome.SAVE, SPUIButtonStyleBorderWithIcon.class);
|
FontAwesome.SAVE, SPUIButtonStyleNoBorderWithIcon.class);
|
||||||
saveButton.setSizeUndefined();
|
saveButton.setSizeUndefined();
|
||||||
saveButton.addStyleName("default-color");
|
|
||||||
saveButton.addClickListener(saveButtonClickListener);
|
saveButton.addClickListener(saveButtonClickListener);
|
||||||
saveButton.setEnabled(false);
|
saveButton.setEnabled(false);
|
||||||
buttonsLayout.addComponent(saveButton);
|
buttonsLayout.addComponent(saveButton);
|
||||||
|
|||||||
@@ -8,15 +8,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.decorators;
|
package org.eclipse.hawkbit.ui.decorators;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.vaadin.server.Resource;
|
import com.vaadin.server.Resource;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
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;
|
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) {
|
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||||
|
|
||||||
this.button = button;
|
this.button = button;
|
||||||
|
button.setSizeFull();
|
||||||
setButtonStyle(style, setStyle);
|
|
||||||
setButtonIcon(icon);
|
|
||||||
|
|
||||||
button.addStyleName(ValoTheme.LABEL_SMALL);
|
button.addStyleName(ValoTheme.LABEL_SMALL);
|
||||||
button.setSizeFull();
|
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
|
||||||
|
setOrAddButtonStyle(style, setStyle);
|
||||||
|
|
||||||
|
setButtonIcon(icon);
|
||||||
|
|
||||||
return button;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setStyle) {
|
if (setStyle) {
|
||||||
|
// overwrite all other styles
|
||||||
button.setStyleName(style);
|
button.setStyleName(style);
|
||||||
} else {
|
} else {
|
||||||
button.addStyleName(style);
|
button.addStyleName(style);
|
||||||
@@ -293,8 +293,4 @@
|
|||||||
padding-bottom: 12px !important;
|
padding-bottom: 12px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-button-default-color {
|
|
||||||
color: #551f62;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,4 +56,5 @@
|
|||||||
.marginTop {
|
.marginTop {
|
||||||
margin-top: 20px !important;
|
margin-top: 20px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,5 +164,6 @@
|
|||||||
|
|
||||||
.actionButtonsMargin {
|
.actionButtonsMargin {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user