Package org.apache.tiles

Examples of org.apache.tiles.Definition


      exposeModelAsRequestAttributes(model, request);
      JstlUtils.exposeLocalizationContext(new RequestContext(request, servletContext));

      TilesRequestContext tilesRequestContext = container.getContextFactory().createRequestContext(
          container.getApplicationContext(), new Object[] { request, response });
      Definition compositeDefinition = container.getDefinitionsFactory().getDefinition(getUrl(),
          tilesRequestContext);
      Map flattenedAttributeMap = new HashMap();
      flattenAttributeMap(container, tilesRequestContext, flattenedAttributeMap, compositeDefinition);

      // initialize the session before rendering any fragments. Otherwise views that require the session which has
View Full Code Here


      Definition compositeDefinition) throws Exception {
    Iterator i = compositeDefinition.getAttributes().keySet().iterator();
    while (i.hasNext()) {
      Object key = i.next();
      Attribute attr = (Attribute) compositeDefinition.getAttributes().get(key);
      Definition nestedDefinition = container.getDefinitionsFactory().getDefinition(attr.getValue().toString(),
          requestContext);
      resultMap.put(key, attr);
      if (nestedDefinition != null) {
        flattenAttributeMap(container, requestContext, resultMap, nestedDefinition);
      }
View Full Code Here

        definition = null;
    }

    /** {@inheritDoc} */
    public int doStartTag() throws TilesJspException {
        definition = new Definition();
        definition.setName(name);
        Attribute templateAttribute = Attribute
                .createTemplateAttribute(template);
        templateAttribute.setRole(role);
        definition.setTemplateAttribute(templateAttribute);
View Full Code Here

     * @throws DefinitionsFactoryException If the definitions factory throws an
     * exception.
     */
    protected Definition getDefinition(String definitionName,
            TilesRequestContext request) {
        Definition definition =
            definitionsFactory.getDefinition(definitionName, request);
        return definition;
    }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Render request recieved for definition '" + definitionName + "'");
        }

        Definition definition = getDefinition(definitionName, request);

        if (definition == null) {
            if (log.isWarnEnabled()) {
                String message = "Unable to find the definition '" + definitionName + "'";
                log.warn(message);
View Full Code Here

     * @return <code>true</code> if <code>definitionName</code> is a valid
     * definition name.
     */
    private boolean isValidDefinition(TilesRequestContext context, String definitionName) {
        try {
            Definition definition = getDefinition(definitionName, context);
            return definition != null;
        } catch (NoSuchDefinitionException nsde) {
            return false;
        } catch (DefinitionsFactoryException e) {
            // TODO, is this the right thing to do?
View Full Code Here

    /** {@inheritDoc} */
    @Override
    protected Definition getDefinition(String definitionName,
            TilesRequestContext request) {
        Definition retValue = null;
        String key = getDefinitionsFactoryKey(request);
        if (key != null) {
            DefinitionsFactory definitionsFactory =
                key2definitionsFactory.get(key);
            if (definitionsFactory != null) {
View Full Code Here

    }

    /** {@inheritDoc} */
    public Definition getDefinition(String name,
            TilesRequestContext tilesContext) {
        Definition retValue;
        Locale locale = null;

        if (tilesContext != null) {
            locale = localeResolver.resolveLocale(tilesContext);
        }

        retValue = definitionDao.getDefinition(name, locale);
        if (retValue != null) {
            retValue = new Definition(retValue);
            String parentDefinitionName = retValue.getExtends();
            while (parentDefinitionName != null) {
                Definition parent = definitionDao.getDefinition(
                        parentDefinitionName, locale);
                if (parent == null) {
                    throw new NoSuchDefinitionException("Cannot find definition '"
                            + parentDefinitionName + "' ancestor of '"
                            + retValue.getName() + "'");
                }
                retValue.inherit(parent);
                parentDefinitionName = parent.getExtends();
            }
        }

        return retValue;
    }
View Full Code Here

     * @param locale The locale to use to resolve the definition.
     * @return the Definition matching the given name or null if none
     *         is found.
     */
    public Definition getDefinition(String name, Locale locale) {
        Definition definition = null;

        if (locale != null) {
            Map<String, Definition> localeSpecificMap =
                localeSpecificDefinitions.get(locale);
            if (localeSpecificMap != null) {
View Full Code Here

     * @return The required definition if found, otherwise it returns
     *         <code>null</code>.
     */
    protected Definition getDefinitionByAttribute(
        Attribute attr, Locale locale) {
        Definition retValue = null;

        Object attrValue = attr.getValue();
        if (attrValue instanceof String) {
            retValue = this.getDefinition((String) attr
                .getValue(), locale);
View Full Code Here

TOP

Related Classes of org.apache.tiles.Definition

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.