|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectice.pilots.html4.SelectionAgent
The SelectionAgent removes the selection code from CSSLayout into a separate entity. The CSSLayout class will defer to this class to manage ObjectSelection, but will not need to know the details of how it's handled.
This object, for the moment, uses references to the CSSLayout object to perform various operations, but this reference should be replaced by an controller interface instance that is passed into the methods that require it.
This object is tightly coupled with the TextBox, and performs selection logic that should likely be in that object, given the way that selection was done in the past. This is a bit that requires refactoring. In general, selection is only a slightly more involved aspect of the accessability code, and leverages those methods to a certain degree. In the future, accessability and the more general topic of handling a HTML document as a language document will be addressed.
This object is also a repository of state for a variety of operations. Clicking the mouse causes selection text to be cleared, but it also can position a cursor for later operations.
| Constructor Summary | |
SelectionAgent(DRange range)
Construct a new SelectionAgent. |
|
| Method Summary | |
void |
clearHighlights()
Remove all highlight areas from the system. |
void |
clearSelection(ice.pilots.html4.CSSLayout layout)
Clear the text Selection. |
void |
defineHighlight(ice.pilots.html4.CSSBox box,
int startIndex,
int endIndex)
Allow a client to define a highlight section. |
void |
empty()
|
DNode |
getEndContainer()
|
int |
getEndOffset()
|
DElement |
getSelectionParentNode()
Retrieve the highest DElement from the selection hierarchy. |
DNode |
getStartContainer()
|
int |
getStartOffset()
|
boolean |
isInside(ice.pilots.html4.CSSLayout layout,
int xPos,
int yPos,
int scrollX,
int scrollY)
Provide a higher resolution solution to the above method. |
boolean |
isInside(DNode node)
Test if a given DNode falls within the currently selected Node hierarchy. |
boolean |
isSelectionActive()
Retrieve a boolean value indicating if a selection region is currently active. |
void |
markDocument(ice.pilots.html4.CSSLayout layout,
int xPos,
int yPos,
int scrollX,
int scrollY)
The same mouse down event has the effect of placing an apparent cursor on the screen for the purposes of (modifier)+arrow text selection. |
void |
postSelectedToClipboard(ice.pilots.html4.CSSLayout layout)
Post any currently selected text to the Application clipboard, if applicable. |
void |
select(DNode n1,
int off1,
DNode n2,
int off2,
ice.pilots.html4.CSSLayout layout)
Select a range of text. |
void |
selectAll(ice.pilots.html4.CSSLayout layout)
Select all the nodes in a document. |
void |
selectCharLeft(ice.pilots.html4.CSSLayout layout)
Move the selection end marker one character to the left. |
void |
selectCharRight(ice.pilots.html4.CSSLayout layout)
Move the selection end marker one character to the right and apply the new selection. |
void |
selectSentenceLeft(ice.pilots.html4.CSSLayout layout)
Move the selection end marker one sentence to the left. |
void |
selectSentenceRight(ice.pilots.html4.CSSLayout layout)
Move the selection end marker one sentence to the left. |
void |
selectWordByIndex(ice.pilots.html4.CSSLayout layout,
int index)
Select a word from the document by absolute index. |
void |
selectWordLeft(ice.pilots.html4.CSSLayout layout)
Move the selection end marker one word to the left, and apply the new selection. |
void |
selectWordRangeByIndex(ice.pilots.html4.CSSLayout layout,
int startIndex,
int endIndex)
This method will select a range of words starting at the starting word index, and continuing through the end of the word indicated by the ending word index. |
void |
selectWordRight(ice.pilots.html4.CSSLayout layout)
Move the selection end marker one word to the right and apply the new selection. |
void |
setSelection(ice.pilots.html4.CSSLayout layout,
int x1,
int y1,
int x2,
int y2,
int scrollX,
int scrollY)
Set a selection region within the content. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public SelectionAgent(DRange range)
| Method Detail |
public void empty()
public void clearSelection(ice.pilots.html4.CSSLayout layout)
layout - reference to CSSLayout class
public void markDocument(ice.pilots.html4.CSSLayout layout,
int xPos,
int yPos,
int scrollX,
int scrollY)
layout - CSSLayout referencexPos - visible x positionyPos - visible y positionscrollX - Horizontal scroll bar valuescrollY - Vertical scroll bar valuepublic void selectAll(ice.pilots.html4.CSSLayout layout)
layout - The CSSLayout class to provide some document access
public void setSelection(ice.pilots.html4.CSSLayout layout,
int x1,
int y1,
int x2,
int y2,
int scrollX,
int scrollY)
layout - Instance of the layout classx1 - top left x coordinatey1 - top left y coordinatex2 - bottom right x coordinatey2 - bottom right y coordinatescrollX - horizontal scroll bar positionscrollY - Vertical scroll bar positionpublic boolean isSelectionActive()
public void selectWordByIndex(ice.pilots.html4.CSSLayout layout,
int index)
0 <= index <= layout.getCount( Html4DocumentAccess.WORD_TYPE);
layout - The CSSLayout classindex - The index of the word to select
public void selectWordRangeByIndex(ice.pilots.html4.CSSLayout layout,
int startIndex,
int endIndex)
0 <= startIndex <= endIndex <= layout.getCount( Html4DocumentAccess.WORD_TYPE);
This method does not set the selection markers for incremental line selection.
layout - Reference to CSSLayout instancestartIndex - the selection starting word index.endIndex - The selection ending word index.public void selectWordRight(ice.pilots.html4.CSSLayout layout)
layout - instance of CSSLayoutpublic void selectCharRight(ice.pilots.html4.CSSLayout layout)
layout - instance of CSSLayoutpublic void selectSentenceRight(ice.pilots.html4.CSSLayout layout)
public void selectWordLeft(ice.pilots.html4.CSSLayout layout)
layout - instance of CSSLayoutpublic void selectCharLeft(ice.pilots.html4.CSSLayout layout)
layout - public void selectSentenceLeft(ice.pilots.html4.CSSLayout layout)
public String toString()
public DNode getStartContainer()
public DNode getEndContainer()
public int getStartOffset()
public int getEndOffset()
public void select(DNode n1,
int off1,
DNode n2,
int off2,
ice.pilots.html4.CSSLayout layout)
n1 - Starting nodesoff1 - Offset within starting nodesn2 - Ending nodesoff2 - Offset within ending nodeslayout - CSSLayout reference.public boolean isInside(DNode node)
commonAncestor
/ \
node *is node *is outside
/ inside \
startContainer endContainer
node - The node to test
public boolean isInside(ice.pilots.html4.CSSLayout layout,
int xPos,
int yPos,
int scrollX,
int scrollY)
xPos - x position within windowyPos - y position within windowscrollX - Horizontal scroll bar positionscrollY - Vertical scroll bar position
public DElement getSelectionParentNode()
public void defineHighlight(ice.pilots.html4.CSSBox box,
int startIndex,
int endIndex)
box - The CSSBox to mark.startIndex - endIndex - clearHighlights()public void clearHighlights()
public void postSelectedToClipboard(ice.pilots.html4.CSSLayout layout)
layout - reference to CSSLayout
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||