Package com.cosmo.ui.templates

Examples of com.cosmo.ui.templates.TemplateControl


   @Override
   public String render(Workspace workspace, PageContext page, String uuid) throws TemplateUnavailableException, PageRenderException
   {
      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());
               }
            }
         }
View Full Code Here


   public String render() throws TemplateUnavailableException
   {
      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)
         {
            xitem = ctrl.getElement(WPART_ITEM);
            xitem = xitem.replace(Widget.getTag(TAG_ITEM_HREF), item.getHref());
            xitem = xitem.replace(Widget.getTag(TAG_ITEM_CAPTION), item.getTitle());
            xitem = Control.replaceTag(xitem, TAG_ITEM_ICON, item.getIcon());

            xhtml += xitem;
         }
         xhtml += ctrl.getElement(WPART_FOOTER);

         // Reemplaza los TAGs comunes a todo el widget
         xhtml = xhtml.replace(Widget.getTag(TAG_MENU_NAME), "Opciones");

         return xhtml;
View Full Code Here

    * @return Devuelve una cadena en formato XHTML que representa el control.
    */
   @Override
   public String render()
   {
      TemplateControl ctrl;
      StringBuilder str = new StringBuilder();

      // Si no tiene elementos, no representa el control
      if (items.isEmpty())
      {
         return "<-- BradcrumbsControl placeholder (void) -->\n";
      }

      // Obtiene la plantilla y la parte del control
      ctrl = getWorkspace().getTemplate().getControl(BreadcrumbsControl.CTUID);

      // Genera la cabecera de la barra de navegaci�n
      str.append(ctrl.getElement(CPART_HEADER));

      for (BreadcrumbsItem item : this.items)
      {
         str.append(item.render(ctrl));
      }

      // Genera el pie de la barra de navegaci�n
      str.append(ctrl.getElement(CPART_FOOTER));

      return str.toString();
   }
View Full Code Here

TOP

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

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.