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 voidAdjust the anchor points of theCalloutAnnotationvoidApplies the text of the text area to the annotation and change the annotation back to its initial colors.protected intcomputeEditorHeight(Point2D transformedSize) Computes the editor height with the size of the selected annotation.protected intcomputeEditorWidth(Point2D transformedSize) Computes the editor width with the size of the selected annotation.com.google.gwt.user.client.ui.IsWidgetcreateWidget(Collection<Object> args) voidResets to the initial status of the annotation in case text changes are discarded.voidfocus()set the cursor to the first position and return the textArea so that theDefaultPopupExecutorcan focus it.intReturns the editor height in px.intReturns the editor width in px.com.google.gwt.user.client.ui.TextAreavoidinit(Collection<? extends ShapeBasedAnnotation> selectedItems, PropertyProfile<?> profile, Page page, RenderControls renderControls, AnnotationTool annoTool, UndoManager undoManager) protected voidsetCalloutHeight(double height) Set new height forCalloutAnnotationvoidsetEditorHeight(int editorHeight) Set the editor height.voidsetEditorWidth(int width) Set the editor width.voidsetGlobalAnnotationChangeAllowed(boolean isGlobalAnnotationChangeAllowed) Set to true, if document permissions allow changing annotations.voidIf 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, setHandlerMethods 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, setIconNameMethods inherited from class com.levigo.jadice.web.client.util.command.InjectedCommand
canExecute, canExecute, clearInjections, execute, getKey, isSelected, isSelected, setKeyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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.TextSelectioncursorPosition- TheTextAnnotationWrangler.CursorPositionexpandHeight- 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:
createWidgetin 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 theDefaultPopupExecutorcan focus it.- Specified by:
focusin 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
-