本文整理汇总了Java中javax.faces.component.UINamingContainer类的典型用法代码示例。如果您正苦于以下问题:Java UINamingContainer类的具体用法?Java UINamingContainer怎么用?Java UINamingContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UINamingContainer类属于javax.faces.component包,在下文中一共展示了UINamingContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getViewStateId
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public static String getViewStateId(FacesContext facesContext)
{
if (JsfUtils.IS_JSF_2_2) {
Integer count = (Integer) facesContext.getAttributes().get(VIEW_STATE_COUNTER);
if (count == null)
{
count = 0;
}
count += 1;
String id = facesContext.getViewRoot().getContainerClientId(facesContext)
+ UINamingContainer.SEPARATOR_CHAR + ResponseStateManager.VIEW_STATE_PARAM + UINamingContainer.SEPARATOR_CHAR + count;
facesContext.getAttributes().put(VIEW_STATE_COUNTER, count);
return id;
}
else
{
return ResponseStateManager.VIEW_STATE_PARAM;
}
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:StateUtils.java
示例2: isFlattenableCoreComponent
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
/**
* Determine if we can flatten a core JSF component.
* @param component The component
* @return true if the component is a core JSF component and we can
* flatten it successfully.
*/
private static boolean isFlattenableCoreComponent(UIComponent component)
{
// Optimize the cases of UINamingContainer (<f:subview>) and UIPanel -
// we will treat these components as FlattenedComponents because they do not render
// any DOM.
// Also note that as of JSF 2.0, UINamingContainer components are built
// by f:subview, as well as composite components.
Class<? extends UIComponent> componentClass = component.getClass();
if (UINamingContainer.class == componentClass)
{
// Check to see if this component was created as a composite
// component, which we cannot flatten
return component.getFacet(UIComponent.COMPOSITE_FACET_NAME) == null;
}
// Note that JSF 2.0 creates UIPanel wrappers around multiple components
// inside of <f:facet>
return UIPanel.class == componentClass;
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:27,代码来源:UIXComponent.java
示例3: testNamingContainerViewRoot
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void testNamingContainerViewRoot()
{
UIViewRoot root = facesContext.getViewRoot();
root.setId("root");
UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
// build the tree
root.getChildren().add(nc1);
nc1.getChildren().add(nc2);
nc2.getChildren().add(nc3);
// Get the ComponentReference util
ComponentReference<UINamingContainer> uiRef = ComponentReference.newUIComponentReference(nc3);
// find the component...
UINamingContainer referencedComp = uiRef.getComponent();
assertEquals(nc3, referencedComp);
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:ComponentReferenceTest.java
示例4: testComponentNotInTree
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void testComponentNotInTree()
{
UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
// build the tree
nc1.getChildren().add(nc2);
nc2.getChildren().add(nc3);
// Get the ComponentReference util
ComponentReference ref = ComponentReference.newUIComponentReference(nc3);
try
{
// find the component...
ref.getComponent();
fail("IllegalStateException expected");
}
catch (IllegalStateException e)
{
// suppress it - this is as expected
}
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:26,代码来源:ComponentReferenceTest.java
示例5: processAction
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void processAction(ActionEvent actionEvent) {
FacesContext context = FacesContext.getCurrentInstance();
UINamingContainer loginComponent
= (UINamingContainer)context.getAttributes().get(UIComponent.CURRENT_COMPOSITE_COMPONENT);
MethodExpression loginAction = (MethodExpression)loginComponent.getAttributes().get("cancelAction");
try {
loginAction.invoke(context.getELContext(), new Object[] {});
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Login-cancellation could not be fulfilled.", e);
} else {
LOG.info("Login-cancellation could not be fulfilled: " + e.getMessage());
}
}
NavigationHandler navigationHandler = context.getApplication().getNavigationHandler();
String outcome = (String)context.getExternalContext().getRequestParameterMap().get("outcome");
if (outcome != null) {
navigationHandler.handleNavigation(context, null, outcome);
}
}
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:21,代码来源:CancelActionListener.java
示例6: processAction
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void processAction(ActionEvent actionEvent) {
FacesContext context = FacesContext.getCurrentInstance();
UINamingContainer loginComponent
= (UINamingContainer)context.getAttributes().get(UIComponent.CURRENT_COMPOSITE_COMPONENT);
UIInput username = (UIInput)loginComponent.findComponent("loginDialog:loginForm:username");
UIInput password = (UIInput)loginComponent.findComponent("loginDialog:loginForm:password");
MethodExpression loginAction = (MethodExpression)loginComponent.getAttributes().get("loginAction");
try {
loginAction.invoke(context.getELContext(), new Object[] {username.getValue(), password.getValue()});
NavigationHandler navigationHandler = context.getApplication().getNavigationHandler();
String outcome = (String)context.getExternalContext().getRequestParameterMap().get("outcome");
if (outcome != null) {
navigationHandler.handleNavigation(context, null, outcome);
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Login could not be established.", e);
} else {
LOG.info("Login could not be established: " + e.getMessage());
}
}
}
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:23,代码来源:LoginActionListener.java
示例7: getEndTextToRender
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
@Override
protected void getEndTextToRender(FacesContext context, UIComponent component, String currentValue) throws IOException {
final ResponseWriter writer = context.getResponseWriter();
if (component instanceof HtmlRadioBox) {
final HtmlRadioBox radioBox = (HtmlRadioBox) component;
final String radioBoxClientId = radioBox.getClientId();
final char separatorChar = UINamingContainer.getSeparatorChar(FacesContext.getCurrentInstance());
if (radioBox.getValues() instanceof Iterable) {
int iterator = 0;
for (java.lang.Object o : (Iterable) radioBox.getValues()) {
renderRadioBoxItem(writer, radioBox, radioBoxClientId, separatorChar, iterator, o);
iterator++;
}
}
}
}
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:19,代码来源:RadioBoxRenderer.java
示例8: encodeEnd
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
@Override
protected void encodeEnd(HtmlTreeBox treeBox, ResponseWriter writer) throws IOException {
if (!treeBox.isReadonly() || treeBox.getValue() != null) {
final TreeBoxModelWrapper treeBoxModelWrapper = new TreeBoxModelWrapper(treeBox);
final List<Node> nodes = treeBoxModelWrapper.getNodes();
final TreeBoxModelType treeBoxModelType = treeBoxModelWrapper.getTreeBoxModelType();
final List<String> mustacheKeys = createMustacheKeys(FacesContext.getCurrentInstance(), treeBox);
final String clientIdSeparator = String.valueOf(UINamingContainer.getSeparatorChar(FacesContext.getCurrentInstance()));
final Map<Integer, Node> nodesMap = CachedNodesInitializer.createNodesMap(nodes);
writer.startElement("script", treeBox);
writer.writeText("jQuery(function () {\n", null);
final String treeBoxReadableId = treeBox.getClientId().replace(clientIdSeparator, "_");
writer.writeText("var entries_" + treeBoxReadableId + " = " + new TrivialComponentsEntriesNodePartRenderer().renderEntriesAsJSON(nodes, replaceDotInMustacheKeys(mustacheKeys), nodesMap) + ";\n", null);
final String jQueryBySelector = RenderUtils.createJQueryBySelector(treeBox.getClientId(), "input");
final String pluginCall = replaceDotInMustacheKeys(mustacheKeys, createJQueryPluginCallTrivial(treeBox, treeBoxModelType, mustacheKeys, nodesMap));
writer.writeText("ButterFaces.TreeBox.removeTrivialTreeDropDown('" + treeBoxReadableId + "');\n", null);
writer.writeText("var trivialTree" + treeBoxReadableId + " = " + jQueryBySelector + pluginCall + "\n", null);
writer.writeText("$(trivialTree" + treeBoxReadableId + ".getDropDown()).attr('data-tree-box-id', '" + treeBoxReadableId + "')", null);
writer.writeText("});", null);
writer.endElement("script");
}
}
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:27,代码来源:TreeBoxRenderer.java
示例9: encodeEnd
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
@Override
protected void encodeEnd(HtmlTags htmlTags, ResponseWriter writer) throws IOException {
writer.startElement("script", htmlTags);
final String clientIdSeparator = String.valueOf(UINamingContainer.getSeparatorChar(FacesContext.getCurrentInstance()));
final String treeBoxReadableId = htmlTags.getClientId().replace(clientIdSeparator, "_");
final List<Node> entries = createEntries(htmlTags.getEntries());
writer.writeText("jQuery(function () {\n", null);
if (!entries.isEmpty()) {
final List<String> mustacheKeys = createMustacheKeys(FacesContext.getCurrentInstance(), htmlTags);
final Map<Integer, Node> nodesMap = CachedNodesInitializer.createNodesMap(entries);
writer.writeText("var entries_" + treeBoxReadableId + " = " + new TrivialComponentsEntriesNodePartRenderer().renderEntriesAsJSON(entries, replaceDotInMustacheKeys(mustacheKeys), nodesMap) + ";\n", null);
}
final String jQueryBySelector = RenderUtils.createJQueryBySelector(htmlTags.getClientId(), ".butter-input-component");
final String pluginCall = createJQueryPluginCallTrivial(htmlTags, entries.isEmpty() ? null : "entries_" + treeBoxReadableId);
writer.writeText("var trivialTags" + treeBoxReadableId + " = " + jQueryBySelector + pluginCall + "\n", null);
writer.writeText(RenderUtils.createJQueryBySelector(htmlTags.getClientId(), null) + "_butterTagsInit(); \n", null);
writer.writeText("});", null);
writer.endElement("script");
}
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:25,代码来源:TagsRenderer.java
示例10: getResolvedId
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
private static String getResolvedId(final UIComponentBase component, final String id) {
if (id.equals("@all") || id.equals("@none") || id.equals("@form") || id.equals("@this")) {
return id;
}
UIComponent resolvedComponent = component.findComponent(id);
if (resolvedComponent == null) {
final FacesContext context = FacesContext.getCurrentInstance();
if (context != null && id.charAt(0) == UINamingContainer.getSeparatorChar(context)) {
return id.substring(1);
}
return id;
}
return resolvedComponent.getClientId();
}
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:17,代码来源:JsfAjaxRequest.java
示例11: testEmptyViewRootOnGetComponent
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void testEmptyViewRootOnGetComponent()
{
UIViewRoot root = facesContext.getViewRoot();
root.setId("root");
UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
// build the tree
root.getChildren().add(nc1);
nc1.getChildren().add(nc2);
nc2.getChildren().add(nc3);
// Get the ComponentReference util
ComponentReference<UINamingContainer> uiRef = ComponentReference.newUIComponentReference(nc3);
// find the component...
UINamingContainer referencedComp = uiRef.getComponent();
assertEquals(nc3, referencedComp);
// clear the ViewRoot
root.getChildren().clear();
// now, the getComponent should return NULL
assertNull(uiRef.getComponent());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:28,代码来源:ComponentReferenceTest.java
示例12: testMovingInsideNamingContainer
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void testMovingInsideNamingContainer()
{
UIViewRoot root = facesContext.getViewRoot();
root.setId("root");
UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
// build the tree
root.getChildren().add(nc1);
nc1.getChildren().add(nc2);
nc2.getChildren().add(nc3);
// Get the ComponentReference util
ComponentReference<UINamingContainer> uiRef = ComponentReference.newUIComponentReference(nc3);
// find the component...
UINamingContainer referencedComp = uiRef.getComponent();
assertEquals(nc3, referencedComp);
// let's move the NC3 component one level up;
nc2.getChildren().remove(nc3);
nc1.getChildren().add(nc3);
// and we can not find the component...
referencedComp = uiRef.getComponent();
assertNull(referencedComp);
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:29,代码来源:ComponentReferenceTest.java
示例13: testDeferredMovingInsideNamingContainer
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void testDeferredMovingInsideNamingContainer()
{
UIViewRoot root = facesContext.getViewRoot();
root.setId("root");
UINamingContainer nc1 = new UINamingContainer(); nc1.setId("nc1");
UINamingContainer nc2 = new UINamingContainer(); nc2.setId("nc2");
UINamingContainer nc3 = new UINamingContainer(); nc3.setId("nc3");
// almost build the tree
nc1.getChildren().add(nc2);
nc2.getChildren().add(nc3);
// Get the ComponentReference util, this will be a deferred component reference since the
// component wasn't attached
ComponentReference<UINamingContainer> uiRef = ComponentReference.newUIComponentReference(nc3);
// now finish building the component tree
root.getChildren().add(nc1);
// find the component...
UINamingContainer referencedComp = uiRef.getComponent();
assertEquals(nc3, referencedComp);
// let's move the NC3 component one level up;
nc2.getChildren().remove(nc3);
nc1.getChildren().add(nc3);
// and we can not find the component...
referencedComp = uiRef.getComponent();
assertNull(referencedComp);
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:32,代码来源:ComponentReferenceTest.java
示例14: testCustomFacet
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void testCustomFacet()
{
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");
UIPanel panel = new UIPanel(); panel.setId("panel");
UIInput input = new UIInput(); input.setId("input1");
// build the Tree...
panel.getFacets().put("fancyFacet", input);
nc3.getChildren().add(panel);
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);
// find it again!
assertEquals(input, uiRef.getComponent());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:36,代码来源:ComponentReferenceTest.java
示例15: testCustomFacetWithFind
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void testCustomFacetWithFind()
{
UIViewRoot root = new UIViewRoot();
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");
UIPanel panel = new UIPanel(); panel.setId("panel");
UIInput input = new UIInput(); input.setId("input1");
// build the Tree...
panel.getFacets().put("fancyFacet", input);
panel.getChildren().add(input);
nc3.getChildren().add(panel);
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);
facesContext.setViewRoot(root);
// Get the ComponentReference util
ComponentReference<UIInput> uiRef = ComponentReference.newUIComponentReference(input);
// find the component...
UIInput referencedComp = uiRef.getComponent();
assertEquals(input, referencedComp);
// find it again!
assertEquals(input, uiRef.getComponent());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:40,代码来源:ComponentReferenceTest.java
示例16: testUIDataFooterFacet
import javax.faces.component.UINamingContainer; //导入依赖的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);
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:34,代码来源:ComponentReferenceTest.java
示例17: testIndex
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void testIndex()
{
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");
UIInput input1 = new UIInput(); input1.setId("input1");
// build the Tree...
nc3.getChildren().add(input1);
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(input1);
// find the component...
UIInput referencedComp = uiRef.getComponent();
assertEquals(input1, referencedComp);
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:32,代码来源:ComponentReferenceTest.java
示例18: resolveWidgetVar
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public String resolveWidgetVar() {
/* 92 */ FacesContext context = getFacesContext();
/* 93 */ String userWidgetVar = (String)getAttributes().get("widgetVar");
/* */
/* 95 */ if (userWidgetVar != null) {
/* 96 */ return userWidgetVar;
/* */ }
/* 98 */ return "widget_" + getClientId(context).replaceAll(new StringBuilder().append("-|").append(UINamingContainer.getSeparatorChar(context)).toString(), "_");
/* */ }
开发者ID:marlonalexis,项目名称:Multicentro_Mascotas,代码行数:10,代码来源:SentinelMenu.java
示例19: resolveWidgetVar
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
@Override
public String resolveWidgetVar() {
FacesContext context = FacesContext.getCurrentInstance();
String userWidgetVar = (String) getAttributes().get("widgetVar");
if (userWidgetVar != null)
return userWidgetVar;
else
return "widget_" + getClientId(context).replaceAll("-|" + UINamingContainer.getSeparatorChar(context), "_");
}
开发者ID:phoenixctms,项目名称:ctsms,代码行数:10,代码来源:TagCloud.java
示例20: processAction
import javax.faces.component.UINamingContainer; //导入依赖的package包/类
public void processAction(ActionEvent actionEvent) {
FacesContext context = FacesContext.getCurrentInstance();
UINamingContainer loginComponent
= (UINamingContainer)context.getAttributes().get(UIComponent.CURRENT_COMPOSITE_COMPONENT);
MethodExpression logoutAction = (MethodExpression)loginComponent.getAttributes().get("logoutAction");
try {
Object result = logoutAction.invoke(context.getELContext(), new Object[0]);
String outcome;
if (result != null) {
outcome = result.toString();
} else {
outcome = context.getViewRoot().getViewId() + "?faces-redirect=true&includeViewParams=true";
String query = (String)context.getExternalContext().getRequestParameterMap().get("query");
if (query != null && query.length() > 0) {
outcome = outcome + "&" + query;
}
}
NavigationHandler navigationHandler = context.getApplication().getNavigationHandler();
if (outcome != null) {
navigationHandler.handleNavigation(context, null, outcome);
}
Object session = context.getExternalContext().getSession(false);
if (session instanceof HttpSession) {
((HttpSession)session).invalidate();
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Logout failed.", e);
} else {
LOG.info("Logout failed: " + e.getMessage());
}
}
}
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:34,代码来源:LogoutActionListener.java
注:本文中的javax.faces.component.UINamingContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论