Add only eventbus subscription where a method listens to it. (#698)

* Add only eventbus subscription where a method listens to it.

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>

* Fix PR findings

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2018-06-28 12:42:51 +02:00
committed by Dominic Schabel
parent 9774f8303b
commit d982bb9a5f
29 changed files with 233 additions and 73 deletions

View File

@@ -48,7 +48,7 @@ public class SoftwareModuleTableHeader extends AbstractSoftwareModuleTableHeader
@Override @Override
protected void showFilterButtonsLayout() { protected void showFilterButtonsLayout() {
getArtifactUploadState().setSwTypeFilterClosed(false); getArtifactUploadState().setSwTypeFilterClosed(false);
eventbus.publish(this, UploadArtifactUIEvent.SHOW_FILTER_BY_TYPE); eventBus.publish(this, UploadArtifactUIEvent.SHOW_FILTER_BY_TYPE);
} }
@@ -56,20 +56,20 @@ public class SoftwareModuleTableHeader extends AbstractSoftwareModuleTableHeader
protected void resetSearchText() { protected void resetSearchText() {
if (getArtifactUploadState().getSoftwareModuleFilters().getSearchText().isPresent()) { if (getArtifactUploadState().getSoftwareModuleFilters().getSearchText().isPresent()) {
getArtifactUploadState().getSoftwareModuleFilters().setSearchText(null); getArtifactUploadState().getSoftwareModuleFilters().setSearchText(null);
eventbus.publish(this, new RefreshSoftwareModuleByFilterEvent()); eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
} }
} }
@Override @Override
public void maximizeTable() { public void maximizeTable() {
getArtifactUploadState().setSwModuleTableMaximized(Boolean.TRUE); getArtifactUploadState().setSwModuleTableMaximized(Boolean.TRUE);
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED)); eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED));
} }
@Override @Override
public void minimizeTable() { public void minimizeTable() {
getArtifactUploadState().setSwModuleTableMaximized(Boolean.FALSE); getArtifactUploadState().setSwModuleTableMaximized(Boolean.FALSE);
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED)); eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED));
} }
@Override @Override
@@ -85,7 +85,7 @@ public class SoftwareModuleTableHeader extends AbstractSoftwareModuleTableHeader
@Override @Override
protected void searchBy(final String newSearchText) { protected void searchBy(final String newSearchText) {
getArtifactUploadState().getSoftwareModuleFilters().setSearchText(newSearchText); getArtifactUploadState().getSoftwareModuleFilters().setSearchText(newSearchText);
eventbus.publish(this, new RefreshSoftwareModuleByFilterEvent()); eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
} }
@Override @Override

View File

@@ -82,7 +82,8 @@ public abstract class AbstractDistributionSetDetails
@Override @Override
protected void onEdit(final ClickEvent event) { protected void onEdit(final ClickEvent event) {
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindowForUpdateDistributionSet(getSelectedBaseEntityId()); final Window newDistWindow = distributionAddUpdateWindowLayout
.getWindowForUpdateDistributionSet(getSelectedBaseEntityId());
UI.getCurrent().addWindow(newDistWindow); UI.getCurrent().addWindow(newDistWindow);
newDistWindow.setVisible(Boolean.TRUE); newDistWindow.setVisible(Boolean.TRUE);
} }

View File

@@ -83,8 +83,19 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
tagsLayout = createTabLayout(); tagsLayout = createTabLayout();
createComponents(); createComponents();
buildLayout(); buildLayout();
if (doSubscribeToEventBus()) {
eventBus.subscribe(this); eventBus.subscribe(this);
} }
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
}
public void setSelectedBaseEntity(final T selectedBaseEntity) { public void setSelectedBaseEntity(final T selectedBaseEntity) {
this.selectedBaseEntity = selectedBaseEntity; this.selectedBaseEntity = selectedBaseEntity;

View File

@@ -53,8 +53,19 @@ public abstract class AbstractFilterButtons extends Table {
this.filterButtonClickBehaviour = filterButtonClickBehaviour; this.filterButtonClickBehaviour = filterButtonClickBehaviour;
createTable(); createTable();
if (doSubscribeToEventBus()) {
eventBus.subscribe(this); eventBus.subscribe(this);
} }
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
}
private void createTable() { private void createTable() {
setImmediate(true); setImmediate(true);

View File

@@ -64,9 +64,19 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
this.permChecker = permChecker; this.permChecker = permChecker;
this.eventBus = eventBus; this.eventBus = eventBus;
this.notification = notification; this.notification = notification;
if (doSubscribeToEventBus()) {
eventBus.subscribe(this); eventBus.subscribe(this);
} }
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
}
protected void init() { protected void init() {
if (hasCountMessage() || hasDeletePermission() || hasUpdatePermission() || hasBulkUploadPermission()) { if (hasCountMessage() || hasDeletePermission() || hasUpdatePermission() || hasBulkUploadPermission()) {

View File

@@ -79,8 +79,19 @@ public abstract class AbstractGrid<T extends Indexed> extends Grid implements Re
} }
setColumnReorderingAllowed(true); setColumnReorderingAllowed(true);
addNewContainerDS(); addNewContainerDS();
if (doSubscribeToEventBus()) {
eventBus.subscribe(this); eventBus.subscribe(this);
} }
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
}
/** /**
* Refresh the container. * Refresh the container.

View File

@@ -40,10 +40,7 @@ public abstract class AbstractGridComponentLayout extends VerticalLayout {
* Constructor. * Constructor.
* *
* @param i18n * @param i18n
* @param deploymentManagement
* @param eventBus * @param eventBus
* @param notification
* @param managementUIState
*/ */
public AbstractGridComponentLayout(final VaadinMessageSource i18n, final UIEventBus eventBus) { public AbstractGridComponentLayout(final VaadinMessageSource i18n, final UIEventBus eventBus) {
this.i18n = i18n; this.i18n = i18n;
@@ -59,8 +56,19 @@ public abstract class AbstractGridComponentLayout extends VerticalLayout {
buildLayout(); buildLayout();
setSizeFull(); setSizeFull();
setImmediate(true); setImmediate(true);
if (doSubscribeToEventBus()) {
eventBus.subscribe(this); eventBus.subscribe(this);
} }
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
}
/** /**
* Layouts header, grid and optional footer. * Layouts header, grid and optional footer.

View File

@@ -83,8 +83,19 @@ public abstract class AbstractTable<E extends NamedEntity> extends Table impleme
setDefault(); setDefault();
addValueChangeListener(event -> onValueChange()); addValueChangeListener(event -> onValueChange());
setPageLength(SPUIDefinitions.PAGE_SIZE); setPageLength(SPUIDefinitions.PAGE_SIZE);
if (doSubscribeToEventBus()) {
eventBus.subscribe(this); eventBus.subscribe(this);
} }
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
}
/** /**
* Gets the selected item id or in multiselect mode a set of selected ids. * Gets the selected item id or in multiselect mode a set of selected ids.

View File

@@ -46,7 +46,7 @@ public abstract class AbstractTableHeader extends VerticalLayout {
protected SpPermissionChecker permChecker; protected SpPermissionChecker permChecker;
protected transient EventBus.UIEventBus eventbus; protected transient EventBus.UIEventBus eventBus;
private Label headerCaption; private Label headerCaption;
@@ -71,18 +71,29 @@ public abstract class AbstractTableHeader extends VerticalLayout {
private final ArtifactUploadState artifactUploadState; private final ArtifactUploadState artifactUploadState;
protected AbstractTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, protected AbstractTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
final UIEventBus eventbus, final ManagementUIState managementUIState, final UIEventBus eventBus, final ManagementUIState managementUIState,
final ManageDistUIState manageDistUIstate, final ArtifactUploadState artifactUploadState) { final ManageDistUIState manageDistUIstate, final ArtifactUploadState artifactUploadState) {
this.i18n = i18n; this.i18n = i18n;
this.permChecker = permChecker; this.permChecker = permChecker;
this.eventbus = eventbus; this.eventBus = eventBus;
this.managementUIState = managementUIState; this.managementUIState = managementUIState;
this.manageDistUIstate = manageDistUIstate; this.manageDistUIstate = manageDistUIstate;
this.artifactUploadState = artifactUploadState; this.artifactUploadState = artifactUploadState;
createComponents(); createComponents();
buildLayout(); buildLayout();
restoreState(); restoreState();
eventbus.subscribe(this); if (doSubscribeToEventBus()) {
eventBus.subscribe(this);
}
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
} }
private void createComponents() { private void createComponents() {

View File

@@ -88,8 +88,19 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
this.managementUIState = managementUIState; this.managementUIState = managementUIState;
createTokenField(); createTokenField();
checkIfTagAssignedIsAllowed(); checkIfTagAssignedIsAllowed();
if (doSubscribeToEventBus()) {
eventBus.subscribe(this); eventBus.subscribe(this);
} }
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
}
protected void onBaseEntityEvent(final BaseUIEntityEvent<T> baseEntityEvent) { protected void onBaseEntityEvent(final BaseUIEntityEvent<T> baseEntityEvent) {
if (BaseEntityEventType.SELECTED_ENTITY != baseEntityEvent.getEventType()) { if (BaseEntityEventType.SELECTED_ENTITY != baseEntityEvent.getEventType()) {

View File

@@ -63,8 +63,19 @@ public abstract class AbstractNotificationView extends VerticalLayout implements
this.notificationUnreadButton = notificationUnreadButton; this.notificationUnreadButton = notificationUnreadButton;
this.viewUnreadNotifcations = new AtomicInteger(0); this.viewUnreadNotifcations = new AtomicInteger(0);
skipUiEventsCache = CacheBuilder.newBuilder().expireAfterAccess(10, SECONDS).build(); skipUiEventsCache = CacheBuilder.newBuilder().expireAfterAccess(10, SECONDS).build();
if (doSubscribeToEventBus()) {
eventBus.subscribe(this); eventBus.subscribe(this);
} }
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
}
@EventBusListenerMethod(scope = EventScope.UI) @EventBusListenerMethod(scope = EventScope.UI)
void onEventContainerEvent(final EventContainer<?> eventContainer) { void onEventContainerEvent(final EventContainer<?> eventContainer) {

View File

@@ -56,27 +56,27 @@ public class DistributionSetTableHeader extends AbstractDistributionSetTableHead
@Override @Override
protected void showFilterButtonsLayout() { protected void showFilterButtonsLayout() {
getManageDistUIstate().setDistTypeFilterClosed(false); getManageDistUIstate().setDistTypeFilterClosed(false);
eventbus.publish(this, DistributionsUIEvent.SHOW_DIST_FILTER_BY_TYPE); eventBus.publish(this, DistributionsUIEvent.SHOW_DIST_FILTER_BY_TYPE);
} }
@Override @Override
protected void resetSearchText() { protected void resetSearchText() {
if (getManageDistUIstate().getManageDistFilters().getSearchText().isPresent()) { if (getManageDistUIstate().getManageDistFilters().getSearchText().isPresent()) {
getManageDistUIstate().getManageDistFilters().setSearchText(null); getManageDistUIstate().getManageDistFilters().setSearchText(null);
eventbus.publish(this, new RefreshDistributionTableByFilterEvent()); eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
} }
} }
@Override @Override
public void maximizeTable() { public void maximizeTable() {
getManageDistUIstate().setDsTableMaximized(Boolean.TRUE); getManageDistUIstate().setDsTableMaximized(Boolean.TRUE);
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED)); eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED));
} }
@Override @Override
public void minimizeTable() { public void minimizeTable() {
getManageDistUIstate().setDsTableMaximized(Boolean.FALSE); getManageDistUIstate().setDsTableMaximized(Boolean.FALSE);
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED)); eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED));
} }
@Override @Override
@@ -92,7 +92,7 @@ public class DistributionSetTableHeader extends AbstractDistributionSetTableHead
@Override @Override
protected void searchBy(final String newSearchText) { protected void searchBy(final String newSearchText) {
getManageDistUIstate().getManageDistFilters().setSearchText(newSearchText); getManageDistUIstate().getManageDistFilters().setSearchText(newSearchText);
eventbus.publish(this, new RefreshDistributionTableByFilterEvent()); eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
} }
@Override @Override

View File

@@ -50,28 +50,28 @@ public class SwModuleTableHeader extends AbstractSoftwareModuleTableHeader {
@Override @Override
protected void showFilterButtonsLayout() { protected void showFilterButtonsLayout() {
getManageDistUIstate().setSwTypeFilterClosed(false); getManageDistUIstate().setSwTypeFilterClosed(false);
eventbus.publish(this, DistributionsUIEvent.SHOW_SM_FILTER_BY_TYPE); eventBus.publish(this, DistributionsUIEvent.SHOW_SM_FILTER_BY_TYPE);
} }
@Override @Override
protected void resetSearchText() { protected void resetSearchText() {
if (getManageDistUIstate().getSoftwareModuleFilters().getSearchText().isPresent()) { if (getManageDistUIstate().getSoftwareModuleFilters().getSearchText().isPresent()) {
getManageDistUIstate().getSoftwareModuleFilters().setSearchText(null); getManageDistUIstate().getSoftwareModuleFilters().setSearchText(null);
eventbus.publish(this, new RefreshSoftwareModuleByFilterEvent()); eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
} }
} }
@Override @Override
public void maximizeTable() { public void maximizeTable() {
getManageDistUIstate().setSwModuleTableMaximized(Boolean.TRUE); getManageDistUIstate().setSwModuleTableMaximized(Boolean.TRUE);
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED)); eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED));
} }
@Override @Override
public void minimizeTable() { public void minimizeTable() {
getManageDistUIstate().setSwModuleTableMaximized(Boolean.FALSE); getManageDistUIstate().setSwModuleTableMaximized(Boolean.FALSE);
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED)); eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED));
} }
@Override @Override
@@ -87,7 +87,7 @@ public class SwModuleTableHeader extends AbstractSoftwareModuleTableHeader {
@Override @Override
protected void searchBy(final String newSearchText) { protected void searchBy(final String newSearchText) {
getManageDistUIstate().getSoftwareModuleFilters().setSearchText(newSearchText); getManageDistUIstate().getSoftwareModuleFilters().setSearchText(newSearchText);
eventbus.publish(this, new RefreshSoftwareModuleByFilterEvent()); eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
} }
} }

View File

@@ -174,13 +174,23 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
* Init the layout. * Init the layout.
*/ */
public void init() { public void init() {
setSizeUndefined(); setSizeUndefined();
createRequiredComponents(); createRequiredComponents();
buildLayout(); buildLayout();
addListeners(); addListeners();
if (doSubscribeToEventBus()) {
eventBus.subscribe(this); eventBus.subscribe(this);
} }
}
/**
* Subscribes the view to the eventBus. Method has to be overriden (return
* false) if the view does not contain any listener to avoid Vaadin blowing
* up our logs with warnings.
*/
protected boolean doSubscribeToEventBus() {
return true;
}
protected void createRequiredComponents() { protected void createRequiredComponents() {

View File

@@ -51,6 +51,11 @@ public abstract class CreateUpdateTypeLayout<E extends NamedEntity> extends Abst
super(i18n, entityFactory, eventBus, permChecker, uiNotification); super(i18n, entityFactory, eventBus, permChecker, uiNotification);
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
protected void addListeners() { protected void addListeners() {
super.addListeners(); super.addListeners();

View File

@@ -63,6 +63,11 @@ public class ActionStatusGrid extends AbstractGrid<LazyQueryContainer> {
init(); init();
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
protected LazyQueryContainer createContainer() { protected LazyQueryContainer createContainer() {
configureQueryFactory(); configureQueryFactory();

View File

@@ -36,6 +36,11 @@ public class ActionStatusLayout extends AbstractGridComponentLayout {
init(); init();
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
public DefaultGridHeader createGridHeader() { public DefaultGridHeader createGridHeader() {
return new DefaultGridHeader(managementUIState, "Action States").init(); return new DefaultGridHeader(managementUIState, "Action States").init();

View File

@@ -74,6 +74,11 @@ public class ActionStatusMsgGrid extends AbstractGrid<LazyQueryContainer> {
init(); init();
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
protected LazyQueryContainer createContainer() { protected LazyQueryContainer createContainer() {
configureQueryFactory(); configureQueryFactory();
@@ -207,4 +212,5 @@ public class ActionStatusMsgGrid extends AbstractGrid<LazyQueryContainer> {
return null; return null;
} }
} }
} }

View File

@@ -36,6 +36,11 @@ public class ActionStatusMsgLayout extends AbstractGridComponentLayout {
init(); init();
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
public DefaultGridHeader createGridHeader() { public DefaultGridHeader createGridHeader() {
return new DefaultGridHeader(managementUIState, "Messages").init(); return new DefaultGridHeader(managementUIState, "Messages").init();

View File

@@ -52,27 +52,27 @@ public class DistributionTableHeader extends AbstractDistributionSetTableHeader
@Override @Override
protected void showFilterButtonsLayout() { protected void showFilterButtonsLayout() {
getManagementUIState().setDistTagFilterClosed(false); getManagementUIState().setDistTagFilterClosed(false);
eventbus.publish(this, ManagementUIEvent.SHOW_DISTRIBUTION_TAG_LAYOUT); eventBus.publish(this, ManagementUIEvent.SHOW_DISTRIBUTION_TAG_LAYOUT);
} }
@Override @Override
protected void resetSearchText() { protected void resetSearchText() {
if (getManagementUIState().getDistributionTableFilters().getSearchText().isPresent()) { if (getManagementUIState().getDistributionTableFilters().getSearchText().isPresent()) {
getManagementUIState().getDistributionTableFilters().setSearchText(null); getManagementUIState().getDistributionTableFilters().setSearchText(null);
eventbus.publish(this, new RefreshDistributionTableByFilterEvent()); eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
} }
} }
@Override @Override
public void maximizeTable() { public void maximizeTable() {
getManagementUIState().setDsTableMaximized(Boolean.TRUE); getManagementUIState().setDsTableMaximized(Boolean.TRUE);
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED)); eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED));
} }
@Override @Override
public void minimizeTable() { public void minimizeTable() {
getManagementUIState().setDsTableMaximized(Boolean.FALSE); getManagementUIState().setDsTableMaximized(Boolean.FALSE);
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED)); eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED));
} }
@Override @Override
@@ -88,7 +88,7 @@ public class DistributionTableHeader extends AbstractDistributionSetTableHeader
@Override @Override
protected void searchBy(final String newSearchText) { protected void searchBy(final String newSearchText) {
getManagementUIState().getDistributionTableFilters().setSearchText(newSearchText); getManagementUIState().getDistributionTableFilters().setSearchText(newSearchText);
eventbus.publish(this, new RefreshDistributionTableByFilterEvent()); eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
} }
@Override @Override

View File

@@ -55,6 +55,11 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
this.distributionSetTagManagement = distributionSetTagManagement; this.distributionSetTagManagement = distributionSetTagManagement;
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
/** /**
* @return the color which should be selected in the color-picker component. * @return the color which should be selected in the color-picker component.
*/ */

View File

@@ -66,6 +66,11 @@ public class DistributionTagButtons extends AbstractFilterButtons implements Ref
} }
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
protected String getButtonsTableId() { protected String getButtonsTableId() {
return UIComponentIdProvider.DISTRIBUTION_TAG_TABLE_ID; return UIComponentIdProvider.DISTRIBUTION_TAG_TABLE_ID;

View File

@@ -228,14 +228,14 @@ public class TargetTableHeader extends AbstractTableHeader {
@Override @Override
protected void showFilterButtonsLayout() { protected void showFilterButtonsLayout() {
getManagementUIState().setTargetTagFilterClosed(false); getManagementUIState().setTargetTagFilterClosed(false);
eventbus.publish(this, ManagementUIEvent.SHOW_TARGET_TAG_LAYOUT); eventBus.publish(this, ManagementUIEvent.SHOW_TARGET_TAG_LAYOUT);
} }
@Override @Override
protected void resetSearchText() { protected void resetSearchText() {
if (getManagementUIState().getTargetTableFilters().getSearchText().isPresent()) { if (getManagementUIState().getTargetTableFilters().getSearchText().isPresent()) {
getManagementUIState().getTargetTableFilters().setSearchText(null); getManagementUIState().getTargetTableFilters().setSearchText(null);
eventbus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT); eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT);
} }
} }
@@ -251,13 +251,13 @@ public class TargetTableHeader extends AbstractTableHeader {
@Override @Override
public void maximizeTable() { public void maximizeTable() {
getManagementUIState().setTargetTableMaximized(Boolean.TRUE); getManagementUIState().setTargetTableMaximized(Boolean.TRUE);
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MAXIMIZED)); eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.MAXIMIZED));
} }
@Override @Override
public void minimizeTable() { public void minimizeTable() {
getManagementUIState().setTargetTableMaximized(Boolean.FALSE); getManagementUIState().setTargetTableMaximized(Boolean.FALSE);
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MINIMIZED)); eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.MINIMIZED));
} }
@Override @Override
@@ -273,7 +273,7 @@ public class TargetTableHeader extends AbstractTableHeader {
@Override @Override
protected void searchBy(final String newSearchText) { protected void searchBy(final String newSearchText) {
getManagementUIState().getTargetTableFilters().setSearchText(newSearchText); getManagementUIState().getTargetTableFilters().setSearchText(newSearchText);
eventbus.publish(this, TargetFilterEvent.FILTER_BY_TEXT); eventBus.publish(this, TargetFilterEvent.FILTER_BY_TEXT);
} }
@Override @Override
@@ -400,7 +400,7 @@ public class TargetTableHeader extends AbstractTableHeader {
getFilterDroppedInfo().addComponent(filteredDistLabel); getFilterDroppedInfo().addComponent(filteredDistLabel);
getFilterDroppedInfo().addComponent(filterLabelClose); getFilterDroppedInfo().addComponent(filterLabelClose);
getFilterDroppedInfo().setExpandRatio(filteredDistLabel, 1.0F); getFilterDroppedInfo().setExpandRatio(filteredDistLabel, 1.0F);
eventbus.publish(this, TargetFilterEvent.FILTER_BY_DISTRIBUTION); eventBus.publish(this, TargetFilterEvent.FILTER_BY_DISTRIBUTION);
} }
private void closeFilterByDistribution() { private void closeFilterByDistribution() {
@@ -412,7 +412,7 @@ public class TargetTableHeader extends AbstractTableHeader {
getManagementUIState().getTargetTableFilters().setDistributionSet(null); getManagementUIState().getTargetTableFilters().setDistributionSet(null);
/* Reload the table */ /* Reload the table */
eventbus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_DISTRIBUTION); eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_DISTRIBUTION);
} }
@Override @Override

View File

@@ -64,6 +64,11 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
this.targetTagManagement = targetTagManagement; this.targetTagManagement = targetTagManagement;
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
protected void addListeners() { protected void addListeners() {
super.addListeners(); super.addListeners();

View File

@@ -8,7 +8,6 @@
*/ */
package org.eclipse.hawkbit.ui.rollout.rollout; package org.eclipse.hawkbit.ui.rollout.rollout;
import static org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.*;
import static org.eclipse.hawkbit.ui.rollout.DistributionBarHelper.getTooltip; import static org.eclipse.hawkbit.ui.rollout.DistributionBarHelper.getTooltip;
import java.util.Arrays; import java.util.Arrays;
@@ -31,6 +30,7 @@ import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus; import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus; import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status; import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
import org.eclipse.hawkbit.ui.SpPermissionChecker; import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.UiProperties; import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow; import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
@@ -113,7 +113,8 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
private static final List<RolloutStatus> RUN_BUTTON_ENABLED = Arrays.asList(RolloutStatus.READY, private static final List<RolloutStatus> RUN_BUTTON_ENABLED = Arrays.asList(RolloutStatus.READY,
RolloutStatus.PAUSED); RolloutStatus.PAUSED);
private static final List<RolloutStatus> APPROVE_BUTTON_ENABLED = Collections.singletonList(RolloutStatus.WAITING_FOR_APPROVAL); private static final List<RolloutStatus> APPROVE_BUTTON_ENABLED = Collections
.singletonList(RolloutStatus.WAITING_FOR_APPROVAL);
private static final Map<RolloutStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutStatus.class); private static final Map<RolloutStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutStatus.class);
@@ -148,8 +149,7 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
RolloutListGrid(final VaadinMessageSource i18n, final UIEventBus eventBus, RolloutListGrid(final VaadinMessageSource i18n, final UIEventBus eventBus,
final RolloutManagement rolloutManagement, final UINotification uiNotification, final RolloutManagement rolloutManagement, final UINotification uiNotification,
final RolloutUIState rolloutUIState, final SpPermissionChecker permissionChecker, final RolloutUIState rolloutUIState, final SpPermissionChecker permissionChecker,
final TargetManagement targetManagement, final EntityFactory entityFactory, final TargetManagement targetManagement, final EntityFactory entityFactory, final UiProperties uiProperties,
final UiProperties uiProperties,
final TargetFilterQueryManagement targetFilterQueryManagement, final TargetFilterQueryManagement targetFilterQueryManagement,
final RolloutGroupManagement rolloutGroupManagement, final QuotaManagement quotaManagement, final RolloutGroupManagement rolloutGroupManagement, final QuotaManagement quotaManagement,
final TenantConfigurationManagement tenantConfigManagement) { final TenantConfigurationManagement tenantConfigManagement) {
@@ -267,8 +267,8 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
false); false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false, rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false,
false); false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_APPROVAL_DECIDED_BY, String.class, null, false, rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_APPROVAL_DECIDED_BY, String.class, null,
false); false, false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_APPROVAL_REMARK, String.class, null, false, rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_APPROVAL_REMARK, String.class, null, false,
false); false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null, false, rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null, false,
@@ -339,7 +339,8 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
getColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE).setHeaderCaption(i18n.getMessage("header.modifiedDate")); getColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE).setHeaderCaption(i18n.getMessage("header.modifiedDate"));
getColumn(SPUILabelDefinitions.VAR_MODIFIED_BY).setHeaderCaption(i18n.getMessage("header.modifiedBy")); getColumn(SPUILabelDefinitions.VAR_MODIFIED_BY).setHeaderCaption(i18n.getMessage("header.modifiedBy"));
getColumn(SPUILabelDefinitions.VAR_APPROVAL_REMARK).setHeaderCaption(i18n.getMessage("header.approvalRemark")); getColumn(SPUILabelDefinitions.VAR_APPROVAL_REMARK).setHeaderCaption(i18n.getMessage("header.approvalRemark"));
getColumn(SPUILabelDefinitions.VAR_APPROVAL_DECIDED_BY).setHeaderCaption(i18n.getMessage("header.approvalDecidedBy")); getColumn(SPUILabelDefinitions.VAR_APPROVAL_DECIDED_BY)
.setHeaderCaption(i18n.getMessage("header.approvalDecidedBy"));
getColumn(SPUILabelDefinitions.VAR_DESC).setHeaderCaption(i18n.getMessage("header.description")); getColumn(SPUILabelDefinitions.VAR_DESC).setHeaderCaption(i18n.getMessage("header.description"));
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS) getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
.setHeaderCaption(i18n.getMessage("header.detail.status")); .setHeaderCaption(i18n.getMessage("header.detail.status"));
@@ -357,8 +358,8 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
private HeaderCell joinColumns() { private HeaderCell joinColumns() {
return getDefaultHeaderRow().join(VIRT_PROP_RUN, VIRT_PROP_APPROVE, VIRT_PROP_PAUSE, VIRT_PROP_UPDATE, VIRT_PROP_COPY, return getDefaultHeaderRow().join(VIRT_PROP_RUN, VIRT_PROP_APPROVE, VIRT_PROP_PAUSE, VIRT_PROP_UPDATE,
VIRT_PROP_DELETE); VIRT_PROP_COPY, VIRT_PROP_DELETE);
} }
@Override @Override
@@ -372,8 +373,8 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
final List<String> columnsToShowInOrder = Arrays.asList(ROLLOUT_RENDERER_DATA, final List<String> columnsToShowInOrder = Arrays.asList(ROLLOUT_RENDERER_DATA,
SPUILabelDefinitions.VAR_DIST_NAME_VERSION, SPUILabelDefinitions.VAR_STATUS, SPUILabelDefinitions.VAR_DIST_NAME_VERSION, SPUILabelDefinitions.VAR_STATUS,
SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS, SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS, SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS, SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS,
SPUILabelDefinitions.VAR_TOTAL_TARGETS, VIRT_PROP_APPROVE, VIRT_PROP_RUN, VIRT_PROP_PAUSE, VIRT_PROP_UPDATE, SPUILabelDefinitions.VAR_TOTAL_TARGETS, VIRT_PROP_APPROVE, VIRT_PROP_RUN, VIRT_PROP_PAUSE,
VIRT_PROP_COPY, VIRT_PROP_DELETE, SPUILabelDefinitions.VAR_CREATED_DATE, VIRT_PROP_UPDATE, VIRT_PROP_COPY, VIRT_PROP_DELETE, SPUILabelDefinitions.VAR_CREATED_DATE,
SPUILabelDefinitions.VAR_CREATED_USER, SPUILabelDefinitions.VAR_MODIFIED_DATE, SPUILabelDefinitions.VAR_CREATED_USER, SPUILabelDefinitions.VAR_MODIFIED_DATE,
SPUILabelDefinitions.VAR_MODIFIED_BY, SPUILabelDefinitions.VAR_APPROVAL_DECIDED_BY, SPUILabelDefinitions.VAR_MODIFIED_BY, SPUILabelDefinitions.VAR_APPROVAL_DECIDED_BY,
SPUILabelDefinitions.VAR_APPROVAL_REMARK, SPUILabelDefinitions.VAR_DESC); SPUILabelDefinitions.VAR_APPROVAL_REMARK, SPUILabelDefinitions.VAR_DESC);
@@ -789,9 +790,8 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
if (!permissionChecker.hasRolloutCreatePermission()) { if (!permissionChecker.hasRolloutCreatePermission()) {
modifiableColumnsList.remove(VIRT_PROP_COPY); modifiableColumnsList.remove(VIRT_PROP_COPY);
} }
if (!permissionChecker.hasRolloutApprovalPermission() || if (!permissionChecker.hasRolloutApprovalPermission() || !tenantConfigManagement
!tenantConfigManagement.getConfigurationValue( .getConfigurationValue(TenantConfigurationKey.ROLLOUT_APPROVAL_ENABLED, Boolean.class).getValue()) {
TenantConfigurationKey.ROLLOUT_APPROVAL_ENABLED, Boolean.class).getValue()) {
modifiableColumnsList.remove(VIRT_PROP_APPROVE); modifiableColumnsList.remove(VIRT_PROP_APPROVE);
} }
if (!permissionChecker.hasRolloutDeletePermission()) { if (!permissionChecker.hasRolloutDeletePermission()) {

View File

@@ -49,8 +49,7 @@ public class RolloutListView extends AbstractGridComponentLayout {
public RolloutListView(final SpPermissionChecker permissionChecker, final RolloutUIState rolloutUIState, public RolloutListView(final SpPermissionChecker permissionChecker, final RolloutUIState rolloutUIState,
final UIEventBus eventBus, final RolloutManagement rolloutManagement, final UIEventBus eventBus, final RolloutManagement rolloutManagement,
final TargetManagement targetManagement, final UINotification uiNotification, final TargetManagement targetManagement, final UINotification uiNotification,
final UiProperties uiProperties, final EntityFactory entityFactory, final UiProperties uiProperties, final EntityFactory entityFactory, final VaadinMessageSource i18n,
final VaadinMessageSource i18n,
final TargetFilterQueryManagement targetFilterQueryManagement, final TargetFilterQueryManagement targetFilterQueryManagement,
final RolloutGroupManagement rolloutGroupManagement, final QuotaManagement quotaManagement, final RolloutGroupManagement rolloutGroupManagement, final QuotaManagement quotaManagement,
final TenantConfigurationManagement tenantConfigManagement) { final TenantConfigurationManagement tenantConfigManagement) {
@@ -70,6 +69,11 @@ public class RolloutListView extends AbstractGridComponentLayout {
init(); init();
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
public AbstractOrderedLayout createGridHeader() { public AbstractOrderedLayout createGridHeader() {
return new RolloutListHeader(permissionChecker, rolloutUIState, eventBus, rolloutManagement, targetManagement, return new RolloutListHeader(permissionChecker, rolloutUIState, eventBus, rolloutManagement, targetManagement,

View File

@@ -297,8 +297,7 @@ public class RolloutGroupListGrid extends AbstractGrid<LazyQueryContainer> {
@Override @Override
public void click(final RendererClickEvent event) { public void click(final RendererClickEvent event) {
final Optional<RolloutGroup> group = rolloutGroupManagement final Optional<RolloutGroup> group = rolloutGroupManagement.getWithDetailedStatus((Long) event.getItemId());
.getWithDetailedStatus((Long) event.getItemId());
if (!group.isPresent()) { if (!group.isPresent()) {
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS); eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS);
return; return;

View File

@@ -52,6 +52,11 @@ public class RolloutGroupsListView extends AbstractGridComponentLayout {
init(); init();
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
public RolloutGroupsListHeader createGridHeader() { public RolloutGroupsListHeader createGridHeader() {
return new RolloutGroupsListHeader(eventBus, rolloutUIState, i18n); return new RolloutGroupsListHeader(eventBus, rolloutUIState, i18n);

View File

@@ -33,6 +33,11 @@ public class RolloutGroupTargetsListView extends AbstractGridComponentLayout {
init(); init();
} }
@Override
protected boolean doSubscribeToEventBus() {
return false;
}
@Override @Override
public AbstractOrderedLayout createGridHeader() { public AbstractOrderedLayout createGridHeader() {
return new RolloutGroupTargetsListHeader(eventBus, i18n, rolloutUIState); return new RolloutGroupTargetsListHeader(eventBus, i18n, rolloutUIState);