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

org.gcube.portlets.user.templates.client.presenter

## Class Presenter

- java.lang.Object
- - org.gcube.portlets.user.templates.client.presenter.Presenter

-     public class Presenter
      extends Object

  `Presenter` class acts as the Controller in the MVP pattern
  Author:
    Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Presenter(TemplateModel model)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAttributArea(int width, int height, String name, String[] values, boolean useCheckBox, boolean displayBlock)`
    `TemplateComponent` | `addCommentArea(int width, int height, boolean isGrouped)` insert a new comment area in the UI and in the UI and model
    `com.google.gwt.user.client.ui.Widget` | `addFakeTextArea(int y, boolean doubleInsterted)`
    `com.google.gwt.user.client.ui.Widget` | `addGroupingStart(int y)`
    `TemplateComponent` | `addInstructionArea(int width, int height, boolean isGrouped)` insert a new instruction area in the UI and in the UI and model
    `void` | `addNewPage()` called when nextPage Button is Clicked
    `TemplateComponent` | `addPageBreak()` called when add page break command is Clicked
    `void` | `addTextToolBar()` add the text format toolbar on the top
    `void` | `changeTemplateName(String newName)` changes the template name
    `TemplateComponent` | `checkIfDoubleColLayout(com.google.gwt.user.client.ui.Widget toRemove)`
    `void` | `cleanAll()` remove the user-added components from the workspace, and from the model
    `void` | `cleanWorkspace()` remove the user-added components from the workspace (in the current page) but not from the model
    `TemplateComponent` | `createAttributArea(int width, int height, String name, String[] values, boolean useCheckBox, boolean displayBlock, boolean hideControls)` insert a new attribute area in the UI and in the UI and model
    `TemplateComponent` | `createDroppingArea(org.gcube.portlets.d4sreporting.common.shared.ComponentType type, int width, int height, boolean hideControls)` Create the DroppingImage object
    `TemplateComponent` | `createStaticTextArea(org.gcube.portlets.d4sreporting.common.shared.ComponentType type, int width, int height, boolean hideControls)` insert a new static area in the UI and in the model
    `TemplateComponent` | `createTable(org.gcube.portlets.d4sreporting.common.shared.ComponentType type, int rows, int cols, boolean hideControls)`
    `void` | `discardCurrentSection()` to remove the current displayed section
    `void` | `enableTextToolBar(com.google.gwt.user.client.ui.RichTextArea d4sArea)` enable the format text toolbar for the given Rich Textarea passed as argument
    `String` | `getCurrentScope()`
    `org.gcube.portlets.d4sreporting.common.client.uicomponents.richtext.RichTextToolbar` | `getCurrentSelected()`
    `com.google.gwt.user.client.ui.RichTextArea` | `getCurrentSelectedTextArea()`
    `String` | `getCurrentUser()`
    `TemplateComponent` | `getGroupInnerArea()`
    `HeaderBar` | `getHeader()`
    `Coords` | `getInsertionPoint()`
    `TemplateModel` | `getModel()`
    `org.gcube.portlets.d4sreporting.common.client.uicomponents.ReportUIComponent` | `getSelectedComponent()`
    `int` | `getSelectedIndex()`
    `TitleBar` | `getTitleBar()`
    `WorkspacePanel` | `getWorkSpacePanel()`
    `WorkspacePanel` | `getWp()`
    `void` | `importSection(org.gcube.portlets.d4sreporting.common.shared.Model toLoad, int sectionNoToimport, int beforeSection, boolean asLastSection)` Import a Section in the View and in the Model
    `void` | `insertDoubleColumnItems(org.gcube.portlets.d4sreporting.common.client.uicomponents.ReportUIComponent leftItem, org.gcube.portlets.d4sreporting.common.client.uicomponents.ReportUIComponent rightItem)`
    `void` | `insertDroppingArea(org.gcube.portlets.d4sreporting.common.shared.ComponentType type, int width, int height)`
    `void` | `insertGroup(org.gcube.portlets.d4sreporting.common.shared.ComponentType... types)` insert a repeatable sequence in the view and in the model
    `void` | `insertPlaceHolder(org.gcube.portlets.d4sreporting.common.shared.ComponentType type, int width, int height)`
    `void` | `insertStaticImage(Coords start, int width, int height, ImageArea imgToPlace, boolean isDoubleColLayout)`
    `void` | `insertStaticTextArea(org.gcube.portlets.d4sreporting.common.shared.ComponentType type, int width, int height)`
    `void` | `insertTable(org.gcube.portlets.d4sreporting.common.shared.ComponentType type, int rows, int cols)`
    `void` | `lockComponent(com.google.gwt.user.client.ui.Widget toLock, boolean locked)`
    `void` | `moveWidget(com.google.gwt.user.client.ui.Widget toMove, int left, int top)`
    `void` | `nextPageButtonClicked()` called when nextPage Button is Clicked
    `void` | `openAttributeDialog(int width, int height, boolean useCheckBox)`
    `void` | `openGroupingDialog()` allow to repeat a sequence of compoenents in the report
    `void` | `openTemplate(String templateToOpen, String TemplateObjectID)` load the template to edit in the MODEL and in the VIEW
    `void` | `placeTemplatePageElements(int pageNo)` It places back the user added widgets (TemplateComponents) in the page
    `void` | `prevPageButtonClicked()` called when prevPage Button is Clicked
    `boolean` | `removeTemplateComponent(com.google.gwt.user.client.ui.Widget toRemove)` remove the user-added components both from UI and Model
    `void` | `repositionModelComponents(com.google.gwt.user.client.ui.Widget toRepos, int newX, int newY)`
    `void` | `resizeTemplateComponent(com.google.gwt.user.client.ui.Widget toResize, int newWidth, int newHeight)` Resize the template componet in the model and in the UI
    `void` | `resizeTemplateComponentInModel(com.google.gwt.user.client.ui.Widget toResize, int newWidth, int newHeight)` Resize the template componet just the model
    `void` | `resizeTemplateComponentInView(com.google.gwt.user.client.ui.Widget toResize, int newWidth, int newHeight)` Resize the template componet in the model and in the UI
    `void` | `saveTemplate(String basketidToSaveIn)` Save the current Template
    `void` | `seekLastPage()` in case someone inser a new section when not in the last page
    `void` | `seekSection(int sect2Seek)` in case someone imported a new section
    `void` | `setCurrCursorPos(int index)`
    `void` | `setEditedOnBy(Date date, String username)`
    `void` | `setHeader(HeaderBar header)`
    `void` | `setModel(TemplateModel templateModel)`
    `void` | `setSelectedComponent(org.gcube.portlets.d4sreporting.common.client.uicomponents.ReportUIComponent selectedComponent)` set the selected compoenent
    `void` | `setTitleBar(TitleBar titleBar)`
    `void` | `setWp(WorkspacePanel wp)`
    `void` | `showTablePopup(org.gcube.portlets.d4sreporting.common.shared.ComponentType type, int width, int height)`
    `void` | `showToolbox()`
    `void` | `storeChangeInSession(com.google.gwt.user.client.ui.Widget toChange)`
    `void` | `updateWidgetIndicesInModel(com.google.gwt.user.client.ui.FlowPanel widgetContainer)`

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

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

- - ### Constructor Detail

    - #### Presenter

          public Presenter(TemplateModel model)

      Parameters:
        `singleton` - . the singleton

  - ### Method Detail

    - #### showToolbox

          public void showToolbox()

    - #### addNewPage

          public void addNewPage()

      called when nextPage Button is Clicked

    - #### seekLastPage

          public void seekLastPage()

      in case someone inser a new section when not in the last page

    - #### seekSection

          public void seekSection(int sect2Seek)

      in case someone imported a new section
      Parameters:
        `sect2Seek` - .

    - #### addTextToolBar

          public void addTextToolBar()

      add the text format toolbar on the top

    - #### changeTemplateName

          public void changeTemplateName(String newName)

      changes the template name
      Parameters:
        `newName` - .

    - #### setEditedOnBy

          public void setEditedOnBy(Date date,
                           String username)

    - #### getTitleBar

          public TitleBar getTitleBar()

    - #### setTitleBar

          public void setTitleBar(TitleBar titleBar)

    - #### cleanAll

          public void cleanAll()

      remove the user-added components from the workspace, and from the model

    - #### cleanWorkspace

          public void cleanWorkspace()

      remove the user-added components from the workspace (in the current page) but not from the model

    - #### discardCurrentSection

          public void discardCurrentSection()

      to remove the current displayed section

    - #### enableTextToolBar

          public void enableTextToolBar(com.google.gwt.user.client.ui.RichTextArea d4sArea)

      enable the format text toolbar for the given Rich Textarea passed as argument
      Parameters:
        `d4sArea` - the enabled text area

    - #### importSection

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

      Import a Section in the View and in the Model
      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

    - #### getHeader

          public HeaderBar getHeader()

      Returns:
        the header UI component

    - #### getModel

          public TemplateModel getModel()

      Returns:
        the model

    - #### getWp

          public WorkspacePanel getWp()

      Returns:
        .

    - #### openGroupingDialog

          public void openGroupingDialog()

      allow to repeat a sequence of compoenents in the report

    - #### insertGroup

          public void insertGroup(org.gcube.portlets.d4sreporting.common.shared.ComponentType... types)

      insert a repeatable sequence in the view and in the model
      Parameters:
        `types` - the sequence that was chosen

    - #### getGroupInnerArea

          public TemplateComponent getGroupInnerArea()

    - #### createDroppingArea

          public TemplateComponent createDroppingArea(org.gcube.portlets.d4sreporting.common.shared.ComponentType type,
                                             int width,
                                             int height,
                                             boolean hideControls)

      Create the DroppingImage object

    - #### insertDroppingArea

          public void insertDroppingArea(org.gcube.portlets.d4sreporting.common.shared.ComponentType type,
                                int width,
                                int height)

      Parameters:
        `type` -
        `width` -
        `height` -

    - #### addPageBreak

          public TemplateComponent addPageBreak()

      called when add page break command is Clicked

    - #### createStaticTextArea

          public TemplateComponent createStaticTextArea(org.gcube.portlets.d4sreporting.common.shared.ComponentType type,
                                               int width,
                                               int height,
                                               boolean hideControls)

      insert a new static area in the UI and in the model
      Parameters:
        `start` - .
        `x` - .
        `y` - .

    - #### insertStaticTextArea

          public void insertStaticTextArea(org.gcube.portlets.d4sreporting.common.shared.ComponentType type,
                                  int width,
                                  int height)

    - #### createTable

          public TemplateComponent createTable(org.gcube.portlets.d4sreporting.common.shared.ComponentType type,
                                      int rows,
                                      int cols,
                                      boolean hideControls)

      Parameters:
        `type` -
        `rows` -
        `cols` -
      Returns:

    - #### insertTable

          public void insertTable(org.gcube.portlets.d4sreporting.common.shared.ComponentType type,
                         int rows,
                         int cols)

      Parameters:
        `start` - the coordinates x,y where to place the widget
        `width` - .
        `height` - .
        `imgToPlace` - .

    - #### addCommentArea

          public TemplateComponent addCommentArea(int width,
                                         int height,
                                         boolean isGrouped)

      insert a new comment area in the UI and in the UI and model
      Parameters:
        `width` - .
        `height` - .

    - #### addInstructionArea

          public TemplateComponent addInstructionArea(int width,
                                             int height,
                                             boolean isGrouped)

      insert a new instruction area in the UI and in the UI and model
      Parameters:
        `width` - .
        `height` - .

    - #### createAttributArea

          public TemplateComponent createAttributArea(int width,
                                             int height,
                                             String name,
                                             String[] values,
                                             boolean useCheckBox,
                                             boolean displayBlock,
                                             boolean hideControls)

      insert a new attribute area in the UI and in the UI and model
      Parameters:
        `width` - .
        `height` - .
        `useCheckBox` -

    - #### addAttributArea

          public void addAttributArea(int width,
                             int height,
                             String name,
                             String[] values,
                             boolean useCheckBox,
                             boolean displayBlock)

      Parameters:
        `width` -
        `height` -
        `name` - the attr name
        `values` - the values
        `useCheckBox` - if true it will be a multi selection (checkbox), false a single selection (radiobox)
        `displayBlock` - if true the items will be displayed as block, if false inline

    - #### openAttributeDialog

          public void openAttributeDialog(int width,
                                 int height,
                                 boolean useCheckBox)

      Parameters:
        `useCheckBox` -

    - #### updateWidgetIndicesInModel

          public void updateWidgetIndicesInModel(com.google.gwt.user.client.ui.FlowPanel widgetContainer)

      Parameters:
        `widgetContainer` - .

    - #### insertStaticImage

          public void insertStaticImage(Coords start,
                               int width,
                               int height,
                               ImageArea imgToPlace,
                               boolean isDoubleColLayout)

      Parameters:
        `start` - the coordinates x,y where to place the widget
        `width` - .
        `height` - .
        `imgToPlace` - .

    - #### insertPlaceHolder

          public void insertPlaceHolder(org.gcube.portlets.d4sreporting.common.shared.ComponentType type,
                               int width,
                               int height)

      Parameters:
        `start` - the coordinates x,y where to place the widget
        `width` - .
        `height` - .
        `imgToPlace` - .

    - #### showTablePopup

          public void showTablePopup(org.gcube.portlets.d4sreporting.common.shared.ComponentType type,
                            int width,
                            int height)

      Parameters:
        `type` -
        `width` -
        `height` -

    - #### getSelectedIndex

          public int getSelectedIndex()

    - #### setCurrCursorPos

          public void setCurrCursorPos(int index)

    - #### getInsertionPoint

          public Coords getInsertionPoint()

    - #### addFakeTextArea

          public com.google.gwt.user.client.ui.Widget addFakeTextArea(int y,
                                                             boolean doubleInsterted)

    - #### addGroupingStart

          public com.google.gwt.user.client.ui.Widget addGroupingStart(int y)

    - #### insertDoubleColumnItems

          public void insertDoubleColumnItems(org.gcube.portlets.d4sreporting.common.client.uicomponents.ReportUIComponent leftItem,
                                     org.gcube.portlets.d4sreporting.common.client.uicomponents.ReportUIComponent rightItem)

      Parameters:
        `leftItem` -
        `rightItem` -

    - #### moveWidget

          public void moveWidget(com.google.gwt.user.client.ui.Widget toMove,
                        int left,
                        int top)

      Parameters:
        `toMove` - .
        `left` - .
        `top` - .

    - #### nextPageButtonClicked

          public void nextPageButtonClicked()

      called when nextPage Button is Clicked

    - #### openTemplate

          public void openTemplate(String templateToOpen,
                          String TemplateObjectID)

      load the template to edit in the MODEL and in the VIEW
      Parameters:
        `templateToOpen` - the name of the template to open without extension nor path

    - #### placeTemplatePageElements

          public void placeTemplatePageElements(int pageNo)

      It places back the user added widgets (TemplateComponents) in the page
      Parameters:
        `pageNo` - . the page number of the wanted TemplateComponent(s)

    - #### prevPageButtonClicked

          public void prevPageButtonClicked()

      called when prevPage Button is Clicked

    - #### removeTemplateComponent

          public boolean removeTemplateComponent(com.google.gwt.user.client.ui.Widget toRemove)

      remove the user-added components both from UI and Model
      Parameters:
        `toRemove` - the widget to remove
      Returns:
        true if the user-added component has been successfully removed

    - #### checkIfDoubleColLayout

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

      Parameters:
        `tc` -
      Returns:

    - #### storeChangeInSession

          public void storeChangeInSession(com.google.gwt.user.client.ui.Widget toChange)

      Parameters:
        `toChange` - .

    - #### repositionModelComponents

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

      Parameters:
        `toRepos` - .
        `newX` - .
        `newY` - .

    - #### resizeTemplateComponent

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

      Resize the template componet in the model and in the UI
      Parameters:
        `toResize` - .
        `newWidth` - .
        `newHeight` - .

    - #### resizeTemplateComponentInView

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

      Resize the template componet in the model and in the UI
      Parameters:
        `toResize` - .
        `newWidth` - .
        `newHeight` - .

    - #### lockComponent

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

      Parameters:
        `toLock` - .
        `locked` - .

    - #### resizeTemplateComponentInModel

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

      Resize the template componet just the model
      Parameters:
        `toResize` - .
        `newWidth` - .
        `newHeight` - .

    - #### saveTemplate

          public void saveTemplate(String basketidToSaveIn)

      Save the current Template

    - #### setHeader

          public void setHeader(HeaderBar header)

      Parameters:
        `header` - .

    - #### setModel

          public void setModel(TemplateModel templateModel)

      Parameters:
        `templateModel` - .

    - #### setWp

          public void setWp(WorkspacePanel wp)

      Parameters:
        `wp` - .

    - #### getCurrentScope

          public String getCurrentScope()

      Returns:
        the scope in which the application is running on

    - #### getCurrentUser

          public String getCurrentUser()

      Returns:
        the user username who is using the application

    - #### getWorkSpacePanel

          public WorkspacePanel getWorkSpacePanel()

      Returns:
        .

    - #### getCurrentSelected

          public org.gcube.portlets.d4sreporting.common.client.uicomponents.richtext.RichTextToolbar getCurrentSelected()

    - #### getCurrentSelectedTextArea

          public com.google.gwt.user.client.ui.RichTextArea getCurrentSelectedTextArea()

    - #### getSelectedComponent

          public org.gcube.portlets.d4sreporting.common.client.uicomponents.ReportUIComponent getSelectedComponent()

      Returns:
        the component selected

    - #### setSelectedComponent

          public void setSelectedComponent(org.gcube.portlets.d4sreporting.common.client.uicomponents.ReportUIComponent selectedComponent)

      set the selected compoenent
      Parameters:
        `selectedComponent` - .

Copyright © 2013. All Rights Reserved.