Пример #1
0
 public void setSortOrder(final Integer sortOrder) {
   this.sortOrder = sortOrder;
   // DTL-VK: Zdůvodů ukládání položky sortOrder do profilu musím posunout maximální id až za
   // nastavovanou hodnotu
   while (this.sortOrder > columnModel.getSortMaxIndex()) {
     columnModel.autoIncSortMaxIndex();
   }
 }
Пример #2
0
  /**
   * Setup sort type for this column and recalculate sortOrder of other columns to hold consistent
   * state.
   *
   * @param sortType new sort type
   */
  public void setSortType(final DLSortType sortType) {
    // if there was setted NATURAL and won't be then active sort order
    if (DLSortType.NATURAL.equals(this.sortType) && !DLSortType.NATURAL.equals(sortType)) {
      sortOrder = columnModel.autoIncSortMaxIndex();
    }
    // if there wasn't setted NATURAL and will be then deactive sort order
    if (!DLSortType.NATURAL.equals(this.sortType) && DLSortType.NATURAL.equals(sortType)) {
      columnModel.autoDecSortMaxIndex();
      for (DLColumnUnitModel unit : columnModel.getColumnModels()) {
        unit.autodecrementSortOrder(sortOrder);
      }
      sortOrder = 0;
    }

    setSortTypeDirectly(sortType);
  }
Пример #3
0
  public void setVisible(final boolean visible) {
    if (this.visible == visible) {
      return;
    }
    if (visible) { // if it is setted on visible true move it to the end
      if (order == 0) {
        order = columnModel.autoIncOrder();
      }
    } else { // if invisible is setting we have to remove a change order index of all other columns
      columnModel.autoDecOrder();
      for (DLColumnUnitModel unit : columnModel.getColumnModels()) {
        unit.autodecrementOrder(order);
      }
      order = 0;
    }

    this.visible = visible;
  }
Пример #4
0
  /**
   * Order starts at 1, 0 off - hidden
   *
   * @param order show order
   */
  public void setOrder(final Integer order) {
    // move all columns which are behind me
    for (DLColumnUnitModel unit : columnModel.getColumnModels()) {
      unit.autodecrementOrder(this.order);
    }

    if (order > 0) { // if it is moving or inserting
      // move all which will be behind me
      for (DLColumnUnitModel unit : columnModel.getColumnModels()) {
        unit.autoincrementOrder(order);
      }

      // if it wasn't shown show it
      if (this.order == 0) {
        columnModel.autoIncOrder();
        visible = true;
      }
    } else {
      visible = false;
      columnModel.autoDecOrder();
    }

    this.order = order;
  }
Пример #5
0
 public FilterComponentFactory getFilterComponentFactory() {
   if (filterComponentFactory == null) {
     // Is the default configuration known for this type?
     if (columnType != null
         && FilterDatatypeConfig.DEFAULT_CONFIGURATION.containsKey(columnType)) {
       return FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(columnType);
     } else if (columnModel.getMaster().getFilterModel().isWysiwyg()) {
       return FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(String.class);
     } else {
       throw new UnsupportedOperationException(
           "Unknown datatype was used in listbox filter for column '"
               + column
               + "'. For type "
               + (columnType == null ? "unknown" : columnType.getCanonicalName())
               + " have to be defined special filter component.");
     }
   } else {
     return filterComponentFactory;
   }
 }
Пример #6
0
 public List<DLFilterOperator> getFilterOperators() {
   if (filterOperators == null) { // No
     LOGGER.debug(
         "Get operators for type: '{}'.",
         (getColumnType() == null ? "null" : getColumnType().getCanonicalName()));
     if (columnType == null && column == null) { // empty model
       filterOperators = Collections.emptyList();
     } else if (columnType == null) { // Is this type defined? know name but known type
       filterOperators = Collections.singletonList(DLFilterOperator.EQUAL);
     } else if (FilterDatatypeConfig.DEFAULT_CONFIGURATION.containsKey(
         columnType)) { // Is the default configuration known for this type?
       filterOperators = FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(columnType).getOperators();
     } else if (columnModel.getMaster().getFilterModel().isWysiwyg()) {
       return FilterDatatypeConfig.DEFAULT_CONFIGURATION.get(String.class).getOperators();
     } else {
       throw new UnsupportedOperationException(
           "Unknown datatype was used in listbox filter. For type "
               + columnType.getCanonicalName()
               + " have to be defined special filter component.");
     }
     LOGGER.debug("Operator list: '{}'.", filterOperators.size());
   }
   return filterOperators;
 }
Пример #7
0
 public DLColumnUnitModel(final DLColumnModel columnModel) {
   this.columnModel = columnModel;
   this.order = columnModel.autoIncOrder();
 }