private static boolean isValueEquals(
      final AbstractField<?> field, final Object orginalValue, final Object currentValue) {
    if (Set.class.equals(field.getType())) {
      return CollectionUtils.isEqualCollection(
          CollectionUtils.emptyIfNull((Collection<?>) orginalValue),
          CollectionUtils.emptyIfNull((Collection<?>) currentValue));
    }

    if (String.class.equals(field.getType())) {
      return Objects.equals(
          Strings.emptyToNull((String) orginalValue), Strings.emptyToNull((String) currentValue));
    }

    return Objects.equals(orginalValue, currentValue);
  }
Exemple #2
0
 private void initRef() {
   listForm =
       BaseListForm.class.cast(Validate.notNull(beanFactory.getBean(getReference().listForm())));
   getListForm().getContent().setPrefHeight(DEFAULT_HEIGHT);
   getListForm().getContent().setMaxHeight(DEFAULT_HEIGHT);
   getListForm().setRowDblClickConsumer(null);
   getListForm().getToolBar().getController().removeAll();
   // Удалить
   getListForm()
       .getToolBar()
       .getController()
       .registerAction(refDeleteAction)
       .setActionCallback(
           () ->
               Optional.ofNullable(getListForm().getSelectedModel())
                   .ifPresent(
                       item -> {
                         setValue(
                             CollectionUtils.emptyIfNull(getValue())
                                 .stream()
                                 .filter(item0 -> !Objects.equals(item0, item))
                                 .collect(Collectors.toSet()));
                       }));
   getListForm().getToolBar().setPrefHeight(DEFAULT_ACTION_HEIGHT + 2);
   getListForm().getToolBar().getController().setActionsHeight(DEFAULT_ACTION_HEIGHT);
   getListForm().getToolBar().getController().setActionsWidth(DEFAULT_BTN_WIDTH);
   setContent(getListForm().getContent());
 }
Exemple #3
0
 @Override
 public void setValue(Collection<M> value) {
   this.value = CollectionUtils.emptyIfNull(value).stream().collect(Collectors.toSet());
   getListForm()
       .setFilter(DaoUtils.createInCriterion(BaseModel.ID, ModelUtils.getIds(getValue())));
   getListForm().refresh();
 }