Optimize multiselect

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2016-06-13 17:49:09 +02:00
parent 3e5f1f75a0
commit 1b59755239
8 changed files with 41 additions and 64 deletions

View File

@@ -77,7 +77,6 @@ public abstract class AbstractFilterButtons extends Table {
setDragMode(TableDragMode.NONE);
setSelectable(false);
setSizeFull();
setMultiSelect(true);
}
private void setStyle() {
@@ -194,17 +193,6 @@ 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);
// }
/**
* Id of the buttons table to be used in test cases.
*

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.DistributionSetTypeEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent.DistributionSetTypeEnum;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent.DistributionTableComponentEvent;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.event.Action;
@@ -77,7 +77,8 @@ 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 DistributionSetTypeEvent(DistributionSetTypeEnum.SELECT_ALL));
getEventBus().publish(this,
new DistributionSetTableEvent(DistributionTableComponentEvent.SELECT_ALL));
}
}

View File

@@ -0,0 +1,25 @@
package org.eclipse.hawkbit.ui.distributions.event;
public class DistributionSetTableEvent {
private final DistributionTableComponentEvent distributionSetTableEvent;
/**
* The component event.
*
* @param distributionSetTableEvent
* the distributionSet component event.
*/
public DistributionSetTableEvent(final DistributionTableComponentEvent distributionSetTableEvent) {
this.distributionSetTableEvent = distributionSetTableEvent;
}
/**
* DistributionSet table components events.
*
*/
public enum DistributionTableComponentEvent {
SELECT_ALL
}
}

View File

@@ -19,7 +19,7 @@ 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, SELECT_ALL
ADD_DIST_SET_TYPE, DELETE_DIST_SET_TYPE, UPDATE_DIST_SET_TYPE, ON_VALUE_CHANGE
}
private DistributionSetType distributionSetType;

View File

@@ -8,36 +8,20 @@
*/
package org.eclipse.hawkbit.ui.distributions.event;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
/**
* Class which contains the Event when selecting all entries of a table
* Class which contains the Event when selecting all entries of the
* softwareModule table
*/
public class SoftwareModuleTableEvent extends BaseEntityEvent<SoftwareModule> {
public class SoftwareModuleTableEvent {
/**
* SoftwareModule table components events.
*
*/
public enum SoftwareModuleComponentEvent {
SELECT_ALL
}
private SoftwareModuleComponentEvent softwareModuleComponentEvent;
/**
* Constructor.
*
* @param eventType
* the event type.
* @param entity
* the entity
*/
public SoftwareModuleTableEvent(final BaseEntityEventType eventType, final SoftwareModule entity) {
super(eventType, entity);
}
private final SoftwareModuleComponentEvent softwareModuleComponentEvent;
/**
* The component event.
@@ -46,7 +30,6 @@ public class SoftwareModuleTableEvent extends BaseEntityEvent<SoftwareModule> {
* the softwareModule component event.
*/
public SoftwareModuleTableEvent(final SoftwareModuleComponentEvent softwareModuleComponentEvent) {
super(null, null);
this.softwareModuleComponentEvent = softwareModuleComponentEvent;
}

View File

@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.ui.management.dstable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionTableComponentEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent.DistributionTableComponentEvent;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.event.Action;
@@ -73,7 +73,8 @@ public class DistributionTableLayout 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 DistributionTableEvent(DistributionTableComponentEvent.SELECT_ALL));
getEventBus().publish(this,
new DistributionSetTableEvent(DistributionTableComponentEvent.SELECT_ALL));
}
}

View File

@@ -13,20 +13,11 @@ import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
/**
*
*
*
* Class which contains the Event when selecting all entries of the
* distributions table
*/
public class DistributionTableEvent extends BaseEntityEvent<DistributionSet> {
/**
* DistributionSet table components events.
*
*/
public enum DistributionTableComponentEvent {
SELECT_ALL
}
/**
* Constructor.
*
@@ -39,14 +30,4 @@ public class DistributionTableEvent extends BaseEntityEvent<DistributionSet> {
super(eventType, entity);
}
/**
* The component event.
*
* @param DistributionSetTableEvent
* the distributionSet component event.
*/
public DistributionTableEvent(final DistributionTableComponentEvent distributionComponentEvent) {
super(null, null);
}
}

View File

@@ -13,9 +13,7 @@ import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
/**
*
*
*
* Class which contains the Event when selecting all entries of the target table
*/
public class TargetTableEvent extends BaseEntityEvent<Target> {