当前位置: 首页>>代码示例>>Java>>正文


Java UIForm类代码示例

本文整理汇总了Java中javax.faces.component.UIForm的典型用法代码示例。如果您正苦于以下问题:Java UIForm类的具体用法?Java UIForm怎么用?Java UIForm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UIForm类属于javax.faces.component包,在下文中一共展示了UIForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _getContainingForm

import javax.faces.component.UIForm; //导入依赖的package包/类
private UIComponent _getContainingForm(UIComponent component)
{
  UIComponent previous = component;
  UIComponent parent = component.getParent();

  while (parent != null)
  {
    if ((parent instanceof UIForm)
        || (parent instanceof UIXForm)
        || (parent instanceof UIXSubform))
      return parent;

    previous = parent;
    parent = parent.getParent();
  }
  return previous;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:18,代码来源:ResetActionListener.java

示例2: _modifyBasicHTMLRenderKit

import javax.faces.component.UIForm; //导入依赖的package包/类
private void _modifyBasicHTMLRenderKit()
{
  // We render UIForms with our own renderer
  addRenderer(UIForm.COMPONENT_FAMILY,
              "javax.faces.Form",
              new HtmlFormRenderer());
  // And we render UICommandLink with our own renderer
  addRenderer(UICommand.COMPONENT_FAMILY,
              "javax.faces.Link",
              new HtmlCommandLinkRenderer());
  // In jsf 1.1_02 the ri FormRenderer writes out script used by
  // h:commandButton. Since we override the RI FormRenderer, we also
  // need to override the commandButton renderer:
  addRenderer(UICommand.COMPONENT_FAMILY,
              "javax.faces.Button",
              new HtmlCommandButtonRenderer());
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:18,代码来源:CoreRenderKit.java

示例3: getFormId

import javax.faces.component.UIForm; //导入依赖的package包/类
/**
 *  Retrieves id of the form the component is contained in.
 *
 * @param context the faces context object
 * @param component UIComponent whose container form id is to be retuirned
 *
 * @return String id of the form if one exists in component's hierarchy,
 *                otherwise null
 */
public static String getFormId(
  FacesContext context,
  UIComponent  component)
{
  UIComponent form = null;
  while (component != null)
  {
    if ((component instanceof UIForm) ||
        (component instanceof UIXForm))
    {
      form = component;
      break;
    }

    component = component.getParent();
  }

  if (form == null)
    return null;

  return form.getClientId(context);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:32,代码来源:RenderUtils.java

示例4: visit

import javax.faces.component.UIForm; //导入依赖的package包/类
@Override
public VisitResult visit(final VisitContext context, final UIComponent target) {
	// if (!target.isRendered()) {
	// return VisitResult.REJECT;
	// }

	if (target instanceof UIInput) {
		this.inputs.add((UIInput) target);
	}
	if (target instanceof UIForm) {
		this.forms.add((UIForm) target);
	}

	if (target instanceof UICommand) {
		this.commands.add((UICommand) target);
	}
	if (target instanceof UIOutput) {
		this.outputs.add((UIOutput) target);
	}
	if (target instanceof UISubmenu) {
		this.subMenus.add((UISubmenu) target);
	}
	if (target instanceof Column) {
		this.columns.add((Column) target);
	}
	if (target instanceof DataTable) {
		this.tables.add((DataTable) target);
	}
	if (target instanceof UISelectItems) {
		this.selectItems.add((UISelectItems) target);
	}
	if (target instanceof PanelGrid) {
		this.panelGrids.add((PanelGrid) target);
	}
	return VisitResult.ACCEPT;
}
 
开发者ID:kiswanij,项目名称:jk-faces,代码行数:37,代码来源:UIFacesVisitor.java

示例5: getForm

import javax.faces.component.UIForm; //导入依赖的package包/类
public static UIForm getForm(UIComponent component) {
    UIComponent parent = component.getParent();
    while (parent != null) {
        if (parent instanceof UIForm) {
            break;
        }
        parent = parent.getParent();
    }

    UIForm form = (UIForm) parent;
    if (form != null) {
        return form;
    }

    return null;
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:17,代码来源:UIComponentResolver.java

示例6: encodeEnd

import javax.faces.component.UIForm; //导入依赖的package包/类
@Override
public void encodeEnd(final FacesContext context) throws IOException {
	if (!isRendered()) {
		return;
	}

	final UIComponent actionComponent = this.getParent();
	final String actionComponentId = actionComponent.getClientId(context);
	final UIForm form = getForm(actionComponent);

	if (form == null) {
		LOGGER.warning("AbstractKeyCodeAction does not have an ambient form. Form is required");
	} else {
		markForm(form, this.getClientId(context));

		final ResponseWriter responseWriter = context.getResponseWriter();
		writeActionScript(responseWriter, form, actionComponentId);
	}
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:20,代码来源:AbstractKeyCodeAction.java

示例7: encodeEnd

import javax.faces.component.UIForm; //导入依赖的package包/类
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
	ResponseWriter writer = context.getResponseWriter();

	UIForm stateholder = (UIForm) component.getChildren().get(0);
	stateholder.encodeAll(context);

	writer.endElement("div");

	Accordion accordion = (Accordion) component;
	WidgetBuilder builder = new WidgetBuilder(context, accordion)
		.init()
		.attr("dynamic", accordion.isDynamic())
		.attr("cache", accordion.isCache())
		.attr("multi", accordion.isMulti())
		.attr("collapsible", accordion.isCollapsible())
		.attr("autoOpen", accordion.isAutoOpen())
		.nativeAttr("onItemChange", accordion.getOnItemChange());

	addBehaviors(builder);

	builder.finish();
}
 
开发者ID:edvin,项目名称:tornadofaces,代码行数:23,代码来源:AccordionRenderer.java

示例8: getTitleComponent

import javax.faces.component.UIForm; //导入依赖的package包/类
/**
 * Return the UI Component to be displayed on the right of the panel title area
 * 
 * @return UIComponent
 */
public UIComponent getTitleComponent()
{
   UIComponent titleComponent = null;
   
   // attempt to find a component with the specified ID
   String facetsId = getFacetsId();
   if (facetsId != null)
   {
      UIForm parent = Utils.getParentForm(FacesContext.getCurrentInstance(), this);
      UIComponent facetsComponent = parent.findComponent(facetsId);
      if (facetsComponent != null)
      {
         // get the 'title' facet from the component
         titleComponent = facetsComponent.getFacet("title");
      }
   }
   
   return titleComponent;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:25,代码来源:UIPanel.java

示例9: generateFormSubmit

import javax.faces.component.UIForm; //导入依赖的package包/类
/**
 * Generate the JavaScript to submit the parent Form.
 * 
 * @param context       FacesContext
 * @param component     UIComponent to generate JavaScript for
 * 
 * @return JavaScript event code
 */
public static String generateFormSubmit(FacesContext context, UIComponent component)
{
   UIForm form = Utils.getParentForm(context, component);
   if (form == null)
   {
      throw new IllegalStateException("Must nest components inside UIForm to generate form submit!");
   }
   
   String formClientId = form.getClientId(context);
   
   StringBuilder buf = new StringBuilder(48);
   
   buf.append("document.forms['");
   buf.append(formClientId);
   buf.append("'].submit()");
   
   buf.append(";return false;");
   
   return buf.toString();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:29,代码来源:Utils.java

示例10: resolve

import javax.faces.component.UIForm; //导入依赖的package包/类
public List<UIComponent> resolve(UIComponent component, List<UIComponent> parentComponents, String currentId,
			String originalExpression, String[] parameters) {

		List<UIComponent> result = new ArrayList<UIComponent>();
//		for (UIComponent parent : parentComponents) {
			UIComponent c = component;

			while (c != null && c.getClass() != UIViewRoot.class) {
				if (UIForm.class.isAssignableFrom(c.getClass())) {
					result.add(c);
					break;
				}
				c = c.getParent();
			}
//		}
		if (result.size() > 0) {
			return result;
		}
		throw new FacesException("Invalid search expression - the component isn't inside a form " + originalExpression);

	}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:22,代码来源:FormExpressionResolver.java

示例11: generateErrorAndRequiredClassForLabels

import javax.faces.component.UIForm; //导入依赖的package包/类
/**
 * @deprecated Use
 *             {@link CoreRenderer#generateErrorAndRequiredClass(javax.faces.component.UIInput, javax.faces.context.ResponseWriter, java.lang.String, java.lang.String, java.lang.String, java.lang.String) }
 *             instead
 * 
 *             Renders the CSS pseudo classes for required fields and for the
 *             error levels.
 *
 * @param input
 * @param rw
 * @param clientId
 * @throws IOException
 */
@Deprecated
public void generateErrorAndRequiredClassForLabels(UIInput input, ResponseWriter rw, String clientId,
		String additionalClass) throws IOException {
	String styleClass = getErrorAndRequiredClass(input, clientId);
	if (null != additionalClass) {
		additionalClass = additionalClass.trim();
		if (additionalClass.trim().length() > 0) {
			styleClass += " " + additionalClass;
		}
	}
	UIForm currentForm = AJAXRenderer.getSurroundingForm((UIComponent) input, true);
	if (currentForm instanceof Form) {
		if (((Form) currentForm).isHorizontal()) {
			styleClass += " control-label";
		}
	}
	if (input instanceof IResponsiveLabel) {
		String responsiveLabelClass = Responsive.getResponsiveLabelClass((IResponsiveLabel) input);
		if (null != responsiveLabelClass) {
			styleClass += " " + responsiveLabelClass;
		}
	}

	rw.writeAttribute("class", styleClass, "class");
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:39,代码来源:CoreRenderer.java

示例12: assertComponentIsInsideForm

import javax.faces.component.UIForm; //导入依赖的package包/类
public static void assertComponentIsInsideForm(UIComponent component, String msg, boolean throwException) {
	if (!FacesContext.getCurrentInstance().isProjectStage(ProjectStage.Production)) {
		UIComponent c = component;
		while ((c != null) && (!(c instanceof UIForm))) {
			c = c.getParent();
		}
		if (!(c instanceof UIForm)) {
			System.out.println("Warning: The BootsFaces component " + component.getClass()
					+ " works better if put inside a form. These capabilities get lost if not put in a form:");
			if (throwException) {
				throw new FacesException(msg);
			} else {
				System.out.println(msg);
			}
		}
	}
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:18,代码来源:CoreRenderer.java

示例13: encodeFormSubmit

import javax.faces.component.UIForm; //导入依赖的package包/类
private static void encodeFormSubmit(UIComponent component, ResponseWriter rw, boolean evenWithoutParameters)
		throws IOException {
	String parameterList = "";
	List<UIComponent> children = component.getChildren();
	for (UIComponent parameter : children) {
		if (parameter instanceof UIParameter) {
			String value = String.valueOf(((UIParameter) parameter).getValue());
			String name = ((UIParameter) parameter).getName();
			if (null != value) {
				parameterList += ",'" + name + "':'" + value + "'";
			}
		}
	}
	if (evenWithoutParameters || parameterList.length() > 0) {
		UIForm currentForm = getSurroundingForm((UIComponent) component, false);
		parameterList = "'" + currentForm.getClientId() + "',{'" + component.getClientId() + "':'"
				+ component.getClientId() + "'" + parameterList + "}";
		rw.writeAttribute("onclick",
				encodeClick((UIComponent) component) + "BsF.submitForm(" + parameterList + ");return false;", null);
	}
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:22,代码来源:AJAXRenderer.java

示例14: addEventHandlingHiddenFieldsIfNotExists

import javax.faces.component.UIForm; //导入依赖的package包/类
public static void addEventHandlingHiddenFieldsIfNotExists(FacesContext context, UIComponent component) throws IOException {

        HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
        UIForm parentForm = findForm(component);
        String parentFormClientId = parentForm.getClientId(context);
        String eventSenderHiddenFieldFinalId = getEventSenderHiddenFieldId(parentFormClientId);
        String eventSenderHiddenFieldRenderedAttribute = getEventSenderHiddenFieldRenderedAttributeName(parentFormClientId);
        String eventArgumentHiddenFieldFinalId = getEventArgumentHiddenFieldId(parentFormClientId);
        String eventArgumentHiddenFieldRenderedAttribute = getEventArgumentHiddenFieldRenderedAttributeName(parentFormClientId);
        ResponseWriter writer = context.getResponseWriter();

        if (request.getAttribute(eventSenderHiddenFieldRenderedAttribute) == null) {
            renderEmptyHiddenField(eventSenderHiddenFieldFinalId, writer);
            request.setAttribute(eventSenderHiddenFieldRenderedAttribute, true);
        }

        if (request.getAttribute(eventArgumentHiddenFieldRenderedAttribute) == null) {
            renderEmptyHiddenField(eventArgumentHiddenFieldFinalId, writer);
            request.setAttribute(eventArgumentHiddenFieldRenderedAttribute, true);
        }
    }
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:22,代码来源:JsfRenderUtils.java

示例15: getSubmitJavaScriptWithArgument

import javax.faces.component.UIForm; //导入依赖的package包/类
public static String getSubmitJavaScriptWithArgument(FacesContext context, UIComponent component, String eventArgument) {
    UIForm parentForm = findForm(component);
    String parentFormClientId = parentForm.getClientId(context);
    String componentClientId = component.getClientId(context);
    String eventSenderHiddenFieldId = getEventSenderHiddenFieldId(parentFormClientId);
    String eventArgumentHiddenFieldId = getEventArgumentHiddenFieldId(parentFormClientId);

    StringBuilder onClickEvent = new StringBuilder();
    onClickEvent.append("document.forms['").append(parentFormClientId).append("'].elements['");
    onClickEvent.append(eventSenderHiddenFieldId).append("'].value='").append(componentClientId).append("';");

    onClickEvent.append("document.forms['").append(parentFormClientId).append("'].elements['");
    onClickEvent.append(eventArgumentHiddenFieldId).append("'].value='").append(eventArgument).append("';");

    onClickEvent.append("document.forms['").append(parentFormClientId).append("'].submit();");

    return onClickEvent.toString();
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:19,代码来源:JsfRenderUtils.java


注:本文中的javax.faces.component.UIForm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。