Package com.avaya.clientservices.collaboration.whiteboard

## Class WhiteboardRenderer<T extends android.view.View & ZoomableSharingView>

- java.lang.Object
- - com.avaya.clientservices.collaboration.whiteboard.WhiteboardRenderer<T>

- All Implemented Interfaces:
    `android.view.View.OnTouchListener`, `ZoomableSharingView.ZoomableSharingViewActionListener`

      public class WhiteboardRenderer<T extends android.view.View & ZoomableSharingView>
      extends java.lang.Object
      implements ZoomableSharingView.ZoomableSharingViewActionListener, android.view.View.OnTouchListener

  WhiteboardRenderer object provides whiteboard rendering methods. Using this object user can draw shapes and receive drawings.

  All user drawings are done internally (by renderer) on `DrawingView` view, until they are accepted by server. After that they and other incoming drawings are displayed on a `ZoomableSharingView` view.

  In order to receive all drawings the user has to create a `ZoomableSharingView` and `DrawingView`, initialize them in the renderer object using `setSharingView(View)` and `setDrawingView(DrawingView)` methods and also add them to the view hierarchy in which he wants to display the whole whiteboard component.

  This two tier system is constructed this way because redrawing all shapes is a time consuming operation which is done on a UI thread, therefore it's better to draw only received shapes instead of all of them.

  See Also:
    `DrawingView`, `ZoomableSharingView`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `WhiteboardRenderer.RendererPrivateListener` | Whiteboard renderer private listener which notifies about whiteboard started and whiteboard ended events.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `WhiteboardRenderer()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addListener​(WhiteboardRenderer.RendererPrivateListener listener)` | Add a new `WhiteboardRenderer.RendererPrivateListener` object to the whiteboard renderer.
    `void` | `clearWhiteboard()` | Clears whiteboard active surface.
    `WhiteboardSurface` | `getActiveWhiteboardSurface()` | Returns the active whiteboard surface.
    `DrawingView.DrawingListener` | `getDrawingListener()` | Returns `DrawingListener` object required for constructing `DrawingView`.
    `int` | `getWhiteboardHeight()` | Whiteboard renderer internally stores `Whiteboard` this method returns height of the whiteboard object.
    `WhiteboardListener` | `getWhiteboardListener()` | Whiteboard renderer internally creates implementation of `WhiteboardListener` and this method returns it.
    `java.util.List<WhiteboardSurface>` | `getWhiteboardSurfaces()` | Returns all `WhiteboardSurface` whiteboard surfaces associated with current whiteboard session.
    `int` | `getWhiteboardWidth()` | Whiteboard renderer internally stores `Whiteboard` this method returns width of the whiteboard object.
    `boolean` | `isInitialized()` | Deprecated.
    `boolean` | `isWhiteboardStarted()` | To get the correct value this method requires one to register a whiteboard renderer object as a listener on `Whiteboard` object from `Collaboration` object returned on `CollaborationListener.onCollaborationStarted` method callback.
    `void` | `onLongPress​(float x, float y)` | Long press gesture was done on this view.
    `void` | `onSingleTap​(float x, float y)` | Single tap gesture was done on this view.
    `boolean` | `onTouch​(android.view.View v, android.view.MotionEvent event)` |
    `void` | `removeListener​(WhiteboardRenderer.RendererPrivateListener listener)` | Removes `WhiteboardRenderer.RendererPrivateListener` object from the whiteboard renderer.
    `void` | `removeWhiteboardSurface​(WhiteboardSurface surface)` | Request for removing whiteboard surface.
    `void` | `requestNewSurface()` | Request for creating new whiteboard surface.
    `void` | `setActiveWhiteboardSurface​(WhiteboardSurface surface)` | Sets whiteboard surface as active and draws all its shape on canvas.
    `void` | `setDrawingColor​(Color color)` | Sets actual color for the drawn shapes.
    `void` | `setDrawingTool​(DrawingTool drawingTool)` | Sets new drawing tool.
    `void` | `setDrawingView​(DrawingView drawingView)` | Sets view for user drawings.
    `void` | `setSharingView​(T sharingView)` | Sets view with zoom and pinch for incoming drawings from server.
    `void` | `setZoomableImageView​(ZoomableImageView zoomableImageView)` | Deprecated.
    `void` | `showActiveWhiteboardSurface()` | Displays active surface and its shapes on canvas in the case when whiteboard session was initialized before and is active.
    `void` | `stopWhiteboardSharing()` | Stops current whiteboard session.

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

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

- - ### Constructor Detail

    - #### WhiteboardRenderer

          public WhiteboardRenderer()

  - ### Method Detail

    - #### addListener

          public void addListener​(WhiteboardRenderer.RendererPrivateListener listener)

      Add a new `WhiteboardRenderer.RendererPrivateListener` object to the whiteboard renderer.
      Parameters:
        `listener` - object to be added.

    - #### removeListener

          public void removeListener​(WhiteboardRenderer.RendererPrivateListener listener)

      Removes `WhiteboardRenderer.RendererPrivateListener` object from the whiteboard renderer.
      Parameters:
        `listener` - object to be removed.

    - #### setZoomableImageView

          @Deprecated
          public void setZoomableImageView​(ZoomableImageView zoomableImageView)

      Deprecated.
      Sets view with zoom and pinch for incoming drawings from server.
      Parameters:
        `zoomableImageView` - zoomable image view object.

    - #### setSharingView

          public void setSharingView​(T sharingView)

      Sets view with zoom and pinch for incoming drawings from server.
      Parameters:
        `sharingView` - sharing view object.

    - #### setDrawingView

          public void setDrawingView​(DrawingView drawingView)

      Sets view for user drawings.
      Parameters:
        `drawingView` - drawing view object.

    - #### setActiveWhiteboardSurface

          public void setActiveWhiteboardSurface​(WhiteboardSurface surface)

      Sets whiteboard surface as active and draws all its shape on canvas.
      Parameters:
        `surface` - object to be active.

    - #### getActiveWhiteboardSurface

          public WhiteboardSurface getActiveWhiteboardSurface()

      Returns the active whiteboard surface. A value of null is returned in case if the whiteboard session hasn't been started or is ended.
      Returns:
        active whiteboard surface.

    - #### requestNewSurface

          public void requestNewSurface()

      Request for creating new whiteboard surface. In case of success whiteboard renderer will show on its `ZoomableSharingView` view newly created `WhiteboardSurface` whiteboard surface.

    - #### removeWhiteboardSurface

          public void removeWhiteboardSurface​(WhiteboardSurface surface)

      Request for removing whiteboard surface. User could not remove last whiteboard surface.
      Parameters:
        `surface` - whiteboard surface to remove.

    - #### showActiveWhiteboardSurface

          public void showActiveWhiteboardSurface()

      Displays active surface and its shapes on canvas in the case when whiteboard session was initialized before and is active.

    - #### getWhiteboardSurfaces

          public java.util.List<WhiteboardSurface> getWhiteboardSurfaces()

      Returns all `WhiteboardSurface` whiteboard surfaces associated with current whiteboard session.
      Returns:
        list of whiteboard surface objects.

    - #### setDrawingColor

          public void setDrawingColor​(Color color)

      Sets actual color for the drawn shapes. Cannot be null.
      Parameters:
        `color` - new drawing color.
      Throws:
        `java.lang.IllegalStateException` - in case when whiteboard views are not properly initialized in renderer object.

    - #### setDrawingTool

          public void setDrawingTool​(DrawingTool drawingTool)

      Sets new drawing tool. Cannot be null.
      Parameters:
        `drawingTool` - new drawing tool.
      Throws:
        `java.lang.IllegalStateException` - in the case when whiteboard views are not properly initialized in renderer object.

    - #### clearWhiteboard

          public void clearWhiteboard()

      Clears whiteboard active surface. Result of this operation will be displayed on `ZoomableSharingView` internally by renderer. If the whiteboard session is not started, this method does nothing.

    - #### stopWhiteboardSharing

          public void stopWhiteboardSharing()

      Stops current whiteboard session. If the whiteboard session is not started, this method does nothing.

    - #### isWhiteboardStarted

          public boolean isWhiteboardStarted()

      To get the correct value this method requires one to register a whiteboard renderer object as a listener on `Whiteboard` object from `Collaboration` object returned on `CollaborationListener.onCollaborationStarted` method callback.
      Returns:
        true if whiteboard session was started, otherwise false.

    - #### isInitialized

          @Deprecated
          public boolean isInitialized()

      Deprecated.
      Indicates if renderer views are properly initialized and added to it.
      Returns:
        true if renderer is properly initialized, otherwise false.
      See Also:
        `setZoomableImageView(ZoomableImageView)`, `setSharingView(View)`, `setDrawingView(DrawingView)`

    - #### getDrawingListener

          public DrawingView.DrawingListener getDrawingListener()

      Returns `DrawingListener` object required for constructing `DrawingView`.
      Returns:
        drawing listener object.

    - #### getWhiteboardListener

          public WhiteboardListener getWhiteboardListener()

      Whiteboard renderer internally creates implementation of `WhiteboardListener` and this method returns it. It should be registered on the `Whiteboard` object in callback `CollaborationListener.onCollaborationStarted`
      Returns:
        whiteboard listener object.

    - #### getWhiteboardHeight

          public int getWhiteboardHeight()

      Whiteboard renderer internally stores `Whiteboard` this method returns height of the whiteboard object.
      Returns:
        whiteboard height if whiteboard object is valid and height is positive integer, othervise returns default value.

    - #### getWhiteboardWidth

          public int getWhiteboardWidth()

      Whiteboard renderer internally stores `Whiteboard` this method returns width of the whiteboard object.
      Returns:
        whiteboard width if whiteboard object is valid and width is positive integer, othervise returns default value.

    - #### onSingleTap

          public void onSingleTap​(float x,
                                  float y)

      Description copied from interface: `ZoomableSharingView.ZoomableSharingViewActionListener`
      Single tap gesture was done on this view.
      Specified by:
        `onSingleTap` in interface `ZoomableSharingView.ZoomableSharingViewActionListener`
      Parameters:
        `x` - coordinate of tap gesture.
        `y` - coordinate of tap gesture.

    - #### onLongPress

          public void onLongPress​(float x,
                                  float y)

      Description copied from interface: `ZoomableSharingView.ZoomableSharingViewActionListener`
      Long press gesture was done on this view.
      Specified by:
        `onLongPress` in interface `ZoomableSharingView.ZoomableSharingViewActionListener`
      Parameters:
        `x` - coordinate of long press gesture.
        `y` - coordinate of long press gesture.

    - #### onTouch

          public boolean onTouch​(android.view.View v,
                                 android.view.MotionEvent event)

      Specified by:
        `onTouch` in interface `android.view.View.OnTouchListener`