code improvement

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-09-06 14:55:48 +02:00
parent c076162cc9
commit d229f45063
11 changed files with 28 additions and 35 deletions

View File

@@ -151,8 +151,8 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
.prompt(i18n.get("textfield.description")).id(SPUIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION)
.buildTextComponent();
typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", "", null, null, true,
null, i18n.get("upload.swmodule.type"));
typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", null, null, true, null,
i18n.get("upload.swmodule.type"));
typeComboBox.setId(SPUIComponentIdProvider.SW_MODULE_TYPE);
typeComboBox.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + " " + ValoTheme.COMBOBOX_TINY);
typeComboBox.setNewItemsAllowed(Boolean.FALSE);

View File

@@ -57,8 +57,6 @@ public final class SPUIComponentProvider {
*
* @param caption
* caption of the combo box
* @param height
* combo box height
* @param width
* combo box width
* @param style
@@ -73,9 +71,9 @@ public final class SPUIComponentProvider {
* input prompt
* @return ComboBox
*/
public static ComboBox getComboBox(final String caption, final String height, final String width,
final String style, final String styleName, final boolean required, final String data, final String promt) {
return SPUIComboBoxDecorator.decorate(caption, height, width, style, styleName, required, data, promt);
public static ComboBox getComboBox(final String caption, final String width, final String style,
final String styleName, final boolean required, final String data, final String promt) {
return SPUIComboBoxDecorator.decorate(caption, width, style, styleName, required, data, promt);
}
/**
@@ -290,20 +288,19 @@ public final class SPUIComponentProvider {
* specify how the link should be open (f. e. new windows =
* _blank)
* @param style
* chosen style of the link
* @param setStyle
* set true if the style should be used
* chosen style of the link. Might be {@code null} if no style
* should be used
* @return a link UI component
*/
public static Link getLink(final String id, final String name, final String resource, final FontAwesome icon,
final String targetOpen, final String style, final boolean setStyle) {
final String targetOpen, final String style) {
final Link link = new Link(name, new ExternalResource(resource));
link.setId(id);
link.setIcon(icon);
link.setTargetName(targetOpen);
if (setStyle) {
if (style != null) {
link.setStyleName(style);
}

View File

@@ -49,7 +49,7 @@ public final class SPUIComboBoxDecorator {
* as promt
* @return ComboBox as comp
*/
public static ComboBox decorate(final String caption, final String height, final String width, final String style,
public static ComboBox decorate(final String caption, final String width, final String style,
final String styleName, final boolean required, final String data, final String prompt) {
final ComboBox spUICombo = new ComboBox();
// Default settings
@@ -67,10 +67,6 @@ public final class SPUIComboBoxDecorator {
if (StringUtils.isNotEmpty(styleName)) {
spUICombo.addStyleName(styleName);
}
// Add height
if (StringUtils.isNotEmpty(height)) {
spUICombo.setHeight(height);
}
// AddWidth
if (StringUtils.isNotEmpty(width)) {
spUICombo.setWidth(width);

View File

@@ -189,7 +189,7 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
tagDesc.setNullRepresentation("");
tagNameComboBox = SPUIComponentProvider.getComboBox(null, "", "", null, null, false, "",
tagNameComboBox = SPUIComponentProvider.getComboBox(null, "", null, null, false, "",
i18n.get("label.combobox.tag"));
tagNameComboBox.addStyleName(SPUIDefinitions.FILTER_TYPE_COMBO_STYLE);
tagNameComboBox.setImmediate(true);

View File

@@ -54,8 +54,8 @@ public abstract class CreateUpdateTypeLayout<E extends NamedEntity> extends Abst
colorLabel = new LabelBuilder().name(i18n.get("label.choose.type.color")).buildLabel();
colorLabel.addStyleName(SPUIDefinitions.COLOR_LABEL_STYLE);
tagNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", "", null, null, false,
"", i18n.get("label.combobox.type"));
tagNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", null, null, false, "",
i18n.get("label.combobox.type"));
tagNameComboBox.setId(SPUIDefinitions.NEW_DISTRIBUTION_SET_TYPE_NAME_COMBO);
tagNameComboBox.addStyleName(SPUIDefinitions.FILTER_TYPE_COMBO_STYLE);
tagNameComboBox.setImmediate(true);

View File

@@ -266,14 +266,14 @@ public class LoginView extends VerticalLayout implements View {
if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
final Link docuLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_DOCUMENTATION,
i18n.get("link.documentation.name"), uiProperties.getLinks().getDocumentation().getRoot(),
FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle, true);
FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle);
links.addComponent(docuLink);
docuLink.addStyleName(ValoTheme.LINK_SMALL);
}
if (!uiProperties.getDemo().getUser().isEmpty()) {
final Link demoLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_DEMO,
i18n.get("link.demo.name"), "?demo", FontAwesome.DESKTOP, "_top", linkStyle, true);
i18n.get("link.demo.name"), "?demo", FontAwesome.DESKTOP, "_top", linkStyle);
links.addComponent(demoLink);
demoLink.addStyleName(ValoTheme.LINK_SMALL);
}
@@ -281,7 +281,7 @@ public class LoginView extends VerticalLayout implements View {
if (!uiProperties.getLinks().getRequestAccount().isEmpty()) {
final Link requestAccountLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_REQUESTACCOUNT,
i18n.get("link.requestaccount.name"), uiProperties.getLinks().getRequestAccount(),
FontAwesome.SHOPPING_CART, "", linkStyle, true);
FontAwesome.SHOPPING_CART, "", linkStyle);
links.addComponent(requestAccountLink);
requestAccountLink.addStyleName(ValoTheme.LINK_SMALL);
}
@@ -289,7 +289,7 @@ public class LoginView extends VerticalLayout implements View {
if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
final Link userManagementLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_USERMANAGEMENT,
i18n.get("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
FontAwesome.USERS, "_blank", linkStyle, true);
FontAwesome.USERS, "_blank", linkStyle);
links.addComponent(userManagementLink);
userManagementLink.addStyleName(ValoTheme.LINK_SMALL);
}

View File

@@ -147,7 +147,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
distNameTextField = createTextField("textfield.name", SPUIComponentIdProvider.DIST_ADD_NAME);
distVersionTextField = createTextField("textfield.version", SPUIComponentIdProvider.DIST_ADD_VERSION);
distsetTypeNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", "", null, "",
distsetTypeNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", null, "",
false, "", i18n.get("label.combobox.type"));
distsetTypeNameComboBox.setImmediate(true);
distsetTypeNameComboBox.setNullSelectionAllowed(false);

View File

@@ -204,8 +204,8 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
private ComboBox getDsComboField() {
final Container container = createContainer();
final ComboBox dsComboBox = SPUIComponentProvider.getComboBox(i18n.get("bulkupload.ds.name"), "", "", null,
null, false, "", i18n.get("bulkupload.ds.name"));
final ComboBox dsComboBox = SPUIComponentProvider.getComboBox(i18n.get("bulkupload.ds.name"), "", null, null,
false, "", i18n.get("bulkupload.ds.name"));
dsComboBox.setSizeUndefined();
dsComboBox.addStyleName(SPUIDefinitions.BULK_UPLOD_DS_COMBO_STYLE);
dsComboBox.setImmediate(true);

View File

@@ -148,7 +148,7 @@ public final class DashboardMenu extends CustomComponent {
if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
final Link docuLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_DOCUMENTATION,
i18n.get("link.documentation.name"), uiProperties.getLinks().getDocumentation().getRoot(),
FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle, true);
FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle);
docuLink.setDescription(i18n.get("link.documentation.name"));
docuLink.setSizeFull();
links.addComponent(docuLink);
@@ -158,7 +158,7 @@ public final class DashboardMenu extends CustomComponent {
if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
final Link userManagementLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_USERMANAGEMENT,
i18n.get("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
FontAwesome.USERS, "_blank", linkStyle, true);
FontAwesome.USERS, "_blank", linkStyle);
userManagementLink.setDescription(i18n.get("link.usermanagement.name"));
links.addComponent(userManagementLink);
userManagementLink.setSizeFull();
@@ -168,7 +168,7 @@ public final class DashboardMenu extends CustomComponent {
if (!uiProperties.getLinks().getSupport().isEmpty()) {
final Link supportLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_SUPPORT,
i18n.get("link.support.name"), uiProperties.getLinks().getSupport(), FontAwesome.ENVELOPE_O, "",
linkStyle, true);
linkStyle);
supportLink.setDescription(i18n.get("link.support.name"));
supportLink.setSizeFull();
links.addComponent(supportLink);

View File

@@ -375,8 +375,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private ComboBox createTargetFilterQueryCombo() {
final ComboBox targetFilter = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL,
false, "", i18n.get("prompt.target.filter"));
final ComboBox targetFilter = SPUIComponentProvider.getComboBox(null, "", null, ValoTheme.COMBOBOX_SMALL, false,
"", i18n.get("prompt.target.filter"));
targetFilter.setImmediate(true);
targetFilter.setPageLength(7);
targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
@@ -571,8 +571,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private ComboBox createDistributionSetCombo() {
final ComboBox dsSet = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL, false,
"", i18n.get("prompt.distribution.set"));
final ComboBox dsSet = SPUIComponentProvider.getComboBox(null, "", null, ValoTheme.COMBOBOX_SMALL, false, "",
i18n.get("prompt.distribution.set"));
dsSet.setImmediate(true);
dsSet.setPageLength(7);
dsSet.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);

View File

@@ -91,7 +91,7 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView impl
final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetManagement
.findDistributionSetTypesAll(pageReq);
combobox = SPUIComponentProvider.getComboBox(null, "", "330", null, null, false, "", "label.combobox.tag");
combobox = SPUIComponentProvider.getComboBox(null, "330", null, null, false, "", "label.combobox.tag");
combobox.setId(SPUIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
combobox.setNullSelectionAllowed(false);
for (final DistributionSetType distributionSetType : distributionSetTypeCollection) {