本文整理汇总了Java中javax.faces.component.UIColumn类的典型用法代码示例。如果您正苦于以下问题:Java UIColumn类的具体用法?Java UIColumn怎么用?Java UIColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIColumn类属于javax.faces.component包,在下文中一共展示了UIColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: organizeTheKids
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* Processes the child {@link UIColumn} components that are nested in the data parameter and returns the data gleaned from the process as an object of RenderData.
*
* @param data
* The component being rendered.
* @return Returns an instance of RenderData whose three components contain the following data:
* <ul>
* <li>uiColumns - After this function is executed, will contain only the rendered UIColumn components in data</li>
* <li>facetCountHeaders - After this function is executed, will contain only the number of "header" facets in data</li>
* <li>facetCountFooters - After this fucntion is executed, will contain only the number of "footer" facets in data</li>
* </ul>
*/
private RenderData organizeTheKids(UIData data) {
RenderData returnVal = new RenderData();
returnVal.uiColumns = new ArrayList<UIColumn>();
returnVal.facetCountHeaders = 0;
returnVal.facetCountFooters = 0;
Iterator kids = data.getChildren().iterator();
while (kids.hasNext()) {
UIComponent kid = (UIComponent) kids.next();
if ((kid instanceof UIColumn) && kid.isRendered()) {
returnVal.uiColumns.add((UIColumn) kid);
if (getFacet(kid, "header") != null) returnVal.facetCountHeaders++;
if (getFacet(kid, "footer") != null) returnVal.facetCountFooters++;
}
}
return returnVal;
}
示例2: testRITable
import javax.faces.component.UIColumn; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testRITable() throws IOException
{
HtmlDataTable table = new HtmlDataTable();
ArrayList<Integer> l = new ArrayList<Integer>();
for (int i = 0 ; i < 10; i++)
l.add(new Integer(i));
table.setValue(l);
table.setStyleClass("TableContent");
table.setHeaderClass("af_column_header-text SomeBorderStyle");
table.setColumnClasses("af_column_cell-text OraTableBorder1111");
for (int i = 0 ; i < 3; i++)
{
UIColumn col = new UIColumn();
/*
HtmlOutputText header = new HtmlOutputText();
header.setValue("Header " + i);
col.setHeader(header);
//HtmlOutputText text = new HtmlOutputText();
HtmlInputText text = new HtmlInputText();
text.setValue("Column " + i);
col.getChildren().add(text);
*/
col.setHeader(new NullComp());
col.getChildren().add(new NullComp());
table.getChildren().add(col);
}
UIViewRoot root = createTestTree(table, "testRITable()", 500);
renderRoot(root);
}
示例3: buildCache
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* <p>Return an Iterator over the <code>UIColumn</code> children of the
* specified <code>UIData</code> that have a <code>rendered</code> property
* of <code>true</code>.</p>
*
* @param table the table from which to extract children
* @return the List of all UIColumn children
*/
private static List<HtmlColumn> buildCache(UIComponent table) {
if (table instanceof UIData) {
final int childCount = table.getChildCount();
if (childCount > 0) {
final List<HtmlColumn> results = new ArrayList<>(childCount);
for (UIComponent kid : table.getChildren()) {
if ((kid instanceof UIColumn) && kid.isRendered()) {
results.add((HtmlColumn) kid);
}
}
return results;
} else {
return Collections.emptyList();
}
} else {
int count;
final Object value = table.getAttributes().get("cachedColumns");
if ((value != null) && (value instanceof Integer)) {
count = ((Integer) value);
} else {
count = 2;
}
if (count < 1) {
count = 1;
}
final List<HtmlColumn> result = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
result.add(new HtmlColumn());
}
return result;
}
}
示例4: getColumns
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* <p>Return an Iterator over the <code>UIColumn</code> children
* of the specified <code>UIData</code> that have a
* <code>rendered</code> property of <code>true</code>.</p>
*
* @param data <code>UIData</code> for which to extract children
*/
private Iterator getColumns(UIData data) {
List results = new ArrayList();
Iterator kids = data.getChildren().iterator();
while (kids.hasNext()) {
UIComponent kid = (UIComponent) kids.next();
if ((kid instanceof UIColumn) && kid.isRendered()) {
results.add(kid);
}
}
return (results.iterator());
}
示例5: getColumnClasses
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* <p>Return an array of stylesheet classes to be applied to
* each column in the table in the order specified. Every column may or
* may not have a class.</p>
*
* @param data {@link UIData} component being rendered
*/
private String[] getColumnClasses(UIData data) {
String values = (String) data.getAttributes().get("columnClasses");
if (values == null) {
return (new String[0]);
}
values = values.trim();
ArrayList list = new ArrayList();
while (values.length() > 0) {
int comma = values.indexOf(",");
if (comma >= 0) {
list.add(values.substring(0, comma).trim());
values = values.substring(comma + 1);
} else {
list.add(values.trim());
values = "";
}
}
// now iterate through the columns and remove the class for any
// columns that aren't rendered
List columns = data.getChildren();
int listIndex = 0;
for (int i=0; i < columns.size(); i++) {
if (i >= list.size())
break;
UIComponent kid = (UIComponent) columns.get(i);
if ((kid instanceof UIColumn) && !kid.isRendered()) {
list.remove(listIndex);
} else {
listIndex++;
}
}
String results[] = new String[list.size()];
return ((String[]) list.toArray(results));
}
示例6: getHeaderClasses
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* <p>Return an array of stylesheet classes to be applied to
* each header in the table in the order specified. Every column may or
* may not have a class.</p>
*
* @param data {@link UIData} component being rendered
*/
private String[] getHeaderClasses(UIData data) {
String values = (String) data.getAttributes().get("headerClasses");
if (values == null) {
return (new String[0]);
}
values = values.trim();
ArrayList list = new ArrayList();
while (values.length() > 0) {
int comma = values.indexOf(",");
if (comma >= 0) {
list.add(values.substring(0, comma).trim());
values = values.substring(comma + 1);
} else {
list.add(values.trim());
values = "";
}
}
// now iterate through the columns and remove the class for any
// columns that aren't rendered
List columns = data.getChildren();
int listIndex = 0;
for (int i=0; i < columns.size(); i++) {
if (i >= list.size())
break;
UIComponent kid = (UIComponent) columns.get(i);
if ((kid instanceof UIColumn) && !kid.isRendered()) {
list.remove(listIndex);
} else {
listIndex++;
}
}
String results[] = new String[list.size()];
return ((String[]) list.toArray(results));
}
示例7: getColumns
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* <p>Return an Iterator over the <code>UIColumn</code> children
* of the specified <code>UIData</code> that have a
* <code>rendered</code> property of <code>true</code>.</p>
*
* @param data <code>UIData</code> for which to extract children
*/
private Iterator getColumns(UIData data) {
List results = new ArrayList();
Iterator kids = data.getChildren().iterator();
while (kids.hasNext()) {
UIComponent kid = (UIComponent) kids.next();
if ((kid instanceof UIColumn) && kid.isRendered()) {
results.add(kid);
}
}
return (results.iterator());
}
示例8: setRosterDataTable
import javax.faces.component.UIColumn; //导入依赖的package包/类
public void setRosterDataTable(HtmlDataTable rosterDataTable) {
Set usedCategories = getUsedCategories();
if (rosterDataTable.findComponent(CAT_COLUMN_PREFIX + "0") == null) {
Application app = FacesContext.getCurrentInstance().getApplication();
// Add columns for each category. Be sure to create unique IDs
// for all child components.
int colpos = 0;
for (Iterator iter = usedCategories.iterator(); iter.hasNext(); colpos++) {
String category = (String)iter.next();
String categoryName = getCategoryName(category);
UIColumn col = new UIColumn();
col.setId(CAT_COLUMN_PREFIX + colpos);
HtmlCommandSortHeader sortHeader = new HtmlCommandSortHeader();
sortHeader.setId(CAT_COLUMN_PREFIX + "sorthdr_" + colpos);
sortHeader.setRendererType("org.apache.myfaces.SortHeader");
sortHeader.setArrow(true);
sortHeader.setColumnName(category);
//sortHeader.setActionListener(app.createMethodBinding("#{rosterBean.sort}", new Class[] {ActionEvent.class}));
HtmlOutputText headerText = new HtmlOutputText();
headerText.setId(CAT_COLUMN_PREFIX + "hdr_" + colpos);
headerText.setValue(categoryName);
sortHeader.getChildren().add(headerText);
col.setHeader(sortHeader);
HtmlOutputText contents = new HtmlOutputText();
contents.setId(CAT_COLUMN_PREFIX + "cell_" + colpos);
contents.setValueBinding("value",
app.createValueBinding("#{enrollment.categoryToSectionMap['" + category + "'].title}"));
col.getChildren().add(contents);
rosterDataTable.getChildren().add(col);
}
}
}
示例9: getColumns
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* <p>
* Return an Iterator over the <code>UIColumn</code> children of the
* specified <code>UIData</code> that have a <code>rendered</code>
* property of <code>true</code>.
* </p>
*
* @param data
* <code>UIData</code> for which to extract children
*/
private Iterator getColumns(UIData data) {
List results = new ArrayList();
Iterator kids = data.getChildren().iterator();
while (kids.hasNext()) {
UIComponent kid = (UIComponent) kids.next();
if ((kid instanceof UIColumn) && kid.isRendered()) {
results.add(kid);
}
}
return (results.iterator());
}
示例10: encodeBegin
import javax.faces.component.UIColumn; //导入依赖的package包/类
public void encodeBegin(FacesContext context, UIComponent component) throws IOException
{
if(!component.isRendered()){
//tool_bar tag is not to be rendered, return now
return;
}
UIData data = (UIData) component;
//Begin Rendering
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", data);
writer.writeAttribute("id", "mainwrap", null);
writer.startElement("div", data);
writer.writeAttribute("id", "headers", null);
String colLock = (String) data.getAttributes().get("colLock");
if(colLock == null){
colLock = "1";
}
int columnLock = Integer.parseInt(colLock);
//Render Header Facets
UIComponent header = data.getFacet("header");
int headerFacets = getFacetCount(data, "header");
if(headerFacets > 0){
writer.startElement("ul", data);
writer.writeAttribute("id", "q1", null);
Iterator columns = getColumns(data);
int count = 0;
while (columns.hasNext()) {
UIColumn column = (UIColumn) columns.next();
if(count == columnLock){
writer.endElement("ul");
writer.startElement("div", data);
writer.writeAttribute("id", "q2", null);
writer.startElement("div", data);
writer.startElement("ul", data);
}
writer.startElement("li", data);
UIComponent facet = column.getFacet("header");
if (facet != null){
facet.encodeBegin(context);
facet.encodeChildren(context);
facet.encodeEnd(context);
//writer.writeText(facet.toString(), null);
}
writer.endElement("li");
count++;
}
if(count > Integer.parseInt(colLock)){
writer.endElement("ul");
writer.endElement("div");
writer.endElement("div");
writer.writeText("\n", null);
} else {
writer.endElement("ul");
writer.writeText("\n", null);
}
}
writer.endElement("div"); //end <div id="headers">
writer.writeText("\n", null);
}
示例11: renderData
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* Core workhouse method of the dynamic renderers.
* @param context FacesContext
* @param component UIComponent
* @throws IOException
*/
protected void renderData(FacesContext context, UIComponent component) throws
IOException
{
boolean multiColumn = component instanceof MultiColumnComponent;
ResponseWriter writer = context.getResponseWriter();
UIData data = (UIData) component;
int first = data.getFirst();
int rows = data.getRows();
for (int i = first, n = 0; n < rows; i++, n++)
{
data.setRowIndex(i);
if (!data.isRowAvailable())
{
break;
}
////////////////////////////////////
// TR
////////////////////////////////////
writer.startElement("tr", data);
Iterator iter = data.getChildren().iterator();
while (iter.hasNext())
{
UIComponent child = (UIComponent) iter.next();
if (child instanceof UIColumn)
{
writer.startElement("td", child);
writer.write("debug UIColumn");
RendererUtil.encodeRecursive(context, child);
writer.endElement("td");
}
else if (child instanceof UIData)
{
writer.write("debug UIData");
child.encodeBegin(context);
child.encodeChildren(context);
child.encodeEnd(context);
}
}
////////////////////////////////////
// /TR
////////////////////////////////////
writer.endElement("tr");
writer.write("\n");
}
}
示例12: encodeChildren
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* We put all our processing in the encodeChildren method
* @param context
* @param component
* @throws IOException
*/
public void encodeChildren(FacesContext context, UIComponent component)
throws IOException
{
if (!component.isRendered())
{
return;
}
String clientId = null;
if (component.getId() != null &&
!component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
{
clientId = component.getClientId(context);
}
ResponseWriter writer = context.getResponseWriter();
if (clientId != null)
{
writer.startElement("span", component);
writer.writeAttribute("id", clientId, "id");
}
UIData data = (UIData) component;
int first = data.getFirst();
int rows = data.getRows();
// this is a special separator attribute, not supported by UIData
String separator = (String) RendererUtil.getAttribute(context, component, "separator");
if (separator==null) separator=" | ";
for (int i = first, n = 0; n < rows; i++, n++)
{
data.setRowIndex(i);
if (!data.isRowAvailable())
{
break;
}
// between any two iterations add separator if there is one
if (i!=first) writer.write(separator);
Iterator iter = data.getChildren().iterator();
while (iter.hasNext())
{
UIComponent column = (UIComponent) iter.next();
if (!(column instanceof UIColumn))
{
continue;
}
RendererUtil.encodeRecursive(context, column);
}
}
if (clientId != null)
{
writer.endElement("span");
}
}
示例13: encodeChildren
import javax.faces.component.UIColumn; //导入依赖的package包/类
/**
* We put all our processing in the encodeChildren method
* @param context
* @param component
* @throws IOException
*/
public void encodeChildren(FacesContext context, UIComponent component)
throws IOException
{
if (!component.isRendered())
{
return;
}
String clientId = null;
if (component.getId() != null &&
!component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
{
clientId = component.getClientId(context);
}
ResponseWriter writer = context.getResponseWriter();
if (clientId != null)
{
writer.startElement("span", component);
writer.writeAttribute("id", clientId, "id");
}
UIData data = (UIData) component;
int first = data.getFirst();
int rows = data.getRows();
// this is a special separator attribute, not supported by UIData
String separator = (String) component.getAttributes().get("separator");
if (separator==null) separator="";
for (int i = first, n = 0; n < rows; i++, n++)
{
data.setRowIndex(i);
if (!data.isRowAvailable())
{
break;
}
// between any two iterations add separator if there is one
if (i!=first) writer.write(separator);
Iterator iter = data.getChildren().iterator();
while (iter.hasNext())
{
UIComponent column = (UIComponent) iter.next();
if (!(column instanceof UIColumn))
{
continue;
}
RendererUtil.encodeRecursive(context, column);
}
}
if (clientId != null)
{
writer.endElement("span");
}
}
示例14: getColName
import javax.faces.component.UIColumn; //导入依赖的package包/类
public UIColumn getColName() { return colName; }
示例15: setColName
import javax.faces.component.UIColumn; //导入依赖的package包/类
public void setColName(UIColumn uic) { colName = uic; }