本文整理汇总了Java中javax.faces.component.UIData类的典型用法代码示例。如果您正苦于以下问题:Java UIData类的具体用法?Java UIData怎么用?Java UIData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UIData类属于javax.faces.component包,在下文中一共展示了UIData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectRowFromEvent
import javax.faces.component.UIData; //导入依赖的package包/类
/**
* Method that obtains the selected row from a UIComponent. It can check super class
*
* @param anEvent
*/
protected Object selectRowFromEvent(UIComponent tmpComponent, Class<?> clazz, boolean checkSuper) {
Object tmpRowData = null;
if(tmpComponent != null){
while (null != tmpComponent && !(tmpComponent instanceof UIData))
tmpComponent = tmpComponent.getParent();
if (tmpComponent != null && (tmpComponent instanceof UIData)) {
tmpRowData = ((UIData)tmpComponent).getRowData();
boolean checked = clazz.isAssignableFrom(tmpRowData.getClass());
if(!checked && checkSuper){
checked = clazz.isInstance(tmpRowData);
}
if(!checked){
setErrorMessage("Casting from event error:", "Error de casting para el objeto fila: se esperaba [" + clazz.toString() + "] y es [" + tmpRowData.getClass().toString() + "]");
tmpRowData = null;
}
}
}
return tmpRowData;
}
示例2: setProperties
import javax.faces.component.UIData; //导入依赖的package包/类
/**
* @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
*/
protected void setProperties(UIComponent component)
{
super.setProperties(component);
FacesContext context = getFacesContext();
if (value != null)
{
ValueBinding vb = context.getApplication().createValueBinding(value);
component.setValueBinding("value", vb);
}
if (var != null)
{
((UIData) component).setVar(var);
}
}
示例3: encodeBegin
import javax.faces.component.UIData; //导入依赖的package包/类
/**
* @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
public void encodeBegin(FacesContext context, UIComponent component)
throws IOException
{
String jsLibraryUrl = "../js";
ResponseWriter writer = context.getResponseWriter();
writer.write("<script type=\"text/javascript\">var _editor_url = \""
+ jsLibraryUrl + "/\";</script>\n");
writer.write("<script type=\"text/javascript\" src=\"" + jsLibraryUrl
+ "/divTree.js\"></script>\n");
writer
.write("<link href=\"../css/divTree.css\" type=\"text/css\" rel=\"stylesheet\">");
UIData data = (UIData) component;
Object value = data.getValue();
Set categories = (Set) value;
encodeRecursive(writer, categories);
}
示例4: encodeEnd
import javax.faces.component.UIData; //导入依赖的package包/类
public void encodeEnd(FacesContext context, UIComponent component)
throws IOException {
if ((context == null) || (component == null)) {
return;
}
if (!component.isRendered()) {
return;
}
UIData data = (UIData) component;
data.setRowIndex(-1);
ResponseWriter writer = context.getResponseWriter();
// Render the ending of this table
writer.endElement("table");
writer.writeText("\n", null);
}
示例5: getRowClasses
import javax.faces.component.UIData; //导入依赖的package包/类
/**
* <p>Return an array of stylesheet classes to be applied to
* each row in the table, in the order specified. Every row may or
* may not have a stylesheet.</p>
*
* @param data {@link UIData} component being rendered
*/
private String[] getRowClasses(UIData data) {
String values = (String) data.getAttributes().get("rowClasses");
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 = "";
}
}
String results[] = new String[list.size()];
return ((String[]) list.toArray(results));
}
示例6: encodeEnd
import javax.faces.component.UIData; //导入依赖的package包/类
public void encodeEnd(FacesContext context, UIComponent component)
throws IOException {
if ((context == null) || (component == null)) {
return;
}
if (!component.isRendered()) {
return;
}
UIData data = (UIData) component;
data.setRowIndex(-1);
ResponseWriter writer = context.getResponseWriter();
// Render the ending of this table
writer.endElement("div");
writer.writeText("\n", null);
}
示例7: getColumnClasses
import javax.faces.component.UIData; //导入依赖的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
* stylesheet.
* </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 = "";
}
}
String results[] = new String[list.size()];
return ((String[]) list.toArray(results));
}
示例8: getRowClasses
import javax.faces.component.UIData; //导入依赖的package包/类
/**
* <p>
* Return an array of stylesheet classes to be applied to each row in the
* table, in the order specified. Every row may or may not have a
* stylesheet.
* </p>
*
* @param data
* {@link UIData}component being rendered
*/
private String[] getRowClasses(UIData data) {
String values = (String) data.getAttributes().get("rowClasses");
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 = "";
}
}
String results[] = new String[list.size()];
return ((String[]) list.toArray(results));
}
示例9: encodeEnd
import javax.faces.component.UIData; //导入依赖的package包/类
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if ((context == null) || (component == null)) {
throw new NullPointerException(Util.getExceptionMessageString(Util.NULL_PARAMETERS_ERROR_MESSAGE_ID));
}
if (!component.isRendered()) {
if (log.isTraceEnabled()) {
log.trace("No encoding necessary " + component.getId() + " since " + "rendered attribute is set to false ");
}
return;
}
UIData data = (UIData) component;
data.setRowIndex(-1);
ResponseWriter writer = context.getResponseWriter();
// Render the ending of this table
writer.endElement("table");
writer.writeText("\n", null);
if (log.isTraceEnabled()) {
log.trace("End encoding component " + component.getId());
}
}
示例10: organizeTheKids
import javax.faces.component.UIData; //导入依赖的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;
}
示例11: getColumnClasses
import javax.faces.component.UIData; //导入依赖的package包/类
/**
* 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 stylesheet.
*
* @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<String> list = new ArrayList<String>();
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 = "";
}
}
String results[] = new String[list.size()];
return ((String[]) list.toArray(results));
}
示例12: getRowClasses
import javax.faces.component.UIData; //导入依赖的package包/类
/**
* Return an array of stylesheet classes to be applied to each row in the table, in the order specified. Every row may or may not have a stylesheet.
*
* @param data
* {@link UIData} component being rendered
*/
private String[] getRowClasses(UIData data) {
String values = (String) data.getAttributes().get("rowClasses");
if (values == null) {
return (new String[0]);
}
values = values.trim();
ArrayList<String> list = new ArrayList<String>();
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 = "";
}
}
String results[] = new String[list.size()];
return ((String[]) list.toArray(results));
}
示例13: viewPatient
import javax.faces.component.UIData; //导入依赖的package包/类
/**
* This is the drill down method to view the details of a patient.
* It looks at the current selection in the patient table and then
* brings up the page to show the studies for that patient. The
* return value is the page to go to (action).
*/
public void viewPatient(ActionEvent e) throws Exception {
//have to go this route because cant figure out a way
//to do a component binding against a backing bean
//that is NOT enumerated in faces-config.xml - like this one and its siblings
UIComponent commandLink = (UIComponent)e.getComponent();
UIData patientTable = JsfUtil.findNearestTable(commandLink);
try {
srb.viewPatient((PatientResultWrapper)patientTable.getRowData());
}
catch(Exception ex) {
MessageUtil.addErrorMessage("MAINbody:dataForm:tableOfPatientResultTables",
"drillDownRequestFailure",
null );
viewPatientException = ex;
}
}
示例14: renderBeginningOfRow
import javax.faces.component.UIData; //导入依赖的package包/类
/**
* The return value is the iteration/count for row CSS classes.
*/
private static int renderBeginningOfRow(ResponseWriter writer,
UIData data,
String[] rowClasses,
int rowStyles,
int rowStyle) throws IOException {
writer.startElement("tr", data);
if (rowStyles > 0) {
writer.writeAttribute("class",
rowClasses[rowStyle++],
"rowClasses");
if (rowStyle >= rowStyles) {
rowStyle = 0;
}
}
writer.writeText("\n", null);
return rowStyle;
}
示例15: testUIDataFooterFacet
import javax.faces.component.UIData; //导入依赖的package包/类
public void testUIDataFooterFacet()
{
UIViewRoot root = facesContext.getViewRoot();
root.setId("root");
UIForm form = new UIForm(); form.setId("form");
UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
UIData table = new UIData(); table.setId("table1");
UIInput input = new UIInput(); input.setId("input1");
// build the Tree...
table.setFooter(input);
nc3.getChildren().add(table);
nc2.getChildren().add(new UIOutput());
nc2.getChildren().add(new UIOutput());
nc2.getChildren().add(nc3);
nc1.getChildren().add(nc2);
form.getChildren().add(new UIOutput());
form.getChildren().add(new UIOutput());
form.getChildren().add(new UIOutput());
form.getChildren().add(nc1);
root.getChildren().add(new UIOutput());
root.getChildren().add(form);
// Get the ComponentReference util
ComponentReference<UIInput> uiRef = ComponentReference.newUIComponentReference(input);
// find the component...
UIInput referencedComp = uiRef.getComponent();
assertEquals(input, referencedComp);
}