Improve code select all table entries

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2016-06-10 15:47:40 +02:00
parent dbdf3c7ab4
commit 3e5f1f75a0
8 changed files with 19 additions and 104 deletions

View File

@@ -23,15 +23,11 @@ public class SoftwareModuleEvent extends BaseEntityEvent<SoftwareModule> {
*
*/
public enum SoftwareModuleEventType {
ARTIFACTS_CHANGED, ASSIGN_SOFTWARE_MODULE
ARTIFACTS_CHANGED, ASSIGN_SOFTWARE_MODULE, SELECT_ALL
}
private SoftwareModuleEventType softwareModuleEventType;
public SoftwareModuleEvent() {
super(null, null);
}
/**
* Creates software module event.
*

View File

@@ -12,20 +12,14 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
/**
* Event to represent software module type add, update or delete.
*
*
*
*/
public class SoftwareModuleTypeEvent {
/**
* Software module type events in the Upload UI.
*
*
*
*/
public enum SoftwareModuleTypeEnum {
ADD_SOFTWARE_MODULE_TYPE, DELETE_SOFTWARE_MODULE_TYPE, UPDATE_SOFTWARE_MODULE_TYPE, SELECT_ALL
ADD_SOFTWARE_MODULE_TYPE, DELETE_SOFTWARE_MODULE_TYPE, UPDATE_SOFTWARE_MODULE_TYPE
}
private SoftwareModuleType softwareModuleType;

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.springframework.beans.factory.annotation.Autowired;
@@ -72,7 +73,7 @@ public class SoftwareModuleTableLayout extends AbstractTableLayout {
public void handleAction(final Action action, final Object sender, final Object target) {
if (ACTION_CTRL_A.equals(action)) {
smTable.selectAll();
getEventBus().publish(this, new SoftwareModuleEvent());
getEventBus().publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.SELECT_ALL, null));
}
}

View File

@@ -16,7 +16,6 @@ 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.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
@@ -49,9 +48,6 @@ public abstract class AbstractFilterButtons extends Table {
private AbstractFilterButtonClickBehaviour filterButtonClickBehaviour;
@Autowired
protected I18N i18n;
/**
* Initialize layout of filter buttons.
*
@@ -198,16 +194,16 @@ public abstract class AbstractFilterButtons extends Table {
setContainerDataSource(createButtonsLazyQueryContainer());
}
/**
* Select all rows in the table.
*/
public void selectAll() {
setValue(createButtonsLazyQueryContainer().getItemIds());
}
public void unSelectAll() {
setValue(null);
}
// /**
// * Select all rows in the table.
// */
// public void selectAll() {
// setValue(createButtonsLazyQueryContainer().getItemIds());
// }
//
// public void unSelectAll() {
// setValue(null);
// }
/**
* Id of the buttons table to be used in test cases.

View File

@@ -62,11 +62,4 @@ public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity,
setValue(getItemIds());
}
/**
* Clear all selections in the table.
*/
public void unSelectAll() {
setValue(null);
}
}

View File

@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.ui.distributions.dstable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent.DistributionSetComponentEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent.DistributionSetTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.event.Action;
@@ -77,8 +77,7 @@ public class DistributionSetTableLayout extends AbstractTableLayout {
public void handleAction(final Action action, final Object sender, final Object target) {
if (ACTION_CTRL_A.equals(action)) {
dsTable.selectAll();
getEventBus().publish(this,
new DistributionSetTableEvent(DistributionSetComponentEvent.SELECT_ALL));
getEventBus().publish(this, new DistributionSetTypeEvent(DistributionSetTypeEnum.SELECT_ALL));
}
}

View File

@@ -1,60 +0,0 @@
package org.eclipse.hawkbit.ui.distributions.event;
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
/**
*
*
*
*/
public class DistributionSetTableEvent extends BaseEntityEvent<DistributionSet> {
/**
* DistributionSet table components events.
*
*/
public enum DistributionSetComponentEvent {
SELECT_ALL
}
private DistributionSetComponentEvent distributionSetComponentEvent;
/**
* Constructor.
*
* @param eventType
* the event type.
* @param entity
* the entity
*/
public DistributionSetTableEvent(final BaseEntityEventType eventType, final DistributionSet entity) {
super(eventType, entity);
}
/**
* The component event.
*
* @param DistributionSetTableEvent
* the distributionSet component event.
*/
public DistributionSetTableEvent(final DistributionSetComponentEvent distributionSetComponentEvent) {
super(null, null);
this.distributionSetComponentEvent = distributionSetComponentEvent;
}
public DistributionSetComponentEvent getDistributionSetComponentEvent() {
return distributionSetComponentEvent;
}
}

View File

@@ -11,19 +11,15 @@ package org.eclipse.hawkbit.ui.distributions.event;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
/**
*
*
* DistributionSetTypeEvent
*/
public class DistributionSetTypeEvent {
/**
* DistributionSet type events in the Distribution UI.
*
*
*
*/
public enum DistributionSetTypeEnum {
ADD_DIST_SET_TYPE, DELETE_DIST_SET_TYPE, UPDATE_DIST_SET_TYPE, ON_VALUE_CHANGE
ADD_DIST_SET_TYPE, DELETE_DIST_SET_TYPE, UPDATE_DIST_SET_TYPE, ON_VALUE_CHANGE, SELECT_ALL
}
private DistributionSetType distributionSetType;