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

com.viaoa.web.html.HtmlCol Maven / Gradle / Ivy

package com.viaoa.web.html;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.viaoa.util.OAConv;
import com.viaoa.util.OAStr;
import com.viaoa.web.util.OAWebUtil;

/*

limited selection of CSS properties 
    https://www.w3schools.com/html/html_table_colgroup.asp



...

*/

/**
 * Control and Html colgroup Col element.
 * 

* This needs to have style "table-layout: fixed;" in table. *

* Notes:
* * Styles are limited to: width, visibility, background, border *
* hide column using the visibility: collapse * * * * * @author vince */ public class HtmlCol extends HtmlElement { protected int span; public HtmlCol() { this(null); } public HtmlCol(String id) { super(id); } public int getSpan() { return span; } public void setSpan(int span) { this.span = span; } protected String createHtml() { final StringBuilder sb = new StringBuilder(); sb.append(" al = getStyles(); if (al != null && al.size() > 0) { sb.append(" style='"); b = true; for (String s : al) { sb.append(s + ": " + OAWebUtil.createJsString(getStyle(s), '\'') + ";"); } } if (OAStr.isNotEmpty(getWidth())) { if (!b) sb.append(" style='"); sb.append("width:"+getWidth()+";"); b = true; } if (!getVisible()) { if (!b) sb.append(" style='"); b = true; sb.append("visibility:collapse;"); } if (b) sb.append("'"); int x = getSpan(); if (x > 0) sb.append(" span="+x); sb.append(">"); return sb.toString(); } private static Set hsSupported = new HashSet(); // lowercase static { // hsSupported.add("width"); } public boolean isSupported(String name) { if (name == null) return false; return super.isSupported(name) || hsSupported.contains(name.toLowerCase()); } }









MON TUE WED THU