📄 headercell.java
字号:
* @param sortName name given to server for sorting this column */ public void setSortName(String sortName) { this.sortName = sortName; } /** * Gets the column title. * @return the column title. If no title is specified the capitalized bean property name is returned */ public String getTitle() { if (this.title != null) { return this.title; } else if (this.beanPropertyName != null) { return StringUtils.capitalize(this.beanPropertyName); } return TagConstants.EMPTY_STRING; } /** * Setter for the column title. * @param value - the column title */ public void setTitle(String value) { this.title = value; } /** * Returns the HtmlAttributeMap containg all the html attributes for the <strong>td </strong> tags. * @return HtmlAttributeMap with td attributes */ public HtmlAttributeMap getHtmlAttributes() { return this.htmlAttributes; } /** * Sets the HtmlAttributeMap containg all the html attributes for the <strong>td </strong> tags. * @param attributes HtmlAttributeMap */ public void setHtmlAttributes(HtmlAttributeMap attributes) { this.htmlAttributes = attributes; } /** * returns the HtmlAttributeMap containg all the html attributes for the <strong>th </strong> tag. * @return HtmlAttributeMap with th attributes */ public HtmlAttributeMap getHeaderAttributes() { return this.headerAttributes; } /** * Sets the HtmlAttributeMap containg all the html attributes for the <strong>th </strong> tag. * @param attributes HtmlAttributeMap */ public void setHeaderAttributes(HtmlAttributeMap attributes) { this.headerAttributes = attributes; } /** * Adds a css class to the html "class" attribute. * @param cssClass String */ public void addHeaderClass(String cssClass) { // null safe if (StringUtils.isBlank(cssClass)) { return; } // if headerAttributes has not been set, instantiates a new map if (headerAttributes == null) { headerAttributes = new HtmlAttributeMap(); } Object classAttributes = this.headerAttributes.get(TagConstants.ATTRIBUTE_CLASS); // handle multiple values if (classAttributes == null) { this.headerAttributes.put(TagConstants.ATTRIBUTE_CLASS, new MultipleHtmlAttribute(cssClass)); } else { ((MultipleHtmlAttribute) classAttributes).addAttributeValue(cssClass); } } /** * return the open tag for a column header (th). * @return String <th> tag with attributes */ public String getHeaderOpenTag() { return HtmlTagUtil.createOpenTagString(TagConstants.TAGNAME_COLUMN_HEADER, this.headerAttributes); } /** * return the closing tag for a cell (td). * @return String </td> */ public String getCloseTag() { return TagConstants.TAG_OPENCLOSING + TagConstants.TAGNAME_COLUMN + TagConstants.TAG_CLOSE; } /** * return the closing tag for a column header (th). * @return String </th> */ public String getHeaderCloseTag() { return TagConstants.TAG_OPENCLOSING + TagConstants.TAGNAME_COLUMN_HEADER + TagConstants.TAG_CLOSE; } /** * Setter for the href to be used for dinamic links in cells. * @param baseHref base href for links */ public void setHref(Href baseHref) { this.href = baseHref; } /** * Getter for the href to be used for dinamic links in cells. * @return Href base href for links */ public Href getHref() { return this.href; } /** * Setter for the name of the param to add to links. * @param name name of the param */ public void setParamName(String name) { this.paramName = name; } /** * Getter for the name of the param to add to links. * @return String name of the param */ public String getParamName() { return this.paramName; } /** * Setter for the name of the property to look up in bean to get the param value for links. * @param property name of the property to look up in bean to get the param value for links */ public void setParamProperty(String property) { this.paramProperty = property; } /** * Getter for the name of the property to look up in bean to get the param value for links. * @return String name of the property to look up in bean to get the param value for links */ public String getParamProperty() { return this.paramProperty; } /** * Getter for the name of the property in the bean which will be used for sorting. * @return String name of the property in the bean which will be used for sorting */ public String getSortProperty() { return this.sortPropertyName; } /** * Setter for the name of the property in the bean which will be used for sorting. * @param propertyName - name of the property in the bean which will be used for sorting */ public void setSortProperty(String propertyName) { this.sortPropertyName = propertyName; } /** * Sets the default sort order for this column * @return default order */ public SortOrderEnum getDefaultSortOrder() { return this.defaultSortOrder; } /** * Gets the default sort order for this column * @param order default order */ public void setDefaultSortOrder(SortOrderEnum order) { this.defaultSortOrder = order; } /** * @see java.lang.Object#toString() */ public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) // .append("columnNumber", this.columnNumber) //$NON-NLS-1$ .append("title", this.title) //$NON-NLS-1$ .append("beanPropertyName", this.beanPropertyName) //$NON-NLS-1$ .toString(); } /** * Set the column comparator. * @param columnComparator the value */ public void setComparator(Comparator columnComparator) { this.comparator = columnComparator; } /** * Get the comparator for sorting this column. * @return the comparator */ public Comparator getComparator() { return this.comparator; } /** * Will we be keeping a total for this column? * @return true if we are totaling */ public boolean isTotaled() { return totaled; } /** * Setter for totaled. * @param isTotaled the value */ public void setTotaled(boolean isTotaled) { this.totaled = isTotaled; } /** * Add the value of this parameter to the column total. The param will be converted to a number via a property * Converter. * @param value the value * @see Converter#convert(Class, Object) */ private void addToTotal(Object value) { if (value != null && value instanceof Number) { this.total = this.total + ((Number) value).doubleValue(); } } /** * Get the current total. * @return the current total. */ public double getTotal() { return this.total; } /** * Add a new cell to this column. * @param column the value */ public void addCell(Column column) { // Not actually going to hold a reference to the added cell - we just need access for the totals if (this.totaled) { try { Object val = column.getValue(false); addToTotal(val); } catch (ObjectLookupException e) { throw new RuntimeException(e); } catch (DecoratorException e) { throw new RuntimeException(e); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -