Small UI inconsitencies and glitches cleanup - Consitent table

muliselect

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2016-04-21 14:50:48 +02:00
parent c76ab23dc5
commit 5fd7f3a5b3
19 changed files with 477 additions and 37 deletions

View File

@@ -28,6 +28,10 @@ public class SoftwareModuleEvent extends BaseEntityEvent<SoftwareModule> {
private SoftwareModuleEventType softwareModuleEventType;
public SoftwareModuleEvent() {
super(null, null);
}
/**
* Creates software module event.
*

View File

@@ -25,7 +25,7 @@ public class SoftwareModuleTypeEvent {
*
*/
public enum SoftwareModuleTypeEnum {
ADD_SOFTWARE_MODULE_TYPE, DELETE_SOFTWARE_MODULE_TYPE, UPDATE_SOFTWARE_MODULE_TYPE
ADD_SOFTWARE_MODULE_TYPE, DELETE_SOFTWARE_MODULE_TYPE, UPDATE_SOFTWARE_MODULE_TYPE, SELECT_ALL
}
private SoftwareModuleType softwareModuleType;

View File

@@ -35,6 +35,7 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.event.Action;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
@@ -211,4 +212,15 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
protected void setDataAvailable(final boolean available) {
artifactUploadState.setNoDataAvilableSoftwareModule(!available);
}
@Override
public void handleAction(final Action action, final Object sender, final Object target) {
if (actionSelectAll.equals(action)) {
selectAll();
eventBus.publish(this, new SoftwareModuleEvent());
}
if (actionUnSelectAll.equals(action)) {
unSelectAll();
}
}
}

View File

@@ -10,14 +10,17 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
/**
* Software module table layout.
* Software module table layout. (Upload Management)
*
*
*
@@ -44,4 +47,42 @@ public class SoftwareModuleTableLayout extends AbstractTableLayout {
void init() {
super.init(smTableHeader, smTable, softwareModuleDetails);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableLayout#
* isShortCutKeysRequired()
*/
@Override
protected boolean isShortCutKeysRequired() {
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableLayout#
* getShortCutKeysHandler()
*/
@Override
protected Handler getShortCutKeysHandler() {
return new Handler() {
private static final long serialVersionUID = 1L;
@Override
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());
}
}
@Override
public Action[] getActions(final Object target, final Object sender) {
return new Action[] { ACTION_CTRL_A };
}
};
}
}

View File

@@ -15,7 +15,10 @@ import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUITagButtonStyle;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
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;
@@ -24,6 +27,9 @@ import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.spring.events.EventBus;
import com.vaadin.data.Item;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.event.ShortcutAction;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Button;
@@ -39,19 +45,25 @@ import com.vaadin.ui.themes.ValoTheme;
*
*
*/
public abstract class AbstractFilterButtons extends Table {
public abstract class AbstractFilterButtons extends Table implements Handler {
private static final long serialVersionUID = 7783305719009746375L;
private static final String DEFAULT_GREEN = "rgb(44,151,32)";
protected static final String FILTER_BUTTON_COLUMN = "filterButton";
@Autowired
protected transient EventBus.SessionEventBus eventBus;
private AbstractFilterButtonClickBehaviour filterButtonClickBehaviour;
private ShortcutAction actionSelectAll;
private ShortcutAction actionUnSelectAll;
@Autowired
protected I18N i18n;
/**
* Initialize layout of filter buttons.
*
@@ -63,7 +75,7 @@ public abstract class AbstractFilterButtons extends Table {
createTable();
eventBus.subscribe(this);
}
@PreDestroy
void destroy() {
eventBus.unsubscribe(this);
@@ -81,6 +93,9 @@ public abstract class AbstractFilterButtons extends Table {
setDragMode(TableDragMode.NONE);
setSelectable(false);
setSizeFull();
setMultiSelect(true);
actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall"));
actionUnSelectAll = new ShortcutAction(i18n.get("action.target.table.clear"));
}
private void setStyle() {
@@ -196,6 +211,33 @@ public abstract class AbstractFilterButtons extends Table {
setContainerDataSource(createButtonsLazyQueryContainer());
}
@Override
public Action[] getActions(final Object target, final Object sender) {
return new Action[] { actionSelectAll, actionUnSelectAll };
}
@Override
public void handleAction(final Action action, final Object sender, final Object target) {
if (actionSelectAll.equals(action)) {
selectAll();
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.SELLECT_ALL));
}
if (actionUnSelectAll.equals(action)) {
unSelectAll();
}
}
/**
* 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

@@ -15,6 +15,9 @@ import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import com.vaadin.data.Item;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.event.ShortcutAction;
/**
* Abstract table to handling {@link NamedVersionedEntity}
@@ -24,10 +27,27 @@ import com.vaadin.data.Item;
* @param <I>
* i is the id of the table
*/
public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity, I> extends AbstractTable<E, I> {
public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity, I> extends AbstractTable<E, I>
implements Handler {
private static final long serialVersionUID = 780050712209750719L;
protected ShortcutAction actionSelectAll;
protected ShortcutAction actionUnSelectAll;
/**
* Initialize the component.
*/
@Override
protected void init() {
super.init();
actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall"));
actionUnSelectAll = new ShortcutAction(i18n.get("action.target.table.clear"));
setMultiSelect(true);
setSelectable(true);
}
@Override
protected List<TableColumn> getTableVisibleColumns() {
final List<TableColumn> columnList = super.getTableVisibleColumns();
@@ -44,4 +64,24 @@ public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity,
item.getItemProperty(SPUILabelDefinitions.VAR_VERSION).setValue(baseEntity.getVersion());
}
@Override
public Action[] getActions(final Object target, final Object sender) {
return new Action[] { actionSelectAll, actionUnSelectAll };
}
/**
* Select all rows in the table.
*/
public void selectAll() {
// only contains the ItemIds of the visible items in the table
setValue(getItemIds());
}
/**
* Clear all selections in the table.
*/
public void unSelectAll() {
setValue(null);
}
}

View File

@@ -53,6 +53,7 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
private static final Logger LOG = LoggerFactory.getLogger(AbstractTable.class);
// TODO MR should be private and use with getter/setter
@Autowired
protected transient EventBus.SessionEventBus eventBus;

View File

@@ -9,8 +9,11 @@
package org.eclipse.hawkbit.ui.common.table;
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import com.vaadin.event.Action.Handler;
import com.vaadin.event.ShortcutAction;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
@@ -27,6 +30,15 @@ public abstract class AbstractTableLayout extends VerticalLayout {
private static final long serialVersionUID = 8611248179949245460L;
/**
* action for the shortcut key ctrl + 'A'.
*/
protected static final ShortcutAction ACTION_CTRL_A = new ShortcutAction("Select All", ShortcutAction.KeyCode.A,
new int[] { ShortcutAction.ModifierKey.CTRL });
@Autowired
private transient EventBus.SessionEventBus eventBus;
private AbstractTableHeader tableHeader;
private AbstractTable table;
@@ -93,12 +105,14 @@ public abstract class AbstractTableLayout extends VerticalLayout {
* @return reference of {@link Handler} to handler the short cut keys.
* Default is null.
*/
protected Handler getShortCutKeysHandler() {
return null;
}
protected abstract Handler getShortCutKeysHandler();
public void setShowFilterButtonVisible(final boolean visible) {
tableHeader.setFilterButtonsIconVisible(visible);
}
public EventBus.SessionEventBus getEventBus() {
return eventBus;
}
}

View File

@@ -31,6 +31,8 @@ import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModule
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTableEvent.DistributionSetComponentEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
@@ -55,6 +57,7 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.event.Action;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
@@ -472,4 +475,15 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
}
@Override
public void handleAction(final Action action, final Object sender, final Object target) {
if (actionSelectAll.equals(action)) {
selectAll();
eventBus.publish(this, new DistributionSetTableEvent(DistributionSetComponentEvent.SELECT_ALL));
}
if (actionUnSelectAll.equals(action)) {
unSelectAll();
}
}
}

View File

@@ -11,8 +11,12 @@ 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.springframework.beans.factory.annotation.Autowired;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
@@ -27,6 +31,7 @@ import com.vaadin.spring.annotation.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.
@@ -48,4 +53,42 @@ public class DistributionSetTableLayout extends AbstractTableLayout {
super.init(dsTableHeader, dsTable, distributionDetails);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableLayout#
* isShortCutKeysRequired()
*/
@Override
protected boolean isShortCutKeysRequired() {
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableLayout#
* getShortCutKeysHandler()
*/
@Override
protected Handler getShortCutKeysHandler() {
return new Handler() {
private static final long serialVersionUID = 1L;
@Override
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));
}
}
@Override
public Action[] getActions(final Object target, final Object sender) {
return new Action[] { ACTION_CTRL_A };
}
};
}
}

View File

@@ -0,0 +1,60 @@
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

@@ -30,16 +30,11 @@ public class DistributionSetTypeEvent {
private final DistributionSetTypeEnum distributionSetTypeEnum;
private String distributionSetTypeName;
/**
* @param distributionSetTypeEnum
* @param distributionSetTypeName
*/
public DistributionSetTypeEvent(final DistributionSetTypeEnum distributionSetTypeEnum,
final String distributionSetTypeName) {
public DistributionSetTypeEvent(final DistributionSetTypeEnum distributionSetTypeEnum) {
this.distributionSetTypeEnum = distributionSetTypeEnum;
this.distributionSetTypeName = distributionSetTypeName;
}
/**
@@ -52,14 +47,6 @@ public class DistributionSetTypeEvent {
this.distributionSetType = distributionSetType;
}
public String getDistributionSetTypeName() {
return distributionSetTypeName;
}
public void setDistributionSetTypeName(final String distributionSetTypeName) {
this.distributionSetTypeName = distributionSetTypeName;
}
public DistributionSetType getDistributionSetType() {
return distributionSetType;
}

View File

@@ -0,0 +1,51 @@
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;
/**
*
*
*
*/
public class SoftwareModuleTableEvent extends BaseEntityEvent<SoftwareModule> {
/**
* 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);
}
/**
* The component event.
*
* @param SoftwareModuleComponentEvent
* the softwareModule component event.
*/
public SoftwareModuleTableEvent(final SoftwareModuleComponentEvent softwareModuleComponentEvent) {
super(null, null);
this.softwareModuleComponentEvent = softwareModuleComponentEvent;
}
public SoftwareModuleComponentEvent getSoftwareModuleComponentEvent() {
return softwareModuleComponentEvent;
}
}

View File

@@ -26,6 +26,8 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
import org.eclipse.hawkbit.ui.distributions.event.SoftwareModuleTableEvent;
import org.eclipse.hawkbit.ui.distributions.event.SoftwareModuleTableEvent.SoftwareModuleComponentEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
@@ -42,6 +44,8 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
@@ -62,7 +66,7 @@ import com.vaadin.ui.Window;
*/
@SpringComponent
@ViewScope
public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Long> {
public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Long> implements Handler {
private static final long serialVersionUID = 6785314784507424750L;
@@ -388,4 +392,15 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
}
@Override
public void handleAction(final Action action, final Object sender, final Object target) {
if (actionSelectAll.equals(action)) {
selectAll();
eventBus.publish(this, new SoftwareModuleTableEvent(SoftwareModuleComponentEvent.SELECT_ALL));
}
if (actionUnSelectAll.equals(action)) {
unSelectAll();
}
}
}

View File

@@ -11,8 +11,12 @@ package org.eclipse.hawkbit.ui.distributions.smtable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.eclipse.hawkbit.ui.distributions.event.SoftwareModuleTableEvent;
import org.eclipse.hawkbit.ui.distributions.event.SoftwareModuleTableEvent.SoftwareModuleComponentEvent;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
@@ -44,4 +48,42 @@ public class SwModuleTableLayout extends AbstractTableLayout {
void init() {
super.init(swModuleTableHeader, swModuleTable, swModuleDetails);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableLayout#
* isShortCutKeysRequired()
*/
@Override
protected boolean isShortCutKeysRequired() {
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableLayout#
* getShortCutKeysHandler()
*/
@Override
protected Handler getShortCutKeysHandler() {
return new Handler() {
private static final long serialVersionUID = 1L;
@Override
public void handleAction(final Action action, final Object sender, final Object target) {
if (ACTION_CTRL_A.equals(action)) {
swModuleTable.selectAll();
getEventBus().publish(this, new SoftwareModuleTableEvent(SoftwareModuleComponentEvent.SELECT_ALL));
}
}
@Override
public Action[] getActions(final Object target, final Object sender) {
return new Action[] { ACTION_CTRL_A };
}
};
}
}

View File

@@ -53,6 +53,7 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.event.Action;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
@@ -658,4 +659,11 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
}
//TODO MR
@Override
public void handleAction(final Action action, final Object sender, final Object target) {
// TODO Auto-generated method stub
}
}

View File

@@ -11,8 +11,12 @@ 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.springframework.beans.factory.annotation.Autowired;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
@@ -45,4 +49,41 @@ public class DistributionTableLayout extends AbstractTableLayout {
super.init(dsTableHeader, dsTable, distributionDetails);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableLayout#
* isShortCutKeysRequired()
*/
@Override
protected boolean isShortCutKeysRequired() {
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableLayout#
* getShortCutKeysHandler()
*/
@Override
protected Handler getShortCutKeysHandler() {
return new Handler() {
private static final long serialVersionUID = 1L;
@Override
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));
}
}
@Override
public Action[] getActions(final Object target, final Object sender) {
return new Action[] { ACTION_CTRL_A };
}
};
}
}

View File

@@ -19,6 +19,14 @@ import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
*/
public class DistributionTableEvent extends BaseEntityEvent<DistributionSet> {
/**
* DistributionSet table components events.
*
*/
public enum DistributionTableComponentEvent {
SELECT_ALL
}
/**
* Constructor.
*
@@ -31,4 +39,14 @@ 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

@@ -21,7 +21,6 @@ import java.util.stream.Collectors;
import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
@@ -63,7 +62,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
@@ -353,6 +351,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
};
}
// TODO MR
private void onTargetDeletedEvent(final List<TargetDeletedEvent> events) {
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
@@ -928,16 +927,24 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
* Select all rows in the table.
*/
public void selectAll() {
final PageRequest pageRequest = new OffsetBasedPageRequest(0, size(),
new Sort(SPUIDefinitions.TARGET_TABLE_CREATE_AT_SORT_ORDER, "createdAt"));
List<TargetIdName> targetIdList;
// is custom filter selected
if (managementUIState.getTargetTableFilters().getTargetFilterQuery().isPresent()) {
targetIdList = getTargetIdsByCustomFilters(pageRequest);
} else {
targetIdList = getTargetIdsBySimpleFilters(pageRequest);
}
setValue(targetIdList);
// final PageRequest pageRequest = new OffsetBasedPageRequest(0, size(),
// new Sort(SPUIDefinitions.TARGET_TABLE_CREATE_AT_SORT_ORDER,
// "createdAt"));
// List<TargetIdName> targetIdList;
// // is custom filter selected
// if
// (managementUIState.getTargetTableFilters().getTargetFilterQuery().isPresent())
// {
// targetIdList = getTargetIdsByCustomFilters(pageRequest);
// } else {
// targetIdList = getTargetIdsBySimpleFilters(pageRequest);
// }
// setValue(targetIdList);
// TODO MR
// As Vaadin Table only returns the current ItemIds which are visible
// you don't need to search explicit for them.
setValue(getItemIds());
}
private List<TargetIdName> getTargetIdsBySimpleFilters(final PageRequest pageRequest) {