Example #1
0
  private void assignDsTag(final DragAndDropEvent event) {
    final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
    final Table distTable = (Table) taregtDet.getTarget();
    final Set<DistributionSetIdName> distsSelected = getTableValue(distTable);
    final Set<Long> distList = new HashSet<>();

    final AbstractSelectTargetDetails dropData =
        (AbstractSelectTargetDetails) event.getTargetDetails();
    final Object distItemId = dropData.getItemIdOver();

    if (!distsSelected.contains(distItemId)) {
      distList.add(((DistributionSetIdName) distItemId).getId());
    } else {
      distList.addAll(distsSelected.stream().map(t -> t.getId()).collect(Collectors.toList()));
    }

    final String distTagName =
        HawkbitCommonUtil.removePrefix(
            event.getTransferable().getSourceComponent().getId(),
            SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);

    final DistributionSetTagAssignmentResult result =
        distributionSetManagement.toggleTagAssignment(distList, distTagName);

    uiNotification.displaySuccess(
        HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n));
    if (result.getAssigned() >= 1
        && managementUIState.getDistributionTableFilters().isNoTagSelected()) {
      refreshFilter();
    }
  }
Example #2
0
 private void showMetadataDetails(final Object itemId) {
   final DistributionSetIdName distIdName =
       (DistributionSetIdName)
           getContainerDataSource()
               .getItem(itemId)
               .getItemProperty(SPUILabelDefinitions.VAR_DIST_ID_NAME)
               .getValue();
   final DistributionSet ds =
       distributionSetManagement.findDistributionSetByIdWithDetails(distIdName.getId());
   UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null));
 }
Example #3
0
 @Override
 protected DistributionSet findEntityByTableValue(final DistributionSetIdName lastSelectedId) {
   return distributionSetManagement.findDistributionSetByIdWithDetails(lastSelectedId.getId());
 }