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:
Serializable, CellEditor, TableCellEditor, UseTableCellEditorAsTableCellRenderer.UseAsRenderer

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

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

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

Field Summary
protected  JTextField iDescriptionTextfield
           
protected  JPanel iJPanel
           
protected  JTextField iKeyTextfield
           
protected  ImageButton iLinkbutton
           
protected  ImageButton iSearchButton
           
static org.apache.log4j.Logger log4j
           
static 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  List<T> findAllPossibleEntities()
           
protected abstract  T findEntity()
           
 Object getCellEditorValue()
          Return the value after the editor is done
 boolean getEditable()
          disable the contents
protected abstract  Class getEntityClass()
           
protected abstract  String getEntityName()
           
 boolean getErrorWhenNothingFound()
          ErrorWhenNothingFound
 ListCellRenderer getListCellRenderer()
          ListCellRenderer
 boolean getShowLink()
          ShowLink
 boolean getShowSearch()
          ShowSearch
 Component getTableCellEditorComponent(JTable table, 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 setErrorWhenNothingFound(boolean value)
           
 void setListCellRenderer(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> withErrorWhenNothingFound(boolean value)
           
 JpaEntityTableCellEditor<T> withListCellRenderer(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 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 JPanel iJPanel

iKeyTextfield

protected JTextField iKeyTextfield

iDescriptionTextfield

protected 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 CellEditor
Overrides:
stopCellEditing in class AbstractCellEditor

getCellEditorValue

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

Specified by:
getCellEditorValue in interface CellEditor

getTableCellEditorComponent

public Component getTableCellEditorComponent(JTable table,
                                             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 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 ListCellRenderer getListCellRenderer()
ListCellRenderer


setListCellRenderer

public void setListCellRenderer(ListCellRenderer value)

withListCellRenderer

public JpaEntityTableCellEditor<T> withListCellRenderer(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)

getErrorWhenNothingFound

public boolean getErrorWhenNothingFound()
ErrorWhenNothingFound


setErrorWhenNothingFound

public void setErrorWhenNothingFound(boolean value)

withErrorWhenNothingFound

public JpaEntityTableCellEditor<T> withErrorWhenNothingFound(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 String getEntityName()

getEntityClass

protected abstract Class getEntityClass()

findEntity

protected abstract T findEntity()

findAllPossibleEntities

protected List<T> findAllPossibleEntities()

updateFields

protected abstract void updateFields(T entity)
optionally



Copyright © 2011 KnowledgePlaza. All Rights Reserved.