Package com.cosmo.ui.templates

Examples of com.cosmo.ui.templates.Template


      // Aplica las reglas
      for (Rule rule : this.templateRules)
      {
         if (rule.matchRule(browserAgent))
         {
            return new Template(context, rule.getTemplateId());
         }
      }

      // Aplica la plantilla por defecto
      if (StringUtils.isNullOrEmptyTrim(this.defaultTemplateId))
      {
         return new Template(context, this.defaultTemplateId);
      }

      // No se ha encontrado plantilla: se genera una excepci�n
      throw new TemplateUnavailableException();
   }
View Full Code Here


   public String render() throws TemplateUnavailableException
   {
      String xhtml = "";
      String xitem;
      TemplateControl ctrl;
      Template template;
      ArrayList<BannerAreaItem> items = new ArrayList<BannerAreaItem>();

      if (!items.isEmpty())
      {
         // Obtiene la plantilla y la parte del widget
         template = this.getWorkspace().getTemplate();
         ctrl = template.getControl(WIDGET_ID);

         // Renderiza el control
         xhtml = "";
         xhtml += ctrl.getElement(WPART_HEADER);
         for (BannerAreaItem item : items)
View Full Code Here

   @Override
   public String render() throws TemplateUnavailableException
   {
      String xhtml = "";
      TemplateControl ctrl;
      Template template;

      // Obtiene la plantilla y la parte del widget
      template = this.getWorkspace().getTemplate();
      ctrl = template.getControl(WIDGET_ID);

      if (!getWorkspace().isValidUserSession())
      {
         // Configura la url del login
         URL url = new URL(getWorkspace().getProperties().getSecurityProperties().getLoginPage());
View Full Code Here

      TemplateScript script;
      TemplateLink link;
      TemplateControl tctrl;
      StringBuilder xhtml = new StringBuilder();

      Template template = workspace.getTemplate();

      try
      {
         // Confecciona la cabecera
         xhtml.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">").append("\n");
         xhtml.append("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"es\" lang=\"es\">").append("\n");
         xhtml.append("<head>").append("\n");
         xhtml.append(TAB_SEPARATOR + "<title>").append(page.getTitle()).append("</title>").append("\n");
         xhtml.append(TAB_SEPARATOR + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=").append(page.getCharset()).append("\"></meta>").append("\n");
         xhtml.append(TAB_SEPARATOR + "<meta name=\"generator\" content=\"" + Cosmo.COSMO_NAME + "\"></meta>").append("\n");
         xhtml.append(TAB_SEPARATOR + "<meta name=\"uuid\" content=\"" + uuid + "\"></meta>").append("\n");

         // Inserta Scripts y Links de la p�gina
         Iterator<TemplateLink> itl = template.getLinks();
         while (itl.hasNext())
         {
            link = itl.next();
            xhtml.append(TAB_SEPARATOR + link.render());
         }

         Iterator<TemplateScript> its = template.getScripts();
         while (its.hasNext())
         {
            script = its.next();
            xhtml.append(TAB_SEPARATOR + script.render());
         }

         // Inserta Scripts y Links de los controles
         for (Control ctrl : page.getCenterContents())
         {
            tctrl = template.getControl(ctrl.getControlTypeId());

            if (tctrl != null)
            {
               for (TemplateLink tlink : tctrl.getLinks())
               {
                  xhtml.append(TAB_SEPARATOR + tlink.render());
               }

               for (TemplateScript tscript : tctrl.getScripts())
               {
                  xhtml.append(TAB_SEPARATOR + tscript.render());
               }
            }
         }

         // xhtml.append("  <link rel=\"stylesheet\" type=\"text/css\" href=\"templates/1/template.css\"></link>").append("\n");
         xhtml.append("</head>").append("\n");
         xhtml.append("<body>").append("\n");

         // Obtiene la estructura
         xhtml.append(template.getLayout(page.getLayout()));
         Control.replaceTag(xhtml, TAG_SITE_NAME, workspace.getName());

         // Widgets
         renderLogin(workspace, xhtml, page);
         renderMenus(workspace, xhtml, page);
View Full Code Here

   {
      String xhtml;
      String xitem;
      ArrayList<MenuItem> menu;
      TemplateControl ctrl;
      Template template;

      try
      {
         // Carga el men� a renderizar
         menu = this.provider.loadMenu(this.getWorkspace(), type);

         // Obtiene la plantilla y la parte del widget
         template = this.getWorkspace().getTemplate();
         ctrl = template.getControl(WIDGET_ID);

         // Renderiza el control
         xhtml = "";
         xhtml += ctrl.getElement(WPART_HEADER);
         for (MenuItem item : menu)
View Full Code Here

TOP

Related Classes of com.cosmo.ui.templates.Template

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.