Class TextEditor
java.lang.Object
com.levigo.jadice.web.client.util.command.InjectedCommand
com.levigo.jadice.web.client.internal.annotation.editor.AnnotationPropertyEditor
com.levigo.jadice.web.client.internal.annotation.editor.WidgetBasedAnnotationPropertyEditor
com.levigo.jadice.web.client.internal.annotation.editor.TextEditor
- All Implemented Interfaces:
com.levigo.jadice.web.client.ui.internal.DefaultPopupExecutor.Focusable
,MenuContributor
,Command
,WidgetCommand
- Direct Known Subclasses:
IconifiedTextEditor
public class TextEditor
extends WidgetBasedAnnotationPropertyEditor
implements com.levigo.jadice.web.client.ui.internal.DefaultPopupExecutor.Focusable
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.levigo.jadice.web.client.util.command.WidgetCommand
WidgetCommand.Handler
-
Constructor Summary
ConstructorsConstructorDescriptionDefault Constructor.TextEditor
(int editorWidth, int editorHeight, TextAnnotationWrangler.TextSelection textSelection, TextAnnotationWrangler.CursorPosition cursorPosition, TextAnnotationWrangler.ExpandHeight expandHeight, int maxEditorHeight) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Adjust the anchor points of theCalloutAnnotation
void
Applies the text of the text area to the annotation and change the annotation back to its initial colors.protected int
computeEditorHeight
(Point2D transformedSize) Computes the editor height with the size of the selected annotation.protected int
computeEditorWidth
(Point2D transformedSize) Computes the editor width with the size of the selected annotation.com.google.gwt.user.client.ui.IsWidget
createWidget
(Collection<Object> args) void
Resets to the initial status of the annotation in case text changes are discarded.void
focus()
set the cursor to the first position and return the textArea so that theDefaultPopupExecutor
can focus it.int
Returns the editor height in px.int
Returns the editor width in px.com.google.gwt.user.client.ui.TextArea
void
init
(Collection<? extends ShapeBasedAnnotation> selectedItems, PropertyProfile<?> profile, Page page, RenderControls renderControls, AnnotationTool annoTool, UndoManager undoManager) protected void
setCalloutHeight
(double height) Set new height forCalloutAnnotation
void
setEditorHeight
(int editorHeight) Set the editor height.void
setEditorWidth
(int width) Set the editor width.void
setGlobalAnnotationChangeAllowed
(boolean isGlobalAnnotationChangeAllowed) Set to true, if document permissions allow changing annotations.void
If the scroll height is bigger than the text area height, it will be adapted.Methods inherited from class com.levigo.jadice.web.client.internal.annotation.editor.WidgetBasedAnnotationPropertyEditor
closePopup, setHandler
Methods inherited from class com.levigo.jadice.web.client.internal.annotation.editor.AnnotationPropertyEditor
applyUndoableEdit, captureMemento, captureStateThenEdit, contribute, execute, getAnnoTool, getIcon, getIcon, getIconName, getPage, getProfile, getRenderControls, getSelectedItems, getUndoManager, repaint, reset, setIconName
Methods inherited from class com.levigo.jadice.web.client.util.command.InjectedCommand
canExecute, canExecute, clearInjections, execute, getKey, isSelected, isSelected, setKey
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.levigo.jadice.web.client.util.command.Command
canExecute, execute, getID, isAvailable, isAvailable, isSelected
-
Constructor Details
-
TextEditor
public TextEditor()Default Constructor. -
TextEditor
public TextEditor(int editorWidth, int editorHeight, TextAnnotationWrangler.TextSelection textSelection, TextAnnotationWrangler.CursorPosition cursorPosition, TextAnnotationWrangler.ExpandHeight expandHeight, int maxEditorHeight) Constructor.- Parameters:
editorWidth
- The minimum width of the editor in px.editorHeight
- The minimum height of the editor in px.textSelection
- TheTextAnnotationWrangler.TextSelection
cursorPosition
- TheTextAnnotationWrangler.CursorPosition
expandHeight
- checks if height expansion is enabled.
-
-
Method Details
-
getEditorWidth
public int getEditorWidth()Returns the editor width in px.- Returns:
- The editor width in px.
-
setEditorWidth
public void setEditorWidth(int width) Set the editor width.- Parameters:
width
- The editor width in px.
-
getEditorHeight
public int getEditorHeight()Returns the editor height in px.- Returns:
- The editor height in px.
-
setEditorHeight
public void setEditorHeight(int editorHeight) Set the editor height.- Parameters:
editorHeight
- height in px.
-
createWidget
- Specified by:
createWidget
in interfaceWidgetCommand
-
computeEditorWidth
Computes the editor width with the size of the selected annotation.- Parameters:
transformedSize
- The point to be used.- Returns:
- The computed width.
-
computeEditorHeight
Computes the editor height with the size of the selected annotation.- Parameters:
transformedSize
- The point to be used.- Returns:
- The computed height
-
focus
public void focus()set the cursor to the first position and return the textArea so that theDefaultPopupExecutor
can focus it.- Specified by:
focus
in interfacecom.levigo.jadice.web.client.ui.internal.DefaultPopupExecutor.Focusable
-
setGlobalAnnotationChangeAllowed
public void setGlobalAnnotationChangeAllowed(boolean isGlobalAnnotationChangeAllowed) Set to true, if document permissions allow changing annotations. The enclosed text area will be enabled according to this global permission in combination with the annotation specific change permissions.- Parameters:
isGlobalAnnotationChangeAllowed
- True, if global change is allowed, false else.
-
applyText
public void applyText()Applies the text of the text area to the annotation and change the annotation back to its initial colors. -
getTextArea
public com.google.gwt.user.client.ui.TextArea getTextArea() -
discardText
public void discardText()Resets to the initial status of the annotation in case text changes are discarded. Since the annotation colors are set transparent before opening the text editor the colors have to be reset to the initial state. It is also important to set the modified status to the initial state because discarding the changes should not change the modified status of the annotation. -
updateHeight
public void updateHeight()If the scroll height is bigger than the text area height, it will be adapted. -
adjustCalloutBounds
protected void adjustCalloutBounds()Adjust the anchor points of theCalloutAnnotation
-
setCalloutHeight
protected void setCalloutHeight(double height) Set new height forCalloutAnnotation
- Parameters:
height
- the new height for the annotation
-