de.jaret.util.ui.table.strategies
Class DefaultCCPStrategy

java.lang.Object
  extended by de.jaret.util.ui.table.strategies.DefaultCCPStrategy
All Implemented Interfaces:
ICCPStrategy

public class DefaultCCPStrategy
extends java.lang.Object
implements ICCPStrategy

Default implementation for cut, copy, paste. See the the description of the methods for details. The implementation is not yet perfect. It uses "brutal" String conversions. May be it would best to introduce converter services in the table model (optional) or use methods in renderers or editors for conversion.

Version:
$Id: DefaultCCPStrategy.java 385 2007-04-29 20:31:49Z olk $
Author:
Peter Kliem

Constructor Summary
DefaultCCPStrategy()
           
 
Method Summary
 void copy(JaretTable table)
          Do the copy operation using the constant COPY_DELIMITER.
 void cut(JaretTable table)
          Do the cut operation.
protected  void cutOrCopy(JaretTable table, boolean cut)
          Do the actual copy or cut operation.
 void dispose()
          If there is something to dispose ... most probably the clipboard instance.
protected  void emptyCell(IJaretTableCell cell)
          Empty the given cell.
 boolean getIncludeHeadersInCopy()
          Retrieve the state of header include in the copied content.
 void paste(JaretTable table)
          Paste pastes textual context starting at the focussed cell (does not use the selection by now).
 void setIncludeHeadersInCopy(boolean includeHeadersInCopy)
          Set includeHeaders: if set to true in copy and cut context the headline (=col headers) labels will be included.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCCPStrategy

public DefaultCCPStrategy()
Method Detail

dispose

public void dispose()
If there is something to dispose ... most probably the clipboard instance.

Specified by:
dispose in interface ICCPStrategy

copy

public void copy(JaretTable table)
Do the copy operation using the constant COPY_DELIMITER. Empty lines will be omitted, missing cels will be empty.

Specified by:
copy in interface ICCPStrategy
Parameters:
table - jaret table the operation is invoked on

cut

public void cut(JaretTable table)
Do the cut operation. Basicly a a copy and a empty operation.

Specified by:
cut in interface ICCPStrategy
Parameters:
table - jaret table the operation is invoked on

cutOrCopy

protected void cutOrCopy(JaretTable table,
                         boolean cut)
Do the actual copy or cut operation.

Parameters:
table - table
cut - if set to true cells we be emptied

emptyCell

protected void emptyCell(IJaretTableCell cell)
Empty the given cell. First try null, if an exception is thrown by the modell try the empty string.

Parameters:
cell - cell to be emptied

paste

public void paste(JaretTable table)
Paste pastes textual context starting at the focussed cell (does not use the selection by now). Uses TAB and semicolon as delimiters (Excel uses TAB, semicolon for pasting csv).

Specified by:
paste in interface ICCPStrategy
Parameters:
table - the jaret table

getIncludeHeadersInCopy

public boolean getIncludeHeadersInCopy()
Retrieve the state of header include in the copied content.

Returns:
the includeHeadersInCopy

setIncludeHeadersInCopy

public void setIncludeHeadersInCopy(boolean includeHeadersInCopy)
Set includeHeaders: if set to true in copy and cut context the headline (=col headers) labels will be included.

Parameters:
includeHeadersInCopy - the includeHeadersInCopy to set


Copyright © 2012. All Rights Reserved.