TemplateModel (gCube Templates Portlet 4.5.0-SNAPSHOT API)
Date: 2013-12-11

org.gcube.portlets.user.templates.client.model

## Class TemplateModel

- java.lang.Object
- - org.gcube.portlets.user.templates.client.model.TemplateModel

-     public class TemplateModel
      extends Object

  The `TemplateModel` class represents the current Template state, the model in the the MVC pattern
  Author:
    Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_NAME` DEFAULT_NAME
    `static int` | `OLD_TEMPLATE_WIDTH` default w and h
    `static int` | `TEMPLATE_HEIGHT` TEMPLATE_HEIGHT
    `static int` | `TEMPLATE_WIDTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TemplateModel()` Constructs a Default Template Model

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addComponentToModel(TemplateComponent tc, int index)`
    `TemplateSection` | `discardSection(int sectNo)`
    `String` | `getAuthor()`
    `int` | `getColumnWidth()`
    `int` | `getCurrentPage()`
    `Date` | `getDateCreated()`
    `Date` | `getLastEdit()`
    `String` | `getLastEditBy()`
    `int` | `getMarginBottom()`
    `int` | `getMarginLeft()`
    `int` | `getMarginRight()`
    `int` | `getMarginTop()`
    `List<org.gcube.portlets.d4sreporting.common.shared.Metadata>` | `getMetadata()` metadata
    `TemplateServiceAsync` | `getModelService()`
    `Coords` | `getNewInsertionPoint(int currSection)` set the insertion point after the last inserted element
    `Vector<TemplateComponent>` | `getOthersPageTC(com.google.gwt.user.client.ui.Widget toCheck)` Returns the other page coomponents in the page except me
    `int` | `getPageHeight()`
    `int` | `getPageWidth()`
    `TemplateSection` | `getSection(int pageNo)`
    `List<TemplateComponent>` | `getSectionComponent(int pageNo)`
    `String` | `getTemplateName()`
    `int` | `getTotalPages()`
    `void` | `importSectionInModel(Presenter controller, org.gcube.portlets.d4sreporting.common.shared.Model toLoad, int sectionNoToimport, int beforeSection, boolean asLastSection)` generally used when reaing a model form disk
    `void` | `insertNewPage()`
    `void` | `loadModel(org.gcube.portlets.d4sreporting.common.shared.Model toLoad, Presenter controller)` generally used when reading a model from disk
    `void` | `lockComponent(com.google.gwt.user.client.ui.Widget toLock, boolean locked)` look for the model in the current section and edits its size
    `TemplateComponent` | `removeComponentFromModel(com.google.gwt.user.client.ui.Widget toRemove)`
    `void` | `repositionModelComponent(com.google.gwt.user.client.ui.Widget toRepos, int newX, int newY)` look for the model in the current section and edits its position
    `void` | `resetModelInSession()`
    `void` | `resizeModelComponent(com.google.gwt.user.client.ui.Widget toResize, int newWidth, int newHeight)` look for the model in the current page and edits its size
    `void` | `serializeModel(String basketidToSaveIn)`
    `void` | `setAuthor(String author)`
    `void` | `setColumnWidth(int columnWidth)`
    `void` | `setCurrentPage(int currentPage)`
    `void` | `setDateCreated(Date dateCreated)`
    `void` | `setLastEdit(Date lastEdit)`
    `void` | `setLastEditBy(String lastEditBy)`
    `void` | `setMarginBottom(int marginBottom)`
    `void` | `setMarginLeft(int marginLeft)`
    `void` | `setMarginRight(int marginRight)`
    `void` | `setMarginTop(int marginTop)`
    `void` | `setPageHeight(int pageHeight)`
    `void` | `setPageWidth(int pageWidth)`
    `void` | `setTemplateName(String templateName)`
    `void` | `setTotalPages(int totalPages)`
    `void` | `storeInSession()` stores the current model in the session
    `void` | `updateModelComponentIndex(com.google.gwt.user.client.ui.Widget toUpdate, int newIndex)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### OLD_TEMPLATE_WIDTH

          public static final int OLD_TEMPLATE_WIDTH

      default w and h
      See Also:
        Constant Field Values

    - #### TEMPLATE_WIDTH

          public static final int TEMPLATE_WIDTH

      See Also:
        Constant Field Values

    - #### TEMPLATE_HEIGHT

          public static final int TEMPLATE_HEIGHT

      TEMPLATE_HEIGHT
      See Also:
        Constant Field Values

    - #### DEFAULT_NAME

          public static final String DEFAULT_NAME

      DEFAULT_NAME
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TemplateModel

          public TemplateModel()

      Constructs a Default Template Model

  - ### Method Detail

    - #### addComponentToModel

          public void addComponentToModel(TemplateComponent tc,
                                 int index)

      Parameters:
        `tc` - .

    - #### removeComponentFromModel

          public TemplateComponent removeComponentFromModel(com.google.gwt.user.client.ui.Widget toRemove)

      Parameters:
        `toRemove` - .

    - #### updateModelComponentIndex

          public void updateModelComponentIndex(com.google.gwt.user.client.ui.Widget toUpdate,
                                       int newIndex)

      Parameters:
        `toUpdate` -
        `newIndex` -

    - #### storeInSession

          public void storeInSession()

      stores the current model in the session

    - #### resetModelInSession

          public void resetModelInSession()

    - #### serializeModel

          public void serializeModel(String basketidToSaveIn)

    - #### discardSection

          public TemplateSection discardSection(int sectNo)

      Parameters:
        `sectNo` - the section to discard
      Returns:
        the removed element

    - #### resizeModelComponent

          public void resizeModelComponent(com.google.gwt.user.client.ui.Widget toResize,
                                  int newWidth,
                                  int newHeight)

      look for the model in the current page and edits its size
      Parameters:
        `toResize` - .
        `newWidth` - .
        `newHeight` - .

    - #### lockComponent

          public void lockComponent(com.google.gwt.user.client.ui.Widget toLock,
                           boolean locked)

      look for the model in the current section and edits its size
      Parameters:
        `toLock` - l
        `locked` - .

    - #### repositionModelComponent

          public void repositionModelComponent(com.google.gwt.user.client.ui.Widget toRepos,
                                      int newX,
                                      int newY)

      look for the model in the current section and edits its position
      Parameters:
        `toRepos` - .
        `newX` - .
        `newY` - .

    - #### insertNewPage

          public void insertNewPage()

    - #### getSectionComponent

          public List<TemplateComponent> getSectionComponent(int pageNo)

      Parameters:
        `pageNo` - .
      Returns:
        .

    - #### getSection

          public TemplateSection getSection(int pageNo)

      Parameters:
        `pageNo` - .
      Returns:
        .

    - #### loadModel

          public void loadModel(org.gcube.portlets.d4sreporting.common.shared.Model toLoad,
                       Presenter controller)

      generally used when reading a model from disk
      Parameters:
        `toLoad` - the SerializableModel instance to load in the model
        `controller` - .

    - #### importSectionInModel

          public void importSectionInModel(Presenter controller,
                                  org.gcube.portlets.d4sreporting.common.shared.Model toLoad,
                                  int sectionNoToimport,
                                  int beforeSection,
                                  boolean asLastSection)

      generally used when reaing a model form disk
      Parameters:
        `toLoad` - the SerializableModel instance where toget the section
        `sectionNoToimport` - section to import 0 -> n-1
        `beforeSection` - say where to import this section (before)
        `asLastSection` - say to import this section as last section in the curren template / report

    - #### getOthersPageTC

          public Vector<TemplateComponent> getOthersPageTC(com.google.gwt.user.client.ui.Widget toCheck)

      Returns the other page coomponents in the page except me
      Parameters:
        `toCheck` - the tc to except
      Returns:
        a Vector of TemplateComponent containing all the tc of the page except the toCheck

    - #### getCurrentPage

          public int getCurrentPage()

      Returns:
        .

    - #### setCurrentPage

          public void setCurrentPage(int currentPage)

      Parameters:
        `currentPage` - .

    - #### getMarginBottom

          public int getMarginBottom()

      Returns:
        .

    - #### setMarginBottom

          public void setMarginBottom(int marginBottom)

      Parameters:
        `marginBottom` - .

    - #### getMarginLeft

          public int getMarginLeft()

      Returns:
        .

    - #### setMarginLeft

          public void setMarginLeft(int marginLeft)

      Parameters:
        `marginLeft` - .

    - #### getMarginRight

          public int getMarginRight()

      Returns:
        .

    - #### setMarginRight

          public void setMarginRight(int marginRight)

      Parameters:
        `marginRight` - .

    - #### getMarginTop

          public int getMarginTop()

      Returns:
        .

    - #### setMarginTop

          public void setMarginTop(int marginTop)

      Parameters:
        `marginTop` - .

    - #### getPageHeight

          public int getPageHeight()

      Returns:
        .

    - #### setPageHeight

          public void setPageHeight(int pageHeight)

      Parameters:
        `pageHeight` - .

    - #### getPageWidth

          public int getPageWidth()

      Returns:
        .

    - #### setPageWidth

          public void setPageWidth(int pageWidth)

      Parameters:
        `pageWidth` - .

    - #### getTemplateName

          public String getTemplateName()

      Returns:
        .

    - #### setTemplateName

          public void setTemplateName(String templateName)

      Parameters:
        `templateName` - .

    - #### getTotalPages

          public int getTotalPages()

      Returns:
        totalPages .

    - #### setTotalPages

          public void setTotalPages(int totalPages)

      Parameters:
        `totalPages` - .

    - #### getAuthor

          public String getAuthor()

    - #### setAuthor

          public void setAuthor(String author)

    - #### getDateCreated

          public Date getDateCreated()

    - #### setDateCreated

          public void setDateCreated(Date dateCreated)

    - #### getLastEdit

          public Date getLastEdit()

    - #### setLastEdit

          public void setLastEdit(Date lastEdit)

    - #### getColumnWidth

          public int getColumnWidth()

      Returns:
        .

    - #### setColumnWidth

          public void setColumnWidth(int columnWidth)

      Parameters:
        `columnWidth` - .

    - #### getModelService

          public TemplateServiceAsync getModelService()

      Returns:
        .

    - #### getMetadata

          public List<org.gcube.portlets.d4sreporting.common.shared.Metadata> getMetadata()

      metadata
      Returns:

    - #### getLastEditBy

          public String getLastEditBy()

    - #### setLastEditBy

          public void setLastEditBy(String lastEditBy)

    - #### getNewInsertionPoint

          public Coords getNewInsertionPoint(int currSection)

      set the insertion point after the last inserted element
      Parameters:
        `currSection` -
      Returns:

Copyright © 2013. All Rights Reserved.