Merge pull request #207 from bsinno/fix_Consitent_table_muliselect
Select all table entries with "CTRL+A"
This commit is contained in:
@@ -12,17 +12,11 @@ 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
|
||||
|
||||
@@ -211,4 +211,5 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
||||
protected void setDataAvailable(final boolean available) {
|
||||
artifactUploadState.setNoDataAvilableSoftwareModule(!available);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,10 +17,7 @@ import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
|
||||
/**
|
||||
* Software module table layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Software module table layout. (Upload Management)
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -44,4 +41,5 @@ public class SoftwareModuleTableLayout extends AbstractTableLayout {
|
||||
void init() {
|
||||
super.init(smTableHeader, smTable, softwareModuleDetails);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,10 +34,6 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Parent class for filter button layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractFilterButtons extends Table {
|
||||
|
||||
|
||||
@@ -28,6 +28,16 @@ public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity,
|
||||
|
||||
private static final long serialVersionUID = 780050712209750719L;
|
||||
|
||||
/**
|
||||
* Initialize the component.
|
||||
*/
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
setMultiSelect(true);
|
||||
setSelectable(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
final List<TableColumn> columnList = super.getTableVisibleColumns();
|
||||
|
||||
@@ -153,6 +153,16 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select all rows in the table.
|
||||
*/
|
||||
protected void selectAll() {
|
||||
if (isMultiSelect()) {
|
||||
// only contains the ItemIds of the visible items in the table
|
||||
setValue(getItemIds());
|
||||
}
|
||||
}
|
||||
|
||||
private void setColumnProperties() {
|
||||
final List<TableColumn> columnList = getTableVisibleColumns();
|
||||
final List<Object> swColumnIds = new ArrayList<>();
|
||||
|
||||
@@ -36,10 +36,6 @@ import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
* Parent class for table header.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
package org.eclipse.hawkbit.ui.common.table;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
||||
import org.eclipse.hawkbit.ui.utils.ShortCutModifierUtils;
|
||||
|
||||
import com.vaadin.event.Action;
|
||||
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;
|
||||
@@ -18,23 +21,19 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Parent class for table layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractTableLayout extends VerticalLayout {
|
||||
|
||||
private static final long serialVersionUID = 8611248179949245460L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private AbstractTableHeader tableHeader;
|
||||
|
||||
private AbstractTable table;
|
||||
private AbstractTable<?, ?> table;
|
||||
|
||||
private AbstractTableDetailsLayout detailsLayout;
|
||||
private AbstractTableDetailsLayout<?> detailsLayout;
|
||||
|
||||
protected void init(final AbstractTableHeader tableHeader, final AbstractTable table,
|
||||
final AbstractTableDetailsLayout detailsLayout) {
|
||||
protected void init(final AbstractTableHeader tableHeader, final AbstractTable<?, ?> table,
|
||||
final AbstractTableDetailsLayout<?> detailsLayout) {
|
||||
this.tableHeader = tableHeader;
|
||||
this.table = table;
|
||||
this.detailsLayout = detailsLayout;
|
||||
@@ -58,33 +57,33 @@ public abstract class AbstractTableLayout extends VerticalLayout {
|
||||
if (isShortCutKeysRequired()) {
|
||||
final Panel tablePanel = new Panel();
|
||||
tablePanel.setStyleName("table-panel");
|
||||
tablePanel.setHeight(100.0f, Unit.PERCENTAGE);
|
||||
tablePanel.setHeight(100.0F, Unit.PERCENTAGE);
|
||||
tablePanel.setContent(table);
|
||||
tablePanel.addActionHandler(getShortCutKeysHandler());
|
||||
tablePanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
|
||||
tableHeaderLayout.addComponent(tablePanel);
|
||||
tableHeaderLayout.setComponentAlignment(tablePanel, Alignment.TOP_CENTER);
|
||||
tableHeaderLayout.setExpandRatio(tablePanel, 1.0f);
|
||||
tableHeaderLayout.setExpandRatio(tablePanel, 1.0F);
|
||||
} else {
|
||||
tableHeaderLayout.addComponent(table);
|
||||
tableHeaderLayout.setComponentAlignment(table, Alignment.TOP_CENTER);
|
||||
tableHeaderLayout.setExpandRatio(table, 1.0f);
|
||||
tableHeaderLayout.setExpandRatio(table, 1.0F);
|
||||
}
|
||||
|
||||
addComponent(tableHeaderLayout);
|
||||
addComponent(detailsLayout);
|
||||
setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER);
|
||||
setComponentAlignment(detailsLayout, Alignment.TOP_CENTER);
|
||||
setExpandRatio(tableHeaderLayout, 1.0f);
|
||||
setExpandRatio(tableHeaderLayout, 1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* If any short cut keys required on the table.
|
||||
*
|
||||
* @return true if required else false. Default is 'false'.
|
||||
* @return true if required else false. Default is 'true'.
|
||||
*/
|
||||
protected boolean isShortCutKeysRequired() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,11 +93,38 @@ public abstract class AbstractTableLayout extends VerticalLayout {
|
||||
* Default is null.
|
||||
*/
|
||||
protected Handler getShortCutKeysHandler() {
|
||||
return null;
|
||||
return new TableShortCutHandler();
|
||||
}
|
||||
|
||||
protected void publishEvent() {
|
||||
// can be override by subclasses
|
||||
}
|
||||
|
||||
public void setShowFilterButtonVisible(final boolean visible) {
|
||||
tableHeader.setFilterButtonsIconVisible(visible);
|
||||
}
|
||||
|
||||
private class TableShortCutHandler implements Handler {
|
||||
|
||||
private static final String SELECT_ALL_TEXT = "Select All";
|
||||
private final ShortcutAction selectAllAction = new ShortcutAction(SELECT_ALL_TEXT, ShortcutAction.KeyCode.A,
|
||||
new int[] { ShortCutModifierUtils.getCtrlOrMetaModifier() });
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void handleAction(final Action action, final Object sender, final Object target) {
|
||||
if (!selectAllAction.equals(action)) {
|
||||
return;
|
||||
}
|
||||
table.selectAll();
|
||||
publishEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action[] getActions(final Object target, final Object sender) {
|
||||
return new Action[] { selectAllAction };
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,9 +31,6 @@ import com.vaadin.spring.annotation.ViewScope;
|
||||
|
||||
/**
|
||||
* Distribution Set Type filter buttons.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
|
||||
@@ -65,7 +65,6 @@ import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Distribution set table.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -468,7 +467,6 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
||||
@Override
|
||||
protected void setDataAvailable(final boolean available) {
|
||||
manageDistUIState.setNoDataAvailableDist(!available);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,16 +17,14 @@ import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
|
||||
/**
|
||||
* Software module table layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
|
||||
@@ -11,16 +11,12 @@ 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
|
||||
|
||||
@@ -17,10 +17,7 @@ import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
|
||||
/**
|
||||
* Implementation of software module Layout .
|
||||
*
|
||||
*
|
||||
*
|
||||
* Implementation of software module Layout
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
|
||||
@@ -638,9 +638,9 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
/**
|
||||
* Added by Saumya Target pin listener.
|
||||
*
|
||||
* @param installedDistItemIds
|
||||
* @param installedDistItemId
|
||||
* Item ids of installed distribution set
|
||||
* @param assignedDistTableItemIds
|
||||
* @param assignedDistTableItemId
|
||||
* Item ids of assigned distribution set
|
||||
*/
|
||||
public void styleDistributionSetTable(final Long installedDistItemId, final Long assignedDistTableItemId) {
|
||||
|
||||
@@ -18,9 +18,6 @@ import com.vaadin.spring.annotation.ViewScope;
|
||||
|
||||
/**
|
||||
* Software module table layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
|
||||
@@ -13,9 +13,8 @@ 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> {
|
||||
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -24,7 +22,7 @@ public class TargetTableEvent extends BaseEntityEvent<Target> {
|
||||
*
|
||||
*/
|
||||
public enum TargetComponentEvent {
|
||||
REFRESH_TARGETS, SELLECT_ALL, BULK_TARGET_CREATED, BULK_UPLOAD_COMPLETED, BULK_TARGET_UPLOAD_STARTED, BULK_UPLOAD_PROCESS_STARTED
|
||||
REFRESH_TARGETS, SELECT_ALL, BULK_TARGET_CREATED, BULK_UPLOAD_COMPLETED, BULK_TARGET_UPLOAD_STARTED, BULK_UPLOAD_PROCESS_STARTED
|
||||
}
|
||||
|
||||
private TargetComponentEvent targetComponentEvent;
|
||||
|
||||
@@ -95,7 +95,7 @@ public class CountMessageLabel extends Label {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final TargetTableEvent event) {
|
||||
if (TargetTableEvent.TargetComponentEvent.SELLECT_ALL == event.getTargetComponentEvent()
|
||||
if (TargetTableEvent.TargetComponentEvent.SELECT_ALL == event.getTargetComponentEvent()
|
||||
|| TargetComponentEvent.REFRESH_TARGETS == event.getTargetComponentEvent()) {
|
||||
displayTargetCountStatus();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.management.targettable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -19,13 +18,11 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetInfoUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
@@ -64,8 +61,6 @@ import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
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;
|
||||
@@ -73,12 +68,8 @@ import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Iterables;
|
||||
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.ShortcutAction;
|
||||
import com.vaadin.event.dd.DragAndDropEvent;
|
||||
import com.vaadin.event.dd.DropHandler;
|
||||
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
|
||||
@@ -97,11 +88,10 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Concrete implementation of Target table.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class TargetTable extends AbstractTable<Target, TargetIdName> implements Handler {
|
||||
public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
|
||||
private static final String TARGET_PINNED = "targetPinned";
|
||||
@@ -129,15 +119,10 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
||||
private Button targetPinnedBtn;
|
||||
|
||||
private Boolean isTargetPinned = Boolean.FALSE;
|
||||
private ShortcutAction actionSelectAll;
|
||||
private ShortcutAction actionUnSelectAll;
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
addActionHandler(this);
|
||||
actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall"));
|
||||
actionUnSelectAll = new ShortcutAction(i18n.get("action.target.table.clear"));
|
||||
setItemDescriptionGenerator(new AssignInstalledDSTooltipGenerator());
|
||||
}
|
||||
|
||||
@@ -262,22 +247,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
||||
HawkbitCommonUtil.addTargetTableContainerProperties(container);
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCustomGeneratedColumns() {
|
||||
addGeneratedColumn(SPUIDefinitions.TARGET_STATUS_PIN_TOGGLE_ICON,
|
||||
@@ -931,52 +900,10 @@ 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);
|
||||
}
|
||||
|
||||
private List<TargetIdName> getTargetIdsBySimpleFilters(final PageRequest pageRequest) {
|
||||
final Long filterByDistId = managementUIState.getTargetTableFilters().getDistributionSet().isPresent()
|
||||
? managementUIState.getTargetTableFilters().getDistributionSet().get().getId() : null;
|
||||
final List<TargetUpdateStatus> statusList = new ArrayList<>();
|
||||
if (isFilteredByStatus()) {
|
||||
statusList.addAll(managementUIState.getTargetTableFilters().getClickedStatusTargetTags());
|
||||
}
|
||||
final List<String> tagList = new ArrayList<>();
|
||||
if (isFilteredByTags()) {
|
||||
tagList.addAll(managementUIState.getTargetTableFilters().getClickedTargetTags());
|
||||
}
|
||||
String searchText = managementUIState.getTargetTableFilters().getSearchText().isPresent()
|
||||
? managementUIState.getTargetTableFilters().getSearchText().get() : null;
|
||||
if (!Strings.isNullOrEmpty(searchText)) {
|
||||
searchText = String.format("%%%s%%", searchText);
|
||||
}
|
||||
final Boolean noTagSelected = managementUIState.getTargetTableFilters().isNoTagSelected();
|
||||
|
||||
final String[] tagArray = tagList.toArray(new String[tagList.size()]);
|
||||
|
||||
List<TargetIdName> targetIdList;
|
||||
targetIdList = targetManagement.findAllTargetIdsByFilters(pageRequest, statusList, searchText, filterByDistId,
|
||||
noTagSelected, tagList.toArray(tagArray));
|
||||
Collections.reverse(targetIdList);
|
||||
return targetIdList;
|
||||
}
|
||||
|
||||
private List<TargetIdName> getTargetIdsByCustomFilters(final PageRequest pageRequest) {
|
||||
List<TargetIdName> targetIdList;
|
||||
final TargetFilterQuery targetFilterQuery = managementUIState.getTargetTableFilters().getTargetFilterQuery()
|
||||
.isPresent() ? managementUIState.getTargetTableFilters().getTargetFilterQuery().get() : null;
|
||||
targetIdList = targetManagement.findAllTargetIdsByTargetFilterQuery(pageRequest, targetFilterQuery);
|
||||
Collections.reverse(targetIdList);
|
||||
return targetIdList;
|
||||
// As Vaadin Table only returns the current ItemIds which are visible
|
||||
// you don't need to search explicit for them.
|
||||
setValue(getItemIds());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1065,10 +992,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
||||
return targetManagement.countTargetsAll();
|
||||
}
|
||||
|
||||
private static TargetIdName getLastSelectedItem(final Set<TargetIdName> values) {
|
||||
return Iterables.getLast(values);
|
||||
}
|
||||
|
||||
private boolean isFilteredByStatus() {
|
||||
return !managementUIState.getTargetTableFilters().getClickedStatusTargetTags().isEmpty();
|
||||
}
|
||||
|
||||
@@ -65,9 +65,6 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private ManagementViewAcceptCriteria managementViewAcceptCriteria;
|
||||
|
||||
@@ -231,14 +228,14 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
@Override
|
||||
protected void showFilterButtonsLayout() {
|
||||
managementUIState.setTargetTagFilterClosed(false);
|
||||
eventBus.publish(this, ManagementUIEvent.SHOW_TARGET_TAG_LAYOUT);
|
||||
eventbus.publish(this, ManagementUIEvent.SHOW_TARGET_TAG_LAYOUT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
if (managementUIState.getTargetTableFilters().getSearchText().isPresent()) {
|
||||
managementUIState.getTargetTableFilters().setSearchText(null);
|
||||
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||
eventbus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,13 +252,13 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
@Override
|
||||
public void maximizeTable() {
|
||||
managementUIState.setTargetTableMaximized(Boolean.TRUE);
|
||||
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.MAXIMIZED,null));
|
||||
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MAXIMIZED,null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void minimizeTable() {
|
||||
managementUIState.setTargetTableMaximized(Boolean.FALSE);
|
||||
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.MINIMIZED,null));
|
||||
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MINIMIZED,null));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -277,12 +274,12 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
@Override
|
||||
protected void searchBy(final String newSearchText) {
|
||||
managementUIState.getTargetTableFilters().setSearchText(newSearchText);
|
||||
eventBus.publish(this, TargetFilterEvent.FILTER_BY_TEXT);
|
||||
eventbus.publish(this, TargetFilterEvent.FILTER_BY_TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
eventbus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
targetAddUpdateWindow.resetComponents();
|
||||
final Window addTargetWindow = targetAddUpdateWindow.getWindow();
|
||||
addTargetWindow.setCaption(i18n.get("caption.add.new.target"));
|
||||
@@ -401,13 +398,13 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
getFilterDroppedInfo().setSizeFull();
|
||||
getFilterDroppedInfo().addComponent(filteredDistLabel);
|
||||
getFilterDroppedInfo().addComponent(filterLabelClose);
|
||||
getFilterDroppedInfo().setExpandRatio(filteredDistLabel, 1.0f);
|
||||
eventBus.publish(this, TargetFilterEvent.FILTER_BY_DISTRIBUTION);
|
||||
getFilterDroppedInfo().setExpandRatio(filteredDistLabel, 1.0F);
|
||||
eventbus.publish(this, TargetFilterEvent.FILTER_BY_DISTRIBUTION);
|
||||
}
|
||||
|
||||
private void closeFilterByDistribution() {
|
||||
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
eventbus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
/* Remove filter by distribution information. */
|
||||
getFilterDroppedInfo().removeAllComponents();
|
||||
getFilterDroppedInfo().setSizeUndefined();
|
||||
@@ -415,7 +412,7 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
managementUIState.getTargetTableFilters().setDistributionSet(null);
|
||||
|
||||
/* Reload the table */
|
||||
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_DISTRIBUTION);
|
||||
eventbus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_DISTRIBUTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,28 +16,17 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentE
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.event.Action;
|
||||
import com.vaadin.event.Action.Handler;
|
||||
import com.vaadin.event.ShortcutAction;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
|
||||
/**
|
||||
* Target table layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class TargetTableLayout extends AbstractTableLayout {
|
||||
|
||||
private static final long serialVersionUID = 2248703121998709112L;
|
||||
/**
|
||||
* action for the shortcut key ctrl + 'A'.
|
||||
*/
|
||||
private static final ShortcutAction ACTION_CTRL_A = new ShortcutAction("Select All", ShortcutAction.KeyCode.A,
|
||||
new int[] { ShortcutAction.ModifierKey.CTRL });
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
@@ -56,45 +45,14 @@ public class TargetTableLayout extends AbstractTableLayout {
|
||||
*/
|
||||
@PostConstruct
|
||||
void init() {
|
||||
|
||||
super.init(targetTableHeader, targetTable, targetDetails);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableLayout#
|
||||
* isShortCutKeysRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isShortCutKeysRequired() {
|
||||
return true;
|
||||
}
|
||||
protected void publishEvent() {
|
||||
|
||||
/*
|
||||
* (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)) {
|
||||
targetTable.selectAll();
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.SELLECT_ALL));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action[] getActions(final Object target, final Object sender) {
|
||||
return new Action[] { ACTION_CTRL_A };
|
||||
}
|
||||
};
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.SELECT_ALL));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.utils;
|
||||
|
||||
import com.vaadin.event.ShortcutAction;
|
||||
import com.vaadin.server.Page;
|
||||
import com.vaadin.server.WebBrowser;
|
||||
|
||||
/**
|
||||
* On different systems there are different modifier for short cuts. This
|
||||
* utility class handles the cross-platform functionality.
|
||||
*/
|
||||
public final class ShortCutModifierUtils {
|
||||
|
||||
private ShortCutModifierUtils() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ctrl or meta modifier depending on the platform.
|
||||
*
|
||||
* @return on mac return
|
||||
* {@link com.vaadin.event.ShortcutAction.ModifierKey#META} other
|
||||
* platform return
|
||||
* {@link com.vaadin.event.ShortcutAction.ModifierKey#CTRL}
|
||||
*/
|
||||
public static int getCtrlOrMetaModifier() {
|
||||
final WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
|
||||
if (webBrowser.isMacOSX()) {
|
||||
return ShortcutAction.ModifierKey.META;
|
||||
}
|
||||
|
||||
return ShortcutAction.ModifierKey.CTRL;
|
||||
}
|
||||
}
|
||||
@@ -299,10 +299,6 @@ message.tag.use.bulk.upload = {0} cannot be deleted .It is in use in targets bul
|
||||
message.bulk.upload.tag.assignment.failed = Tag {0} assignment failed as tag no longer exists
|
||||
message.bulk.upload.tag.assignments.failed= Few tag assignments failed as tags no longer exists
|
||||
|
||||
# action info
|
||||
action.target.table.selectall = Select all (Ctrl+A)
|
||||
action.target.table.clear = Clear selections
|
||||
|
||||
#reused messages
|
||||
soft.module.jvm =Runtime
|
||||
soft.module.application =Application
|
||||
|
||||
Reference in New Issue
Block a user