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); setDragMode(TableDragMode.NONE);
setSelectable(false); setSelectable(false);
setSizeFull(); setSizeFull();
setMultiSelect(true);
} }
private void setStyle() { private void setStyle() {
@@ -194,17 +193,6 @@ public abstract class AbstractFilterButtons extends Table {
setContainerDataSource(createButtonsLazyQueryContainer()); 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. * 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 javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout; import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent; import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent.DistributionSetTypeEnum; import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent.DistributionTableComponentEvent;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.event.Action; 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) { public void handleAction(final Action action, final Object sender, final Object target) {
if (ACTION_CTRL_A.equals(action)) { if (ACTION_CTRL_A.equals(action)) {
dsTable.selectAll(); 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. * DistributionSet type events in the Distribution UI.
*/ */
public enum DistributionSetTypeEnum { 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; private DistributionSetType distributionSetType;

View File

@@ -8,36 +8,20 @@
*/ */
package org.eclipse.hawkbit.ui.distributions.event; 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. * SoftwareModule table components events.
*
*/ */
public enum SoftwareModuleComponentEvent { public enum SoftwareModuleComponentEvent {
SELECT_ALL SELECT_ALL
} }
private SoftwareModuleComponentEvent softwareModuleComponentEvent; private final SoftwareModuleComponentEvent softwareModuleComponentEvent;
/**
* Constructor.
*
* @param eventType
* the event type.
* @param entity
* the entity
*/
public SoftwareModuleTableEvent(final BaseEntityEventType eventType, final SoftwareModule entity) {
super(eventType, entity);
}
/** /**
* The component event. * The component event.
@@ -46,7 +30,6 @@ public class SoftwareModuleTableEvent extends BaseEntityEvent<SoftwareModule> {
* the softwareModule component event. * the softwareModule component event.
*/ */
public SoftwareModuleTableEvent(final SoftwareModuleComponentEvent softwareModuleComponentEvent) { public SoftwareModuleTableEvent(final SoftwareModuleComponentEvent softwareModuleComponentEvent) {
super(null, null);
this.softwareModuleComponentEvent = softwareModuleComponentEvent; this.softwareModuleComponentEvent = softwareModuleComponentEvent;
} }

View File

@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.ui.management.dstable;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout; import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent; import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent;
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionTableComponentEvent; import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent.DistributionTableComponentEvent;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.event.Action; 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) { public void handleAction(final Action action, final Object sender, final Object target) {
if (ACTION_CTRL_A.equals(action)) { if (ACTION_CTRL_A.equals(action)) {
dsTable.selectAll(); 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; 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> { public class DistributionTableEvent extends BaseEntityEvent<DistributionSet> {
/**
* DistributionSet table components events.
*
*/
public enum DistributionTableComponentEvent {
SELECT_ALL
}
/** /**
* Constructor. * Constructor.
* *
@@ -39,14 +30,4 @@ public class DistributionTableEvent extends BaseEntityEvent<DistributionSet> {
super(eventType, entity); 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; 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> { public class TargetTableEvent extends BaseEntityEvent<Target> {