View Javadoc

1   /*
2    *  File: CellEditorBase.java 
3    *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of the Common Public License v1.0
8    * which accompanies this distribution, and is available at
9    * http://www.eclipse.org/legal/cpl-v10.html
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   * Abstract base implementation for ICellEditors for the jaret table.
22   * 
23   * @author Peter Kliem
24   * @version $Id: CellEditorBase.java 179 2007-01-07 17:37:50Z olk $
25   */
26  public abstract class CellEditorBase implements ICellEditor {
27  
28      /*** member storing the last requested row. */
29      protected IRow _row;
30      /*** member storing the last requested column. */
31      protected IColumn _column;
32      /*** member storing the requesting table. */
33      protected JaretTable _table;
34  
35      /***
36       * {@inheritDoc} Base implementation storing the table and row/col information.
37       */
38      public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) {
39          _table = table;
40          _row = row;
41          _column = column;
42  
43          return null;
44      }
45  
46      /***
47       * {@inheritDoc}
48       */
49      public void dispose() {
50          // help the garbage collector
51          _table = null;
52          _column = null;
53          _row = null;
54  
55      }
56  
57      /***
58       * {@inheritDoc} default will always return -1.
59       */
60      public int getPreferredHeight() {
61          return -1;
62      }
63  
64      /***
65       * {@inheritDoc}
66       */
67      public boolean handleClick(JaretTable table, IRow row, IColumn column, Rectangle drawingArea, int x, int y) {
68          // no action on single click
69          return false;
70      }
71  
72  }