Multivalent API

multivalent.std
Class TableSort

java.lang.Object
  extended by multivalent.VObject
      extended by multivalent.Behavior
          extended by multivalent.std.TableSort

public class TableSort
extends Behavior

Sort structural table at given column, heuristically determining data type. Assume HTML/CALS-style table (row major; TABLE tag with THEAD, TBODYs, and TFOOT as children, and TRs as their children). Relies on HTML parser normalizing table by filling in cells not explicit in rowspan or colspan, though painting and formatting will still be weird if these are around. Unlike most behaviors, which work on all document types, TableSort works only on flowed documents.

To do: generalize to range of lines, as tables aren't used for tabular information much, as least in HTML.

Version:
$Revision: 1.3 $ $Date: 2003/06/02 06:00:49 $

Field Summary
static java.lang.String MSG_ASCENDING
          Sort table in ascending order.
static java.lang.String MSG_DESCENDING
          Sort table in descending order.
static java.lang.String MSG_SORT
          Sort table in ascending order, or reverse order if already sorted in ascending order.
 
Fields inherited from class multivalent.Behavior
ATTR_BEHAVIOR, name_
 
Fields inherited from class multivalent.VObject
attr_
 
Constructor Summary
TableSort()
           
 
Method Summary
 boolean semanticEventAfter(SemanticEvent se, java.lang.String msg)
          Round robin distribution to all behaviors.
 boolean semanticEventBefore(SemanticEvent se, java.lang.String msg)
          Since not all man page references are recognizable as such, have docpopup choice to treat current word as man page ref.
 void sortTable(java.lang.Object colin, int direction)
           
 
Methods inherited from class multivalent.Behavior
buildAfter, buildBefore, checkRep, clipboardAfter, clipboardBefore, createUI, destroy, eventAfter, eventBefore, formatAfter, formatBefore, getBrowser, getDocument, getInstance, getInstance, getLayer, getLogger, getName, getPreference, getRoot, isEditable, paintAfter, paintBefore, putPreference, redo, restore, restoreChildren, save, setName, toString, undo
 
Methods inherited from class multivalent.VObject
attrEntrySetIterator, attrKeysIterator, clearAttributes, getAttr, getAttr, getAttributes, getGlobal, getValue, hasAttributes, putAttr, removeAttr, setAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MSG_SORT

public static final java.lang.String MSG_SORT
Sort table in ascending order, or reverse order if already sorted in ascending order.

"tableSort": arg= Node column-to-sort

See Also:
Constant Field Values

MSG_ASCENDING

public static final java.lang.String MSG_ASCENDING
Sort table in ascending order.

"tableSortAscending": arg= Node column-to-sort

See Also:
Constant Field Values

MSG_DESCENDING

public static final java.lang.String MSG_DESCENDING
Sort table in descending order.

"tableSortDescending": arg= Node column-to-sort

See Also:
Constant Field Values
Constructor Detail

TableSort

public TableSort()
Method Detail

semanticEventBefore

public boolean semanticEventBefore(SemanticEvent se,
                                   java.lang.String msg)
Since not all man page references are recognizable as such, have docpopup choice to treat current word as man page ref.

Overrides:
semanticEventBefore in class Behavior

semanticEventAfter

public boolean semanticEventAfter(SemanticEvent se,
                                  java.lang.String msg)
Description copied from class: Behavior
Round robin distribution to all behaviors. Message and clientData unpacked from SemanticEvent for convenience. Message is interned, so if you compare to a literal, you can use "==". Message can't be changed (it can be short-circuited out of), but client data can be mutated as it is passed along (so it's not passed as a parameter).

Overrides:
semanticEventAfter in class Behavior

sortTable

public void sortTable(java.lang.Object colin,
                      int direction)
Parameters:
colin - some node within column to sort
direction: - -1=descending order, 1=ascending order, 0=ascending but descending if already in ascending.

Multivalent API