All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.fhframework.model.forms.ColumnPaged Maven / Gradle / Ivy

There is a newer version: 4.10.401
Show newest version
package pl.fhframework.model.forms;

import com.fasterxml.jackson.annotation.JsonIgnore;

import pl.fhframework.core.util.StringUtils;
import pl.fhframework.annotations.Control;
import pl.fhframework.annotations.DesignerXMLProperty;
import pl.fhframework.annotations.DocumentedComponentAttribute;
import pl.fhframework.annotations.XMLProperty;

import lombok.Getter;
import lombok.Setter;
import pl.fhframework.model.dto.ElementChanges;

@Control(parents = {TablePaged.class, ColumnPaged.class})
public class ColumnPaged extends Column {

    @Getter
    @Setter
    private boolean sortable = false;

    @JsonIgnore
    @Getter
    @Setter
    @DocumentedComponentAttribute(value = "Property name passed in the Pageable object to be interpreted in a data source (eg. DAO)")
    @XMLProperty
    @DesignerXMLProperty(commonUse = true)
    private String sortBy;

    public ColumnPaged(Form form) {
        super(form);
    }

    public void init() {
        super.init();
        sortable = !StringUtils.isNullOrEmpty(sortBy) && !isSubColumnsExists();
    }

    @Override
    public ElementChanges updateView() {
        ElementChanges elementChanges = super.updateView();

        boolean sortable = sortBy != null && !sortBy.isEmpty();

        if (!areValuesTheSame(this.sortable, sortable)) {
            this.refreshView();
            this.sortable = sortable;
            elementChanges.addChange("sortable", this.sortable);
        }

        return elementChanges;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy