1
2
3
4
5
6
7
8
9
10
11 package de.jaret.util.ui.table.editor;
12
13 import org.eclipse.swt.graphics.Rectangle;
14 import org.eclipse.swt.widgets.Control;
15
16 import de.jaret.util.ui.table.JaretTable;
17 import de.jaret.util.ui.table.model.IColumn;
18 import de.jaret.util.ui.table.model.IRow;
19
20 /***
21 * Interface for a cell editor to be used in the jaret table.
22 *
23 * @author Peter Kliem
24 * @version $Id: ICellEditor.java 179 2007-01-07 17:37:50Z olk $
25 */
26 public interface ICellEditor {
27 /***
28 * Provide the Control for editing the value at row/column. <b>Important:</b> make shure _not_ to create a new
29 * control with every call!
30 * <p>
31 * This method may return <code>null</code> indicating that the editor will not supply a control.
32 * </p>
33 *
34 * @param table the table requesting the editor
35 * @param row row
36 * @param column column
37 * @param typedKey the character typed when invoking the editor (may be 0 if the editor was invoked without typing
38 * any key)
39 * @return configured Control (parent has to be the table)
40 */
41 Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey);
42
43 /***
44 * End editing.
45 *
46 * @param storeInput if true the editor shall save the current input.
47 */
48 void stopEditing(boolean storeInput);
49
50 /***
51 * Handle a click on the cell. This could handle the whole edit for single click editors. The return value controls
52 * whether the click will be used for regular selection after handling.
53 *
54 * @param table the jaret table calling
55 * @param row row
56 * @param column column
57 * @param drawingArea the rectangle of the cell
58 * @param x clicked coordinate x
59 * @param y clicked coordinate y
60 * @return true if the click has been handled
61 */
62 boolean handleClick(JaretTable table, IRow row, IColumn column, Rectangle drawingArea, int x, int y);
63
64 /***
65 * Dispose whatever resouces have been allocated.
66 *
67 */
68 void dispose();
69
70 /***
71 * If the renderer *wishes* to be sized not the height of the cell, this method may be used to announce the
72 * preferred height of the control. A value of -1 signals no preference.
73 *
74 * @return preferred height or -1 for no preference.
75 */
76 int getPreferredHeight();
77 }