Merged with master

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
kaizimmerm
2016-11-29 16:30:37 +01:00
185 changed files with 2815 additions and 3476 deletions

View File

@@ -10,10 +10,13 @@ package org.eclipse.hawkbit.app;
import org.eclipse.hawkbit.ui.login.HawkbitLoginUI;
import org.eclipse.hawkbit.ui.themes.HawkbitTheme;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.spring.navigator.SpringViewProvider;
/**
* Example hawkBit login UI implementation.
@@ -31,4 +34,9 @@ public class MyLoginUI extends HawkbitLoginUI {
private static final long serialVersionUID = 1L;
@Autowired
protected MyLoginUI(final SpringViewProvider viewProvider, final ApplicationContext context) {
super(viewProvider, context);
}
}

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.app;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.push.EventPushStrategy;
import org.vaadin.spring.events.EventBus.SessionEventBus;
import com.vaadin.annotations.Push;
import com.vaadin.annotations.Theme;
@@ -43,7 +42,7 @@ public class MyUI extends HawkbitUI {
* @param eventBus
* the event bus
*/
public MyUI(final EventPushStrategy pushStrategy, final SessionEventBus eventBus) {
super(pushStrategy, eventBus);
public MyUI(final EventPushStrategy pushStrategy) {
super(pushStrategy);
}
}

View File

@@ -10,8 +10,11 @@ package org.eclipse.hawkbit.app;
import org.eclipse.hawkbit.ui.login.HawkbitLoginUI;
import org.eclipse.hawkbit.ui.themes.HawkbitTheme;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.spring.navigator.SpringViewProvider;
/**
* Example hawkBit login UI implementation.
@@ -27,6 +30,11 @@ import com.vaadin.spring.annotation.SpringUI;
@SuppressWarnings({ "squid:MaximumInheritanceDepth" })
public class MyLoginUI extends HawkbitLoginUI {
@Autowired
protected MyLoginUI(final SpringViewProvider viewProvider, final ApplicationContext context) {
super(viewProvider, context);
}
private static final long serialVersionUID = 1L;
}

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.app;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.push.EventPushStrategy;
import org.vaadin.spring.events.EventBus.SessionEventBus;
import com.vaadin.annotations.Push;
import com.vaadin.shared.communication.PushMode;
@@ -41,8 +40,8 @@ public class MyUI extends HawkbitUI {
* @param eventBus
* the event bus
*/
public MyUI(final EventPushStrategy pushStrategy, final SessionEventBus eventBus) {
super(pushStrategy, eventBus);
public MyUI(final EventPushStrategy pushStrategy) {
super(pushStrategy);
}
}

View File

@@ -69,9 +69,6 @@ public class ConfigurableScenario {
private final MgmtSoftwareModuleClientResource uploadSoftwareModule;
// Exception - squid:S00107 - this is a simulator that leverages multiple
// resouces/feign beans.
@SuppressWarnings("squid:S00107")
public ConfigurableScenario(final MgmtDistributionSetClientResource distributionSetResource,
final MgmtSoftwareModuleClientResource softwareModuleResource,
final MgmtSoftwareModuleClientResource uploadSoftwareModule, final MgmtTargetClientResource targetResource,

View File

@@ -8,6 +8,8 @@
*/
package org.eclipse.hawkbit.autoconfigure.ui;
import java.util.concurrent.ScheduledExecutorService;
import org.eclipse.hawkbit.DistributedResourceBundleMessageSource;
import org.eclipse.hawkbit.ui.push.DelayedEventBusPushStrategy;
import org.eclipse.hawkbit.ui.push.EventPushStrategy;
@@ -18,6 +20,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.vaadin.spring.annotation.EnableVaadinExtensions;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.annotation.EnableEventBus;
import org.vaadin.spring.security.annotation.EnableVaadinSecurity;
@@ -65,8 +68,11 @@ public class UIAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@UIScope
public EventPushStrategy eventPushStrategy(final ConfigurableApplicationContext applicationContext) {
final DelayedEventBusPushStrategy delayedEventBusPushStrategy = new DelayedEventBusPushStrategy();
public EventPushStrategy eventPushStrategy(final ConfigurableApplicationContext applicationContext,
final ScheduledExecutorService executorService, final UIEventBus eventBus,
final UIEventProvider eventProvider) {
final DelayedEventBusPushStrategy delayedEventBusPushStrategy = new DelayedEventBusPushStrategy(executorService,
eventBus, eventProvider);
applicationContext.addApplicationListener(delayedEventBusPushStrategy);
return delayedEventBusPushStrategy;
}

View File

@@ -8,6 +8,8 @@
*/
package org.eclipse.hawkbit;
import java.io.Serializable;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.EnvironmentAware;
@@ -25,7 +27,8 @@ import org.springframework.stereotype.Component;
*/
@Component
@ConfigurationProperties(prefix = "hawkbit.controller")
public class ControllerPollProperties {
public class ControllerPollProperties implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Maximum polling time that can be configured by a tenant in HH:MM:SS

View File

@@ -63,7 +63,8 @@ public interface TargetManagement {
*
* @return number of found {@link Target}s.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Long countTargetByAssignedDistributionSet(@NotNull Long distId);
/**
@@ -104,7 +105,8 @@ public interface TargetManagement {
* to search for
* @return number of found {@link Target}s.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Long countTargetByInstalledDistributionSet(@NotNull Long distId);
/**

View File

@@ -11,8 +11,6 @@ package org.eclipse.hawkbit.repository.model;
import java.util.List;
import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
/**
* A {@link DistributionSet} defines a meta package that combines a set of
* {@link SoftwareModule}s which have to be or are provisioned to a
@@ -36,12 +34,6 @@ public interface DistributionSet extends NamedVersionedEntity {
*/
boolean isDeleted();
/**
* @return immutable {@link List} of {@link DistributionSetMetadata}
* elements. See {@link DistributionSetManagement} to alter.
*/
List<DistributionSetMetadata> getMetadata();
/**
* @return <code>true</code> if {@link DistributionSet} contains a mandatory
* migration step, i.e. unfinished {@link Action}s will kept active
@@ -49,21 +41,11 @@ public interface DistributionSet extends NamedVersionedEntity {
*/
boolean isRequiredMigrationStep();
/**
* @return the assignedTargets
*/
List<Target> getAssignedTargets();
/**
* @return the auto assign target filters
*/
List<TargetFilterQuery> getAutoAssignFilters();
/**
* @return the installedTargets
*/
List<TargetInfo> getInstalledTargets();
/**
*
* @return unmodifiableSet of {@link SoftwareModule}.

View File

@@ -231,7 +231,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
}
private JpaDistributionSet findDistributionSetAndThrowExceptionIfNotFound(final Long setId) {
final JpaDistributionSet set = (JpaDistributionSet) findDistributionSetByIdWithDetails(setId);
final JpaDistributionSet set = (JpaDistributionSet) findDistributionSetById(setId);
if (set == null) {
throw new EntityNotFoundException("Distribution set cannot be updated as it does not exixt" + setId);

View File

@@ -34,7 +34,7 @@ public interface TargetTagRepository
*/
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
Long deleteByName(final String tagName);
Long deleteByName(String tagName);
/**
* find {@link TargetTag} by its name.
@@ -43,7 +43,7 @@ public interface TargetTagRepository
* to filter on
* @return the {@link TargetTag} if found, otherwise null
*/
JpaTargetTag findByNameEquals(final String tagName);
JpaTargetTag findByNameEquals(String tagName);
/**
* Returns all instances of the type.

View File

@@ -209,7 +209,6 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
return deleted;
}
@Override
public List<DistributionSetMetadata> getMetadata() {
if (metadata == null) {
return Collections.emptyList();
@@ -241,29 +240,11 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
return this;
}
@Override
public List<Target> getAssignedTargets() {
if (assignedToTargets == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(assignedToTargets);
}
@Override
public List<TargetFilterQuery> getAutoAssignFilters() {
return autoAssignFilters;
}
@Override
public List<TargetInfo> getInstalledTargets() {
if (installedAtTargets == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(installedAtTargets);
}
@Override
public String toString() {
return "DistributionSet [getName()=" + getName() + ", getOptLockRevision()=" + getOptLockRevision()

View File

@@ -176,14 +176,6 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
this.type = type;
}
public List<SoftwareModuleMetadata> getMetadata() {
if (metadata == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(metadata);
}
@Override
public String toString() {
return "SoftwareModule [deleted=" + deleted + ", name=" + getName() + ", version=" + getVersion()

View File

@@ -83,7 +83,6 @@ public final class DistributionSetSpecification {
targetRoot.fetch(JpaDistributionSet_.modules, JoinType.LEFT);
targetRoot.fetch(JpaDistributionSet_.tags, JoinType.LEFT);
targetRoot.fetch(JpaDistributionSet_.type, JoinType.LEFT);
targetRoot.fetch(JpaDistributionSet_.metadata, JoinType.LEFT);
query.distinct(true);
return predicate;
@@ -110,8 +109,8 @@ public final class DistributionSetSpecification {
}
/**
* {@link Specification} for retrieving {@link DistributionSet}s by
* "like name or like description or like version".
* {@link Specification} for retrieving {@link DistributionSet}s by "like
* name or like description or like version".
*
* @param subString
* to be filtered on
@@ -125,8 +124,8 @@ public final class DistributionSetSpecification {
}
/**
* {@link Specification} for retrieving {@link DistributionSet}s by
* "has at least one of the given tag names".
* {@link Specification} for retrieving {@link DistributionSet}s by "has at
* least one of the given tag names".
*
* @param tagNames
* to be filtered on

View File

@@ -14,23 +14,22 @@ import org.eclipse.hawkbit.im.authentication.PermissionService;
import org.eclipse.hawkbit.im.authentication.SpPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* Bean which contains all SP permissions.
*
*
*
*
*/
@Validated
@Service
public class SpPermissionChecker implements Serializable {
private static final long serialVersionUID = 2757865286212875704L;
@Autowired
private transient PermissionService permissionService;
@Autowired
SpPermissionChecker(final PermissionService permissionService) {
this.permissionService = permissionService;
}
/**
* Gets the SP monitor View Permission.
*

View File

@@ -32,23 +32,22 @@ import com.vaadin.ui.VerticalLayout;
*
* @see Navigator#setErrorView(Class)
*/
@SuppressWarnings("serial")
@SpringComponent
@UIScope
class ErrorView extends VerticalLayout implements View {
private static final long serialVersionUID = 1L;
private final Label message;
@Autowired
private I18N i18n;
private final I18N i18n;
private final DashboardMenu dashboardMenu;
@Autowired
private DashboardMenu dashboardMenu;
/**
* Constructor.
*/
public ErrorView() {
ErrorView(final I18N i18n, final DashboardMenu dashboardMenu) {
this.i18n = i18n;
this.dashboardMenu = dashboardMenu;
setMargin(true);
message = new Label();
addComponent(message);

View File

@@ -61,7 +61,8 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
private transient EventPushStrategy pushStrategy;
protected transient EventBus.SessionEventBus eventBus;
@Autowired
protected transient EventBus.UIEventBus eventBus;
@Autowired
private SpringViewProvider viewProvider;
@@ -80,23 +81,13 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
@Autowired
private ErrorView errorview;
/**
* Default constructor.
*/
@Autowired
public HawkbitUI(final EventBus.SessionEventBus eventBus) {
this.eventBus = eventBus;
}
/**
* Constructor taking the push strategy.
*
* @param pushStrategy
* the strategy to push events from the backend to the UI
*/
@Autowired
public HawkbitUI(final EventPushStrategy pushStrategy, final EventBus.SessionEventBus eventBus) {
this(eventBus);
public HawkbitUI(final EventPushStrategy pushStrategy) {
this.pushStrategy = pushStrategy;
}

View File

@@ -8,6 +8,8 @@
*/
package org.eclipse.hawkbit.ui;
import java.io.Serializable;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@@ -17,13 +19,15 @@ import org.springframework.stereotype.Component;
*/
@Component
@ConfigurationProperties("hawkbit.server.ui")
public class UiProperties {
public class UiProperties implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Demo account login information.
*
*/
public static class Demo {
public static class Demo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Demo tenant.
@@ -72,12 +76,15 @@ public class UiProperties {
* documentation etc.).
*
*/
public static class Links {
public static class Links implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Configuration of UI documentation links.
*
*/
public static class Documentation {
public static class Documentation implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Link to root of documentation and user guides.
*/
@@ -235,13 +242,15 @@ public class UiProperties {
* Configuration of login view.
*
*/
public static class Login {
public static class Login implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Cookie configuration for login credential cookie.
*
*/
public static class Cookie {
public static class Cookie implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Secure cookie enabled.
*/

View File

@@ -8,13 +8,19 @@
*/
package org.eclipse.hawkbit.ui.artifacts;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
import org.eclipse.hawkbit.ui.artifacts.event.ArtifactDetailsEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
import org.eclipse.hawkbit.ui.artifacts.footer.SMDeleteActionsLayout;
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleTableLayout;
import org.eclipse.hawkbit.ui.artifacts.smtype.SMTypeFilterLayout;
@@ -25,8 +31,10 @@ import org.eclipse.hawkbit.ui.management.event.DragEvent;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.util.SPInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -37,7 +45,7 @@ import com.vaadin.server.Page;
import com.vaadin.server.Page.BrowserWindowResizeEvent;
import com.vaadin.server.Page.BrowserWindowResizeListener;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.DragAndDropWrapper;
import com.vaadin.ui.GridLayout;
@@ -47,45 +55,33 @@ import com.vaadin.ui.VerticalLayout;
/**
* Display artifacts upload view.
*
*
*/
@UIScope
@SpringView(name = UploadArtifactView.VIEW_NAME, ui = HawkbitUI.class)
@ViewScope
public class UploadArtifactView extends VerticalLayout implements View, BrowserWindowResizeListener {
public static final String VIEW_NAME = "spUpload";
private static final long serialVersionUID = 8754632011301553682L;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private SpPermissionChecker permChecker;
private final SpPermissionChecker permChecker;
@Autowired
private I18N i18n;
private final I18N i18n;
@Autowired
private transient UINotification uiNotification;
private final UINotification uiNotification;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
@Autowired
private SMTypeFilterLayout filterByTypeLayout;
private final SMTypeFilterLayout filterByTypeLayout;
@Autowired
private SoftwareModuleTableLayout smTableLayout;
private final SoftwareModuleTableLayout smTableLayout;
@Autowired
private ArtifactDetailsLayout artifactDetailsLayout;
private final ArtifactDetailsLayout artifactDetailsLayout;
@Autowired
private UploadLayout uploadLayout;
private final UploadLayout uploadLayout;
@Autowired
private SMDeleteActionsLayout deleteActionsLayout;
private final SMDeleteActionsLayout deleteActionsLayout;
private VerticalLayout detailAndUploadLayout;
@@ -94,8 +90,31 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
private GridLayout mainLayout;
private DragAndDropWrapper dadw;
@Override
public void enter(final ViewChangeEvent event) {
@Autowired
UploadArtifactView(final UIEventBus eventBus, final SpPermissionChecker permChecker, final I18N i18n,
final UINotification uiNotification, final ArtifactUploadState artifactUploadState,
final TagManagement tagManagement, final EntityFactory entityFactory,
final SoftwareManagement softwareManagement, final UploadViewAcceptCriteria uploadViewAcceptCriteria,
final SPInfo spInfo, final ArtifactManagement artifactManagement) {
this.eventBus = eventBus;
this.permChecker = permChecker;
this.i18n = i18n;
this.uiNotification = uiNotification;
this.artifactUploadState = artifactUploadState;
this.filterByTypeLayout = new SMTypeFilterLayout(artifactUploadState, i18n, permChecker, eventBus,
tagManagement, entityFactory, uiNotification, softwareManagement, uploadViewAcceptCriteria);
this.smTableLayout = new SoftwareModuleTableLayout(i18n, permChecker, artifactUploadState, uiNotification,
eventBus, softwareManagement, entityFactory, uploadViewAcceptCriteria);
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
artifactManagement);
this.uploadLayout = new UploadLayout(i18n, uiNotification, eventBus, artifactUploadState, spInfo,
artifactManagement);
this.deleteActionsLayout = new SMDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
artifactUploadState, softwareManagement, uploadViewAcceptCriteria);
}
@PostConstruct
void init() {
buildLayout();
restoreState();
checkNoDataAvaialble();
@@ -109,7 +128,7 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
eventBus.unsubscribe(this);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleEvent event) {
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
minimizeSwTable();
@@ -118,7 +137,7 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final ArtifactDetailsEvent event) {
if (event == ArtifactDetailsEvent.MINIMIZED) {
minimizeArtifactoryDetails();
@@ -272,4 +291,9 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
}
}
@Override
public void enter(final ViewChangeEvent event) {
// This view is constructed in the init() method()
}
}

View File

@@ -14,9 +14,6 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.ArtifactDetailsEvent;
@@ -34,14 +31,13 @@ import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -50,8 +46,6 @@ import com.google.common.collect.Maps;
import com.vaadin.data.Container;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
@@ -65,12 +59,7 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Display the details of the artifacts for a selected software module.
*
*
*/
@SpringComponent
@ViewScope
public class ArtifactDetailsLayout extends VerticalLayout {
private static final long serialVersionUID = -5189069028037133891L;
@@ -91,17 +80,13 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private static final String MD5HASH = "md5Hash";
@Autowired
private I18N i18n;
private final I18N i18n;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
@Autowired
private transient UINotification uINotification;
private final UINotification uINotification;
private Label titleOfArtifactDetails;
@@ -111,15 +96,21 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private Table maxArtifactDetailsTable;
private boolean fullWindowMode = false;
private boolean fullWindowMode;
private boolean readOnly = false;
private boolean readOnly;
private final transient ArtifactManagement artifactManagement;
public ArtifactDetailsLayout(final I18N i18n, final UIEventBus eventBus,
final ArtifactUploadState artifactUploadState, final UINotification uINotification,
final ArtifactManagement artifactManagement) {
this.i18n = i18n;
this.eventBus = eventBus;
this.artifactUploadState = artifactUploadState;
this.uINotification = uINotification;
this.artifactManagement = artifactManagement;
/**
* Initialize the artifact details layout.
*/
@PostConstruct
private void init() {
createComponents();
buildLayout();
eventBus.subscribe(this);
@@ -133,18 +124,6 @@ public class ArtifactDetailsLayout extends VerticalLayout {
}
}
/**
* Initialize the artifact details layout in readonly mode (will not show
* the delete icon) .
*
* @param readOnly
* value true for read only.
*/
public void init(final boolean readOnly) {
this.readOnly = readOnly;
init();
}
private void createComponents() {
final String labelStr = artifactUploadState.getSelectedBaseSoftwareModule()
.map(softwareModule -> HawkbitCommonUtil.getFormattedNameVersion(softwareModule.getName(),
@@ -192,7 +171,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
header.addComponents(titleOfArtifactDetails, maxMinButton);
header.setComponentAlignment(titleOfArtifactDetails, Alignment.TOP_LEFT);
header.setComponentAlignment(maxMinButton, Alignment.TOP_RIGHT);
header.setExpandRatio(titleOfArtifactDetails, 1.0f);
header.setExpandRatio(titleOfArtifactDetails, 1.0F);
setSizeFull();
setImmediate(true);
@@ -202,7 +181,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
setComponentAlignment(header, Alignment.MIDDLE_CENTER);
addComponent(artifactDetailsTable);
setComponentAlignment(artifactDetailsTable, Alignment.MIDDLE_CENTER);
setExpandRatio(artifactDetailsTable, 1.0f);
setExpandRatio(artifactDetailsTable, 1.0F);
}
@@ -276,8 +255,6 @@ public class ArtifactDetailsLayout extends VerticalLayout {
i18n.get("message.delete.artifact", new Object[] { fileName }), i18n.get("button.ok"),
i18n.get("button.cancel"), ok -> {
if (ok) {
final ArtifactManagement artifactManagement = SpringContextHelper
.getBean(ArtifactManagement.class);
artifactManagement.deleteArtifact(id);
uINotification.displaySuccess(i18n.get("message.artifact.deleted", fileName));
if (artifactUploadState.getSelectedBaseSwModuleId().isPresent()) {
@@ -308,15 +285,15 @@ public class ArtifactDetailsLayout extends VerticalLayout {
table.setColumnHeader(ACTION, i18n.get("upload.action"));
}
table.setColumnExpandRatio(PROVIDED_FILE_NAME, 3.5f);
table.setColumnExpandRatio(PROVIDED_FILE_NAME, 3.5F);
table.setColumnExpandRatio(SIZE, 2f);
if (fullWindowMode) {
table.setColumnExpandRatio(SHA1HASH, 2.8f);
table.setColumnExpandRatio(MD5HASH, 2.4f);
table.setColumnExpandRatio(SHA1HASH, 2.8F);
table.setColumnExpandRatio(MD5HASH, 2.4F);
}
table.setColumnExpandRatio(CREATE_MODIFIED_DATE_UPLOAD, 3f);
table.setColumnExpandRatio(CREATE_MODIFIED_DATE_UPLOAD, 3F);
if (!readOnly) {
table.setColumnExpandRatio(ACTION, 2.5f);
table.setColumnExpandRatio(ACTION, 2.5F);
}
table.setVisibleColumns(getVisbleColumns().toArray());
@@ -460,7 +437,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
setVisible(false);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
if (BaseEntityEventType.SELECTED_ENTITY == softwareModuleEvent.getEventType()) {
UI.getCurrent().access(() -> {
@@ -486,14 +463,6 @@ public class ArtifactDetailsLayout extends VerticalLayout {
}
}
@PreDestroy
void destroy() {
eventBus.unsubscribe(this); // It's good manners to do this, even though
// we should be
// automatically unsubscribed when the UI is
// garbage collected
}
public Table getArtifactDetailsTable() {
return artifactDetailsTable;
}

View File

@@ -14,10 +14,13 @@ import java.util.Map;
import org.eclipse.hawkbit.ui.common.AbstractAcceptCriteria;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.google.common.collect.Maps;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.Component;
/**
@@ -25,7 +28,7 @@ import com.vaadin.ui.Component;
*
*/
@SpringComponent
@ViewScope
@UIScope
public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
private static final long serialVersionUID = 5158811326115667378L;
@@ -34,6 +37,11 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
private static final Map<String, Object> DROP_HINTS_CONFIGS = createDropHintConfigurations();
@Autowired
UploadViewAcceptCriteria(final UINotification uiNotification, final UIEventBus eventBus) {
super(uiNotification, eventBus);
}
@Override
protected String getComponentId(final Component component) {
String id = component.getId();

View File

@@ -10,22 +10,24 @@ package org.eclipse.hawkbit.ui.artifacts.footer;
import java.util.Set;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
import org.eclipse.hawkbit.ui.management.event.DragEvent;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Component;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.TableTransferable;
@@ -33,24 +35,30 @@ import com.vaadin.ui.UI;
/**
* Upload view footer layout implementation.
*
*/
@SpringComponent
@ViewScope
public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
private static final long serialVersionUID = -3273982053389866299L;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
@Autowired
private UploadViewConfirmationWindowLayout uploadViewConfirmationWindowLayout;
private final UploadViewConfirmationWindowLayout uploadViewConfirmationWindowLayout;
@Autowired
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
private final UploadViewAcceptCriteria uploadViewAcceptCriteria;
@EventBusListenerMethod(scope = EventScope.SESSION)
public SMDeleteActionsLayout(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final UINotification notification, final ArtifactUploadState artifactUploadState,
final SoftwareManagement softwareManagement, final UploadViewAcceptCriteria uploadViewAcceptCriteria) {
super(i18n, permChecker, eventBus, notification);
this.artifactUploadState = artifactUploadState;
this.uploadViewConfirmationWindowLayout = new UploadViewConfirmationWindowLayout(i18n, eventBus,
softwareManagement, artifactUploadState);
this.uploadViewAcceptCriteria = uploadViewAcceptCriteria;
init();
}
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final UploadArtifactUIEvent event) {
if (isSoftwareEvent(event) || isSoftwareTypeEvent(event)) {
@@ -84,7 +92,7 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|| event == UploadArtifactUIEvent.DISCARD_DELETE_SOFTWARE_TYPE;
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DragEvent event) {
if (event == DragEvent.HIDE_DROP_HINT) {
UI.getCurrent().access(() -> hideDropHints());
@@ -134,9 +142,8 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
final String swModuleTypeName = sourceComponent.getId()
.replace(UIComponentIdProvider.UPLOAD_TYPE_BUTTON_PREFIX, "");
if (artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent()
&& artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().get().getName()
.equalsIgnoreCase(swModuleTypeName)) {
if (artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType()
.map(type -> type.getName().equalsIgnoreCase(swModuleTypeName)).orElse(false)) {
notification.displayValidationError(
i18n.get("message.swmodule.type.check.delete", new Object[] { swModuleTypeName }));
} else {

View File

@@ -20,30 +20,24 @@ import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.google.common.collect.Maps;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.FontAwesome;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Table.Align;
/**
* Abstract layout of confirm actions window.
*
*
*
*/
@SpringComponent
@ViewScope
public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWindowLayout {
private static final long serialVersionUID = 1804036019105286988L;
@@ -56,11 +50,16 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
private static final String DISCARD = "Discard";
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
UploadViewConfirmationWindowLayout(final I18N i18n, final UIEventBus eventBus,
final SoftwareManagement softwareManagement, final ArtifactUploadState artifactUploadState) {
super(i18n, eventBus);
this.softwareManagement = softwareManagement;
this.artifactUploadState = artifactUploadState;
}
@Override
protected Map<String, ConfirmationTab> getConfimrationTabs() {

View File

@@ -8,8 +8,6 @@
*/
package org.eclipse.hawkbit.ui.artifacts.smtable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -29,12 +27,10 @@ import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.FormLayout;
@@ -46,26 +42,19 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Generates window for Software module add or update.
*/
@SpringComponent
@ViewScope
public class SoftwareModuleAddUpdateWindow extends CustomComponent {
private static final long serialVersionUID = -5217675246477211483L;
@Autowired
private I18N i18n;
private final I18N i18n;
@Autowired
private transient UINotification uiNotifcation;
private final UINotification uiNotifcation;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private transient EntityFactory entityFactory;
private final transient EntityFactory entityFactory;
private TextField nameTextField;
@@ -77,14 +66,23 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
private TextArea descTextArea;
private CommonDialogWindow window;
private Boolean editSwModule = Boolean.FALSE;
private Long baseSwModuleId;
private FormLayout formLayout;
public SoftwareModuleAddUpdateWindow(final I18N i18n, final UINotification uiNotifcation, final UIEventBus eventBus,
final SoftwareManagement softwareManagement, final EntityFactory entityFactory) {
this.i18n = i18n;
this.uiNotifcation = uiNotifcation;
this.eventBus = eventBus;
this.softwareManagement = softwareManagement;
this.entityFactory = entityFactory;
createRequiredComponents();
}
/**
* Save or update the sw module.
*/
@@ -104,14 +102,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
}
}
/**
* Initialize Distribution Add and Edit Window.
*/
@PostConstruct
void init() {
createRequiredComponents();
}
/**
* Create window for new software module.
*
@@ -133,9 +123,9 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
public CommonDialogWindow createUpdateSoftwareModuleWindow(final Long baseSwModuleId) {
this.baseSwModuleId = baseSwModuleId;
resetComponents();
populateTypeNameCombo();
populateValuesOfSwModule();
createWindow();
return window;
return createWindow();
}
private void createRequiredComponents() {
@@ -157,7 +147,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
typeComboBox.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + " " + ValoTheme.COMBOBOX_TINY);
typeComboBox.setNewItemsAllowed(Boolean.FALSE);
typeComboBox.setImmediate(Boolean.TRUE);
populateTypeNameCombo();
}
private TextField createTextField(final String in18Key, final String id) {
@@ -181,7 +170,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
editSwModule = Boolean.FALSE;
}
private void createWindow() {
private CommonDialogWindow createWindow() {
final Label madatoryStarLabel = new Label("*");
madatoryStarLabel.setStyleName("v-caption v-required-field-indicator");
madatoryStarLabel.setWidth(null);
@@ -198,7 +187,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
setCompositionRoot(formLayout);
window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
final CommonDialogWindow window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
.caption(i18n.get("upload.caption.add.new.swmodule")).content(this).layout(formLayout).i18n(i18n)
.saveDialogCloseListener(new SaveOnDialogCloseListener()).buildCommonDialogWindow();
nameTextField.setEnabled(!editSwModule);
@@ -206,6 +195,8 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
typeComboBox.setEnabled(!editSwModule);
typeComboBox.focus();
return window;
}
private void addNewBaseSoftware() {
@@ -271,6 +262,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
: HawkbitCommonUtil.trimAndNullIfEmpty(swModle.getVendor()));
descTextArea.setValue(swModle.getDescription() == null ? HawkbitCommonUtil.SP_STRING_EMPTY
: HawkbitCommonUtil.trimAndNullIfEmpty(swModle.getDescription()));
if (swModle.getType().isDeleted()) {
typeComboBox.addItem(swModle.getType().getName());
}

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
@@ -20,13 +21,12 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.distributions.event.MetadataEvent;
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
@@ -36,44 +36,39 @@ import com.vaadin.ui.Window;
/**
* Software module details.
*
*
*/
@SpringComponent
@ViewScope
public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDetailsLayout<SoftwareModule> {
private static final long serialVersionUID = -4900381301076646366L;
@Autowired
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private SwMetadataPopupLayout swMetadataPopupLayout;
private final SwMetadataPopupLayout swMetadataPopupLayout;
@Autowired
private transient EntityFactory entityFactory;
private final SoftwareModuleMetadatadetailslayout swmMetadataTable;
private SoftwareModuleMetadatadetailslayout swmMetadataTable;
SoftwareModuleDetails(final I18N i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow,
final ArtifactUploadState artifactUploadState, final SoftwareManagement softwareManagement,
final SwMetadataPopupLayout swMetadataPopupLayout, final EntityFactory entityFactory) {
super(i18n, eventBus, permissionChecker, null);
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
this.artifactUploadState = artifactUploadState;
this.softwareManagement = softwareManagement;
this.swMetadataPopupLayout = swMetadataPopupLayout;
/**
* softwareLayout Initialize the component.
*/
@Override
protected void init() {
swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
swmMetadataTable.init(getI18n(), getPermissionChecker(), softwareManagement, swMetadataPopupLayout,
entityFactory);
super.init();
addTabs(detailsTab);
restoreState();
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final MetadataEvent event) {
UI.getCurrent().access(() -> {
final MetaData softwareModuleMetadata = event.getMetaData();
@@ -168,7 +163,7 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
return artifactUploadState.isSwModuleTableMaximized();
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
onBaseEntityEvent(softwareModuleEvent);
}
@@ -194,8 +189,7 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
}
private boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
final SoftwareModule selectedUploadSWModule = artifactUploadState.getSelectedBaseSoftwareModule().isPresent()
? artifactUploadState.getSelectedBaseSoftwareModule().get() : null;
final SoftwareModule selectedUploadSWModule = artifactUploadState.getSelectedBaseSoftwareModule().orElse(null);
return softwareModule != null && selectedUploadSWModule != null
&& selectedUploadSWModule.getName().equals(softwareModule.getName())
&& selectedUploadSWModule.getVersion().equals(softwareModule.getVersion());

View File

@@ -24,15 +24,17 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -42,34 +44,41 @@ import com.vaadin.data.Item;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.server.FontAwesome;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Table;
import com.vaadin.ui.UI;
/**
* Header of Software module table.
* The Software module table.
*/
@ViewScope
@SpringComponent
public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModule, Long> {
private static final long serialVersionUID = 6469417305487144809L;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
private final UploadViewAcceptCriteria uploadViewAcceptCriteria;
@Autowired
private SwMetadataPopupLayout swMetadataPopupLayout;
private final SwMetadataPopupLayout swMetadataPopupLayout;
@EventBusListenerMethod(scope = EventScope.SESSION)
SoftwareModuleTable(final UIEventBus eventBus, final I18N i18n, final UINotification uiNotification,
final ArtifactUploadState artifactUploadState, final SoftwareManagement softwareManagement,
final UploadViewAcceptCriteria uploadViewAcceptCriteria,
final SwMetadataPopupLayout swMetadataPopupLayout) {
super(eventBus, i18n, uiNotification);
this.artifactUploadState = artifactUploadState;
this.softwareManagement = softwareManagement;
this.uploadViewAcceptCriteria = uploadViewAcceptCriteria;
this.swMetadataPopupLayout = swMetadataPopupLayout;
addNewContainerDS();
setColumnProperties();
setDataAvailable(getContainerDataSource().size() != 0);
}
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SMFilterEvent filterEvent) {
UI.getCurrent().access(() -> {
@@ -153,12 +162,12 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, lastSoftwareModule));
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleEvent event) {
onBaseEntityEvent(event);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final UploadArtifactUIEvent event) {
if (event == UploadArtifactUIEvent.DELETED_ALL_SOFWARE) {
UI.getCurrent().access(this::refreshFilter);

View File

@@ -8,43 +8,41 @@
*/
package org.eclipse.hawkbit.ui.artifacts.smtable;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
/**
* Header of Software module table.
*
*
*
*/
@SpringComponent
@ViewScope
public class SoftwareModuleTableHeader extends AbstractTableHeader {
private static final long serialVersionUID = 242961845006626297L;
@Autowired
private ArtifactUploadState artifactUploadState;
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
@Autowired
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
SoftwareModuleTableHeader(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
final ArtifactUploadState artifactUploadState,
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow) {
super(i18n, permChecker, eventbus, null, null, artifactUploadState);
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final UploadArtifactUIEvent event) {
if (event == UploadArtifactUIEvent.HIDE_FILTER_BY_TYPE) {
setFilterButtonsIconVisible(true);
@@ -73,10 +71,7 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
@Override
protected String onLoadSearchBoxValue() {
if (artifactUploadState.getSoftwareModuleFilters().getSearchText().isPresent()) {
return artifactUploadState.getSoftwareModuleFilters().getSearchText().get();
}
return null;
return artifactUploadState.getSoftwareModuleFilters().getSearchText().orElse(null);
}
@Override

View File

@@ -8,38 +8,42 @@
*/
package org.eclipse.hawkbit.ui.artifacts.smtable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
/**
* Software module table layout. (Upload Management)
*/
@SpringComponent
@ViewScope
public class SoftwareModuleTableLayout extends AbstractTableLayout {
private static final long serialVersionUID = 6464291374980641235L;
@Autowired
private SoftwareModuleDetails softwareModuleDetails;
public SoftwareModuleTableLayout(final I18N i18n, final SpPermissionChecker permChecker,
final ArtifactUploadState artifactUploadState, final UINotification uiNotification,
final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
final UploadViewAcceptCriteria uploadViewAcceptCriteria) {
@Autowired
private SoftwareModuleTableHeader smTableHeader;
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow = new SoftwareModuleAddUpdateWindow(i18n,
uiNotification, eventBus, softwareManagement, entityFactory);
@Autowired
private SoftwareModuleTable smTable;
final SwMetadataPopupLayout swMetadataPopupLayout = new SwMetadataPopupLayout(i18n, uiNotification, eventBus,
softwareManagement, entityFactory, permChecker);
/**
* Initialize the filter layout.
*/
@PostConstruct
void init() {
super.init(smTableHeader, smTable, softwareModuleDetails);
super.init(
new SoftwareModuleTableHeader(i18n, permChecker, eventBus, artifactUploadState,
softwareModuleAddUpdateWindow),
new SoftwareModuleTable(eventBus, i18n, uiNotification, artifactUploadState, softwareManagement,
uploadViewAcceptCriteria, swMetadataPopupLayout),
new SoftwareModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow,
artifactUploadState, softwareManagement, swMetadataPopupLayout, entityFactory));
}
}

View File

@@ -11,7 +11,10 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum;
@@ -23,17 +26,17 @@ import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Label;
import com.vaadin.ui.OptionGroup;
import com.vaadin.ui.TextField;
@@ -44,15 +47,12 @@ import com.vaadin.ui.themes.ValoTheme;
* Layout for the create or update software module type.
*
*/
@SpringComponent
@ViewScope
public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<SoftwareModuleType> {
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory.getLogger(CreateUpdateSoftwareTypeLayout.class);
@Autowired
private transient SoftwareManagement swTypeManagementService;
private final transient SoftwareManagement swTypeManagementService;
private String singleAssignStr;
private String multiAssignStr;
@@ -60,6 +60,13 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
private Label multiAssign;
private OptionGroup assignOptiongroup;
public CreateUpdateSoftwareTypeLayout(final I18N i18n, final TagManagement tagManagement,
final EntityFactory entityFactory, final UIEventBus eventBus, final SpPermissionChecker permChecker,
final UINotification uiNotification, final SoftwareManagement swTypeManagementService) {
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
this.swTypeManagementService = swTypeManagementService;
}
@Override
protected void addListeners() {
super.addListeners();

View File

@@ -15,52 +15,37 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
/**
* Single button click behaviour of filter buttons layout.
*
*
*
*/
@SpringComponent
@ViewScope
public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick implements Serializable {
private static final long serialVersionUID = 3707945900524967887L;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
SMTypeFilterButtonClick(final UIEventBus eventBus, final ArtifactUploadState artifactUploadState,
final SoftwareManagement softwareManagement) {
this.eventBus = eventBus;
this.artifactUploadState = artifactUploadState;
this.softwareManagement = softwareManagement;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#
* filterUnClicked(com.vaadin.ui. Button)
*/
@Override
protected void filterUnClicked(final Button clickedButton) {
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(null);
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
}
/*
* (non-Javadoc)
*
* @see hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#filterClicked
* (com.vaadin.ui.Button )
*/
@Override
protected void filterClicked(final Button clickedButton) {
final SoftwareModuleType softwareModuleType = softwareManagement

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
import java.util.EnumSet;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
@@ -19,35 +20,36 @@ import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Software module type filter buttons.
*
*/
@SpringComponent
@ViewScope
public class SMTypeFilterButtons extends AbstractFilterButtons {
private static final long serialVersionUID = 169198312654380358L;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
@Autowired
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
private final UploadViewAcceptCriteria uploadViewAcceptCriteria;
@EventBusListenerMethod(scope = EventScope.SESSION)
SMTypeFilterButtons(final UIEventBus eventBus, final ArtifactUploadState artifactUploadState,
final UploadViewAcceptCriteria uploadViewAcceptCriteria, final SoftwareManagement softwareManagement) {
super(eventBus, new SMTypeFilterButtonClick(eventBus, artifactUploadState, softwareManagement));
this.artifactUploadState = artifactUploadState;
this.uploadViewAcceptCriteria = uploadViewAcceptCriteria;
}
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleTypeEvent event) {
if (event.getSoftwareModuleType() != null
&& EnumSet.allOf(SoftwareModuleTypeEnum.class).contains(event.getSoftwareModuleTypeEnum())) {
@@ -56,7 +58,7 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final UploadArtifactUIEvent event) {
if (event == UploadArtifactUIEvent.DELETED_ALL_SOFWARE_TYPE) {
refreshTable();
@@ -70,14 +72,13 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
@Override
protected LazyQueryContainer createButtonsLazyQueryContainer() {
return HawkbitCommonUtil.createLazyQueryContainer(
new BeanQueryFactory<SoftwareModuleTypeBeanQuery>(SoftwareModuleTypeBeanQuery.class));
return HawkbitCommonUtil.createLazyQueryContainer(new BeanQueryFactory<>(SoftwareModuleTypeBeanQuery.class));
}
@Override
protected boolean isClickedByDefault(final String typeName) {
return artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() && artifactUploadState
.getSoftwareModuleFilters().getSoftwareModuleType().get().getName().equals(typeName);
return artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType()
.map(type -> type.getName().equals(typeName)).orElse(false);
}
@Override

View File

@@ -8,18 +8,20 @@
*/
package org.eclipse.hawkbit.ui.artifacts.smtype;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
@@ -27,25 +29,22 @@ import com.vaadin.ui.Window;
/**
* Software module type filter buttons header.
*/
@SpringComponent
@ViewScope
public class SMTypeFilterHeader extends AbstractFilterHeader {
private static final long serialVersionUID = -4855810338059032342L;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
private final CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
@Autowired
private CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
SMTypeFilterHeader(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final ArtifactUploadState artifactUploadState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement) {
super(permChecker, eventBus, i18n);
this.artifactUploadState = artifactUploadState;
this.createUpdateSWTypeLayout = new CreateUpdateSoftwareTypeLayout(i18n, tagManagement, entityFactory, eventBus,
permChecker, uiNotification, softwareManagement);
/**
* Initialize the components.
*/
@Override
@PostConstruct
protected void init() {
super.init();
if (permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission()) {
createUpdateSWTypeLayout.init();
}

View File

@@ -8,57 +8,44 @@
*/
package org.eclipse.hawkbit.ui.artifacts.smtype;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterLayout;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Software module type filter buttons layout.
*
*
*
*/
@SpringComponent
@ViewScope
public class SMTypeFilterLayout extends AbstractFilterLayout {
private static final long serialVersionUID = 1581066345157393665L;
@Autowired
private transient EventBus.SessionEventBus eventbus;
private final ArtifactUploadState artifactUploadState;
@Autowired
private SMTypeFilterHeader smTypeFilterHeader;
public SMTypeFilterLayout(final ArtifactUploadState artifactUploadState, final I18N i18n,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement, final UploadViewAcceptCriteria uploadViewAcceptCriteria) {
super(new SMTypeFilterHeader(i18n, permChecker, eventBus, artifactUploadState, tagManagement, entityFactory,
uiNotification, softwareManagement),
new SMTypeFilterButtons(eventBus, artifactUploadState, uploadViewAcceptCriteria, softwareManagement));
@Autowired
private SMTypeFilterButtons smTypeFilterButtons;
this.artifactUploadState = artifactUploadState;
restoreState();
@Autowired
private SMTypeFilterButtonClick smTypeFilterButtonClick;
@Autowired
private ArtifactUploadState artifactUploadState;
/**
* Initialize the filter layout.
*/
@PostConstruct
void init() {
super.init(smTypeFilterHeader, smTypeFilterButtons, smTypeFilterButtonClick);
eventbus.subscribe(this);
eventBus.subscribe(this);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final UploadArtifactUIEvent event) {
if (event == UploadArtifactUIEvent.HIDE_FILTER_BY_TYPE) {
setVisible(false);
@@ -68,21 +55,6 @@ public class SMTypeFilterLayout extends AbstractFilterLayout {
}
}
@PreDestroy
void destroy() {
/*
* It's good manners to do this, even though vaadin-spring will
* automatically unsubscribe when this UI is garbage collected.
*/
eventbus.unsubscribe(this);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.SPFilterLayout#
* onLoadIsTypeFilterIsClosed()
*/
@Override
public Boolean onLoadIsTypeFilterIsClosed() {
return artifactUploadState.isSwTypeFilterClosed();

View File

@@ -38,8 +38,7 @@ public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializ
private static final long serialVersionUID = 8273440375917450859L;
@Autowired
private SoftwareModuleFilters softwareModuleFilters;
private final SoftwareModuleFilters softwareModuleFilters;
private final Map<Long, String> deleteSofwareModules = new HashMap<>();
@@ -75,6 +74,11 @@ public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializ
private final AtomicInteger numberOfFileUploadsFailed = new AtomicInteger();
@Autowired
ArtifactUploadState(final SoftwareModuleFilters softwareModuleFilters) {
this.softwareModuleFilters = softwareModuleFilters;
}
public AtomicInteger getNumberOfFileUploadsFailed() {
return numberOfFileUploadsFailed;
}

View File

@@ -85,16 +85,6 @@ public class CustomFile implements Serializable {
this.baseSoftwareModuleVersion = baseSoftwareModuleVersion;
}
/**
* Default constructor with the immutable fileName set.
*
* @param fileName
* uploaded file name
*/
public CustomFile(final String fileName) {
this.fileName = fileName;
}
public String getBaseSoftwareModuleName() {
return baseSoftwareModuleName;
}

View File

@@ -35,10 +35,10 @@ import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
@@ -116,6 +116,10 @@ public class UploadConfirmationWindow implements Button.ClickListener {
private final ArtifactUploadState artifactUploadState;
private final transient UIEventBus eventBus;
private final transient ArtifactManagement artifactManagement;
/**
* Initialize the upload confirmation window.
*
@@ -124,10 +128,12 @@ public class UploadConfirmationWindow implements Button.ClickListener {
* @param artifactUploadState
* reference of session variable {@link ArtifactUploadState}.
*/
public UploadConfirmationWindow(final UploadLayout artifactUploadView,
final ArtifactUploadState artifactUploadState) {
UploadConfirmationWindow(final UploadLayout artifactUploadView, final ArtifactUploadState artifactUploadState,
final UIEventBus eventBus, final ArtifactManagement artifactManagement) {
this.uploadLayout = artifactUploadView;
this.artifactUploadState = artifactUploadState;
this.eventBus = eventBus;
this.artifactManagement = artifactManagement;
i18n = artifactUploadView.getI18n();
createRequiredComponents();
buildLayout();
@@ -188,7 +194,6 @@ public class UploadConfirmationWindow implements Button.ClickListener {
*/
private void setWarningIcon(final Label warningIconLabel, final String fileName, final Object itemId) {
final Item item = uploadDetailsTable.getItem(itemId);
final ArtifactManagement artifactManagement = SpringContextHelper.getBean(ArtifactManagement.class);
if (HawkbitCommonUtil.trimAndNullIfEmpty(fileName) != null) {
final Long baseSwId = (Long) item.getItemProperty(BASE_SOFTWARE_ID).getValue();
final List<Artifact> artifactList = artifactManagement.findByFilenameAndSoftwareModule(fileName, baseSwId);
@@ -432,7 +437,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
private void hideErrorIcon(final Label warningLabel, final int errorLabelCount, final int duplicateCount,
final Label errorLabel, final String oldFileName, final Long currentSwId) {
if (warningLabel == null && (errorLabelCount > 1 || (duplicateCount == 1 && errorLabelCount == 1))) {
final ArtifactManagement artifactManagement = SpringContextHelper.getBean(ArtifactManagement.class);
final List<Artifact> artifactList = artifactManagement.findByFilenameAndSoftwareModule(oldFileName,
currentSwId);
errorLabel.removeStyleName(SPUIStyleDefinitions.ERROR_LABEL);
@@ -577,7 +582,6 @@ public class UploadConfirmationWindow implements Button.ClickListener {
private void processArtifactUpload() {
final List<String> itemIds = (List<String>) uploadDetailsTable.getItemIds();
if (preUploadValidation(itemIds)) {
final ArtifactManagement artifactManagement = SpringContextHelper.getBean(ArtifactManagement.class);
Boolean refreshArtifactDetailsLayout = false;
for (final String itemId : itemIds) {
final String[] itemDet = itemId.split("/");
@@ -602,7 +606,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
uploadLayout.clearFileList();
window.close();
// call upload result window
currentUploadResultWindow = new UploadResultWindow(uploadResultList, i18n);
currentUploadResultWindow = new UploadResultWindow(uploadResultList, i18n, eventBus);
UI.getCurrent().addWindow(currentUploadResultWindow.getUploadResultsWindow());
currentUploadResultWindow.getUploadResultsWindow().addCloseListener(event -> onResultDetailsPopupClose());
uploadLayout.setResultPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),

View File

@@ -11,8 +11,6 @@ package org.eclipse.hawkbit.ui.artifacts.upload;
import java.io.IOException;
import java.io.OutputStream;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.UploadFileStatus;
@@ -60,15 +58,15 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
private final long maxSize;
private final Upload upload;
private volatile String fileName = null;
private volatile String mimeType = null;
private volatile boolean streamingInterrupted = false;
private volatile boolean uploadInterrupted = false;
private volatile boolean aborted = false;
private volatile String fileName;
private volatile String mimeType;
private volatile boolean streamingInterrupted;
private volatile boolean uploadInterrupted;
private volatile boolean aborted;
private String failureReason;
private final I18N i18n;
private transient EventBus.SessionEventBus eventBus;
private transient EventBus.UIEventBus eventBus;
private final SoftwareModule selectedSw;
private SoftwareModule selectedSwForUpload;
private final ArtifactUploadState artifactUploadState;
@@ -85,21 +83,12 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
this.mimeType = mimeType;
this.selectedSw = selectedSw;
this.i18n = SpringContextHelper.getBean(I18N.class);
this.eventBus = SpringContextHelper.getBean(EventBus.SessionEventBus.class);
this.eventBus = SpringContextHelper.getBean(EventBus.UIEventBus.class);
this.artifactUploadState = SpringContextHelper.getBean(ArtifactUploadState.class);
eventBus.subscribe(this);
}
@PreDestroy
void destroy() {
/*
* It's good manners to do this, even though vaadin-spring will
* automatically unsubscribe when this UI is garbage collected.
*/
eventBus.unsubscribe(this);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final UploadStatusEventType event) {
if (event == UploadStatusEventType.ABORT_UPLOAD) {
aborted = true;

View File

@@ -17,10 +17,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.apache.commons.io.FileUtils;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
@@ -43,9 +41,9 @@ import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.util.SPInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -58,8 +56,6 @@ import com.vaadin.server.FontAwesome;
import com.vaadin.server.Page;
import com.vaadin.server.StreamVariable;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.DragAndDropWrapper;
@@ -74,36 +70,24 @@ import com.vaadin.ui.VerticalLayout;
/**
* Upload files layout.
*/
@ViewScope
@SpringComponent
public class UploadLayout extends VerticalLayout {
/**
*
*/
private static final String HTML_DIV = "</div>";
private static final long serialVersionUID = -566164756606779220L;
private static final Logger LOG = LoggerFactory.getLogger(UploadLayout.class);
@Autowired
private UploadStatusInfoWindow uploadInfoWindow;
private final UploadStatusInfoWindow uploadInfoWindow;
@Autowired
private I18N i18n;
private final I18N i18n;
@Autowired
private transient UINotification uiNotification;
private final UINotification uiNotification;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
@Autowired
private transient SPInfo spInfo;
private final transient SPInfo spInfo;
private final List<String> duplicateFileNamesList = new ArrayList<>();
@@ -115,7 +99,7 @@ public class UploadLayout extends VerticalLayout {
private VerticalLayout dropAreaLayout;
private UI ui;
private final UI ui;
private HorizontalLayout fileUploadLayout;
@@ -125,11 +109,19 @@ public class UploadLayout extends VerticalLayout {
private Button uploadStatusButton;
/**
* Initialize the upload layout.
*/
@PostConstruct
void init() {
private final transient ArtifactManagement artifactManagement;
public UploadLayout(final I18N i18n, final UINotification uiNotification, final UIEventBus eventBus,
final ArtifactUploadState artifactUploadState, final SPInfo spInfo,
final ArtifactManagement artifactManagement) {
this.uploadInfoWindow = new UploadStatusInfoWindow(eventBus, artifactUploadState, i18n);
this.i18n = i18n;
this.uiNotification = uiNotification;
this.eventBus = eventBus;
this.artifactUploadState = artifactUploadState;
this.spInfo = spInfo;
this.artifactManagement = artifactManagement;
createComponents();
buildLayout();
restoreState();
@@ -137,7 +129,7 @@ public class UploadLayout extends VerticalLayout {
ui = UI.getCurrent();
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final UploadArtifactUIEvent event) {
if (event == UploadArtifactUIEvent.DELETED_ALL_SOFWARE) {
ui.access(() -> updateActionCount());
@@ -150,32 +142,23 @@ public class UploadLayout extends VerticalLayout {
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final UploadStatusEvent event) {
if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STARTED) {
ui.access(() -> onStartOfUpload());
ui.access(this::onStartOfUpload);
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_FAILED) {
ui.access(() -> onUploadFailure(event));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_FINISHED) {
ui.access(() -> onUploadCompletion());
ui.access(this::onUploadCompletion);
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_SUCCESSFUL) {
ui.access(() -> onUploadSuccess(event));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FAILED) {
ui.access(() -> onUploadStreamingFailure(event));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FINISHED) {
ui.access(() -> onUploadStreamingSuccess());
ui.access(this::onUploadStreamingSuccess);
}
}
@PreDestroy
void destroy() {
/*
* It's good manners to do this, even though vaadin-spring will
* automatically unsubscribe when this UI is garbage collected.
*/
eventBus.unsubscribe(this);
}
private void createComponents() {
createUploadStatusButton();
createProcessButton();
@@ -643,7 +626,8 @@ public class UploadLayout extends VerticalLayout {
if (artifactUploadState.getFileSelected().isEmpty()) {
uiNotification.displayValidationError(i18n.get("message.error.noFileSelected"));
} else {
currentUploadConfirmationwindow = new UploadConfirmationWindow(this, artifactUploadState);
currentUploadConfirmationwindow = new UploadConfirmationWindow(this, artifactUploadState, eventBus,
artifactManagement);
UI.getCurrent().addWindow(currentUploadConfirmationwindow.getUploadConfrimationWindow());
setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),
Page.getCurrent().getBrowserWindowHeight());

View File

@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.vaadin.spring.events.EventBus;
@@ -37,11 +36,6 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Upload status popup.
*
*
*
*
*
*/
public class UploadResultWindow implements Button.ClickListener {
@@ -66,9 +60,8 @@ public class UploadResultWindow implements Button.ClickListener {
private static final String UPLOAD_RESULT = "uploadResult";
private static final String REASON = "reason";
private transient EventBus.SessionEventBus eventBus;
private transient EventBus.UIEventBus eventBus;
/**
* Initialize upload status popup.
@@ -78,10 +71,10 @@ public class UploadResultWindow implements Button.ClickListener {
* @param i18n
* I18N
*/
public UploadResultWindow(final List<UploadStatus> uploadResultList, final I18N i18n) {
UploadResultWindow(final List<UploadStatus> uploadResultList, final I18N i18n, final EventBus.UIEventBus eventBus) {
this.uploadResultList = uploadResultList;
this.i18n = i18n;
eventBus = SpringContextHelper.getBean( EventBus.SessionEventBus.class);
this.eventBus = eventBus;
createComponents();
createLayout();
}
@@ -190,7 +183,7 @@ public class UploadResultWindow implements Button.ClickListener {
if (event.getComponent().getId().equals(UIComponentIdProvider.UPLOAD_ARTIFACT_RESULT_CLOSE)
|| event.getComponent().getId().equals(UIComponentIdProvider.UPLOAD_ARTIFACT_RESULT_POPUP_CLOSE)) {
uploadResultsWindow.close();
//close upload status popup if open
// close upload status popup if open
eventBus.publish(this, UploadArtifactUIEvent.ARTIFACT_RESULT_POPUP_CLOSED);
}

View File

@@ -11,9 +11,6 @@ package org.eclipse.hawkbit.ui.artifacts.upload;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadFileStatus;
@@ -28,8 +25,8 @@ import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -38,8 +35,6 @@ import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.window.WindowMode;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Grid;
@@ -58,18 +53,13 @@ import elemental.json.JsonValue;
/**
* Shows upload status during upload.
*/
@ViewScope
@SpringComponent
public class UploadStatusInfoWindow extends Window {
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private ArtifactUploadState artifactUploadState;
private final ArtifactUploadState artifactUploadState;
@Autowired
private I18N i18n;
private final I18N i18n;
private static final String PROGRESS = "Progress";
@@ -81,17 +71,17 @@ public class UploadStatusInfoWindow extends Window {
private static final long serialVersionUID = 1L;
private Grid grid;
private final Grid grid;
private IndexedContainer uploads;
private final IndexedContainer uploads;
private volatile boolean errorOccured = false;
private volatile boolean errorOccured;
private volatile boolean uploadAborted = false;
private volatile boolean uploadAborted;
private Button minimizeButton;
private VerticalLayout mainLayout;
private final VerticalLayout mainLayout;
private Label windowCaption;
@@ -99,15 +89,14 @@ public class UploadStatusInfoWindow extends Window {
private Button resizeButton;
private UI ui;
private final UI ui;
private ConfirmationDialog confirmDialog;
/**
* Default Constructor.
*/
@PostConstruct
void init() {
UploadStatusInfoWindow(final UIEventBus eventBus, final ArtifactUploadState artifactUploadState, final I18N i18n) {
this.eventBus = eventBus;
this.artifactUploadState = artifactUploadState;
this.i18n = i18n;
setPopupProperties();
createStatusPopupHeaderComponents();
@@ -130,7 +119,7 @@ public class UploadStatusInfoWindow extends Window {
createConfirmDialog();
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final UploadStatusEvent event) {
final UploadFileStatus uploadStatus = event.getUploadStatus();
@@ -166,15 +155,6 @@ public class UploadStatusInfoWindow extends Window {
uploadStarted(event.getUploadStatus().getFileName(), event.getUploadStatus().getSoftwareModule());
}
@PreDestroy
void destroy() {
/*
* It's good manners to do this, even though vaadin-spring will
* automatically unsubscribe when this UI is garbage collected.
*/
eventBus.unsubscribe(this);
}
private void restoreState() {
final Indexed container = grid.getContainerDataSource();
if (container.getItemIds().isEmpty()) {

View File

@@ -27,15 +27,7 @@ public class UploadStatusObject implements Serializable {
private String reason;
private final SoftwareModule selectedSoftwareModule;
public UploadStatusObject(final String status, final Double progress, final String fileName, final String reason,
final SoftwareModule selectedSoftwareModule) {
this(fileName, selectedSoftwareModule);
this.status = status;
this.progress = progress;
this.reason = reason;
}
public UploadStatusObject(final String fileName, final SoftwareModule selectedSoftwareModule) {
UploadStatusObject(final String fileName, final SoftwareModule selectedSoftwareModule) {
this.filename = fileName;
this.selectedSoftwareModule = selectedSoftwareModule;
}

View File

@@ -62,7 +62,7 @@ public class ColorPickerLayout extends GridLayout {
addComponent(colorSelect, 1, 1, 1, 3);
}
public void init() {
private void init() {
selectors = new HashSet<>();
selectedColor = getDefaultColor();
@@ -80,7 +80,7 @@ public class ColorPickerLayout extends GridLayout {
selectors.add(colorSelect);
}
public Slider createRGBSlider(final String caption, final String styleName) {
private Slider createRGBSlider(final String caption, final String styleName) {
final Slider slider = new Slider(caption, 0, 255);
slider.setImmediate(true);
slider.setWidth("150px");

View File

@@ -18,8 +18,8 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion;
@@ -39,11 +39,14 @@ public abstract class AbstractAcceptCriteria extends ServerSideCriterion {
private int previousRowCount;
@Autowired
protected transient UINotification uiNotification;
protected UINotification uiNotification;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
protected transient EventBus.UIEventBus eventBus;
protected AbstractAcceptCriteria(final UINotification uiNotification, final UIEventBus eventBus) {
this.uiNotification = uiNotification;
this.eventBus = eventBus;
}
@Override
public boolean accept(final DragAndDropEvent dragEvent) {

View File

@@ -11,8 +11,7 @@ package org.eclipse.hawkbit.ui.common;
import java.util.List;
import java.util.Set;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
@@ -30,8 +29,8 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
@@ -73,14 +72,11 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
private static final String KEY = "key";
@Autowired
protected I18N i18n;
@Autowired
private UINotification uiNotification;
private final UINotification uiNotification;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
protected transient EventBus.UIEventBus eventBus;
private TextField keyTextField;
@@ -97,6 +93,18 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
private E selectedEntity;
private HorizontalLayout mainLayout;
protected SpPermissionChecker permChecker;
protected AbstractMetadataPopupLayout(final I18N i18n, final UINotification uiNotification,
final UIEventBus eventBus, final SpPermissionChecker permChecker) {
this.i18n = i18n;
this.uiNotification = uiNotification;
this.eventBus = eventBus;
this.permChecker = permChecker;
createComponents();
buildLayout();
}
/**
* Save the metadata and never close the window after saving.
@@ -119,13 +127,6 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
}
@PostConstruct
void init() {
createComponents();
buildLayout();
}
/**
* Returns metadata popup.
*

View File

@@ -11,8 +11,6 @@ package org.eclipse.hawkbit.ui.common.confirmwindow.layout;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
@@ -20,8 +18,8 @@ import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Accordion;
@@ -46,16 +44,15 @@ public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
private String consolidatedMessage;
@Autowired
protected I18N i18n;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
protected transient EventBus.UIEventBus eventBus;
protected AbstractConfirmationWindowLayout(final I18N i18n, final UIEventBus eventBus) {
this.i18n = i18n;
this.eventBus = eventBus;
}
/**
* PostConstruct.
*/
@PostConstruct
public void initialize() {
removeAllComponents();
consolidatedMessage = "";
@@ -69,8 +66,7 @@ public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
}
private void createActionMessgaeLabel() {
actionMessage = new LabelBuilder().name("").id(UIComponentIdProvider.ACTION_LABEL).visible(false)
.buildLabel();
actionMessage = new LabelBuilder().name("").id(UIComponentIdProvider.ACTION_LABEL).visible(false).buildLabel();
actionMessage.addStyleName(SPUIStyleDefinitions.CONFIRM_WINDOW_INFO_BOX);
}

View File

@@ -8,8 +8,12 @@
*/
package org.eclipse.hawkbit.ui.common.detailslayout;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.vaadin.spring.events.EventBus.UIEventBus;
/**
*
@@ -20,6 +24,11 @@ public abstract class AbstractNamedVersionedEntityTableDetailsLayout<T extends N
private static final long serialVersionUID = 1L;
protected AbstractNamedVersionedEntityTableDetailsLayout(final I18N i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState) {
super(i18n, eventBus, permissionChecker, managementUIState);
}
@Override
protected String getName() {
return HawkbitCommonUtil.getFormattedNameVersion(getSelectedBaseEntity().getName(),

View File

@@ -10,9 +10,6 @@ package org.eclipse.hawkbit.ui.common.detailslayout;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.model.NamedEntity;
@@ -22,13 +19,14 @@ import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
@@ -48,14 +46,11 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
private static final long serialVersionUID = 4862529368471627190L;
@Autowired
private I18N i18n;
private final I18N i18n;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private SpPermissionChecker permissionChecker;
private final SpPermissionChecker permissionChecker;
private T selectedBaseEntity;
@@ -65,37 +60,38 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
private Button manageMetadataBtn;
private TabSheet detailsTab;
protected TabSheet detailsTab;
private VerticalLayout detailsLayout;
private final VerticalLayout detailsLayout;
private VerticalLayout descriptionLayout;
private final VerticalLayout descriptionLayout;
private VerticalLayout logLayout;
private final VerticalLayout logLayout;
private VerticalLayout attributesLayout;
private final VerticalLayout attributesLayout;
/**
* Initialize components.
*/
@PostConstruct
protected void init() {
protected final ManagementUIState managementUIState;
protected AbstractTableDetailsLayout(final I18N i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState) {
this.i18n = i18n;
this.eventBus = eventBus;
this.permissionChecker = permissionChecker;
this.managementUIState = managementUIState;
detailsLayout = getTabLayout();
descriptionLayout = getTabLayout();
logLayout = getTabLayout();
attributesLayout = getTabLayout();
createComponents();
buildLayout();
restoreState();
eventBus.subscribe(this);
}
@PreDestroy
void destroy() {
eventBus.unsubscribe(this);
}
protected SpPermissionChecker getPermissionChecker() {
return permissionChecker;
}
protected EventBus.SessionEventBus getEventBus() {
protected EventBus.UIEventBus getEventBus() {
return eventBus;
}
@@ -153,7 +149,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
detailsTab.setHeight(90, Unit.PERCENTAGE);
detailsTab.addStyleName(SPUIStyleDefinitions.DETAILS_LAYOUT_STYLE);
detailsTab.setId(getTabSheetId());
addTabs(detailsTab);
}
private void buildLayout() {
@@ -196,7 +191,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
caption.setValue(HawkbitCommonUtil.getSoftwareModuleName(headerCaption, value));
}
private void restoreState() {
protected void restoreState() {
if (onLoadIsTableRowSelected()) {
populateData(null);
editButton.setEnabled(true);
@@ -276,22 +271,18 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
}
protected VerticalLayout createLogLayout() {
logLayout = getTabLayout();
return logLayout;
}
protected VerticalLayout createAttributesLayout() {
attributesLayout = getTabLayout();
return attributesLayout;
}
protected VerticalLayout createDetailsLayout() {
detailsLayout = getTabLayout();
return detailsLayout;
}
protected VerticalLayout createDescriptionLayout() {
descriptionLayout = getTabLayout();
return descriptionLayout;
}

View File

@@ -24,8 +24,6 @@ import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
@@ -33,13 +31,9 @@ import com.vaadin.ui.UI;
import com.vaadin.ui.themes.ValoTheme;
/**
*
* DistributionSet Metadata details layout.
*
*/
@SpringComponent
@ViewScope
public class DistributionSetMetadatadetailslayout extends Table {
private static final long serialVersionUID = 2913758299611837718L;
@@ -48,27 +42,19 @@ public class DistributionSetMetadatadetailslayout extends Table {
private static final String VIEW = "view";
private transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetManagement distributionSetManagement;
private DsMetadataPopupLayout dsMetadataPopupLayout;
private final DsMetadataPopupLayout dsMetadataPopupLayout;
private SpPermissionChecker permissionChecker;
private final SpPermissionChecker permissionChecker;
private transient EntityFactory entityFactory;
private final transient EntityFactory entityFactory;
private I18N i18n;
private final I18N i18n;
private Long selectedDistSetId;
/**
*
* @param i18n
* @param permissionChecker
* @param distributionSetManagement
* @param dsMetadataPopupLayout
* @param entityFactory
*/
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
public DistributionSetMetadatadetailslayout(final I18N i18n, final SpPermissionChecker permissionChecker,
final DistributionSetManagement distributionSetManagement,
final DsMetadataPopupLayout dsMetadataPopupLayout, final EntityFactory entityFactory) {
this.i18n = i18n;

View File

@@ -26,11 +26,10 @@ import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vaadin.spring.events.EventBus.SessionEventBus;
import org.vaadin.spring.events.EventBus;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
@@ -46,9 +45,6 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Software module details table.
*
*
*
*
*/
public class SoftwareModuleDetailsTable extends Table {
@@ -64,18 +60,18 @@ public class SoftwareModuleDetailsTable extends Table {
private boolean isTargetAssigned;
private boolean isUnassignSoftModAllowed;
private SpPermissionChecker permissionChecker;
private final boolean isUnassignSoftModAllowed;
private final SpPermissionChecker permissionChecker;
private transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetManagement distributionSetManagement;
private I18N i18n;
private final I18N i18n;
private transient SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
private transient ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
private transient UINotification uiNotification;
private final UINotification uiNotification;
/**
* Initialize software module table- to be displayed in details layout.
@@ -94,16 +90,17 @@ public class SoftwareModuleDetailsTable extends Table {
* @param manageDistUIState
* ManageDistUIState
*/
public void init(final I18N i18n, final boolean isUnassignSoftModAllowed,
public SoftwareModuleDetailsTable(final I18N i18n, final boolean isUnassignSoftModAllowed,
final SpPermissionChecker permissionChecker, final DistributionSetManagement distributionSetManagement,
final SessionEventBus eventBus, final ManageDistUIState manageDistUIState) {
final EventBus.UIEventBus eventBus, final ManageDistUIState manageDistUIState,
final UINotification uiNotification) {
this.i18n = i18n;
this.isUnassignSoftModAllowed = isUnassignSoftModAllowed;
this.permissionChecker = permissionChecker;
this.distributionSetManagement = distributionSetManagement;
this.manageDistUIState = manageDistUIState;
this.eventBus = eventBus;
this.uiNotification = SpringContextHelper.getBean(UINotification.class);
this.uiNotification = uiNotification;
createSwModuleTable();
}

View File

@@ -25,7 +25,7 @@ import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Table;
import com.vaadin.ui.UI;
@@ -38,7 +38,7 @@ import com.vaadin.ui.themes.ValoTheme;
*/
@SpringComponent
@ViewScope
@UIScope
public class SoftwareModuleMetadatadetailslayout extends Table {
private static final long serialVersionUID = 2913758299611838818L;

View File

@@ -18,19 +18,13 @@ import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.VaadinSessionScope;
import com.vaadin.ui.Table;
import com.vaadin.ui.themes.ValoTheme;
/**
*
* DistributionSet TargetFilterQuery table
*
*/
@SpringComponent
@VaadinSessionScope
public class TargetFilterQueryDetailsTable extends Table {
private static final long serialVersionUID = 2913758299611837718L;
@@ -38,13 +32,9 @@ public class TargetFilterQueryDetailsTable extends Table {
private static final String TFQ_NAME = "name";
private static final String TFQ_QUERY = "query";
private I18N i18n;
private final I18N i18n;
/**
*
* @param i18n
*/
public void init(final I18N i18n) {
public TargetFilterQueryDetailsTable(final I18N i18n) {
this.i18n = i18n;
createTable();
}
@@ -52,7 +42,8 @@ public class TargetFilterQueryDetailsTable extends Table {
/**
* Populate software module metadata.
*
* @param distributionSet the selected distribution set
* @param distributionSet
* the selected distribution set
*/
public void populateTableByDistributionSet(final DistributionSet distributionSet) {
removeAllItems();
@@ -60,11 +51,11 @@ public class TargetFilterQueryDetailsTable extends Table {
return;
}
Container dataSource = getContainerDataSource();
List<TargetFilterQuery> filters = distributionSet.getAutoAssignFilters();
final Container dataSource = getContainerDataSource();
final List<TargetFilterQuery> filters = distributionSet.getAutoAssignFilters();
filters.forEach(query -> {
Object itemId = dataSource.addItem();
Item item = dataSource.getItem(itemId);
final Object itemId = dataSource.addItem();
final Item item = dataSource.getItem(itemId);
item.getItemProperty(TFQ_NAME).setValue(query.getName());
item.getItemProperty(TFQ_QUERY).setValue(query.getQuery());
});
@@ -103,5 +94,4 @@ public class TargetFilterQueryDetailsTable extends Table {
setColumnHeader(TFQ_QUERY, i18n.get("header.target.filter.query"));
}
}

View File

@@ -14,10 +14,6 @@ import com.vaadin.ui.Button;
/**
* Abstract button click behaviour of filter buttons layout.
*
*
*
*
*/
public abstract class AbstractFilterButtonClickBehaviour implements Serializable {

View File

@@ -13,17 +13,15 @@ import static org.eclipse.hawkbit.ui.utils.SPUIDefinitions.NO_TAG_BUTTON_ID;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUITagButtonStyle;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.data.Item;
import com.vaadin.event.dd.DropHandler;
@@ -45,28 +43,19 @@ public abstract class AbstractFilterButtons extends Table {
protected static final String FILTER_BUTTON_COLUMN = "filterButton";
@Autowired
protected transient EventBus.SessionEventBus eventBus;
protected transient EventBus.UIEventBus eventBus;
private AbstractFilterButtonClickBehaviour filterButtonClickBehaviour;
protected final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour;
protected AbstractFilterButtons(final UIEventBus eventBus,
final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
this.eventBus = eventBus;
/**
* Initialize layout of filter buttons.
*
* @param filterButtonClickBehaviour
* click behaviour of filter buttons.
*/
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
this.filterButtonClickBehaviour = filterButtonClickBehaviour;
createTable();
eventBus.subscribe(this);
}
@PreDestroy
void destroy() {
eventBus.unsubscribe(this);
}
private void createTable() {
setImmediate(true);
setId(getButtonsTableId());

View File

@@ -12,9 +12,10 @@ import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Alignment;
@@ -25,20 +26,14 @@ import com.vaadin.ui.VerticalLayout;
/**
* Parent class for filter button header layout.
*
*
*
*
*/
public abstract class AbstractFilterHeader extends VerticalLayout {
private static final long serialVersionUID = -1388340600522323332L;
@Autowired
protected SpPermissionChecker permChecker;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
protected transient EventBus.UIEventBus eventBus;
private Label title;
@@ -46,10 +41,12 @@ public abstract class AbstractFilterHeader extends VerticalLayout {
private Button hideIcon;
/**
* Initialize the header layout.
*/
protected void init() {
protected final I18N i18n;
protected AbstractFilterHeader(final SpPermissionChecker permChecker, final UIEventBus eventBus, final I18N i18n) {
this.permChecker = permChecker;
this.eventBus = eventBus;
this.i18n = i18n;
createComponents();
buildLayout();
}

View File

@@ -15,35 +15,25 @@ import com.vaadin.ui.VerticalLayout;
/**
* Parent class for filter button layout.
*
*
*
*
*/
public abstract class AbstractFilterLayout extends VerticalLayout {
private static final long serialVersionUID = 9190616426688385851L;
private AbstractFilterHeader filterHeader;
private final AbstractFilterHeader filterHeader;
private AbstractFilterButtons filterButtons;
private final AbstractFilterButtons filterButtons;
/**
* Initialize the artifact details layout.
*/
protected void init(final AbstractFilterHeader filterHeader, final AbstractFilterButtons filterButtons,
final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
protected AbstractFilterLayout(final AbstractFilterHeader filterHeader, final AbstractFilterButtons filterButtons) {
this.filterHeader = filterHeader;
this.filterButtons = filterButtons;
filterButtons.init(filterButtonClickBehaviour);
buildLayout();
restoreState();
}
private void buildLayout() {
setWidth(SPUIDefinitions.FILTER_BY_TYPE_WIDTH, Unit.PIXELS);
setStyleName("filter-btns-main-layout");
setHeight(100.0f, Unit.PERCENTAGE);
setHeight(100.0F, Unit.PERCENTAGE);
setSpacing(false);
setMargin(false);
@@ -52,10 +42,10 @@ public abstract class AbstractFilterLayout extends VerticalLayout {
setComponentAlignment(filterHeader, Alignment.TOP_CENTER);
setComponentAlignment(filterButtons, Alignment.TOP_CENTER);
setExpandRatio(filterButtons, 1.0f);
setExpandRatio(filterButtons, 1.0F);
}
private void restoreState() {
protected void restoreState() {
if (onLoadIsTypeFilterIsClosed()) {
setVisible(false);
}

View File

@@ -25,12 +25,6 @@ public abstract class AbstractFilterMultiButtonClick extends AbstractFilterButto
private static final long serialVersionUID = 1L;
protected final transient Set<Button> alreadyClickedButtons = new HashSet<>();
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClick#
* processFilterButtonClick(com.vaadin.ui. Button.ClickEvent)
*/
@Override
public void processFilterButtonClick(final ClickEvent event) {
final Button clickedButton = (Button) event.getComponent();
@@ -46,12 +40,6 @@ public abstract class AbstractFilterMultiButtonClick extends AbstractFilterButto
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#
* setDefaultClickedButton(com.vaadin .ui.Button)
*/
@Override
protected void setDefaultClickedButton(final Button button) {
if (button != null) {
@@ -60,10 +48,6 @@ public abstract class AbstractFilterMultiButtonClick extends AbstractFilterButto
}
}
/**
* @param clickedButton
* @return
*/
private boolean isButtonUnClicked(final Button clickedButton) {
return !alreadyClickedButtons.isEmpty() && alreadyClickedButtons.contains(clickedButton);
}

View File

@@ -16,9 +16,6 @@ import com.vaadin.ui.Button.ClickEvent;
/**
* Abstract Single button click behaviour of filter buttons layout.
*
*
*
*
*/
public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButtonClickBehaviour {
@@ -26,12 +23,6 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
private Button alreadyClickedButton;
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClick#
* processFilterButtonClick(com.vaadin.ui. Button.ClickEvent)
*/
@Override
protected void processFilterButtonClick(final ClickEvent event) {
final Button clickedButton = (Button) event.getComponent();
@@ -54,20 +45,10 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
}
}
/**
* @param clickedButton
* @return
*/
private boolean isButtonUnClicked(final Button clickedButton) {
return alreadyClickedButton != null && alreadyClickedButton.equals(clickedButton);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#
* setDefaultClickedButton(com.vaadin .ui.Button)
*/
@Override
protected void setDefaultClickedButton(final Button button) {
alreadyClickedButton = button;
@@ -76,17 +57,10 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
}
}
/**
* @return the alreadyClickedButton
*/
public Button getAlreadyClickedButton() {
return alreadyClickedButton;
}
/**
* @param alreadyClickedButton
* the alreadyClickedButton to set
*/
public void setAlreadyClickedButton(final Button alreadyClickedButton) {
this.alreadyClickedButton = alreadyClickedButton;
}

View File

@@ -8,9 +8,6 @@
*/
package org.eclipse.hawkbit.ui.common.footer;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
@@ -21,8 +18,8 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
@@ -48,17 +45,13 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
private static final long serialVersionUID = -6047975388519155509L;
@Autowired
protected I18N i18n;
@Autowired
protected SpPermissionChecker permChecker;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
protected transient EventBus.UIEventBus eventBus;
@Autowired
protected transient UINotification notification;
protected UINotification notification;
private DragAndDropWrapper deleteWrapper;
@@ -68,30 +61,30 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
private Button bulkUploadStatusButton;
/**
* Initialize.
*/
@PostConstruct
protected AbstractDeleteActionsLayout(final I18N i18n, final SpPermissionChecker permChecker,
final UIEventBus eventBus, final UINotification notification) {
this.i18n = i18n;
this.permChecker = permChecker;
this.eventBus = eventBus;
this.notification = notification;
eventBus.subscribe(this);
}
protected void init() {
if (hasCountMessage() || hasDeletePermission() || hasUpdatePermission() || hasBulkUploadPermission()) {
createComponents();
buildLayout();
reload();
}
eventBus.subscribe(this);
}
@PreDestroy
void destroy() {
eventBus.unsubscribe(this);
}
private void reload() {
protected void reload() {
restoreActionCount();
restoreBulkUploadStatusCount();
}
private void createComponents() {
protected void createComponents() {
if (hasDeletePermission()) {
deleteWrapper = createDeleteWrapperLayout();
}
@@ -103,7 +96,7 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
}
}
private void buildLayout() {
protected void buildLayout() {
final HorizontalLayout dropHintLayout = new HorizontalLayout();
if (hasCountMessage()) {
dropHintLayout.addComponent(getCountMessageLabel());

View File

@@ -8,13 +8,11 @@
*/
package org.eclipse.hawkbit.ui.common.grid;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.data.Container;
import com.vaadin.data.Container.Indexed;
@@ -27,19 +25,18 @@ import com.vaadin.ui.Grid;
public abstract class AbstractGrid extends Grid {
private static final long serialVersionUID = 4856562746502217630L;
@Autowired
protected I18N i18n;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
protected final I18N i18n;
protected final transient EventBus.UIEventBus eventBus;
protected final SpPermissionChecker permissionChecker;
protected AbstractGrid(final I18N i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker) {
this.i18n = i18n;
this.eventBus = eventBus;
this.permissionChecker = permissionChecker;
/**
* Initialize the components.
*/
@PostConstruct
protected void init() {
setSizeFull();
setImmediate(true);
setId(getGridId());
@@ -48,13 +45,8 @@ public abstract class AbstractGrid extends Grid {
addNewContainerDS();
eventBus.subscribe(this);
}
@PreDestroy
void destroy() {
eventBus.unsubscribe(this);
}
public void addNewContainerDS() {
private void addNewContainerDS() {
final Container container = createContainer();
setContainerDataSource((Indexed) container);
addContainerProperties();

View File

@@ -8,10 +8,13 @@
*/
package org.eclipse.hawkbit.ui.common.grid;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.components.SPUIButton;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
@@ -42,7 +45,17 @@ public abstract class AbstractGridHeader extends VerticalLayout {
private Button closeButton;
protected void init() {
protected final SpPermissionChecker permissionChecker;
protected final RolloutUIState rolloutUIState;
protected final I18N i18n;
protected AbstractGridHeader(final SpPermissionChecker permissionChecker, final RolloutUIState rolloutUIState,
final I18N i18n) {
this.permissionChecker = permissionChecker;
this.rolloutUIState = rolloutUIState;
this.i18n = i18n;
createComponents();
buildLayout();
restoreState();

View File

@@ -18,27 +18,24 @@ import com.vaadin.ui.VerticalLayout;
/**
*
* Abstract grid layout class which builds layout with grid
* {@link AbstractGrid} and table header
* {@link AbstractGridHeader}.
* Abstract grid layout class which builds layout with grid {@link AbstractGrid}
* and table header {@link AbstractGridHeader}.
*
*/
public abstract class AbstractGridLayout extends VerticalLayout {
private static final long serialVersionUID = 8611248179949245460L;
private AbstractGridHeader tableHeader;
private AbstractGrid grid;
private final AbstractGridHeader tableHeader;
protected final AbstractGrid grid;
protected void init(final AbstractGridHeader tableHeader,final AbstractGrid grid) {
protected AbstractGridLayout(final AbstractGridHeader tableHeader, final AbstractGrid grid) {
this.tableHeader = tableHeader;
this.grid = grid;
buildLayout();
}
private void buildLayout() {
protected void buildLayout() {
setSizeFull();
setSpacing(true);
setMargin(false);
@@ -54,18 +51,17 @@ public abstract class AbstractGridLayout extends VerticalLayout {
tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER);
tableHeaderLayout.addComponent(grid);
tableHeaderLayout.setComponentAlignment(grid, Alignment.TOP_CENTER);
tableHeaderLayout.setExpandRatio(grid, 1.0f);
tableHeaderLayout.setExpandRatio(grid, 1.0F);
addComponent(tableHeaderLayout);
setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER);
setExpandRatio(tableHeaderLayout, 1.0f);
setExpandRatio(tableHeaderLayout, 1.0F);
if (hasCountMessage()) {
final HorizontalLayout rolloutGroupTargetsCountLayout = createCountMessageComponent();
addComponent(rolloutGroupTargetsCountLayout);
setComponentAlignment(rolloutGroupTargetsCountLayout, Alignment.BOTTOM_CENTER);
}
}
private HorizontalLayout createCountMessageComponent() {

View File

@@ -11,8 +11,11 @@ package org.eclipse.hawkbit.ui.common.table;
import java.util.List;
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.data.Item;
import com.vaadin.event.dd.DragAndDropEvent;
@@ -30,12 +33,8 @@ public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity,
private static final long serialVersionUID = 780050712209750719L;
/**
* Initialize the component.
*/
@Override
protected void init() {
super.init();
protected AbstractNamedVersionTable(final UIEventBus eventBus, final I18N i18n, final UINotification notification) {
super(eventBus, i18n, notification);
setMultiSelect(true);
setSelectable(true);
}

View File

@@ -15,9 +15,6 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
@@ -28,8 +25,8 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
@@ -61,20 +58,16 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
protected static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
@Autowired
protected transient EventBus.SessionEventBus eventBus;
protected transient EventBus.UIEventBus eventBus;
@Autowired
protected I18N i18n;
@Autowired
protected UINotification notification;
/**
* Initialize the components.
*/
@PostConstruct
protected void init() {
protected AbstractTable(final UIEventBus eventBus, final I18N i18n, final UINotification notification) {
this.eventBus = eventBus;
this.i18n = i18n;
this.notification = notification;
setStyleName("sp-table");
setSizeFull();
setImmediate(true);
@@ -84,22 +77,13 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
setSortEnabled(false);
setId(getTableId());
addCustomGeneratedColumns();
addNewContainerDS();
setColumnProperties();
setDefault();
addValueChangeListener(event -> onValueChange());
selectRow();
setPageLength(SPUIDefinitions.PAGE_SIZE);
setDataAvailable(getContainerDataSource().size() != 0);
eventBus.subscribe(this);
}
@PreDestroy
protected void destroy() {
eventBus.unsubscribe(this);
}
/**
* Gets the selected item id or in multiselect mode a set of selected ids.
*
@@ -148,7 +132,7 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
setDropHandler(getTableDropHandler());
}
private void addNewContainerDS() {
protected void addNewContainerDS() {
final Container container = createContainer();
addContainerProperties(container);
setContainerDataSource(container);
@@ -178,7 +162,7 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
}
}
private void setColumnProperties() {
protected void setColumnProperties() {
final List<TableColumn> columnList = getTableVisibleColumns();
final List<Object> swColumnIds = new ArrayList<>();
for (final TableColumn column : columnList) {
@@ -249,9 +233,9 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
protected void onBaseEntityEvent(final BaseUIEntityEvent<E> event) {
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
UI.getCurrent().access(() -> applyMinTableSettings());
UI.getCurrent().access(this::applyMinTableSettings);
} else if (BaseEntityEventType.MAXIMIZED == event.getEventType()) {
UI.getCurrent().access(() -> applyMaxTableSettings());
UI.getCurrent().access(this::applyMaxTableSettings);
} else if (BaseEntityEventType.NEW_ENTITY == event.getEventType()) {
UI.getCurrent().access(() -> addEntity(event.getEntity()));
}

View File

@@ -8,21 +8,21 @@
*/
package org.eclipse.hawkbit.ui.common.table;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.components.SPUIButton;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.server.FontAwesome;
@@ -41,14 +41,11 @@ public abstract class AbstractTableHeader extends VerticalLayout {
private static final long serialVersionUID = 4881626370291837175L;
@Autowired
protected I18N i18n;
@Autowired
protected SpPermissionChecker permChecker;
@Autowired
protected transient EventBus.SessionEventBus eventbus;
protected transient EventBus.UIEventBus eventbus;
private Label headerCaption;
@@ -64,26 +61,27 @@ public abstract class AbstractTableHeader extends VerticalLayout {
private HorizontalLayout filterDroppedInfo;
private DragAndDropWrapper dropFilterLayout;
private Button bulkUploadIcon;
/**
* Initialze components.
*/
@PostConstruct
protected void init() {
protected final ManagementUIState managementUIState;
protected final ManageDistUIState manageDistUIstate;
protected final ArtifactUploadState artifactUploadState;
protected AbstractTableHeader(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
final ManagementUIState managementUIState, final ManageDistUIState manageDistUIstate,
final ArtifactUploadState artifactUploadState) {
this.i18n = i18n;
this.permChecker = permChecker;
this.eventbus = eventbus;
this.managementUIState = managementUIState;
this.manageDistUIstate = manageDistUIstate;
this.artifactUploadState = artifactUploadState;
createComponents();
buildLayout();
restoreState();
eventbus.subscribe(this);
}
@PreDestroy
void destroy() {
eventbus.unsubscribe(this);
}
private void createComponents() {
headerCaption = createHeaderCaption();
searchField = new TextFieldBuilder(getSearchBoxId()).createSearchField(event -> searchBy(event.getText()));
@@ -181,7 +179,7 @@ public abstract class AbstractTableHeader extends VerticalLayout {
filterDroppedInfo.setHeightUndefined();
filterDroppedInfo.setSizeUndefined();
displayFilterDropedInfoOnLoad();
dropFilterLayout = new DragAndDropWrapper(filterDroppedInfo);
final DragAndDropWrapper dropFilterLayout = new DragAndDropWrapper(filterDroppedInfo);
dropFilterLayout.setId(getDropFilterId());
dropFilterLayout.setDropHandler(getDropFilterHandler());

View File

@@ -38,6 +38,8 @@ public abstract class AbstractTableLayout extends VerticalLayout {
this.table = table;
this.detailsLayout = detailsLayout;
buildLayout();
table.selectRow();
}
private void buildLayout() {

View File

@@ -13,9 +13,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
@@ -25,8 +22,8 @@ import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.tokenfield.TokenField;
import org.vaadin.tokenfield.TokenField.InsertPosition;
@@ -65,19 +62,14 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
protected CssLayout tokenLayout = new CssLayout();
@Autowired
protected SpPermissionChecker checker;
@Autowired
protected I18N i18n;
@Autowired
protected UINotification uinotification;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
protected transient EventBus.UIEventBus eventBus;
@Autowired
protected ManagementUIState managementUIState;
// BaseEntity implements Serializable so this entity is serializable. Maybe
@@ -85,18 +77,18 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
@SuppressWarnings("squid:S1948")
protected T selectedEntity;
@PostConstruct
protected void init() {
protected AbstractTagToken(final SpPermissionChecker checker, final I18N i18n, final UINotification uinotification,
final UIEventBus eventBus, final ManagementUIState managementUIState) {
this.checker = checker;
this.i18n = i18n;
this.uinotification = uinotification;
this.eventBus = eventBus;
this.managementUIState = managementUIState;
createTokenField();
checkIfTagAssignedIsAllowed();
eventBus.subscribe(this);
}
@PreDestroy
protected void destroy() {
eventBus.unsubscribe(this);
}
protected void onBaseEntityEvent(final BaseUIEntityEvent<T> baseEntityEvent) {
if (BaseEntityEventType.SELECTED_ENTITY != baseEntityEvent.getEventType()) {
return;

View File

@@ -10,12 +10,16 @@ package org.eclipse.hawkbit.ui.common.tagdetails;
import java.util.List;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdateEvent;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.push.TargetTagCreatedEventContainer;
import org.eclipse.hawkbit.ui.push.TargetTagDeletedEventContainer;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -31,24 +35,30 @@ public abstract class AbstractTargetTagToken<T extends BaseEntity> extends Abstr
private static final long serialVersionUID = 7772876588903171201L;
@Autowired
protected transient TagManagement tagManagement;
protected final transient TagManagement tagManagement;
@EventBusListenerMethod(scope = EventScope.SESSION)
protected AbstractTargetTagToken(final SpPermissionChecker checker, final I18N i18n,
final UINotification uinotification, final UIEventBus eventBus, final ManagementUIState managementUIState,
final TagManagement tagManagement) {
super(checker, i18n, uinotification, eventBus, managementUIState);
this.tagManagement = tagManagement;
}
@EventBusListenerMethod(scope = EventScope.UI)
void onEventTargetTagCreated(final TargetTagCreatedEventContainer container) {
container.getEvents().stream().map(event -> event.getEntity())
.forEach(tag -> setContainerPropertValues(tag.getId(), tag.getName(), tag.getColour()));
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onTargetTagDeletedEvent(final TargetTagDeletedEventContainer container) {
container.getEvents().stream().map(event -> getTagIdByTagName(event.getEntityId()))
.forEach(this::removeTagFromCombo);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onTargetTagUpdateEvent(final List<TargetTagUpdateEvent> events) {
events.stream().map(event -> event.getEntity()).forEach(entity -> {
events.stream().map(TargetTagUpdateEvent::getEntity).forEach(entity -> {
final Item item = container.getItem(entity.getId());
if (item != null) {
updateItem(entity.getName(), entity.getColour(), item);

View File

@@ -12,43 +12,50 @@ import java.util.List;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.push.DistributionSetTagCreatedEventContainer;
import org.eclipse.hawkbit.ui.push.DistributionSetTagDeletedEventContainer;
import org.eclipse.hawkbit.ui.push.DistributionSetTagUpdatedEventContainer;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.google.common.collect.Sets;
import com.vaadin.data.Item;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Implementation of target/ds tag token layout.
*
*/
@SpringComponent
@ViewScope
public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
private static final long serialVersionUID = -8022738301736043396L;
@Autowired
private transient TagManagement tagManagement;
@Autowired
private transient DistributionSetManagement distributionSetManagement;
private final transient TagManagement tagManagement;
private final transient DistributionSetManagement distributionSetManagement;
// To Be Done : have to set this value based on view???
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
public DistributionTagToken(final SpPermissionChecker checker, final I18N i18n, final UINotification uinotification,
final UIEventBus eventBus, final ManagementUIState managementUIState, final TagManagement tagManagement,
final DistributionSetManagement distributionSetManagement) {
super(checker, i18n, uinotification, eventBus, managementUIState);
this.tagManagement = tagManagement;
this.distributionSetManagement = distributionSetManagement;
}
@Override
protected String getTagStyleName() {
return "distribution-tag-";
@@ -111,25 +118,25 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionTableEvent distributionTableEvent) {
onBaseEntityEvent(distributionTableEvent);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onDistributionSetTagCreatedBulkEvent(final DistributionSetTagCreatedEventContainer eventContainer) {
eventContainer.getEvents().stream().map(event -> event.getEntity())
.forEach(distributionSetTag -> setContainerPropertValues(distributionSetTag.getId(),
distributionSetTag.getName(), distributionSetTag.getColour()));
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onDistributionSetTagDeletedEvent(final DistributionSetTagDeletedEventContainer eventContainer) {
eventContainer.getEvents().stream().map(event -> getTagIdByTagName(event.getEntityId()))
.forEach(this::removeTagFromCombo);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onDistributionSetTagUpdateEvent(final DistributionSetTagUpdatedEventContainer eventContainer) {
eventContainer.getEvents().stream().map(event -> event.getEntity()).forEach(entity -> {
final Item item = container.getItem(entity.getId());

View File

@@ -11,27 +11,27 @@ package org.eclipse.hawkbit.ui.common.tagdetails;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Implementation of Target tag token.
*
*
*/
@SpringComponent
@ViewScope
public class TargetTagToken extends AbstractTargetTagToken<Target> {
private static final long serialVersionUID = 7124887018280196721L;
@@ -39,8 +39,14 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
// To Be Done : have to set this value based on view???
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
@Autowired
private transient TargetManagement targetManagement;
private final transient TargetManagement targetManagement;
public TargetTagToken(final SpPermissionChecker checker, final I18N i18n, final UINotification uinotification,
final UIEventBus eventBus, final ManagementUIState managementUIState, final TagManagement tagManagement,
final TargetManagement targetManagement) {
super(checker, i18n, uinotification, eventBus, managementUIState, tagManagement);
this.targetManagement = targetManagement;
}
@Override
protected String getTagStyleName() {
@@ -136,7 +142,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
return false;
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final TargetTableEvent targetTableEvent) {
onBaseEntityEvent(targetTableEvent);
}

View File

@@ -19,9 +19,6 @@ import com.vaadin.ui.VerticalLayout;
/**
* Distribution set panel for Target.
*
*
*
*/
@SuppressWarnings("serial")
public class DistributionSetInfoPanel extends Panel {
@@ -38,9 +35,8 @@ public class DistributionSetInfoPanel extends Panel {
* @param style2
* as String
*/
public DistributionSetInfoPanel(final DistributionSet distributionSet, final String caption, final String style1,
DistributionSetInfoPanel(final DistributionSet distributionSet, final String caption, final String style1,
final String style2) {
super();
setImmediate(false);
decorate(distributionSet, caption, style1, style2);
}

View File

@@ -21,9 +21,6 @@ import com.vaadin.ui.VerticalLayout;
/**
* Attributes Vertical layout for Target.
*
*
*
*/
public class SPTargetAttributesLayout {
private final VerticalLayout targetAttributesLayout;
@@ -35,7 +32,7 @@ public class SPTargetAttributesLayout {
* controller attributes
*
*/
public SPTargetAttributesLayout(final Map<String, String> controllerAttibs) {
SPTargetAttributesLayout(final Map<String, String> controllerAttibs) {
targetAttributesLayout = new VerticalLayout();
targetAttributesLayout.setSpacing(true);
targetAttributesLayout.setMargin(true);

View File

@@ -13,29 +13,11 @@ import com.vaadin.ui.Button;
/**
* Basic button for SPUI. Any commonality can be decorated.
*
*
*
*/
public class SPUIButton extends Button {
/**
* ID.
*/
private static final long serialVersionUID = -7327726430436273739L;
/**
* Parametric constructor.
*
* @param id
* as String
* @param buttonName
* as String
* @param buttonDesc
* as String
*/
public SPUIButton(final String id, final String buttonName, final String buttonDesc) {
SPUIButton(final String id, final String buttonName, final String buttonDesc) {
super(buttonName);
setDescription(buttonDesc);
setImmediate(false);
@@ -50,7 +32,7 @@ public class SPUIButton extends Button {
* @param icon
* as Resource
*/
public void togleIcon(Resource icon) {
public void togleIcon(final Resource icon) {
setIcon(icon);
}
}

View File

@@ -13,32 +13,13 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* ComboBox with required style.
*
*
*
*/
public class SPUICheckBox extends CheckBox {
private static final long serialVersionUID = 2270323611612189225L;
/**
* Parametric constructor to decorate.
*
* @param caption
* as caption for checkbox
* @param style
* style of the CheckBox
* @param styleName
* styleName of the CheckBox
* @param required
* required check for Checkbox
* @param data
* data of the CheckBox
*
*/
public SPUICheckBox(final String caption, final String style, final String styleName, final boolean required,
SPUICheckBox(final String caption, final String style, final String styleName, final boolean required,
final String data) {
super();
decorate(caption, style, styleName, required, data);
}

View File

@@ -8,14 +8,24 @@
*/
package org.eclipse.hawkbit.ui.distributions;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.distributions.disttype.DSTypeFilterLayout;
import org.eclipse.hawkbit.ui.distributions.dstable.DistributionSetTableLayout;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
import org.eclipse.hawkbit.ui.distributions.footer.DSDeleteActionsLayout;
import org.eclipse.hawkbit.ui.distributions.smtable.SwModuleTableLayout;
@@ -27,6 +37,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -37,7 +48,7 @@ import com.vaadin.server.Page;
import com.vaadin.server.Page.BrowserWindowResizeEvent;
import com.vaadin.server.Page.BrowserWindowResizeListener;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.UI;
@@ -45,58 +56,67 @@ import com.vaadin.ui.VerticalLayout;
/**
* Manage distributions and distributions type view.
*
*
*
*/
@UIScope
@SpringView(name = DistributionsView.VIEW_NAME, ui = HawkbitUI.class)
@ViewScope
public class DistributionsView extends VerticalLayout implements View, BrowserWindowResizeListener {
public static final String VIEW_NAME = "distributions";
private static final long serialVersionUID = 3887435076372276300L;
@Autowired
private SpPermissionChecker permChecker;
private final SpPermissionChecker permChecker;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private I18N i18n;
private final I18N i18n;
@Autowired
private transient UINotification uiNotification;
private final UINotification uiNotification;
@Autowired
private DSTypeFilterLayout filterByDSTypeLayout;
private final DSTypeFilterLayout filterByDSTypeLayout;
@Autowired
private DistributionSetTableLayout distributionTableLayout;
private final DistributionSetTableLayout distributionTableLayout;
@Autowired
private SwModuleTableLayout softwareModuleTableLayout;
private final SwModuleTableLayout softwareModuleTableLayout;
@Autowired
private DistSMTypeFilterLayout filterBySMTypeLayout;
private final DistSMTypeFilterLayout filterBySMTypeLayout;
@Autowired
private DSDeleteActionsLayout deleteActionsLayout;
private final DSDeleteActionsLayout deleteActionsLayout;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
private GridLayout mainLayout;
/*
* (non-Javadoc)
*
* @see
* com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.
* ViewChangeEvent)
*/
@Override
public void enter(final ViewChangeEvent event) {
@Autowired
DistributionsView(final SpPermissionChecker permChecker, final UIEventBus eventBus, final I18N i18n,
final UINotification uiNotification, final ManageDistUIState manageDistUIState,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final TargetManagement targetManagement, final EntityFactory entityFactory,
final TagManagement tagManagement, final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
final ArtifactUploadState artifactUploadState, final SystemManagement systemManagement,
final ArtifactManagement artifactManagement) {
this.permChecker = permChecker;
this.eventBus = eventBus;
this.i18n = i18n;
this.uiNotification = uiNotification;
this.filterByDSTypeLayout = new DSTypeFilterLayout(manageDistUIState, i18n, permChecker, eventBus,
tagManagement, entityFactory, uiNotification, softwareManagement, distributionSetManagement,
distributionsViewAcceptCriteria);
this.distributionTableLayout = new DistributionSetTableLayout(i18n, eventBus, permChecker, manageDistUIState,
softwareManagement, distributionSetManagement, targetManagement, entityFactory, uiNotification,
tagManagement, distributionsViewAcceptCriteria, systemManagement);
this.softwareModuleTableLayout = new SwModuleTableLayout(i18n, uiNotification, eventBus, softwareManagement,
entityFactory, manageDistUIState, permChecker, distributionsViewAcceptCriteria, artifactUploadState,
artifactManagement);
this.filterBySMTypeLayout = new DistSMTypeFilterLayout(eventBus, i18n, permChecker, manageDistUIState,
tagManagement, entityFactory, uiNotification, softwareManagement, distributionsViewAcceptCriteria);
this.deleteActionsLayout = new DSDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
systemManagement, manageDistUIState, distributionsViewAcceptCriteria, distributionSetManagement,
softwareManagement);
this.manageDistUIState = manageDistUIState;
}
@PostConstruct
void init() {
// Build the Distributions view layout with all the required components.
buildLayout();
restoreState();
@@ -142,9 +162,9 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
mainLayout.addComponent(softwareModuleTableLayout, 2, 0);
mainLayout.addComponent(filterBySMTypeLayout, 3, 0);
mainLayout.addComponent(deleteActionsLayout, 1, 1, 2, 1);
mainLayout.setRowExpandRatio(0, 1.0f);
mainLayout.setColumnExpandRatio(1, 0.5f);
mainLayout.setColumnExpandRatio(2, 0.5f);
mainLayout.setRowExpandRatio(0, 1.0F);
mainLayout.setColumnExpandRatio(1, 0.5F);
mainLayout.setColumnExpandRatio(2, 0.5F);
mainLayout.setComponentAlignment(deleteActionsLayout, Alignment.BOTTOM_CENTER);
}
@@ -157,7 +177,7 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
});
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionTableEvent event) {
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
minimizeDistTable();
@@ -166,7 +186,7 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleEvent event) {
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
minimizeSwTable();
@@ -179,17 +199,17 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
mainLayout.removeComponent(filterByDSTypeLayout);
mainLayout.removeComponent(distributionTableLayout);
mainLayout.removeComponent(deleteActionsLayout);
mainLayout.setColumnExpandRatio(2, 1f);
mainLayout.setColumnExpandRatio(0, 0f);
mainLayout.setColumnExpandRatio(1, 0f);
mainLayout.setColumnExpandRatio(2, 1F);
mainLayout.setColumnExpandRatio(0, 0F);
mainLayout.setColumnExpandRatio(1, 0F);
}
private void minimizeSwTable() {
mainLayout.addComponent(filterByDSTypeLayout, 0, 0);
mainLayout.addComponent(distributionTableLayout, 1, 0);
mainLayout.addComponent(deleteActionsLayout, 1, 1, 2, 1);
mainLayout.setColumnExpandRatio(1, 0.5f);
mainLayout.setColumnExpandRatio(2, 0.5f);
mainLayout.setColumnExpandRatio(1, 0.5F);
mainLayout.setColumnExpandRatio(2, 0.5F);
mainLayout.setComponentAlignment(deleteActionsLayout, Alignment.BOTTOM_CENTER);
}
@@ -197,8 +217,8 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
mainLayout.addComponent(softwareModuleTableLayout, 2, 0);
mainLayout.addComponent(filterBySMTypeLayout, 3, 0);
mainLayout.addComponent(deleteActionsLayout, 1, 1, 2, 1);
mainLayout.setColumnExpandRatio(1, 0.5f);
mainLayout.setColumnExpandRatio(2, 0.5f);
mainLayout.setColumnExpandRatio(1, 0.5F);
mainLayout.setColumnExpandRatio(2, 0.5F);
mainLayout.setComponentAlignment(deleteActionsLayout, Alignment.BOTTOM_CENTER);
}
@@ -206,9 +226,9 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
mainLayout.removeComponent(softwareModuleTableLayout);
mainLayout.removeComponent(filterBySMTypeLayout);
mainLayout.removeComponent(deleteActionsLayout);
mainLayout.setColumnExpandRatio(1, 1f);
mainLayout.setColumnExpandRatio(2, 0f);
mainLayout.setColumnExpandRatio(3, 0f);
mainLayout.setColumnExpandRatio(1, 1F);
mainLayout.setColumnExpandRatio(2, 0F);
mainLayout.setColumnExpandRatio(3, 0F);
}
private void checkNoDataAvaialble() {
@@ -243,4 +263,9 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
}
}
@Override
public void enter(final ViewChangeEvent event) {
// This view is constructed in the init() method()
}
}

View File

@@ -13,7 +13,10 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeUpdate;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
@@ -28,21 +31,21 @@ import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent.DistributionSetTypeEnum;
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.data.domain.PageRequest;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.data.Item;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
@@ -57,8 +60,6 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Window for create update Distribution Set Type.
*/
@SpringComponent
@ViewScope
public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<DistributionSetType> {
private static final long serialVersionUID = 1L;
@@ -67,11 +68,9 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
private static final String DIST_TYPE_MANDATORY = "mandatory";
private static final String STAR = " * ";
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetManagement distributionSetManagement;
private HorizontalLayout distTypeSelectLayout;
private Table sourceTable;
@@ -82,6 +81,15 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
private IndexedContainer originalSelectedTableContainer;
public CreateUpdateDistSetTypeLayout(final I18N i18n, final TagManagement tagManagement,
final EntityFactory entityFactory, final UIEventBus eventBus, final SpPermissionChecker permChecker,
final UINotification uiNotification, final SoftwareManagement softwareManagement,
final DistributionSetManagement distributionSetManagement) {
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
this.softwareManagement = softwareManagement;
this.distributionSetManagement = distributionSetManagement;
}
@Override
protected void createRequiredComponents() {

View File

@@ -15,41 +15,31 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
/**
* Single button click behaviour of filter buttons layout.
*
*
*
*/
@SpringComponent
@ViewScope
public class DSTypeFilterButtonClick extends AbstractFilterSingleButtonClick implements Serializable {
private static final long serialVersionUID = -584783755917528648L;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetManagement distributionSetManagement;
DSTypeFilterButtonClick(final UIEventBus eventBus, final ManageDistUIState manageDistUIState,
final DistributionSetManagement distributionSetManagement) {
this.eventBus = eventBus;
this.manageDistUIState = manageDistUIState;
this.distributionSetManagement = distributionSetManagement;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.
* AbstractFilterButtonClickBehaviour#filterUnClicked (com.vaadin.ui.Button)
*/
@Override
protected void filterUnClicked(final Button clickedButton) {
manageDistUIState.getManageDistFilters().setClickedDistSetType(null);
@@ -57,12 +47,6 @@ public class DSTypeFilterButtonClick extends AbstractFilterSingleButtonClick imp
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.
* AbstractFilterButtonClickBehaviour#filterClicked (com.vaadin.ui.Button)
*/
@Override
protected void filterClicked(final Button clickedButton) {
final DistributionSetType distSetType = distributionSetManagement

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ui.distributions.disttype;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent;
@@ -17,32 +18,34 @@ import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Distribution Set Type filter buttons.
*/
@SpringComponent
@ViewScope
public class DSTypeFilterButtons extends AbstractFilterButtons {
private static final long serialVersionUID = 771251569981876005L;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
private final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
DSTypeFilterButtons(final UIEventBus eventBus, final ManageDistUIState manageDistUIState,
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
final DistributionSetManagement distributionSetManagement) {
super(eventBus, new DSTypeFilterButtonClick(eventBus, manageDistUIState, distributionSetManagement));
this.manageDistUIState = manageDistUIState;
this.distributionsViewAcceptCriteria = distributionsViewAcceptCriteria;
}
@Override
protected String getButtonsTableId() {
@@ -52,8 +55,7 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
@Override
protected LazyQueryContainer createButtonsLazyQueryContainer() {
return HawkbitCommonUtil.createLazyQueryContainer(
new BeanQueryFactory<DistributionSetTypeBeanQuery>(DistributionSetTypeBeanQuery.class));
return HawkbitCommonUtil.createLazyQueryContainer(new BeanQueryFactory<>(DistributionSetTypeBeanQuery.class));
}
@Override
@@ -97,7 +99,7 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
return SPUIDefinitions.DISTRIBUTION_SET_TYPE_ID_PREFIXS;
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionSetTypeEvent event) {
if (event.getDistributionSetTypeEnum() == DistributionSetTypeEvent.DistributionSetTypeEnum.ADD_DIST_SET_TYPE
|| event.getDistributionSetTypeEnum() == DistributionSetTypeEvent.DistributionSetTypeEnum.UPDATE_DIST_SET_TYPE) {
@@ -106,7 +108,7 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SaveActionWindowEvent event) {
if (event == SaveActionWindowEvent.SAVED_DELETE_DIST_SET_TYPES) {
refreshTypeTable();

View File

@@ -8,42 +8,43 @@
*/
package org.eclipse.hawkbit.ui.distributions.disttype;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.UI;
/**
* Distribution Set Type filter buttons header.
*/
@SpringComponent
@ViewScope
public class DSTypeFilterHeader extends AbstractFilterHeader {
private static final long serialVersionUID = 3433417459392880222L;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private CreateUpdateDistSetTypeLayout createUpdateDistSetTypeLayout;
private final CreateUpdateDistSetTypeLayout createUpdateDistSetTypeLayout;
private CommonDialogWindow addUpdateWindow;
@Override
@PostConstruct
public void init() {
super.init();
DSTypeFilterHeader(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final ManageDistUIState manageDistUIState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement) {
super(permChecker, eventBus, i18n);
this.manageDistUIState = manageDistUIState;
this.createUpdateDistSetTypeLayout = new CreateUpdateDistSetTypeLayout(i18n, tagManagement, entityFactory,
eventBus, permChecker, uiNotification, softwareManagement, distributionSetManagement);
if (hasCreateUpdatePermission()) {
createUpdateDistSetTypeLayout.init();
}
@@ -61,7 +62,7 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
@Override
protected void settingsIconClicked(final ClickEvent event) {
addUpdateWindow = createUpdateDistSetTypeLayout.getWindow();
final CommonDialogWindow addUpdateWindow = createUpdateDistSetTypeLayout.getWindow();
UI.getCurrent().addWindow(addUpdateWindow);
}

View File

@@ -8,58 +8,46 @@
*/
package org.eclipse.hawkbit.ui.distributions.disttype;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterLayout;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Distribution Set Type filter buttons layout.
*
*
*
*/
@SpringComponent
@ViewScope
public class DSTypeFilterLayout extends AbstractFilterLayout {
private static final long serialVersionUID = 2689002932344750781L;
@Autowired
private transient EventBus.SessionEventBus eventbus;
private final ManageDistUIState manageDistUIState;
@Autowired
private DSTypeFilterHeader dsTypeFilterHeader;
public DSTypeFilterLayout(final ManageDistUIState manageDistUIState, final I18N i18n,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria) {
super(new DSTypeFilterHeader(i18n, permChecker, eventBus, manageDistUIState, tagManagement, entityFactory,
uiNotification, softwareManagement, distributionSetManagement),
new DSTypeFilterButtons(eventBus, manageDistUIState, distributionsViewAcceptCriteria,
distributionSetManagement));
this.manageDistUIState = manageDistUIState;
@Autowired
private DSTypeFilterButtons dsTypeFilterButtons;
@Autowired
private DSTypeFilterButtonClick dsTypeFilterButtonClick;
@Autowired
private ManageDistUIState manageDistUIState;
/**
* Initialize the filter layout.
*/
@PostConstruct
public void init() {
super.init(dsTypeFilterHeader, dsTypeFilterButtons, dsTypeFilterButtonClick);
eventbus.subscribe(this);
restoreState();
eventBus.subscribe(this);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionsUIEvent event) {
if (event == DistributionsUIEvent.HIDE_DIST_FILTER_BY_TYPE) {
setVisible(false);
@@ -69,22 +57,6 @@ public class DSTypeFilterLayout extends AbstractFilterLayout {
}
}
@PreDestroy
void destroy() {
/*
* It's good manners to do this, even though vaadin-spring will
* automatically unsubscribe when this UI is garbage collected.
*/
eventbus.unsubscribe(this);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterLayout#
* onLoadIsTypeFilterIsClosed()
*/
@Override
public Boolean onLoadIsTypeFilterIsClosed() {

View File

@@ -16,6 +16,9 @@ import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
@@ -33,16 +36,17 @@ import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.data.Item;
import com.vaadin.server.FontAwesome;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.HorizontalLayout;
@@ -54,66 +58,63 @@ import com.vaadin.ui.Window;
/**
* Distribution set details layout.
*
*
*
*/
@SpringComponent
@ViewScope
public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDetailsLayout<DistributionSet> {
private static final long serialVersionUID = -4595004466943546669L;
private static final String SOFT_MODULE = "softwareModule";
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
private final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
@Autowired
private DistributionTagToken distributionTagToken;
private final DistributionTagToken distributionTagToken;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetManagement distributionSetManagement;
@Autowired
private DsMetadataPopupLayout dsMetadataPopupLayout;
private final transient TargetManagement targetManagement;
@Autowired
private transient EntityFactory entityFactory;
private final DsMetadataPopupLayout dsMetadataPopupLayout;
private SoftwareModuleDetailsTable softwareModuleTable;
private final SoftwareModuleDetailsTable softwareModuleTable;
private DistributionSetMetadatadetailslayout dsMetadataTable;
private final DistributionSetMetadatadetailslayout dsMetadataTable;
private TargetFilterQueryDetailsTable tfqDetailsTable;
private final TargetFilterQueryDetailsTable tfqDetailsTable;
private VerticalLayout tagsLayout;
private Map<String, StringBuilder> assignedSWModule;
/**
* softwareLayout Initialize the component.
*/
@Override
protected void init() {
softwareModuleTable = new SoftwareModuleDetailsTable();
softwareModuleTable.init(getI18n(), true, getPermissionChecker(), distributionSetManagement, getEventBus(),
manageDistUIState);
DistributionSetDetails(final I18N i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
final ManageDistUIState manageDistUIState, final ManagementUIState managementUIState,
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final TargetManagement targetManagement, final EntityFactory entityFactory,
final UINotification uinotification, final TagManagement tagManagement,
final DsMetadataPopupLayout popupLayout, final UINotification uiNotification) {
super(i18n, eventBus, permissionChecker, managementUIState);
this.manageDistUIState = manageDistUIState;
this.distributionAddUpdateWindowLayout = distributionAddUpdateWindowLayout;
this.distributionTagToken = new DistributionTagToken(permissionChecker, i18n, uinotification, eventBus,
managementUIState, tagManagement, distributionSetManagement);
this.softwareManagement = softwareManagement;
this.distributionSetManagement = distributionSetManagement;
this.targetManagement = targetManagement;
this.dsMetadataPopupLayout = popupLayout;
dsMetadataTable = new DistributionSetMetadatadetailslayout();
dsMetadataTable.init(getI18n(), getPermissionChecker(), distributionSetManagement, dsMetadataPopupLayout,
entityFactory);
softwareModuleTable = new SoftwareModuleDetailsTable(i18n, true, permissionChecker, distributionSetManagement,
eventBus, manageDistUIState, uiNotification);
tfqDetailsTable = new TargetFilterQueryDetailsTable();
tfqDetailsTable.init(getI18n());
dsMetadataTable = new DistributionSetMetadatadetailslayout(i18n, permissionChecker, distributionSetManagement,
dsMetadataPopupLayout, entityFactory);
super.init();
tfqDetailsTable = new TargetFilterQueryDetailsTable(i18n);
addTabs(detailsTab);
restoreState();
}
protected VerticalLayout createTagsLayout() {
@@ -183,9 +184,8 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
private Button assignSoftModuleButton(final String softwareModuleName) {
if (getPermissionChecker().hasUpdateDistributionPermission()
&& manageDistUIState.getLastSelectedDistribution().isPresent()
&& distributionSetManagement
.findDistributionSetById(manageDistUIState.getLastSelectedDistribution().get().getId())
.getAssignedTargets().isEmpty()) {
&& targetManagement.countTargetByAssignedDistributionSet(
manageDistUIState.getLastSelectedDistribution().get().getId()) <= 0) {
final Button reassignSoftModule = SPUIComponentProvider.getButton(softwareModuleName, "", "", "", true,
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
reassignSoftModule.setEnabled(false);
@@ -352,19 +352,19 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
return getPermissionChecker().hasUpdateDistributionPermission();
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleEvent event) {
if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.ASSIGN_SOFTWARE_MODULE) {
UI.getCurrent().access(() -> updateSoftwareModule(event.getEntity()));
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionTableEvent distributionTableEvent) {
onBaseEntityEvent(distributionTableEvent);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SaveActionWindowEvent saveActionWindowEvent) {
if ((saveActionWindowEvent == SaveActionWindowEvent.SAVED_ASSIGNMENTS
|| saveActionWindowEvent == SaveActionWindowEvent.DISCARD_ALL_ASSIGNMENTS)
@@ -374,11 +374,11 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
}
setSelectedBaseEntity(
distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()));
UI.getCurrent().access(() -> populateModule());
UI.getCurrent().access(this::populateModule);
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEventDiscard(final SaveActionWindowEvent saveActionWindowEvent) {
if (saveActionWindowEvent == SaveActionWindowEvent.DISCARD_ASSIGNMENT
|| saveActionWindowEvent == SaveActionWindowEvent.DISCARD_ALL_ASSIGNMENTS

View File

@@ -45,17 +45,19 @@ import org.eclipse.hawkbit.ui.push.DistributionCreatedEventContainer;
import org.eclipse.hawkbit.ui.push.DistributionDeletedEventContainer;
import org.eclipse.hawkbit.ui.push.DistributionSetUpdatedEventContainer;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -65,8 +67,6 @@ import com.vaadin.data.Item;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.server.FontAwesome;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Table;
@@ -75,8 +75,6 @@ import com.vaadin.ui.UI;
/**
* Distribution set table.
*/
@SpringComponent
@ViewScope
public class DistributionSetTable extends AbstractNamedVersionTable<DistributionSet, DistributionSetIdName> {
private static final long serialVersionUID = -7731776093470487988L;
@@ -86,37 +84,41 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
private static final List<Object> DISPLAY_DROP_HINT_EVENTS = new ArrayList<>(
Arrays.asList(DragEvent.SOFTWAREMODULE_DRAG));
@Autowired
private SpPermissionChecker permissionChecker;
private final SpPermissionChecker permissionChecker;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetManagement distributionSetManagement;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
private final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
@Autowired
private transient TargetManagement targetManagement;
private final transient TargetManagement targetManagement;
@Autowired
private DsMetadataPopupLayout dsMetadataPopupLayout;
private final DsMetadataPopupLayout dsMetadataPopupLayout;
/**
* Initialize the component.
*/
@Override
protected void init() {
super.init();
DistributionSetTable(final UIEventBus eventBus, final I18N i18n, final UINotification notification,
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
final DistributionSetManagement distributionSetManagement, final SoftwareManagement softwareManagement,
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
final TargetManagement targetManagement, final DsMetadataPopupLayout dsMetadataPopupLayout) {
super(eventBus, i18n, notification);
this.permissionChecker = permissionChecker;
this.manageDistUIState = manageDistUIState;
this.distributionSetManagement = distributionSetManagement;
this.softwareManagement = softwareManagement;
this.distributionsViewAcceptCriteria = distributionsViewAcceptCriteria;
this.targetManagement = targetManagement;
this.dsMetadataPopupLayout = dsMetadataPopupLayout;
addTableStyleGenerator();
addNewContainerDS();
setColumnProperties();
setDataAvailable(getContainerDataSource().size() != 0);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DragEvent event) {
if (event == DragEvent.HIDE_DROP_HINT) {
UI.getCurrent().access(() -> removeStyleName(SPUIStyleDefinitions.SHOW_DROP_HINT_TABLE));
@@ -125,7 +127,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onDistributionSetUpdateEvents(final DistributionSetUpdatedEventContainer eventContainer) {
final List<DistributionSetIdName> visibleItemIds = (List<DistributionSetIdName>) getVisibleItemIds();
@@ -150,12 +152,12 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
.forEach(event -> updateDistributionInTable(event.getEntity()));
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onDistributionCreatedEvents(final DistributionCreatedEventContainer eventContainer) {
refreshDistributions();
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onDistributionDeletedEvents(final DistributionDeletedEventContainer eventContainer) {
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
@@ -470,7 +472,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
});
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionTableEvent event) {
onBaseEntityEvent(event);
if (BaseEntityEventType.UPDATED_ENTITY != event.getEventType()) {
@@ -479,7 +481,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
UI.getCurrent().access(() -> updateDistributionInTable(event.getEntity()));
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SaveActionWindowEvent event) {
if (event == SaveActionWindowEvent.DELETED_DISTRIBUTIONS || event == SaveActionWindowEvent.SAVED_ASSIGNMENTS) {
UI.getCurrent().access(this::refreshFilter);
@@ -492,7 +494,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
* @param event
* as instance of {@link DistributionTableFilterEvent}
*/
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
public void onEvent(final DistributionTableFilterEvent event) {
if (event == DistributionTableFilterEvent.FILTER_BY_TEXT
|| event == DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ui.distributions.dstable;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
@@ -16,14 +17,13 @@ import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
@@ -31,19 +31,19 @@ import com.vaadin.ui.Window;
/**
* Distribution table header.
*/
@SpringComponent
@ViewScope
public class DistributionSetTableHeader extends AbstractTableHeader {
private static final long serialVersionUID = -3483238438474530748L;
@Autowired
private ManageDistUIState manageDistUIstate;
private final DistributionAddUpdateWindowLayout addUpdateWindowLayout;
@Autowired
private DistributionAddUpdateWindowLayout addUpdateWindowLayout;
DistributionSetTableHeader(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
final ManageDistUIState manageDistUIstate, final DistributionAddUpdateWindowLayout addUpdateWindowLayout) {
super(i18n, permChecker, eventbus, null, manageDistUIstate, null);
this.addUpdateWindowLayout = addUpdateWindowLayout;
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionsUIEvent event) {
if (event == DistributionsUIEvent.HIDE_DIST_FILTER_BY_TYPE) {
setFilterButtonsIconVisible(true);

View File

@@ -8,42 +8,54 @@
*/
package org.eclipse.hawkbit.ui.distributions.dstable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
/**
* DistributionSet table layout
*/
@SpringComponent
@ViewScope
public class DistributionSetTableLayout extends AbstractTableLayout {
private static final long serialVersionUID = 6464291374980641235L;
/**
* Details to be autowired before table as details listens to value change
* of table.
*/
@Autowired
private DistributionSetDetails distributionDetails;
public DistributionSetTableLayout(final I18N i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final TargetManagement targetManagement, final EntityFactory entityFactory,
final UINotification uiNotification, final TagManagement tagManagement,
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
final SystemManagement systemManagement) {
@Autowired
private DistributionSetTableHeader dsTableHeader;
final DsMetadataPopupLayout popupLayout = new DsMetadataPopupLayout(i18n, uiNotification, eventBus,
distributionSetManagement, entityFactory, permissionChecker);
@Autowired
private DistributionSetTable dsTable;
final DistributionSetTable distributionSetTable = new DistributionSetTable(eventBus, i18n, uiNotification,
permissionChecker, manageDistUIState, distributionSetManagement, softwareManagement,
distributionsViewAcceptCriteria, targetManagement, popupLayout);
/**
* Initialize the filter layout.
*/
@PostConstruct
void init() {
super.init(dsTableHeader, dsTable, distributionDetails);
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout = new DistributionAddUpdateWindowLayout(
i18n, uiNotification, eventBus, distributionSetManagement, systemManagement, entityFactory,
distributionSetTable);
super.init(
new DistributionSetTableHeader(i18n, permissionChecker, eventBus, manageDistUIState,
distributionAddUpdateWindowLayout),
distributionSetTable,
new DistributionSetDetails(i18n, eventBus, permissionChecker, manageDistUIState, null,
distributionAddUpdateWindowLayout, softwareManagement, distributionSetManagement,
targetManagement, entityFactory, uiNotification, tagManagement, popupLayout, uiNotification));
}
}

View File

@@ -18,29 +18,30 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.ui.common.AbstractMetadataPopupLayout;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.google.common.collect.Lists;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Pop up layout to display distribution metadata.
*/
@SpringComponent
@ViewScope
public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<DistributionSet, MetaData> {
private static final long serialVersionUID = -7778944849012048106L;
@Autowired
private transient DistributionSetManagement distributionSetManagement;
private final transient DistributionSetManagement distributionSetManagement;
@Autowired
private transient EntityFactory entityFactory;
private final transient EntityFactory entityFactory;
@Autowired
protected SpPermissionChecker permChecker;
public DsMetadataPopupLayout(final I18N i18n, final UINotification uiNotification, final UIEventBus eventBus,
final DistributionSetManagement distributionSetManagement, final EntityFactory entityFactory,
final SpPermissionChecker permChecker) {
super(i18n, uiNotification, eventBus, permChecker);
this.distributionSetManagement = distributionSetManagement;
this.entityFactory = entityFactory;
}
@Override
protected void checkForDuplicate(final DistributionSet entity, final String value) {
@@ -73,7 +74,8 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
@Override
protected List<MetaData> getMetadataList() {
return Collections.unmodifiableList(getSelectedEntity().getMetadata());
return Collections.unmodifiableList(
distributionSetManagement.findDistributionSetMetadataByDistributionSetId(getSelectedEntity().getId()));
}
/**

View File

@@ -15,10 +15,13 @@ import java.util.Map;
import org.eclipse.hawkbit.ui.common.AbstractAcceptCriteria;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.google.common.collect.Maps;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.Component;
/**
@@ -26,7 +29,7 @@ import com.vaadin.ui.Component;
*
*/
@SpringComponent
@ViewScope
@UIScope
public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
private static final long serialVersionUID = -7686564967583118935L;
@@ -35,6 +38,11 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
private static final Map<String, List<String>> DROP_CONFIGS = createDropConfigurations();
@Autowired
DistributionsViewAcceptCriteria(final UINotification uiNotification, final UIEventBus eventBus) {
super(uiNotification, eventBus);
}
@Override
protected String getComponentId(final Component component) {
String id = component.getId();

View File

@@ -15,6 +15,9 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
@@ -27,16 +30,17 @@ import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Component;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.TableTransferable;
@@ -44,12 +48,7 @@ import com.vaadin.ui.UI;
/**
* Distributions footer layout implementation.
*
*
*
*/
@org.springframework.stereotype.Component
@ViewScope
public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
private static final long serialVersionUID = 3494052985006132714L;
@@ -58,19 +57,30 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
Arrays.asList(DragEvent.DISTRIBUTION_TYPE_DRAG, DragEvent.DISTRIBUTION_DRAG, DragEvent.SOFTWAREMODULE_DRAG,
DragEvent.SOFTWAREMODULE_TYPE_DRAG));
@Autowired
private transient SystemManagement systemManagement;
private final transient SystemManagement systemManagement;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private DistributionsConfirmationWindowLayout distConfirmationWindowLayout;
private final DistributionsConfirmationWindowLayout distConfirmationWindowLayout;
@Autowired
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
private final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
@EventBusListenerMethod(scope = EventScope.SESSION)
public DSDeleteActionsLayout(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final UINotification notification, final SystemManagement systemManagement,
final ManageDistUIState manageDistUIState,
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
final DistributionSetManagement dsManagement, final SoftwareManagement softwareManagement) {
super(i18n, permChecker, eventBus, notification);
this.systemManagement = systemManagement;
this.manageDistUIState = manageDistUIState;
this.distConfirmationWindowLayout = new DistributionsConfirmationWindowLayout(i18n, eventBus, dsManagement,
softwareManagement, manageDistUIState);
this.distributionsViewAcceptCriteria = distributionsViewAcceptCriteria;
init();
}
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DragEvent event) {
if (event == DragEvent.HIDE_DROP_HINT) {
hideDropHints();
@@ -79,7 +89,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SaveActionWindowEvent event) {
if (event != null) {
UI.getCurrent().access(() -> {
@@ -253,7 +263,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
* @param event
* as instance of {@link DistributionsUIEvent}
*/
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
public void onEvent(final DistributionsUIEvent event) {
if (event == DistributionsUIEvent.UPDATE_COUNT) {
updateDSActionCount();

View File

@@ -26,11 +26,12 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -39,7 +40,6 @@ import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.FontAwesome;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Table.Align;
@@ -48,11 +48,7 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract layout of confirm actions window.
*
*
*
*/
@org.springframework.stereotype.Component
@ViewScope
public class DistributionsConfirmationWindowLayout extends AbstractConfirmationWindowLayout {
private static final long serialVersionUID = 3641621131320823058L;
@@ -77,14 +73,20 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
private ConfirmationTab assignmnetTab;
@Autowired
private transient DistributionSetManagement dsManagement;
private final transient DistributionSetManagement dsManagement;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
DistributionsConfirmationWindowLayout(final I18N i18n, final UIEventBus eventBus,
final DistributionSetManagement dsManagement, final SoftwareManagement softwareManagement,
final ManageDistUIState manageDistUIState) {
super(i18n, eventBus);
this.dsManagement = dsManagement;
this.softwareManagement = softwareManagement;
this.manageDistUIState = manageDistUIState;
}
@Override
protected Map<String, ConfirmationTab> getConfimrationTabs() {
@@ -630,7 +632,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEventDiscard(final SaveActionWindowEvent saveActionWindowEvent) {
if (saveActionWindowEvent == SaveActionWindowEvent.DELETE_ALL_SOFWARE) {
getSWAssignmentsTableContainer();

View File

@@ -20,28 +20,28 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
import org.eclipse.hawkbit.ui.common.AbstractMetadataPopupLayout;
import org.eclipse.hawkbit.ui.distributions.event.MetadataEvent;
import org.eclipse.hawkbit.ui.distributions.event.MetadataEvent.MetadataUIEvent;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
/**
* Pop up layout to display software module metadata.
*/
@SpringComponent
@ViewScope
public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareModule, MetaData> {
private static final long serialVersionUID = -1252090014161012563L;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private transient EntityFactory entityFactory;
private final transient EntityFactory entityFactory;
@Autowired
protected SpPermissionChecker permChecker;
public SwMetadataPopupLayout(final I18N i18n, final UINotification uiNotification, final UIEventBus eventBus,
final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
final SpPermissionChecker permChecker) {
super(i18n, uiNotification, eventBus, permChecker);
this.softwareManagement = softwareManagement;
this.entityFactory = entityFactory;
}
@Override
protected void checkForDuplicate(final SoftwareModule entity, final String value) {

View File

@@ -57,7 +57,7 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
super(definition, queryConfig, sortIds, sortStates);
if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) {
type = Optional.ofNullable((SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE))
.map(t -> t.getId()).orElse(null);
.map(SoftwareModuleType::getId).orElse(null);
final String text = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
if (!Strings.isNullOrEmpty(text)) {
searchText = String.format("%%%s%%", text);

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.distributions.smtable;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
@@ -20,13 +21,12 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.distributions.event.MetadataEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
@@ -38,38 +38,35 @@ import com.vaadin.ui.Window;
* Implementation of software module details block using generic abstract
* details style .
*/
@SpringComponent
@ViewScope
public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLayout<SoftwareModule> {
private static final long serialVersionUID = -1052279281066089812L;
@Autowired
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private SwMetadataPopupLayout swMetadataPopupLayout;
private final SwMetadataPopupLayout swMetadataPopupLayout;
@Autowired
private transient EntityFactory entityFactory;
private final SoftwareModuleMetadatadetailslayout swmMetadataTable;
private SoftwareModuleMetadatadetailslayout swmMetadataTable;
SwModuleDetails(final I18N i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow,
final ManageDistUIState manageDistUIState, final SoftwareManagement softwareManagement,
final SwMetadataPopupLayout swMetadataPopupLayout, final EntityFactory entityFactory) {
super(i18n, eventBus, permissionChecker, null);
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
this.manageDistUIState = manageDistUIState;
this.softwareManagement = softwareManagement;
this.swMetadataPopupLayout = swMetadataPopupLayout;
/**
* softwareLayout Initialize the component.
*/
@Override
protected void init() {
swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
swmMetadataTable.init(getI18n(), getPermissionChecker(), softwareManagement, swMetadataPopupLayout,
entityFactory);
super.init();
addTabs(detailsTab);
restoreState();
}
/**
@@ -79,7 +76,7 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
* as instance of {@link MetadataEvent}
*/
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final MetadataEvent event) {
UI.getCurrent().access(() -> {
final MetaData softwareModuleMetadata = event.getMetaData();
@@ -94,7 +91,7 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
});
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
onBaseEntityEvent(softwareModuleEvent);
}
@@ -203,10 +200,12 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
}
private boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
final Long selectedDistSWModuleId = manageDistUIState.getSelectedBaseSwModuleId().isPresent()
? manageDistUIState.getSelectedBaseSwModuleId().get() : null;
return softwareModule != null && selectedDistSWModuleId != null
&& selectedDistSWModuleId.equals(softwareModule.getId());
if (softwareModule == null) {
return false;
}
return manageDistUIState.getSelectedBaseSwModuleId().map(module -> module.equals(softwareModule.getId()))
.orElse(false);
}
@Override

View File

@@ -12,11 +12,13 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
@@ -27,15 +29,17 @@ import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteri
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -47,8 +51,6 @@ import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.Page;
import com.vaadin.shared.ui.window.WindowMode;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.JavaScript;
@@ -60,39 +62,42 @@ import com.vaadin.ui.Window;
* Implementation of software module table using generic abstract table styles .
*
*/
@SpringComponent
@ViewScope
public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Long> {
private static final long serialVersionUID = 6785314784507424750L;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
@Autowired
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
private final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
@Autowired
private ArtifactDetailsLayout artifactDetailsLayout;
private final ArtifactDetailsLayout artifactDetailsLayout;
@Autowired
private SwMetadataPopupLayout swMetadataPopupLayout;
private final SwMetadataPopupLayout swMetadataPopupLayout;
/**
* Initialize the filter layout.
*/
@Override
protected void init() {
super.init();
SwModuleTable(final UIEventBus eventBus, final I18N i18n, final UINotification uiNotification,
final ManageDistUIState manageDistUIState, final SoftwareManagement softwareManagement,
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
final ArtifactManagement artifactManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final ArtifactUploadState artifactUploadState) {
super(eventBus, i18n, uiNotification);
this.manageDistUIState = manageDistUIState;
this.softwareManagement = softwareManagement;
this.distributionsViewAcceptCriteria = distributionsViewAcceptCriteria;
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
artifactManagement);
this.swMetadataPopupLayout = swMetadataPopupLayout;
addNewContainerDS();
setColumnProperties();
setDataAvailable(getContainerDataSource().size() != 0);
styleTableOnDistSelection();
}
/* All event Listeners */
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SMFilterEvent filterEvent) {
UI.getCurrent().access(() -> {
@@ -105,7 +110,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
});
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionsUIEvent event) {
UI.getCurrent().access(() -> {
if (event == DistributionsUIEvent.ORDER_BY_DISTRIBUTION) {
@@ -115,14 +120,14 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
});
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SaveActionWindowEvent event) {
if (event == SaveActionWindowEvent.DELETE_ALL_SOFWARE) {
UI.getCurrent().access(this::refreshFilter);
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleEvent event) {
onBaseEntityEvent(event);
}

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ui.distributions.smtable;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
@@ -15,14 +16,13 @@ import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
@@ -31,19 +31,20 @@ import com.vaadin.ui.Window;
* Implementation of software module Header block using generic abstract details
* style .
*/
@SpringComponent
@ViewScope
public class SwModuleTableHeader extends AbstractTableHeader {
private static final long serialVersionUID = 242961845006626297L;
@Autowired
private ManageDistUIState manageDistUIState;
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
@Autowired
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
SwModuleTableHeader(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
final ManageDistUIState manageDistUIstate,
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow) {
super(i18n, permChecker, eventbus, null, manageDistUIstate, null);
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionsUIEvent event) {
if (event == DistributionsUIEvent.HIDE_SM_FILTER_BY_TYPE) {
setFilterButtonsIconVisible(true);
@@ -72,10 +73,7 @@ public class SwModuleTableHeader extends AbstractTableHeader {
@Override
protected String onLoadSearchBoxValue() {
if (manageDistUIState.getSoftwareModuleFilters().getSearchText().isPresent()) {
return manageDistUIState.getSoftwareModuleFilters().getSearchText().get();
}
return null;
return manageDistUIstate.getSoftwareModuleFilters().getSearchText().orElse(null);
}
@Override
@@ -102,14 +100,14 @@ public class SwModuleTableHeader extends AbstractTableHeader {
@Override
protected void showFilterButtonsLayout() {
manageDistUIState.setSwTypeFilterClosed(false);
manageDistUIstate.setSwTypeFilterClosed(false);
eventbus.publish(this, DistributionsUIEvent.SHOW_SM_FILTER_BY_TYPE);
}
@Override
protected void resetSearchText() {
if (manageDistUIState.getSoftwareModuleFilters().getSearchText().isPresent()) {
manageDistUIState.getSoftwareModuleFilters().setSearchText(null);
if (manageDistUIstate.getSoftwareModuleFilters().getSearchText().isPresent()) {
manageDistUIstate.getSoftwareModuleFilters().setSearchText(null);
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
}
}
@@ -121,30 +119,30 @@ public class SwModuleTableHeader extends AbstractTableHeader {
@Override
public void maximizeTable() {
manageDistUIState.setSwModuleTableMaximized(Boolean.TRUE);
manageDistUIstate.setSwModuleTableMaximized(Boolean.TRUE);
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED, null));
}
@Override
public void minimizeTable() {
manageDistUIState.setSwModuleTableMaximized(Boolean.FALSE);
manageDistUIstate.setSwModuleTableMaximized(Boolean.FALSE);
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED, null));
}
@Override
public Boolean onLoadIsTableMaximized() {
return manageDistUIState.isSwModuleTableMaximized();
return manageDistUIstate.isSwModuleTableMaximized();
}
@Override
public Boolean onLoadIsShowFilterButtonDisplayed() {
return manageDistUIState.isSwTypeFilterClosed();
return manageDistUIstate.isSwTypeFilterClosed();
}
@Override
protected void searchBy(final String newSearchText) {
manageDistUIState.getSoftwareModuleFilters().setSearchText(newSearchText);
manageDistUIstate.getSoftwareModuleFilters().setSearchText(newSearchText);
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
}

View File

@@ -8,37 +8,44 @@
*/
package org.eclipse.hawkbit.ui.distributions.smtable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
/**
* Implementation of software module Layout
*/
@SpringComponent
@ViewScope
public class SwModuleTableLayout extends AbstractTableLayout {
private static final long serialVersionUID = 6464291374980641235L;
@Autowired
private SwModuleTableHeader swModuleTableHeader;
public SwModuleTableLayout(final I18N i18n, final UINotification uiNotification, final UIEventBus eventBus,
final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
final ManageDistUIState manageDistUIState, final SpPermissionChecker permChecker,
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
final ArtifactUploadState artifactUploadState, final ArtifactManagement artifactManagement) {
@Autowired
private SwModuleDetails swModuleDetails;
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow = new SoftwareModuleAddUpdateWindow(i18n,
uiNotification, eventBus, softwareManagement, entityFactory);
@Autowired
private SwModuleTable swModuleTable;
final SwMetadataPopupLayout swMetadataPopupLayout = new SwMetadataPopupLayout(i18n, uiNotification, eventBus,
softwareManagement, entityFactory, permChecker);
/**
* Initialize the filter layout.
*/
@PostConstruct
void init() {
super.init(swModuleTableHeader, swModuleTable, swModuleDetails);
super.init(
new SwModuleTableHeader(i18n, permChecker, eventBus, manageDistUIState, softwareModuleAddUpdateWindow),
new SwModuleTable(eventBus, i18n, uiNotification, manageDistUIState, softwareManagement,
distributionsViewAcceptCriteria, artifactManagement, swMetadataPopupLayout,
artifactUploadState),
new SwModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow, manageDistUIState,
softwareManagement, swMetadataPopupLayout, entityFactory));
}
}

View File

@@ -15,54 +15,37 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
/**
* Single button click behaviour of filter buttons layout.
*
*
*
*/
@SpringComponent
@ViewScope
public class DistSMTypeFilterButtonClick extends AbstractFilterSingleButtonClick implements Serializable {
private static final long serialVersionUID = -4166632002904286983L;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private transient SoftwareManagement softwareManagement;
private final transient SoftwareManagement softwareManagement;
DistSMTypeFilterButtonClick(final UIEventBus eventBus, final ManageDistUIState manageDistUIState,
final SoftwareManagement softwareManagement) {
this.eventBus = eventBus;
this.manageDistUIState = manageDistUIState;
this.softwareManagement = softwareManagement;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.
* AbstractFilterButtonClickBehaviour#filterUnClicked (com.vaadin.ui.Button)
*/
@Override
protected void filterUnClicked(final Button clickedButton) {
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(null);
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.
* AbstractFilterButtonClickBehaviour#filterClicked (com.vaadin.ui.Button)
*/
@Override
protected void filterClicked(final Button clickedButton) {
final SoftwareModuleType smType = softwareManagement

View File

@@ -15,6 +15,7 @@ import static org.eclipse.hawkbit.ui.utils.UIComponentIdProvider.SW_MODULE_TYPE_
import java.util.Collections;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
@@ -23,33 +24,35 @@ import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Software Module Type filter buttons.
*/
@ViewScope
@SpringComponent
public class DistSMTypeFilterButtons extends AbstractFilterButtons {
private static final long serialVersionUID = 6804534533362387433L;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
@Autowired
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
private final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
DistSMTypeFilterButtons(final UIEventBus eventBus, final ManageDistUIState manageDistUIState,
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria,
final SoftwareManagement softwareManagement) {
super(eventBus, new DistSMTypeFilterButtonClick(eventBus, manageDistUIState, softwareManagement));
this.manageDistUIState = manageDistUIState;
this.distributionsViewAcceptCriteria = distributionsViewAcceptCriteria;
}
@Override
protected String getButtonsTableId() {
@@ -103,7 +106,7 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
return SPUIDefinitions.SOFTWARE_MODULE_TAG_ID_PREFIXS;
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleTypeEvent event) {
if (isCreateOrUpdate(event) && event.getSoftwareModuleType() != null) {
refreshTypeTable();
@@ -115,7 +118,7 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|| event.getSoftwareModuleTypeEnum() == UPDATE_SOFTWARE_MODULE_TYPE;
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SaveActionWindowEvent event) {
if (event == SaveActionWindowEvent.SAVED_DELETE_SW_MODULE_TYPES) {
refreshTypeTable();

View File

@@ -8,19 +8,21 @@
*/
package org.eclipse.hawkbit.ui.distributions.smtype;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.artifacts.smtype.CreateUpdateSoftwareTypeLayout;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
@@ -28,22 +30,21 @@ import com.vaadin.ui.Window;
/**
* Software Module Type filter buttons header.
*/
@SpringComponent
@ViewScope
public class DistSMTypeFilterHeader extends AbstractFilterHeader {
private static final long serialVersionUID = -8763788280848718344L;
@Autowired
private ManageDistUIState manageDistUIState;
private final ManageDistUIState manageDistUIState;
private final CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
@Autowired
private CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
DistSMTypeFilterHeader(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final ManageDistUIState manageDistUIState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement swTypeManagementService) {
super(permChecker, eventBus, i18n);
this.manageDistUIState = manageDistUIState;
this.createUpdateSWTypeLayout = new CreateUpdateSoftwareTypeLayout(i18n, tagManagement, entityFactory, eventBus,
permChecker, uiNotification, swTypeManagementService);
@Override
@PostConstruct
public void init() {
super.init();
if (hasCreateUpdatePermission()) {
createUpdateSWTypeLayout.init();
}

View File

@@ -8,58 +8,45 @@
*/
package org.eclipse.hawkbit.ui.distributions.smtype;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterLayout;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Software Module Type filter layout.
*
*
*
*/
@SpringComponent
@ViewScope
public class DistSMTypeFilterLayout extends AbstractFilterLayout {
private static final long serialVersionUID = 3042297420534417538L;
@Autowired
private transient EventBus.SessionEventBus eventbus;
private final ManageDistUIState manageDistUIState;
@Autowired
private DistSMTypeFilterHeader smTypeFilterHeader;
public DistSMTypeFilterLayout(final UIEventBus eventBus, final I18N i18n, final SpPermissionChecker permChecker,
final ManageDistUIState manageDistUIState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareManagement softwareManagement,
final DistributionsViewAcceptCriteria distributionsViewAcceptCriteria) {
super(new DistSMTypeFilterHeader(i18n, permChecker, eventBus, manageDistUIState, tagManagement, entityFactory,
uiNotification, softwareManagement),
new DistSMTypeFilterButtons(eventBus, manageDistUIState, distributionsViewAcceptCriteria,
softwareManagement));
this.manageDistUIState = manageDistUIState;
@Autowired
private DistSMTypeFilterButtons smTypeFilterButtons;
@Autowired
private DistSMTypeFilterButtonClick smTypeFilterButtonClick;
@Autowired
private ManageDistUIState manageDistUIState;
/**
* Initialize the filter layout.
*/
@PostConstruct
public void init() {
super.init(smTypeFilterHeader, smTypeFilterButtons, smTypeFilterButtonClick);
eventbus.subscribe(this);
restoreState();
eventBus.subscribe(this);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final DistributionsUIEvent event) {
if (event == DistributionsUIEvent.HIDE_SM_FILTER_BY_TYPE) {
setVisible(false);
@@ -69,22 +56,6 @@ public class DistSMTypeFilterLayout extends AbstractFilterLayout {
}
}
@PreDestroy
void destroy() {
/*
* It's good manners to do this, even though vaadin-spring will
* automatically unsubscribe when this UI is garbage collected.
*/
eventbus.unsubscribe(this);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterLayout#
* onLoadIsTypeFilterIsClosed()
*/
@Override
public Boolean onLoadIsTypeFilterIsClosed() {

View File

@@ -36,11 +36,9 @@ public class ManageDistUIState implements ManagmentEntityState<DistributionSetId
private static final long serialVersionUID = -7569047247017742928L;
@Autowired
private ManageDistFilters manageDistFilters;
private final ManageDistFilters manageDistFilters;
@Autowired
private ManageSoftwareModuleFilters softwareModuleFilters;
private final ManageSoftwareModuleFilters softwareModuleFilters;
private final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = new HashMap<>();
@@ -76,6 +74,13 @@ public class ManageDistUIState implements ManagmentEntityState<DistributionSetId
private boolean noDataAvailableDist;
@Autowired
ManageDistUIState(final ManageDistFilters manageDistFilters,
final ManageSoftwareModuleFilters softwareModuleFilters) {
this.manageDistFilters = manageDistFilters;
this.softwareModuleFilters = softwareModuleFilters;
}
/**
* @return the manageDistFilters
*/

View File

@@ -25,13 +25,14 @@ import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.HorizontalLayout;
@@ -44,33 +45,39 @@ import com.vaadin.ui.UI;
* suggestions in a suggestion-pop-up window while typing.
*/
@SpringComponent
@ViewScope
@UIScope
public class AutoCompleteTextFieldComponent extends HorizontalLayout {
private static final long serialVersionUID = 1L;
@Autowired
private FilterManagementUIState filterManagementUIState;
private final FilterManagementUIState filterManagementUIState;
private final transient EventBus.UIEventBus eventBus;
private final transient RsqlValidationOracle rsqlValidationOracle;
private final transient Executor executor;
private final transient List<FilterQueryChangeListener> listeners = new LinkedList<>();
private Label validationIcon;
private TextField queryTextField;
@Autowired
private transient EventBus.SessionEventBus eventBus;
@Autowired
private transient RsqlValidationOracle rsqlValidationOracle;
@Autowired
@Qualifier("uiExecutor")
private transient Executor executor;
private transient List<FilterQueryChangeListener> listeners = new LinkedList<>();
private final Label validationIcon;
private final TextField queryTextField;
public AutoCompleteTextFieldComponent(final FilterManagementUIState filterManagementUIState,
final UIEventBus eventBus, final RsqlValidationOracle rsqlValidationOracle,
@Qualifier("uiExecutor") final Executor executor) {
this.filterManagementUIState = filterManagementUIState;
this.eventBus = eventBus;
this.rsqlValidationOracle = rsqlValidationOracle;
this.executor = executor;
}
/**
* Constructor.
*/
public AutoCompleteTextFieldComponent() {
@PostConstruct
void init() {
queryTextField = createSearchField();
validationIcon = createStatusIcon();
@@ -80,13 +87,7 @@ public class AutoCompleteTextFieldComponent extends HorizontalLayout {
addStyleName("custom-search-layout");
addComponents(validationIcon, queryTextField);
setComponentAlignment(validationIcon, Alignment.TOP_CENTER);
}
/**
* Called by the spring-framework when this bean has be post-constructed.
*/
@PostConstruct
public void postConstruct() {
eventBus.subscribe(this);
new TextFieldSuggestionBox(rsqlValidationOracle, this).extend(queryTextField);
}
@@ -96,7 +97,7 @@ public class AutoCompleteTextFieldComponent extends HorizontalLayout {
eventBus.unsubscribe(this);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final CustomFilterUIEvent custFUIEvent) {
if (custFUIEvent == CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON) {
validationIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
@@ -222,7 +223,7 @@ public class AutoCompleteTextFieldComponent extends HorizontalLayout {
class StatusCircledAsync implements Runnable {
private final UI current;
public StatusCircledAsync(final UI current) {
StatusCircledAsync(final UI current) {
this.current = current;
}

View File

@@ -10,9 +10,6 @@ package org.eclipse.hawkbit.ui.filtermanagement;
import java.util.Optional;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
@@ -30,8 +27,8 @@ import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -40,8 +37,6 @@ import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.LayoutEvents.LayoutClickListener;
import com.vaadin.server.FontAwesome;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -56,40 +51,29 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* A Vaadin layout for create or update the target filter.
*/
@SpringComponent
@ViewScope
public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button.ClickListener {
private static final long serialVersionUID = 7474232427119031474L;
private static final String BREADCRUMB_CUSTOM_FILTERS = "breadcrumb.target.filter.custom.filters";
@Autowired
private I18N i18n;
private final I18N i18n;
@Autowired
private transient EventBus.SessionEventBus eventBus;
private final transient EventBus.UIEventBus eventBus;
@Autowired
private FilterManagementUIState filterManagementUIState;
private final FilterManagementUIState filterManagementUIState;
@Autowired
private transient TargetFilterQueryManagement targetFilterQueryManagement;
private final transient TargetFilterQueryManagement targetFilterQueryManagement;
@Autowired
private SpPermissionChecker permissionChecker;
private final SpPermissionChecker permissionChecker;
@Autowired
private UINotification notification;
private final UINotification notification;
@Autowired
private transient UiProperties uiProperties;
private final UiProperties uiProperties;
@Autowired
private transient EntityFactory entityFactory;
private final transient EntityFactory entityFactory;
@Autowired
private AutoCompleteTextFieldComponent queryTextField;
private final AutoCompleteTextFieldComponent queryTextField;
private Button breadcrumbButton;
@@ -121,11 +105,21 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private LayoutClickListener nameLayoutClickListner;
/**
* Initialize the Campaign Status History Header.
*/
@PostConstruct
public void init() {
CreateOrUpdateFilterHeader(final I18N i18n, final UIEventBus eventBus,
final FilterManagementUIState filterManagementUIState,
final TargetFilterQueryManagement targetFilterQueryManagement, final SpPermissionChecker permissionChecker,
final UINotification notification, final UiProperties uiProperties, final EntityFactory entityFactory,
final AutoCompleteTextFieldComponent queryTextField) {
this.i18n = i18n;
this.eventBus = eventBus;
this.filterManagementUIState = filterManagementUIState;
this.targetFilterQueryManagement = targetFilterQueryManagement;
this.permissionChecker = permissionChecker;
this.notification = notification;
this.uiProperties = uiProperties;
this.entityFactory = entityFactory;
this.queryTextField = queryTextField;
createComponents();
createListeners();
buildLayout();
@@ -140,12 +134,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
}
}
@PreDestroy
void destroy() {
eventBus.unsubscribe(this);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final CustomFilterUIEvent custFUIEvent) {
if (custFUIEvent == CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW) {
populateComponents();

Some files were not shown because too many files have changed in this diff Show More