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

panda.tool.codegen.bean.ListColumn Maven / Gradle / Ivy

package panda.tool.codegen.bean;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import panda.lang.Strings;

/**
 * 

* Java class for ListColumn complex type. *

* The following schema fragment specifies the expected content contained within this class. * *

 * <complexType name="ListColumn">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="format" type="{panda.tool.codegen}Format" minOccurs="0"/>
 *         <element name="filter" type="{panda.tool.codegen}Filter" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="cssClass" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="display" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="tooltip" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="label" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="link" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="group" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 *       <attribute name="filterable" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="sortable" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 *       <attribute name="hidden" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 *       <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 *       <attribute name="order" type="{http://www.w3.org/2001/XMLSchema}int" />
 *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
*/ @XmlAccessorType(XmlAccessType.NONE) @XmlType(name = "ListColumn") public class ListColumn implements Comparable { @XmlElement private Format format; @XmlElement private Filter filter; @XmlAttribute private String cssClass; @XmlAttribute private String display; @XmlAttribute private String tooltip; @XmlAttribute private String label; @XmlAttribute private String link; @XmlAttribute private Boolean group; @XmlAttribute private Boolean sortable; @XmlAttribute private String filterable; @XmlAttribute private Boolean hidden; @XmlAttribute private Boolean value; @XmlAttribute private Integer order; @XmlAttribute(required = true) private String name; /** * Constructor */ public ListColumn() { } /** * Constructor - copy properties from source * * @param lc source list column */ public ListColumn(ListColumn lc) { this.display = lc.display; this.tooltip = lc.tooltip; this.link = lc.link; this.cssClass = lc.cssClass; this.group = lc.group; this.sortable = lc.sortable; this.filterable = lc.filterable; this.hidden = lc.hidden; this.value = lc.value; this.order = lc.order; this.label = lc.label; this.name = lc.name; if (lc.format != null) { this.format = new Format(lc.format); } if (lc.filter != null) { this.filter = new Filter(lc.filter); } } /** * extend list column * * @param src source list column * @param parent extend list column * @return listcolumn */ public static ListColumn extend(ListColumn src, ListColumn parent) { ListColumn me = new ListColumn(parent); if (src.display != null) { me.display = src.display; } if (src.tooltip != null) { me.tooltip = src.tooltip; } if (src.link != null) { me.link = src.link; } if (src.cssClass != null) { me.cssClass = src.cssClass; } if (src.group != null) { me.group = src.group; } if (src.sortable != null) { me.sortable = src.sortable; } if (src.filterable != null) { me.filterable = src.filterable; } if (src.hidden != null) { me.hidden = src.hidden; } if (src.value != null) { me.value = src.value; } if (src.order != null) { me.order = src.order; } if (src.label != null) { me.label = src.label; } if (src.name != null) { me.name = src.name; } if (src.format != null) { me.format = "none".equalsIgnoreCase(src.format.getType()) ? null : new Format(src.format); } if (src.filter != null) { me.filter = "none".equalsIgnoreCase(src.filter.getType()) ? null : new Filter(src.filter); } return me; } /** * @return the format */ public Format getFormat() { return format; } /** * @param format the format to set */ public void setFormat(Format format) { this.format = format; } /** * @return the filter */ public Filter getFilter() { return filter; } /** * @param filter the filter to set */ public void setFilter(Filter filter) { this.filter = filter; } /** * @return the display */ public String getDisplay() { return display; } /** * @param display the display to set */ public void setDisplay(String display) { if (Strings.isNotEmpty(display) && !"true".equals(display) && !"false".equals(display)) { throw new IllegalArgumentException("Invalid display value: " + display); } this.display = display; } /** * @return the tooltip */ public String getTooltip() { return tooltip; } /** * @param tooltip the tooltip to set */ public void setTooltip(String tooltip) { this.tooltip = tooltip; } /** * @return the label */ public String getLabel() { return label; } /** * @param label the label to set */ public void setLabel(String label) { this.label = label; } /** * @return the link */ public String getLink() { return link; } /** * @param link the link to set */ public void setLink(String link) { this.link = link; } /** * @return the cssClass */ public String getCssClass() { return cssClass; } /** * @param cssClass the cssClass to set */ public void setCssClass(String cssClass) { this.cssClass = cssClass; } /** * @return the group */ public Boolean getGroup() { return group; } /** * @param group the group to set */ public void setGroup(Boolean group) { this.group = group; } /** * @return the sortable */ public Boolean getSortable() { return sortable; } /** * @param sortable the sortable to set */ public void setSortable(Boolean sortable) { this.sortable = sortable; } /** * @return the filterable */ public String getFilterable() { return filterable; } /** * @param filterable the filterable to set */ public void setFilterable(String filterable) { if (Strings.isNotEmpty(filterable) && !"true".equals(filterable) && !"false".equals(filterable)) { throw new IllegalArgumentException("Invalid filterable value: " + filterable); } this.filterable = filterable; } /** * @return the hidden */ public Boolean getHidden() { return hidden; } /** * @param hidden the hidden to set */ public void setHidden(Boolean hidden) { this.hidden = hidden; } /** * @return the value */ public Boolean getValue() { return value; } /** * @param value the value to set */ public void setValue(Boolean value) { this.value = value; } /** * @return the order */ public Integer getOrder() { return order; } /** * @param order the order to set */ public void setOrder(Integer order) { this.order = order; } public boolean isVirtualColumn() { return Strings.isEmpty(name) || !Character.isLetter(name.charAt(0)); } /** * @return the name */ public String getName() { return name; } /** * Gets the value of the uname property. * * @return possible object is {@link String } */ public String getUname() { return EntityProperty.upname(name); } /** * @param name the name to set */ public void setName(String name) { this.name = name; } protected int compareByName(ListColumn o) { int i = this.name.compareTo(o.name); return i == 0 ? this.hashCode() - o.hashCode() : i; } /** * @param o compare target * @return -1/0/1 */ public int compareTo(ListColumn o) { if (this == o) { return 0; } if (this.order == null && o.order == null) { return compareByName(o); } if (this.order == null) { return -1; } if (o.order == null) { return 1; } int i = this.order.compareTo(o.order); return i == 0 ? compareByName(o) : i; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy