commit 1b3f0d8ced2179d187717eeeab1b9e69b2a21dc4
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Thu Feb 7 10:08:42 2019 +0100

    fix #8072 introducing component BadgeButton and harmonizing the blocking registration and validation problem buttons

diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/component/BadgeButton.java b/src/main/java/eu/etaxonomy/cdm/vaadin/component/BadgeButton.java
new file mode 100644
index 00000000..8134d4b3
--- /dev/null
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/component/BadgeButton.java
@@ -0,0 +1,81 @@
+/**
+* Copyright (C) 2019 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.vaadin.component;
+
+import com.vaadin.server.Resource;
+import com.vaadin.ui.Button;
+
+import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles;
+
+/**
+ * A button with badge. The caption of the Button is shown inside the badge.
+ *
+ * @author a.kohlbecker
+ * @since Feb 7, 2019
+ *
+ */
+public class BadgeButton extends Button {
+
+    private static final long serialVersionUID = -6408645355930129935L;
+
+    String badgeCaption = null;
+
+
+    /**
+     *
+     */
+    public BadgeButton() {
+        super();
+        setCaptionAsHtml(true);
+    }
+
+    /**
+     * @param icon
+     */
+    public BadgeButton(Resource icon) {
+        super(icon);
+    }
+
+    /**
+     * @param caption
+     * @param listener
+     */
+    public BadgeButton(String caption, ClickListener listener) {
+        super(caption, listener);
+    }
+
+    /**
+     * @param caption
+     * @param icon
+     */
+    public BadgeButton(String caption, Resource icon) {
+        super(caption, icon);
+    }
+
+    /**
+     * @param caption
+     */
+    public BadgeButton(String caption) {
+        super(caption);
+    }
+
+    @Override
+    public String getCaption() {
+        return badgeCaption;
+    }
+
+    @Override
+    public void setCaption(String caption) {
+        setCaptionAsHtml(true);
+        super.setCaption("<span class=\"" + RegistrationStyles.BUTTON_BADGE +"\"> " + caption + "</span>");
+    }
+
+
+
+}
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java b/src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java
index 7ac7c0f9..839d4668 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java
@@ -43,6 +43,7 @@ import eu.etaxonomy.cdm.model.name.RegistrationStatus;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
 import eu.etaxonomy.cdm.service.UserHelperAccess;
+import eu.etaxonomy.cdm.vaadin.component.BadgeButton;
 import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
 import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent;
 import eu.etaxonomy.cdm.vaadin.permission.PermissionDebugUtils;
@@ -88,8 +89,8 @@ public class RegistrationItem extends GridLayout {
     private RegistrationStatusLabel stateLabel = new RegistrationStatusLabel();
     private Link identifierLink = new Link();
     private Label citationSummaryLabel = new Label();
-    private Button blockedByButton = new Button(FontAwesome.WARNING);
-    private Button validationProblemsButton;
+    private Button blockedByButton = new Button(FontAwesome.BAN);
+    private BadgeButton validationProblemsButton;
     private Button openButton = new Button(FontAwesome.COGS);
     private Label submitterLabel = new Label();
     private Label createdLabel = new Label();
@@ -144,7 +145,7 @@ public class RegistrationItem extends GridLayout {
         setComponentAlignment(identifierLink, Alignment.TOP_CENTER);
         setColumnExpandRatio(1, 1.0f);
 
-        validationProblemsButton = new Button(FontAwesome.COMMENT);
+        validationProblemsButton = new BadgeButton(FontAwesome.WARNING);
         CssLayout buttonGroup = new CssLayout(blockedByButton, validationProblemsButton, openButton);
         blockedByButton.setStyleName(ValoTheme.BUTTON_TINY);
         blockedByButton.setEnabled(false);
@@ -250,7 +251,7 @@ public class RegistrationItem extends GridLayout {
         StringBuffer labelMarkup = new StringBuffer();
         DateTime registrationDate = null;
 
-        if(validationProblemsCount > 0){
+        if(validationProblemsCount + 1 > 0){
             getValidationProblemsButton().setEnabled(true);
             // getMessageButton().addStyleName(RegistrationStyles.STYLE_FRIENDLY_FOREGROUND);
             getValidationProblemsButton().addClickListener(e -> {
@@ -271,8 +272,7 @@ public class RegistrationItem extends GridLayout {
                 publishEvent(detailsEvent);
                 }
             );
-            getValidationProblemsButton().setCaption("<span class=\"" + RegistrationStyles.BUTTON_BADGE +"\"> " + validationProblemsCount + "</span>");
-            getValidationProblemsButton().setCaptionAsHtml(true);
+            getValidationProblemsButton().setCaption(Integer.toString(validationProblemsCount + 1));
         }
 
         if(regDto != null && regDto.isBlocked()){
@@ -396,7 +396,7 @@ public class RegistrationItem extends GridLayout {
     /**
      * @return the validationProblemsButton
      */
-    public Button getValidationProblemsButton() {
+    public BadgeButton getValidationProblemsButton() {
         return validationProblemsButton;
     }
 
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItemButtons.java b/src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItemButtons.java
index aebed50c..b27be7d5 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItemButtons.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItemButtons.java
@@ -13,6 +13,8 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.CssLayout;
 import com.vaadin.ui.themes.ValoTheme;
 
+import eu.etaxonomy.cdm.vaadin.component.BadgeButton;
+
 /**
  * @author a.kohlbecker
  * @since Feb 27, 2018
@@ -25,7 +27,7 @@ public class RegistrationItemButtons extends CssLayout {
 
     Button blockingRegistrationButton;
 
-    Button validationProblemsButton;
+    BadgeButton validationProblemsButton;
 
     public RegistrationItemButtons() {
 
@@ -34,7 +36,7 @@ public class RegistrationItemButtons extends CssLayout {
           blockingRegistrationButton = new Button(FontAwesome.BAN);
           blockingRegistrationButton.setEnabled(false);
 
-          validationProblemsButton = new Button(FontAwesome.WARNING);
+          validationProblemsButton = new BadgeButton(FontAwesome.WARNING);
           validationProblemsButton.setEnabled(false);
 
           addComponents(blockingRegistrationButton, validationProblemsButton);
@@ -50,7 +52,7 @@ public class RegistrationItemButtons extends CssLayout {
     /**
      * @return the validationProblemsButton
      */
-    public Button getValidationProblemsButton() {
+    public BadgeButton getValidationProblemsButton() {
         return validationProblemsButton;
     }
 
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java
index c683d607..13718f48 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java
@@ -198,6 +198,7 @@ public class ListViewBean extends AbstractPageView<ListPresenter> implements Lis
             RegistrationItem item = new RegistrationItem(regDto, this, null);
             item.getSubmitterLabel().setVisible(isCurator);
             item.setWidth(100, Unit.PERCENTAGE);
+            // TODO move addClickListener into RegistrationItem.updateUI where the clicklistener for the ValidationProblemsButton is set also?
             item.getBlockedByButton().addClickListener(e -> getViewEventBus().publish(
                     this,
                     new ShowDetailsEvent<Registration, UUID>(
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorksetViewBean.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorksetViewBean.java
index c09167a2..8fad8e90 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorksetViewBean.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorksetViewBean.java
@@ -57,6 +57,7 @@ import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
 import eu.etaxonomy.cdm.ref.EntityReference;
 import eu.etaxonomy.cdm.ref.TypedEntityReference;
 import eu.etaxonomy.cdm.service.UserHelperAccess;
+import eu.etaxonomy.cdm.vaadin.component.BadgeButton;
 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItem;
 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemButtons;
 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemNameAndTypeButtons;
@@ -64,7 +65,6 @@ import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemNameAndTyp
 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemsPanel;
 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStatusFieldInstantiator;
 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStatusLabel;
-import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles;
 import eu.etaxonomy.cdm.vaadin.event.EditorActionContext;
 import eu.etaxonomy.cdm.vaadin.event.RegistrationEditorAction;
 import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent;
@@ -406,7 +406,7 @@ public class RegistrationWorksetViewBean extends AbstractPageView<RegistrationWo
                     ));
         }
 
-        Button validationProblemsButton = regItemButtons.getValidationProblemsButton();
+        BadgeButton validationProblemsButton = regItemButtons.getValidationProblemsButton();
         validationProblemsButton.setStyleName(ValoTheme.BUTTON_TINY); //  + " " + RegistrationStyles.STYLE_FRIENDLY_FOREGROUND);
 
         if(!dto.getValidationProblems().isEmpty()){
@@ -421,8 +421,7 @@ public class RegistrationWorksetViewBean extends AbstractPageView<RegistrationWo
                     )
                 );
         }
-        validationProblemsButton.setCaption("<span class=\"" + RegistrationStyles.BUTTON_BADGE +"\"> " + dto.getValidationProblems().size() + "</span>");
-        validationProblemsButton.setCaptionAsHtml(true);
+        validationProblemsButton.setCaption(Integer.toString(dto.getValidationProblems().size()));
 
         Component statusComponent;
         if(statusFieldInstantiator != null){
