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


Java UIComponentBase类代码示例

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


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

示例1: getResolvedId

import javax.faces.component.UIComponentBase; //导入依赖的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

示例2: convertStringListToJoinedString

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
/**
 * @return a space joined string of given clientIds. If component is set all clientIds will be resolved to get full
 * qualified client id.
 */
private String convertStringListToJoinedString(final Collection<String> clientIds, final UIComponentBase component) {
    if (clientIds.isEmpty()) {
        return null;
    }

    StringJoiner joiner = StringJoiner.on(' ');

    for (String clientId : clientIds) {
        if (StringUtils.isNotEmpty(clientId)) {
            if (component != null) {
                joiner = joiner.join(getResolvedId(component, clientId));
            } else {
                joiner = joiner.join(clientId);
            }
        }
    }

    return joiner.toString();
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:24,代码来源:JsfAjaxRequest.java

示例3: saveState

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
public Object saveState(FacesContext context) {
    if (isTransient()) {
        return null;
    }

    if (iterationState != null) {
        return new Object[]{UIComponentBase.saveAttachedState(context, iterationState)};
    } else {
        return new Object[]{
                valid ? Boolean.TRUE : Boolean.FALSE,
                localValueSet ? Boolean.TRUE : Boolean.FALSE,
                submitted ? Boolean.TRUE : Boolean.FALSE,
                UIComponentBase.saveAttachedState(context, submittedValue),
                UIComponentBase.saveAttachedState(context, value)};
    }
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:17,代码来源:ChildStateHolder.java

示例4: restoreState

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
public void restoreState(FacesContext context, Object stateObject) {
    if (stateObject == null) {
        return;
    }

    final Object[] state = (Object[]) stateObject;

    if (state.length == 1) {
        iterationState = UIComponentBase.restoreAttachedState(context, state[0]);
    } else {
        valid = Boolean.TRUE.equals(state[0]);
        localValueSet = Boolean.TRUE.equals(state[1]);
        submitted = Boolean.TRUE.equals(state[2]);
        submittedValue = UIComponentBase.restoreAttachedState(context, state[3]);
        value = UIComponentBase.restoreAttachedState(context, state[4]);
    }
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:18,代码来源:ChildStateHolder.java

示例5: testRenderByComponentEvent

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
@Test
public void testRenderByComponentEvent() throws Exception {
    final Map<String, List<ClientBehavior>> behaviors = new HashMap<>();
    behaviors.put("click", Arrays.<ClientBehavior>asList(
            createAjaxBehavior(true, "disabled"),
            createAjaxBehavior(false, "@all"),
            createAjaxBehavior(false, "@none"),
            createAjaxBehavior(false, "@this"),
            createAjaxBehavior(false, "@form"),
            createAjaxBehavior(false, "enabled")));

    final UIComponentBase uiComponentMock = mock(UIComponentBase.class);
    when(uiComponentMock.getClientBehaviors()).thenReturn(behaviors);

    final JsfAjaxRequest requestBuilder = new JsfAjaxRequest("mySourceElement", false);

    assertThat(requestBuilder.setRender(uiComponentMock, "toggle").toString())
            .isEqualTo("jsf.ajax.request(mySourceElement);");
    assertThat(requestBuilder.setRender(uiComponentMock, "click").toString())
            .isEqualTo("jsf.ajax.request(mySourceElement, {render: '@all @none @this @form enabled'});");
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:22,代码来源:JsfAjaxRequestTest.java

示例6: findFirstActiveAjaxBehavior

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
public static AjaxBehavior findFirstActiveAjaxBehavior(final UIComponentBase component, final String eventName) {
    if (component != null) {
        final List<ClientBehavior> behaviors = component.getClientBehaviors().get(eventName);
        if (behaviors != null) {
            for (ClientBehavior behavior : behaviors) {
                if (behavior instanceof AjaxBehavior && !((AjaxBehavior) behavior).isDisabled()) {
                    return (AjaxBehavior) behavior;
                }
            }
        }
    }

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

示例7: createMustacheKeys

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
public static List<String> createMustacheKeys(FacesContext context, UIComponentBase component) throws IOException {
    final Set<String> mustacheKeys = new HashSet<>();
    mustacheKeys.addAll(createMustacheKeysFromTemplate(context, component, "template"));
    mustacheKeys.addAll(createMustacheKeysFromTemplate(context, component, "emptyEntryTemplate"));
    mustacheKeys.addAll(createMustacheKeysFromTemplate(context, component, "selectedEntryTemplate"));
    return new ArrayList<>(mustacheKeys);
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:8,代码来源:TrivialComponentsUtil.java

示例8: createMustacheKeysFromTemplate

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
private static List<String> createMustacheKeysFromTemplate(FacesContext context, UIComponentBase component, String facetKey) throws IOException {
    final UIComponent templateFacet = component.getFacet(facetKey);
    if (templateFacet != null) {
        final String encodedTemplate = StringHtmlEncoder.encodeComponentWithSurroundingDiv(context, templateFacet);
        return MustacheResolver.getMustacheKeysForTreeNode(encodedTemplate);
    } else {
        return Collections.emptyList();
    }
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:10,代码来源:TrivialComponentsUtil.java

示例9: JsfAjaxRequest

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
/**
 * Creates {@link JsfAjaxRequest} using given {@link AjaxBehavior} to set ajax parameters.
 * <p>
 * TODO maybe remove {@link AjaxBehavior} and find it by myself by using event string?
 */
public JsfAjaxRequest(final UIComponentBase component, AjaxBehavior ajaxBehavior, String event) {
    this(component.getClientId(), true);

    if (!ajaxBehavior.isDisabled()) {
        if (ajaxBehavior.getExecute() != null) {
            execute = convertStringListToJoinedString(ajaxBehavior.getExecute(), component);
        }
        if (ajaxBehavior.getRender() != null) {
            render = convertStringListToJoinedString(ajaxBehavior.getRender(), component);
        }
        if (ajaxBehavior.getOnevent() != null) {
            this.addOnEventHandler(ajaxBehavior.getOnevent());
        }
        if (ajaxBehavior.getOnerror() != null) {
            this.addOnErrorHandler(ajaxBehavior.getOnerror());
        }
        try {
            if (StringUtils.isNotEmpty(ajaxBehavior.getDelay())) {
                delay = ajaxBehavior.getDelay();
            }
            resetValues = ajaxBehavior.isResetValues();
        } catch (NoSuchMethodError e) {
            // do nothing. Delay and resetValues is supported by JSF 2.2.x
        }


        this.setEvent(event);
        this.setBehaviorEvent(event);
    }
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:36,代码来源:JsfAjaxRequest.java

示例10: createRerenderIds

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
public static List<String> createRerenderIds(final UIComponentBase component, final String eventName) {
    final List<String> idsToRender = new ArrayList<>();
    final Map<String, List<ClientBehavior>> behaviors = component.getClientBehaviors();
    final List<ClientBehavior> refreshBehaviors = behaviors.get(eventName);

    if (refreshBehaviors == null) {
        return new ArrayList<>();
        //throw new IllegalArgumentException("Ajax event '" + eventName + "' not found on component '" + component.getClientId() + "'.");
    }

    boolean enabledAjaxEventFound = false;

    if (!refreshBehaviors.isEmpty()) {
        for (ClientBehavior refreshBehavior : refreshBehaviors) {
            if (refreshBehavior instanceof AjaxBehavior) {
                final AjaxBehavior ajaxBehavior = (AjaxBehavior) refreshBehavior;

                if (!ajaxBehavior.isDisabled()) {
                    if (ajaxBehavior.getRender() != null && !ajaxBehavior.getRender().isEmpty()) {
                        for (String singleRender : ajaxBehavior.getRender()) {
                            idsToRender.add(getResolvedId(component, singleRender));
                        }
                    }

                    enabledAjaxEventFound = true;
                }
            }
        }
    }

    if (!enabledAjaxEventFound) {
        return new ArrayList<>();
        //throw new IllegalStateException("Ajax event '" + eventName + "' on component '" + component.getClientId() + "' is disabled.");
    }

    return idsToRender;
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:38,代码来源:JsfAjaxRequest.java

示例11: writeContent

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
private static void writeContent(List<String> row, StringListResponseWriter writer, FacesContext facesContext,
                                 int columnCount, UIComponent child) throws IOException {
    if (child instanceof HtmlCommandLink) {
        final HtmlOutputLabel label = new HtmlOutputLabel();
        label.setValue(((HtmlCommandLink) child).getValue());
        label.setRendered(child.isRendered());
        label.encodeBegin(facesContext);
        label.encodeEnd(facesContext);
    } else if (child instanceof HtmlGraphicImage) {
        writer.writeText("", "");
    //} else if (child instanceof UIInstructions) {
    //    child.encodeBegin(facesContext);
    //    child.encodeEnd(facesContext);
    //    postCleanUp(row, columnCount);
    } else if (child instanceof HtmlPanelGroup || child instanceof HtmlOutputLink) {
        final UIComponentBase uiComponent = (UIComponentBase) child;
        if (uiComponent.isRendered()) {
            for (UIComponent uiChildComponent : uiComponent.getChildren()) {
                writeContent(row, writer, facesContext, columnCount, uiChildComponent);
            }
        }
        postCleanUp(row, columnCount);
    } else {
        child.encodeBegin(facesContext);
        child.encodeEnd(facesContext);
    }
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:28,代码来源:TableExportELResolver.java

示例12: setUp

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    initMocks(this);

    clientBehaviorsMock = new HashMap<>();
    clientBehaviorsMock.put(existingButNotActiveEvent, notActiveBehaviors);
    clientBehaviorsMock.put(existingEvent, activeBehaviors);

    componentMock = new UIComponentBase() {

        @Override
        public Map<String, List<ClientBehavior>> getClientBehaviors() {
            return clientBehaviorsMock;
        }

        @Override
        public String getFamily() {
            return null;
        }
    };

    final AjaxBehavior disabledBehavior = new AjaxBehavior();
    disabledBehavior.setDisabled(true);
    notActiveBehaviors.add(disabledBehavior);

    activeBehaviors.add(new AjaxBehavior());
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:28,代码来源:ClientBehaviorResolverTest.java

示例13: getCompareSkips_UIComponent

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
/**
 * The methods skipped when comparing that all properties are the same in
 * the restored UIComponent tree.
 */
public static Object[][] getCompareSkips_UIComponent(){
	Object[][] skips = new Object[][]{
			// {String methodName, Class nullOrObjectInstanceofClass, boolean skipWasUsed}
			{"getParent", UIComponentBase.class, false},
			{"getFacetsAndChildren", UIComponentBase.class, false},
			{"getAttributes", UIComponentBase.class, false},
	};
	return skips;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:14,代码来源:BaseRegisteredSerializationTest.java

示例14: resolveActiveAjaxBehavior

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
/**
 * @deprecated use {@link ClientBehaviorResolver#findFirstActiveAjaxBehavior(UIComponentBase, String)} instead
 */
@Deprecated
public static AjaxBehavior resolveActiveAjaxBehavior(final UIComponentBase component, final String event) {
    return findAjaxBehavior(component.getClientBehaviors(), event);
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:8,代码来源:ClientBehaviorResolver.java

示例15: setRender

import javax.faces.component.UIComponentBase; //导入依赖的package包/类
public JsfAjaxRequest setRender(final UIComponentBase component, final String eventName) {
    this.render = StringJoiner.on(' ').join(createRerenderIds(component, eventName)).toString();
    return this;
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:5,代码来源:JsfAjaxRequest.java


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