public class CommentLayerComponent
extends Div
HTML component. Its purpose is allow placing positioned
comments over images (i.e. in printcockpit - over page previews), but it is possible to use a custom div
component with any content as parent of such component.
This component is design in the MVC pattern. It must be constructed with an instance of
CommentLayerComponentController and CommentLayerComponentModel. The former triggers any comment-layer
actions, like placing new comment, reading comment for the comment layer, while the later holds the current state of
the component. Besides controller and model, the constructor requires the HTML component that is the
parent of the comment layer component (or in other words, lays below the comment layer)| Constructor and Description |
|---|
CommentLayerComponent(CommentLayerComponentController controller,
CommentLayerComponentModel model,
HtmlBasedComponent parent) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addIconComponent(CommentIcon icon)
Adds new comment icon component to the comment layer.
|
void |
appendCanvas(Canvas canvas)
Appends canvas element to this comment layer component.
|
boolean |
containsComment(CommentModel commentModel)
Returns true if this component contains given comment or false otherwise.
|
Canvas |
getCanvas() |
CommentIcon |
getCommentIcon(CommentModel commentModel)
Returns
CommentIcon corresponding to the target CommentModel instance |
CommentIcon |
getCommentIcon(java.lang.String id)
Returns
CommentIcon contained in this component and having target component id. |
protected Menupopup |
getContextMenu()
Creates the context menu for the right-click listener.
|
CommentLayerComponentController |
getController()
Returns the comment layer's controller.
|
java.util.List<CommentIcon> |
getIconComponents()
Returns all comment icons components that are currently contained by this comment layer.
|
protected Menupopup |
getIconContextMenu(CommentIcon icon) |
CommentLayerComponentModel |
getModel()
Returns current state of the comment layer component -
CommentLayerComponentModel. |
HtmlBasedComponent |
getParent() |
void |
refresh()
Refreshes the component according to the current state in the model.
|
void |
refresh(CommentLayerComponentModel model)
Refreshes the component according to the current state in the model.
|
protected void |
refreshCanvas()
Refreshes (if the comment layer component is in edit mode) or clears the canvas component.
|
boolean |
removeIcon(CommentIcon icon)
Removes icon comment component from the comment layer.
|
void |
resize(double scaleFactor)
Resizes the component according to the given scale factor.
|
protected void |
setListeners() |
void |
setModel(CommentLayerComponentModel model)
Sets model to the component.
|
public CommentLayerComponent(CommentLayerComponentController controller, CommentLayerComponentModel model, HtmlBasedComponent parent)
public void setModel(CommentLayerComponentModel model)
model - - CommentLayerComponentModelpublic CommentLayerComponentModel getModel()
CommentLayerComponentModel.public CommentLayerComponentController getController()
public void refresh(CommentLayerComponentModel model)
model - - the state representationprotected void refreshCanvas()
public void refresh()
public void resize(double scaleFactor)
refresh() is called.public java.util.List<CommentIcon> getIconComponents()
List of CommentIconspublic boolean addIconComponent(CommentIcon icon)
icon - CommentIconpublic boolean removeIcon(CommentIcon icon)
icon - - icon to removepublic boolean containsComment(CommentModel commentModel)
commentModel - comment to search forpublic CommentIcon getCommentIcon(CommentModel commentModel)
CommentIcon corresponding to the target CommentModel instancecommentModel - CommentIcon or null.public CommentIcon getCommentIcon(java.lang.String id)
CommentIcon contained in this component and having target component id.id - - commentIcon Idpublic Canvas getCanvas()
public void appendCanvas(Canvas canvas)
canvas - Canvaspublic HtmlBasedComponent getParent()
protected Menupopup getContextMenu()
controller -
CommentLayerComponentController.createContextMenu(CommentLayerComponent);Menupopupprotected Menupopup getIconContextMenu(CommentIcon icon)
protected void setListeners()
Copyright © 2018 SAP SE. All Rights Reserved.