TaackUiSimpleService (taack-ui 0.3.8 API)
Package: taack.base

[Groovy] Class TaackUiSimpleService

    • taack.base.TaackUiSimpleService
    • All Implemented Interfaces and Traits:
      grails.web.api.WebAttributes, grails.artefact.controller.support.ResponseRenderer, grails.web.databinding.DataBinder


      @grails.compiler.GrailsCompileStatic
      final class TaackUiSimpleService
      extends java.lang.Object
      implements grails.web.api.WebAttributes, grails.artefact.controller.support.ResponseRenderer, grails.web.databinding.DataBinder

      Service responsible for rendering a web page or producing ajax parts of a web page.

      taackUiSimpleService.show(new UiBlockSpecifier() {
            modal {
                ajaxBlock "showUser", {
                    show "${u.username", crewUiService.buildUserShow(u), BlockSpec.Width.MAX
                }
            }
        })}
      Author:
      Adrien Guichard
      Version:
      0.1
      Since:
      taack-ui 0.1

      • Methods Summary

          Methods 
          Type Params Return Type Name and description
          <T extends GormEntity> final T ajaxBind(java.lang.Class<T> aClass)
          Retrieve hidden field passed with UiFilterSpecifier#ui(java.lang.Class, groovy.lang.Closure, taack.ast.type.FieldInfo[]).
          final void ajaxReload()
          Allow to reload the current page
          final void cleanForm()
          Clear all params elements not mandatory
          final java.lang.Object closeModal(java.lang.Long id, java.lang.String text)
          Shortcut method that call the show(UiBlockSpecifier) underneath.
          final java.lang.Object closeModal(java.lang.String id, java.lang.String text)
          Shortcut method that call the show(UiBlockSpecifier) underneath.
          final java.lang.Object downloadCsv(UiTableSpecifier tableSpecifier, java.lang.String fileNamePrefix)
          Allow to upload a CSV version of a table to the client browser
          final java.lang.Object downloadDiagram(UiDiagramSpecifier diagramSpecifier, java.lang.String fileName, DiagramBase diagramBase)
          Allow to upload the diagram to the client browser
          final java.lang.Object downloadPdf(UiPrintableSpecifier printableSpecifier, java.lang.String fileName, java.lang.Boolean isHtml, java.lang.String brutHtml)
          Allow to upload the PDF to the client browser
          final java.lang.String dumpAsset(java.lang.String assetName)
          Dump a Grails asset, typically an SVG file, in a text.
          final byte[] dumpAssetBin(java.lang.String assetName)
          Dump a binary Grails asset, typically an image.
          final java.lang.String dumpMailHtml(UiBlockSpecifier blockSpecifier, java.util.Locale locale)
          Dump a block in Mail HTML version.
          final boolean isProcessingForm()
          Return true if the action is called from a form
          final java.lang.Object show(UiBlockSpecifier block, UiMenuSpecifier menu)
          Render the block to the browser.
          final java.lang.Object show(UiFormSpecifier formSpecifier, java.lang.String i18n, UiMenuSpecifier menu)
          Shortcut method that call the show(UiBlockSpecifier) underneath.
          final java.lang.Object show(UiTableSpecifier tableSpecifier, java.lang.String i18nTable, UiFilterSpecifier filterSpecifier, java.lang.String i18nTableFilter, UiMenuSpecifier menuSpecifier)
          Shortcut method that call the show(UiBlockSpecifier) underneath.
          final java.lang.Object showModal(UiFormSpecifier formSpecifier, java.lang.String i18n)
          Build a modal from a form and shows it.
          final java.lang.Object showModal(UiTableSpecifier tableSpecifier, java.lang.String i18nTable, UiFilterSpecifier filterSpecifier, java.lang.String i18nTableFilter)
          Build a modal from a table and a filter and shows it.
          final java.lang.Long showOptions(java.lang.String i18n, java.util.List<java.lang.String> options, boolean isAjax)
          Helper displaying a dialog allowing to confirm before processing the action.
          final java.lang.String streamPdf(UiPrintableSpecifier printableSpecifier, java.io.OutputStream outputStream, java.util.Locale locale)
          Allow to get the HTML version of the PDF, also, render the PDF in the outputStream parameter.
          java.lang.String tr(java.lang.String code, java.util.Locale locale, java.lang.Object[] args)
          java.lang.String visit(UiBlockSpecifier blockSpecifier, boolean isAjaxRendering)
          Allows to retrieve the content of a block without rendering it.
          static java.lang.String visitMenu(UiMenuSpecifier menuSpecifier)
          Allows to retrieve the content of a menu without rendering it.
          static java.lang.String visitTable(UiTableSpecifier tableSpecifier)
          Allows to retrieve the content of a table without rendering it.
      • Inherited Methods Summary

          Inherited Methods 
          Methods inherited from class Name
          class java.lang.Object java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
      • Property Detail

        • @org.springframework.beans.factory.annotation.Autowired org.grails.core.io.ResourceLocator assetResourceLocator

        • @org.springframework.beans.factory.annotation.Autowired grails.gsp.PageRenderer g

        • @org.springframework.beans.factory.annotation.Autowired org.springframework.context.MessageSource messageSource

        • @org.springframework.beans.factory.annotation.Autowired TaackUiConfiguration taackUiPluginConfiguration

      • Constructor Detail

        • TaackUiSimpleService()

      • Method Detail

        • <T extends GormEntity> final T ajaxBind(java.lang.Class<T> aClass)

          Retrieve hidden field passed with UiFilterSpecifier#ui(java.lang.Class, groovy.lang.Closure, taack.ast.type.FieldInfo[]). The latest parameter allow to pass additional data that will not be interpreted by TaackSimpleFilterService.list

          Parameters:
          aClass
          Returns:
          objectClass initialized

        • final void ajaxReload()

          Allow to reload the current page

        • final void cleanForm()

          Clear all params elements not mandatory

        • final java.lang.Object closeModal(java.lang.Long id, java.lang.String text)

          Shortcut method that call the show(UiBlockSpecifier) underneath.

          Allow to return the selection to the parent form from a table in a many to many relationship..

          Calling this method close the current modal, that contains usually a table. @return

          Parameters:
          id - id of the object selected
          text - label of the object

        • final java.lang.Object closeModal(java.lang.String id, java.lang.String text)

          Shortcut method that call the show(UiBlockSpecifier) underneath.

          Allow to return the selection to the parent form from a table in a many to many relationship..

          Calling this method close the current modal, that contains usually a table. @return

          Parameters:
          id - id of the object selected
          text - label of the object

        • final java.lang.Object downloadCsv(UiTableSpecifier tableSpecifier, java.lang.String fileNamePrefix)

          Allow to upload a CSV version of a table to the client browser @return

          Parameters:
          tableSpecifier - table descriptor
          fileNamePrefix - part of the filename before ".csv"

        • final java.lang.Object downloadDiagram(UiDiagramSpecifier diagramSpecifier, java.lang.String fileName, DiagramBase diagramBase)

          Allow to upload the diagram to the client browser @return

          Parameters:
          diagramSpecifier - diagram descriptor
          fileName
          isSvg

        • final java.lang.Object downloadPdf(UiPrintableSpecifier printableSpecifier, java.lang.String fileName, java.lang.Boolean isHtml, java.lang.String brutHtml)

          Allow to upload the PDF to the client browser @return

          Parameters:
          printableSpecifier - PDF descriptor
          fileName
          isHtml
          brutHtml

        • final java.lang.String dumpAsset(java.lang.String assetName)

          Dump a Grails asset, typically an SVG file, in a text.

          Parameters:
          assetName
          Returns:
          the asset file content

        • final byte[] dumpAssetBin(java.lang.String assetName)

          Dump a binary Grails asset, typically an image.

          Parameters:
          assetName
          Returns:
          binary content of the file

        • final java.lang.String dumpMailHtml(UiBlockSpecifier blockSpecifier, java.util.Locale locale)

          Dump a block in Mail HTML version.

          Parameters:
          blockSpecifier - block descriptor
          locale - language
          Returns:
          HTML content

        • final boolean isProcessingForm()

          Return true if the action is called from a form @return

        • final java.lang.Object show(UiBlockSpecifier block, UiMenuSpecifier menu)

          Render the block to the browser. Either the page is updated with the block content, either the full page is rendered if 'isAjax' params is true. @return

          Parameters:
          block - page descriptor
          menu - menu descriptor

        • final java.lang.Object show(UiFormSpecifier formSpecifier, java.lang.String i18n, UiMenuSpecifier menu)

          Shortcut method that call the show(UiBlockSpecifier) underneath.

          Allow to render a form directly. @return

          Parameters:
          formSpecifier - form descriptor
          i18n - title of the form
          menu

        • final java.lang.Object show(UiTableSpecifier tableSpecifier, java.lang.String i18nTable, UiFilterSpecifier filterSpecifier, java.lang.String i18nTableFilter, UiMenuSpecifier menuSpecifier)

          Shortcut method that call the show(UiBlockSpecifier) underneath.

          Allow to render a table and its filter directly. @return

          Parameters:
          tableSpecifier - table descriptor
          i18nTable - label of the table
          filterSpecifier - filter descriptor
          i18nTableFilter - label of the filter
          menuSpecifier - page menu if not ajax rendering

        • final java.lang.Object showModal(UiFormSpecifier formSpecifier, java.lang.String i18n)

          Build a modal from a form and shows it. @return

          Parameters:
          formSpecifier - form descriptor
          i18n - title of the form

        • final java.lang.Object showModal(UiTableSpecifier tableSpecifier, java.lang.String i18nTable, UiFilterSpecifier filterSpecifier, java.lang.String i18nTableFilter)

          Build a modal from a table and a filter and shows it. @return

          Parameters:
          tableSpecifier - table descriptor
          i18nTable
          filterSpecifier - filter descriptor
          i18nTableFilter

        • final java.lang.Long showOptions(java.lang.String i18n, java.util.List<java.lang.String> options, boolean isAjax)

          Helper displaying a dialog allowing to confirm before processing the action.

          Long option = taackUiSimpleService.showOptions(tr('default.button.confirm.message'), ['Yes', 'No'])
           if (option == 0) // do things
           
          Parameters:
          i18n - content of the text
          options - list of options
          isAjax - set to true if the next action is ajax
          Returns:
          the index, starting from zero the user click on

        • final java.lang.String streamPdf(UiPrintableSpecifier printableSpecifier, java.io.OutputStream outputStream, java.util.Locale locale)

          Allow to get the HTML version of the PDF, also, render the PDF in the outputStream parameter.

          Parameters:
          printableSpecifier - PDF descriptor
          outputStream - connection to the client browser
          locale - the language the PDF must be rendered
          Returns:
          the HTML version of the PDF

        • java.lang.String tr(java.lang.String code, java.util.Locale locale, java.lang.Object[] args)

        • java.lang.String visit(UiBlockSpecifier blockSpecifier, boolean isAjaxRendering)

          Allows to retrieve the content of a block without rendering it.

          Parameters:
          blockSpecifier - block descriptor
          isAjaxRendering - if false a complete page will be generated, if true the ajax version is returned
          Returns:
          String that contains the HTML snippet

        • static java.lang.String visitMenu(UiMenuSpecifier menuSpecifier)

          Allows to retrieve the content of a menu without rendering it.

          Parameters:
          menuSpecifier - menu descriptor
          Returns:
          String the contains the HTML snippet

        • static java.lang.String visitTable(UiTableSpecifier tableSpecifier)

          Allows to retrieve the content of a table without rendering it.

          Parameters:
          tableSpecifier - table descriptor
          Returns:
          String the contains the HTML snippet