org.tbee.swing.jpa
Class JpaEntityTableCellEditor<T>

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by org.tbee.swing.jpa.JpaEntityTableCellEditor<T>
All Implemented Interfaces:
java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor, UseTableCellEditorAsTableCellRenderer.UseAsRenderer

public abstract class JpaEntityTableCellEditor<T>
extends javax.swing.AbstractCellEditor
implements javax.swing.table.TableCellEditor, UseTableCellEditorAsTableCellRenderer.UseAsRenderer

The class edits a boolean value using a checkbox (improves visualisation)

Version:
$Revision: 1.1 $
Author:
$Author: toeukpap $
See Also:
, Serialized Form

Field Summary
protected  javax.swing.JTextField iDescriptionTextfield
           
protected  javax.swing.JPanel iJPanel
           
protected  javax.swing.JTextField iKeyTextfield
           
protected  ImageButton iLinkbutton
           
protected  ImageButton iSearchButton
           
static org.apache.log4j.Logger log4j
           
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
JpaEntityTableCellEditor()
          Initialize the editor
JpaEntityTableCellEditor(boolean showDescription)
          Initialize the editor
JpaEntityTableCellEditor(boolean showDescription, int keyfieldLength)
          Initialize the editor
 
Method Summary
protected  java.util.List<T> findAllPossibleEntities()
           
protected abstract  T findEntity()
           
 java.lang.Object getCellEditorValue()
          Return the value after the editor is done
 boolean getEditable()
          disable the contents
protected abstract  java.lang.Class getEntityClass()
           
protected abstract  java.lang.String getEntityName()
           
 javax.swing.ListCellRenderer getListCellRenderer()
          ListCellRenderer
 boolean getShowLink()
          ShowLink
 boolean getShowSearch()
          ShowSearch
 java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column)
          Return the component that is shown in the cell in the table.
protected  void search()
           
 void setEditable(boolean value)
           
 void setListCellRenderer(javax.swing.ListCellRenderer value)
           
 void setShowLink(boolean value)
           
 void setShowSearch(boolean value)
           
 boolean stopCellEditing()
          validate and return false if it failed
protected abstract  void updateFields(T entity)
          optionally
 JpaEntityTableCellEditor useAsRenderer()
          Makes the textfields transparent so the alternating coloring of the rows becomes visible (when used as renderer by UseTableCellEditorAsTableCellRenderer)
 JpaEntityTableCellEditor<T> withEditable(boolean value)
           
 JpaEntityTableCellEditor<T> withListCellRenderer(javax.swing.ListCellRenderer value)
           
 JpaEntityTableCellEditor<T> withShowLink(boolean value)
           
 JpaEntityTableCellEditor<T> withShowSearch(boolean value)
           
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.CellEditor
addCellEditorListener, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell
 

Field Detail

SOURCECODE_VERSION

public static final java.lang.String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values

log4j

public static org.apache.log4j.Logger log4j

iJPanel

protected javax.swing.JPanel iJPanel

iKeyTextfield

protected javax.swing.JTextField iKeyTextfield

iDescriptionTextfield

protected javax.swing.JTextField iDescriptionTextfield

iSearchButton

protected ImageButton iSearchButton

iLinkbutton

protected ImageButton iLinkbutton
Constructor Detail

JpaEntityTableCellEditor

public JpaEntityTableCellEditor()
Initialize the editor


JpaEntityTableCellEditor

public JpaEntityTableCellEditor(boolean showDescription)
Initialize the editor


JpaEntityTableCellEditor

public JpaEntityTableCellEditor(boolean showDescription,
                                int keyfieldLength)
Initialize the editor

Method Detail

stopCellEditing

public boolean stopCellEditing()
validate and return false if it failed

Specified by:
stopCellEditing in interface javax.swing.CellEditor
Overrides:
stopCellEditing in class javax.swing.AbstractCellEditor

getCellEditorValue

public java.lang.Object getCellEditorValue()
Return the value after the editor is done

Specified by:
getCellEditorValue in interface javax.swing.CellEditor

getTableCellEditorComponent

public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
                                                      java.lang.Object value,
                                                      boolean isSelected,
                                                      int row,
                                                      int column)
Return the component that is shown in the cell in the table.

Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor

useAsRenderer

public JpaEntityTableCellEditor useAsRenderer()
Makes the textfields transparent so the alternating coloring of the rows becomes visible (when used as renderer by UseTableCellEditorAsTableCellRenderer)

Specified by:
useAsRenderer in interface UseTableCellEditorAsTableCellRenderer.UseAsRenderer

search

protected void search()

getListCellRenderer

public javax.swing.ListCellRenderer getListCellRenderer()
ListCellRenderer


setListCellRenderer

public void setListCellRenderer(javax.swing.ListCellRenderer value)

withListCellRenderer

public JpaEntityTableCellEditor<T> withListCellRenderer(javax.swing.ListCellRenderer value)

getShowLink

public boolean getShowLink()
ShowLink


setShowLink

public void setShowLink(boolean value)

withShowLink

public JpaEntityTableCellEditor<T> withShowLink(boolean value)

getShowSearch

public boolean getShowSearch()
ShowSearch


setShowSearch

public void setShowSearch(boolean value)

withShowSearch

public JpaEntityTableCellEditor<T> withShowSearch(boolean value)

getEditable

public boolean getEditable()
disable the contents


setEditable

public void setEditable(boolean value)

withEditable

public JpaEntityTableCellEditor<T> withEditable(boolean value)

getEntityName

protected abstract java.lang.String getEntityName()

getEntityClass

protected abstract java.lang.Class getEntityClass()

findEntity

protected abstract T findEntity()

findAllPossibleEntities

protected java.util.List<T> findAllPossibleEntities()

updateFields

protected abstract void updateFields(T entity)
optionally



Copyright © 2010. All Rights Reserved.