Class TextAreaAdapter
- java.lang.Object
-
- com.acrolinx.sidebar.swing.adapter.TextAreaAdapter
-
- All Implemented Interfaces:
InputAdapterInterface
public class TextAreaAdapter extends java.lang.Object implements InputAdapterInterface
Demo adapter for Swing JTextArea.- See Also:
InputAdapterInterface
-
-
Constructor Summary
Constructors Constructor Description TextAreaAdapter(javax.swing.JTextArea jTextArea, InputFormat inputFormat, java.lang.String documentReference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContent()Receives the current text from the editor.java.util.List<IntRange>getCurrentSelection()Is called when checkSelection is enabled to get the current selected intRange for checking.java.lang.StringgetDocumentReference()The path or filename of the document to check.ExternalContentgetExternalContent()Receives the external text from the editor.InputFormatgetInputFormat()Receives the current input format.javax.swing.JTextAreagetTextArea()voidreplaceRanges(java.lang.String checkId, java.util.List<AcrolinxMatchWithReplacement> matches)Is called by the Acrolinx Integration to replace found issues with suggestions from the Acrolinx Sidebar.voidselectRanges(java.lang.String checkId, java.util.List<AcrolinxMatch> acrolinxMatches)Is called by the Acrolinx Integration to highlight current issues in the text editor.voidsetInputFormat(InputFormat inputFormat)
-
-
-
Constructor Detail
-
TextAreaAdapter
public TextAreaAdapter(javax.swing.JTextArea jTextArea, InputFormat inputFormat, java.lang.String documentReference)
-
-
Method Detail
-
getTextArea
public javax.swing.JTextArea getTextArea()
-
getInputFormat
public InputFormat getInputFormat()
Description copied from interface:InputAdapterInterfaceReceives the current input format. If this method returns null, the check will be canceled by the sidebar.- Specified by:
getInputFormatin interfaceInputAdapterInterface- Returns:
- Returns the current input format.
- See Also:
InputFormat
-
setInputFormat
public void setInputFormat(InputFormat inputFormat)
-
getContent
public java.lang.String getContent()
Description copied from interface:InputAdapterInterfaceReceives the current text from the editor.- Specified by:
getContentin interfaceInputAdapterInterface- Returns:
- Returns the text to be checked.
-
getExternalContent
public ExternalContent getExternalContent()
Description copied from interface:InputAdapterInterfaceReceives the external text from the editor. Only supported with Acrolinx Platform 2019.10 (Sidebar version 14.16) and newer. Return null if not used.- Specified by:
getExternalContentin interfaceInputAdapterInterface- Returns:
- Returns the object for external content.
-
getDocumentReference
public java.lang.String getDocumentReference()
Description copied from interface:InputAdapterInterfaceThe path or filename of the document to check. In a CMS, it can be the id that is used to look up the document.- Specified by:
getDocumentReferencein interfaceInputAdapterInterface
-
selectRanges
public void selectRanges(java.lang.String checkId, java.util.List<AcrolinxMatch> acrolinxMatches)Description copied from interface:InputAdapterInterfaceIs called by the Acrolinx Integration to highlight current issues in the text editor.Note that the matches contain the ranges as found in the originally checked text. It might be necessary to implement some lookup algorithm here to map these ranges to the current document (which might have changed in the meantime).
- Specified by:
selectRangesin interfaceInputAdapterInterface- Parameters:
checkId- The current check id.acrolinxMatches- The ranges to be highlighted as sent by the AcrolinxServer.
-
replaceRanges
public void replaceRanges(java.lang.String checkId, java.util.List<AcrolinxMatchWithReplacement> matches)Description copied from interface:InputAdapterInterfaceIs called by the Acrolinx Integration to replace found issues with suggestions from the Acrolinx Sidebar. If the Acrolinx Sidebar is configured as read only, this method won't be called.Note that the matches contain the ranges as found in the originally checked text. It might be necessary to implement some lookup algorithm here to map these ranges to the current document (which might have changed in the meantime).
- Specified by:
replaceRangesin interfaceInputAdapterInterface- Parameters:
checkId- The current check id.matches- The ranges to be replaced.
-
getCurrentSelection
public java.util.List<IntRange> getCurrentSelection()
Description copied from interface:InputAdapterInterfaceIs called when checkSelection is enabled to get the current selected intRange for checking.- Specified by:
getCurrentSelectionin interfaceInputAdapterInterface- Returns:
- currently selected range.
-
-