Package javax.faces.application

Examples of javax.faces.application.Application


        Map.Entry entry = (Map.Entry) o;
        LOG.debug("*** '" + entry.getKey() + "' -> '" + entry.getValue() + "'");
      }
    }

    Application application = facesContext.getApplication();
    ViewHandler viewHandler = application.getViewHandler();
    String viewId = facesContext.getViewRoot().getViewId();
    String formAction = viewHandler.getActionURL(facesContext, viewId);
    formAction = facesContext.getExternalContext().encodeActionURL(formAction);
    String contentType = writer.getContentTypeWithCharSet();
    ResponseUtils.ensureContentTypeHeader(facesContext, contentType);
View Full Code Here


        if (facesContext == null) {
            throw new MissingResourceException("FacesContext is null", getClass().getName(), messageKey.toString());
        }

        Application application = facesContext.getApplication();

        if (application == null || application.getMessageBundle() == null) {
            throw new MissingResourceException("Cannot read message bundle name from application", getClass().getName(),
                messageKey.toString());
        }

        return ResourceBundle.getBundle(application.getMessageBundle(), locale, getClassLoader());
    }
View Full Code Here

            return INSTANCE;
        }
    }

    private UIComponent createComponentResource(FacesContext context) {
        Application application = context.getApplication();

        // renderkit id is not set on FacesContext at this point, so calling
        // application.createComponent(context, componentType, rendererType) causes NPE
        UIComponent resourceComponent = application.createComponent(UIOutput.COMPONENT_TYPE);

        String rendererType = application.getResourceHandler().getRendererTypeForResourceName(BOTH_SKINNING);
        resourceComponent.setRendererType(rendererType);

        return resourceComponent;
    }
View Full Code Here

    protected void processProperties(FacesContext context, Map<Object, Object> properties) {
        ELContext elContext = context.getELContext();

        // replace all EL-expressions by prepared ValueBinding ?
        Application app = context.getApplication();

        for (Entry<Object, Object> entry : properties.entrySet()) {
            Object propertyObject = entry.getValue();

            if (propertyObject instanceof String) {
                String property = (String) propertyObject;

                if (ELUtils.isValueReference(property)) {
                    ExpressionFactory expressionFactory = app.getExpressionFactory();

                    entry.setValue(expressionFactory.createValueExpression(elContext, property, Object.class));
                } else {
                    entry.setValue(property);
                }
View Full Code Here

        if (!this.isRendered()) {
            return;
        }

        pushComponentToEL(faces, this);
        Application app = faces.getApplication();
        app.publishEvent(faces, PreValidateEvent.class, this);
        preValidate(faces);
        processValidatesChildren(faces);
        app.publishEvent(faces, PostValidateEvent.class, this);
        popComponentFromEL(faces);
    }
View Full Code Here

    writer.endElement(HtmlConstants.TABLE);
  }

  private UIToolBar createToolBar(FacesContext facesContext, UITabGroup component, int virtualTab, String switchType, TabGroupRenderer.TabList tabList, String clientId) {
    Application application = facesContext.getApplication();

    // tool bar

    UICommand scrollLeft = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
    scrollLeft.setId(component.getId() + "__" + virtualTab + "__" + "previous");
    //scrollLeft.setId(facesContext.getViewRoot().createUniqueId());
    scrollLeft.setRendererType(null);
    scrollLeft.getAttributes().put(ATTR_IMAGE, "image/tabPrev.gif");
    if (tabList.isFirst(virtualTab)) {
      scrollLeft.setDisabled(true);
    }
    if (!(TobagoConfig.getInstance(facesContext).isAjaxEnabled() && SWITCH_TYPE_RELOAD_TAB.equals(switchType))) {
      scrollLeft.getAttributes().put(ATTR_ONCLICK, "tobago_previousTab('" + switchType + "','" + clientId + "',"
          + component.getChildCount() + ')');
    } else {
      scrollLeft.getAttributes().put(ATTR_ONCLICK, "javascript:false");
    }
    UICommand scrollRight = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
    scrollRight.setId(component.getId() + "__" + virtualTab + "__" + "next");
    scrollRight.setRendererType(null);
    scrollRight.getAttributes().put(ATTR_IMAGE, "image/tabNext.gif");
    if (tabList.isLast(virtualTab)) {
      scrollRight.setDisabled(true);
    }
    if (!(TobagoConfig.getInstance(facesContext).isAjaxEnabled() && SWITCH_TYPE_RELOAD_TAB.equals(switchType))) {
      scrollRight.getAttributes().put(ATTR_ONCLICK, "tobago_nextTab('" + switchType + "','" + clientId + "',"
          + component.getChildCount() + ')');
    } else {
      scrollRight.getAttributes().put(ATTR_ONCLICK, "javascript:false");
    }
    /*UICommand commandList = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
    commandList.setId(component.getId() + "__commandList);
    commandList.setRendererType(null);
    UIMenu menu = (UIMenu) application.createComponent(UIMenu.COMPONENT_TYPE);
    menu.setId(component.getId() + "__" + virtualTab + "__" + "menu");
    menu.setRendererType(null);
    commandList.getFacets().put(FACET_MENUPOPUP, menu);*/
    UIToolBar toolBar = (UIToolBar) application.createComponent(UIToolBar.COMPONENT_TYPE);
    toolBar.setId(component.getId() + "__toolBar");
    //toolBar.setLabelPosition(UIToolBar.LABEL_OFF);
    toolBar.setRendererType("TabNavigationBar");
    toolBar.setTransient(true);
    //toolBar.setIconSize(AbstractUIToolBar.ICON_OFF);
View Full Code Here

        }
    }

    private void configureApplication()
    {
        Application application = ((ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY))
                .getApplication();
        FacesConfigDispenser dispenser = getDispenser();
        application.setActionListener((ActionListener) getApplicationObject(ActionListener.class, dispenser
                .getActionListenerIterator(), null));

        if (dispenser.getDefaultLocale() != null)
        {
            application.setDefaultLocale(LocaleUtils.toLocale(dispenser.getDefaultLocale()));
        }

        if (dispenser.getDefaultRenderKitId() != null)
        {
            application.setDefaultRenderKitId(dispenser.getDefaultRenderKitId());
        }

        if (dispenser.getMessageBundle() != null)
        {
            application.setMessageBundle(dispenser.getMessageBundle());
        }

        application.setNavigationHandler((NavigationHandler) getApplicationObject(NavigationHandler.class, dispenser
                .getNavigationHandlerIterator(), application.getNavigationHandler()));
       
        application.setStateManager((StateManager) getApplicationObject(StateManager.class, dispenser
                .getStateManagerIterator(), application.getStateManager()));
        List<Locale> locales = new ArrayList<Locale>();
        for (Iterator it = dispenser.getSupportedLocalesIterator(); it.hasNext();)
        {
            locales.add(LocaleUtils.toLocale((String) it.next()));
        }
        application.setSupportedLocales(locales);

        application.setViewHandler((ViewHandler) getApplicationObject(ViewHandler.class, dispenser
                .getViewHandlerIterator(), application.getViewHandler()));

        for (Iterator it = dispenser.getComponentTypes(); it.hasNext();)
        {
            String componentType = (String) it.next();
            application.addComponent(componentType, dispenser.getComponentClass(componentType));
        }

        for (Iterator it = dispenser.getConverterIds(); it.hasNext();)
        {
            String converterId = (String) it.next();
            application.addConverter(converterId, dispenser.getConverterClassById(converterId));
        }

        for (Iterator it = dispenser.getConverterClasses(); it.hasNext();)
        {
            String converterClass = (String) it.next();
            try
            {
                application.addConverter(ClassUtils.simpleClassForName(converterClass), dispenser
                        .getConverterClassByClass(converterClass));
            }
            catch (Exception ex)
            {
                log.error("Converter could not be added. Reason:", ex);
            }
        }

        for (Iterator it = dispenser.getValidatorIds(); it.hasNext();)
        {
            String validatorId = (String) it.next();
            application.addValidator(validatorId, dispenser.getValidatorClass(validatorId));
        }

        RuntimeConfig runtimeConfig = getRuntimeConfig();
       
        runtimeConfig.setPropertyResolverChainHead((PropertyResolver) getApplicationObject(PropertyResolver.class, dispenser
View Full Code Here

      if (attribute != null)
      {
         if (Expressions.isEL(attribute))
         {
            FacesContext context = FacesContext.getCurrentInstance();
            Application app = context.getApplication();

            ExpressionFactory expressionFactory = app.getExpressionFactory();
            ValueExpression ve = expressionFactory.createValueExpression(attribute, Object.class);
            component.setValueExpression(attributeName, ve);
         }
         else
         {
View Full Code Here

            return true;
        }

        private ClientBehavior createBehavior(FacesContext context) {
            Application application = context.getApplication();
            ClientBehavior behavior = (ClientBehavior) application.createBehavior(this.behaviorId);

            ((StateHolder) behavior).restoreState(context, behaviorState);

            if (behaviors == null) {
                behaviors = new ArrayList<ClientBehavior>();
View Full Code Here

        if (!isRendered()) {
            return;
        }

        pushComponentToEL(facesContext, null);
        Application app = facesContext.getApplication();
        app.publishEvent(facesContext, PreValidateEvent.class, this);

        final String activeItem = getActiveItemValue();
        EnumSet<VisitHint> hints = EnumSet.of(VisitHint.SKIP_UNRENDERED);
        VisitContext visitContext = new FullVisitContext(facesContext, hints);
        this.visitTree(visitContext, new VisitCallback() {
            @Override
            public VisitResult visit(VisitContext context, UIComponent target) {
                if (AbstractTogglePanel.this == target || target instanceof UIRepeat) {
                    return VisitResult.ACCEPT; // Proceed with visit to target's children
                }
                if (isActiveItem(target, activeItem) || getSwitchType() == SwitchType.client) {
                    target.processValidators(context.getFacesContext());
                }
                return VisitResult.REJECT; // No need to visit target's children, as they were recursively visited above
            }
        });

        app.publishEvent(facesContext, PostValidateEvent.class, this);
        popComponentFromEL(facesContext);
    }
View Full Code Here

TOP

Related Classes of javax.faces.application.Application

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.