AddImageView

com.j0h1.contour.admin.client

## Class AddImageView

- java.lang.Object
- - com.google.gwt.user.client.ui.UIObject
  - - com.google.gwt.user.client.ui.Widget
    - - com.google.gwt.user.client.ui.Composite
      - - com.j0h1.contour.admin.client.AddImageView

- All Implemented Interfaces:
    com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget

      public class AddImageView
      extends com.google.gwt.user.client.ui.Composite

  View that contains the UI elements and logic to add a new image.
  Author:
    Johannes Riedmann

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static interface` | `AddImageView.AddImageViewUiBinder`

    - ### Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

      `com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) com.google.gwt.user.client.ui.Button` | `btnSave`
    `private gwtupload.client.SingleUploader` | `defaultUploader`
    `private java.lang.String` | `edgeImageString`
    `private java.lang.String` | `fileEnding`
    `(package private) com.google.gwt.user.client.ui.FlowPanel` | `fpnEdgePreview`
    `private com.google.gwt.user.client.ui.FlowPanel` | `fpnImagePreview`
    `(package private) com.google.gwt.user.client.ui.FlowPanel` | `fpnOriginalPreview`
    `private java.lang.String` | `IMAGE_WIDTH`
    `(package private) com.google.gwt.user.client.ui.Image` | `imgEdgePreview`
    `(package private) com.google.gwt.user.client.ui.Image` | `imgOriginalPreview`
    `(package private) com.google.gwt.user.client.ui.Label` | `lblStatus`
    `private gwtupload.client.IUploader.OnFinishUploaderHandler` | `onFinishUploaderHandler`
    `private java.lang.String` | `originalImageString`
    `(package private) com.google.gwt.user.client.ui.TextBox` | `txtThreshold`
    `(package private) com.google.gwt.user.client.ui.TextBox` | `txtTitleDE`
    `(package private) com.google.gwt.user.client.ui.TextBox` | `txtTitleEN`
    `private java.lang.String` | `type`
    `private static AddImageView.AddImageViewUiBinder` | `uiBinder`
    `(package private) com.google.gwt.user.client.ui.VerticalPanel` | `vpnContainer`
    `(package private) com.google.gwt.user.client.ui.VerticalPanel` | `vpnDefineThreshold`
    `(package private) com.google.gwt.user.client.ui.VerticalPanel` | `vpnEdgeImage`
    `(package private) com.google.gwt.user.client.ui.VerticalPanel` | `vpnOriginalImage`

    - ### Fields inherited from class com.google.gwt.user.client.ui.UIObject

      `DEBUG_ID_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AddImageView()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private void` | `afterOriginalImageReceived(java.lang.String originalImageString)` This method is called after the asynchronous callback from the server is received.
    `void` | `calculateEdgeImage(int thresh)` Calculates a base64 encoded image String for the uploaded image file.
    `void` | `generateClicked(com.google.gwt.event.dom.client.ClickEvent event)` Method that is invoked, when generate Button is clicked.
    `void` | `getOriginalImageString(java.lang.String fileUrl, java.lang.String fileName, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.String> callback)` Performs an asynchronous HTTP callback to the server to receive the uploaded image as bas64 encoded String.
    `private void` | `setStatusLabel(java.lang.String text, boolean isError)` Set the status label to a given text for feedback.
    `void` | `submitImage(com.google.gwt.event.dom.client.ClickEvent event)` Method that is invoked, when save Button is clicked.

    - ### Methods inherited from class com.google.gwt.user.client.ui.Composite

      `claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget`

    - ### Methods inherited from class com.google.gwt.user.client.ui.Widget

      `addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents`

    - ### Methods inherited from class com.google.gwt.user.client.ui.UIObject

      `addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents`

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

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

- - ### Field Detail

    - #### uiBinder

          private static AddImageView.AddImageViewUiBinder uiBinder

    - #### txtTitleEN

          @UiField
          com.google.gwt.user.client.ui.TextBox txtTitleEN

    - #### txtTitleDE

          @UiField
          com.google.gwt.user.client.ui.TextBox txtTitleDE

    - #### vpnOriginalImage

          @UiField
          com.google.gwt.user.client.ui.VerticalPanel vpnOriginalImage

    - #### vpnContainer

          @UiField
          com.google.gwt.user.client.ui.VerticalPanel vpnContainer

    - #### vpnEdgeImage

          @UiField
          com.google.gwt.user.client.ui.VerticalPanel vpnEdgeImage

    - #### fpnEdgePreview

          @UiField
          com.google.gwt.user.client.ui.FlowPanel fpnEdgePreview

    - #### vpnDefineThreshold

          @UiField
          com.google.gwt.user.client.ui.VerticalPanel vpnDefineThreshold

    - #### lblStatus

          @UiField
          com.google.gwt.user.client.ui.Label lblStatus

    - #### imgEdgePreview

          @UiField
          com.google.gwt.user.client.ui.Image imgEdgePreview

    - #### imgOriginalPreview

          @UiField
          com.google.gwt.user.client.ui.Image imgOriginalPreview

    - #### btnSave

          @UiField
          com.google.gwt.user.client.ui.Button btnSave

    - #### txtThreshold

          @UiField
          com.google.gwt.user.client.ui.TextBox txtThreshold

    - #### fpnOriginalPreview

          @UiField
          com.google.gwt.user.client.ui.FlowPanel fpnOriginalPreview

    - #### fpnImagePreview

          private com.google.gwt.user.client.ui.FlowPanel fpnImagePreview

    - #### defaultUploader

          private gwtupload.client.SingleUploader defaultUploader

    - #### edgeImageString

          private java.lang.String edgeImageString

    - #### originalImageString

          private java.lang.String originalImageString

    - #### type

          private java.lang.String type

    - #### fileEnding

          private java.lang.String fileEnding

    - #### IMAGE_WIDTH

          private final java.lang.String IMAGE_WIDTH

      See Also:
        Constant Field Values

    - #### onFinishUploaderHandler

          private gwtupload.client.IUploader.OnFinishUploaderHandler onFinishUploaderHandler

  - ### Constructor Detail

    - #### AddImageView

          public AddImageView()

  - ### Method Detail

    - #### afterOriginalImageReceived

          private void afterOriginalImageReceived(java.lang.String originalImageString)

      This method is called after the asynchronous callback from the server is received. The result of the callback has to be handled outside of the onSuccess method in order to store the original image string.
      Parameters:
        `originalImageString` - Result of asynchronous callback (uploaded image String).

    - #### getOriginalImageString

          public void getOriginalImageString(java.lang.String fileUrl,
                                             java.lang.String fileName,
                                             com.google.gwt.user.client.rpc.AsyncCallback<java.lang.String> callback)

      Performs an asynchronous HTTP callback to the server to receive the uploaded image as bas64 encoded String.
      Parameters:
        `fileUrl` - URI of String
        `fileName` - uploaded filename as key of HashMap on the server
        `callback` - response from server

    - #### calculateEdgeImage

          public void calculateEdgeImage(int thresh)

      Calculates a base64 encoded image String for the uploaded image file.
      Parameters:
        `thresh` - Threshold bigger than 0 and smaller or equal to 100 that is used for edge detection.

    - #### generateClicked

          @UiHandler(value="btnGenerate")
          public void generateClicked(com.google.gwt.event.dom.client.ClickEvent event)

      Method that is invoked, when generate Button is clicked. Executes edge detection on image data.
      Parameters:
        `event` - ClickEvent received from Button.

    - #### submitImage

          @UiHandler(value="btnSave")
          public void submitImage(com.google.gwt.event.dom.client.ClickEvent event)

      Method that is invoked, when save Button is clicked. Persists image to database.
      Parameters:
        `event` - ClickEvent received from Button.

    - #### setStatusLabel

          private void setStatusLabel(java.lang.String text,
                                      boolean isError)

      Set the status label to a given text for feedback.
      Parameters:
        `text` - Exception/success message.
        `isError` - Flag that defines if the current message is a error message.