|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectquick.dbtable.DBTableCellEditor
Cell editor for image, checkbox, radiobutton, combo box, text field
DBTable.setCellComponent(Column, int, Hashtable),
Serialized Form| Constructor Summary | |
DBTableCellEditor(CellComponent cc,
DBTable dBTable)
Deprecated. This constructor should not be directly used, instead use the setCellComponent method in DBTable. |
|
DBTableCellEditor(int cellType,
java.util.Hashtable cellValueToDisplayHashtable,
DBTable dBTable)
Deprecated. This constructor should not be directly used, instead use the setCellComponent method in DBTable. |
|
DBTableCellEditor(int cellType,
java.util.Hashtable cellValueToDisplayHashtable,
DBTable dBTable,
boolean addClearOption)
Deprecated. |
|
DBTableCellEditor(int cellType,
java.util.Hashtable cellValueToDisplayHashtable,
java.lang.Object[] keysSortOrder,
DBTable dBTable,
boolean addClearOption)
Deprecated. |
|
DBTableCellEditor(javax.swing.JComboBox jc,
DBTable dBTable)
Deprecated. This constructor should not be directly used, instead use the setCellComponent method in DBTable. |
|
DBTableCellEditor(javax.swing.JTextArea jt,
DBTable dBTable)
Deprecated. This constructor should not be directly used, instead use the setCellComponent method in DBTable. |
|
DBTableCellEditor(javax.swing.JTextField jt,
DBTable dBTable)
Deprecated. This constructor should not be directly used, instead use the setCellComponent method in DBTable. |
|
| Method Summary | |
void |
addCellEditorListener(javax.swing.event.CellEditorListener l)
Deprecated. |
void |
cancelCellEditing()
Deprecated. |
java.lang.Object |
convertDisplayToActual(java.lang.Object input)
Deprecated. |
java.lang.Object |
getCellEditorValue()
Deprecated. |
int |
getCellType()
Deprecated. |
int |
getClickCountToStart()
Deprecated. ClickCountToStart controls the number of clicks required to start editing. |
java.awt.Component |
getComponent()
Deprecated. Returns the a reference to the editor component. |
java.awt.Component |
getSecondaryEditorComponent()
Deprecated. |
java.awt.Component |
getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
Deprecated. |
boolean |
isCellEditable(java.util.EventObject anEvent)
Deprecated. |
void |
removeCellEditorListener(javax.swing.event.CellEditorListener l)
Deprecated. |
void |
setClickCountToStart(int count)
Deprecated. Specifies the number of clicks needed to start editing. |
boolean |
shouldSelectCell(java.util.EventObject anEvent)
Deprecated. |
boolean |
stopCellEditing()
Deprecated. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DBTableCellEditor(javax.swing.JTextField jt,
DBTable dBTable)
editor properties like color, font, alignmnet etc are decided by the
cellproperties model of the quicktable
example
yourQuickTable.getColumn(1).setCellEditor( new DBTableCellEditor(yourTextField, yourQuickTable));
Its not advisable to use this class or method directly, try to use the
setCellComponent(Column c, int cellType, Hashtable cellValueToDisplayHash)
method in DBTable, because that method sets both the celleditor & cell renderer,
so both will be in sync. see DBTable#setCellComponent(Column , int , Hashtable)
If you are a experienced programmer and if you know what you are doing, you can use this.
jt - textfield which should be used as editordBTable - quicktable in which this cell is usedDBTable.setCellComponent(Column , int , Hashtable)
public DBTableCellEditor(javax.swing.JTextArea jt,
DBTable dBTable)
editor properties like color, font, alignmnet etc are decided by the
cellproperties model of the quicktable
example
yourQuickTable.getColumn(1).setCellEditor( new DBTableCellEditor(yourTextArea, yourQuickTable));
Its not advisable to use this class or method directly, try to use the
setCellComponent(Column c, int cellType, Hashtable cellValueToDisplayHash)
method in DBTable, because that method sets both the celleditor & cell renderer,
so both will be in sync. see DBTable#setCellComponent(Column , int , Hashtable)
If you are a experienced programmer and if you know what you are doing, you can use this.
jt - textarea which should be used as editordBTable - quicktable in which this cell is usedDBTable.setCellComponent(Column , int , Hashtable)
public DBTableCellEditor(CellComponent cc,
DBTable dBTable)
editor properties like color, font, alignmnet etc are decided by the cellproperties model of the quicktable Its not advisable to use this class or method directly, use Column#setUserCellEditor(CellComponent)
cc - CellComponent should be used as editordBTable - quicktable in which this cell is usedDBTable.setCellComponent(Column , int , Hashtable)
public DBTableCellEditor(javax.swing.JComboBox jc,
DBTable dBTable)
editor properties like color, font, alignmnet etc are decided by the
cellproperties model of the quicktable
example
JComboBox yourComboBox = new JComboBox();
yourComboBox.addItem("A");
yourComboBox.addItem("D");
yourComboBox.addItem("L");
yourQuickTable.getColumn(1).setCellEditor( new DBTableCellEditor(yourComboBox, yourQuickTable));
In the above case database values "A", "D","L" & combo box listed values are same
but sometimes the database values "A", "D" are diffrenet from the combo box listed
values "Alive","Dead" ,in that case, use the other constructor
see #DBTableCellEditor(int, Hashtable, DBTable)
with Column.COMBOBOX_CELL as cellType and passing the hash of database values
to listed values
Its not advisable to use this class directly, try to use the
setCellComponent(Column c, int cellType, Hashtable cellValueToDisplayHash) method
in DBTable, because that method sets both the celleditor & cell renderer, so both
will be in sync. @see DBTable#setCellComponent(Column , int , Hashtable)
If you are a experienced programmer and if you know what you are doing, you can use this.
jc - comboBox which should be used as editordBTable - quicktable in which this cell is usedDBTable.setCellComponent(Column , int , Hashtable)
public DBTableCellEditor(int cellType,
java.util.Hashtable cellValueToDisplayHashtable,
DBTable dBTable)
Currently QuickTable supports the following components
Icon, CheckBox, RadioButton, ComboBox.
Its not advisable to use this class directly, try to use the
setCellComponent(Column c, int cellType, Hashtable cellValueToDisplayHash) method
in DBTable, because that method sets both the celleditor & cell renderer, so both
will be in sync. @see DBTable#setCellComponent(Column , int , Hashtable)
If you are a experienced programmer and if you know what you are doing, you can use this.
Setting Icon Editor
Icon editor displays a list of icons in a combobox, user can select one of the icon from combo box
set the celltype argument as Column.IMAGE_CELL
set the cellValueToDisplayHash to hashtable which contains a mapping of actual cell data
to the icon that need to be displayed
For example, lets say the database contains "A" for employee alive, "D" for employee dead
and "L" for employee on Leave and you have three gif files to represent these states alive.gif, dead.gif, leave.gif
Hashtable imageHash = new Hashtable();
imageHash.put("A",new ImageIcon(this.getClass().getResource("images/alive.gif")));
imageHash.put("D",new ImageIcon(this.getClass().getResource("images/dead.gif")));
imageHash.put("L",new ImageIcon(this.getClass().getResource("images/leave.gif")));
//Note: make sure you have the images directory in classpath
yourQuickTable.getColumn(1).setCellEditor( new DBTableCellEditor(Column.IMAGE_CELL, imageHash, yourQuickTable));
Checkbox editor
checkbox editor displayes a checkbox, user will be able to edit the check box by
checking or unchecking
set the celltype argument as Column.CHECKBOX_CELL
set the cellValueToDisplayHash to hashtable which contains a mapping of actual cell data to the
checkbox selection state
For example, lets say the database contains "A" for employee alive, "D" for employee dead
and if you want to set the checkbox selected when "A" and unselected when "D"
Hashtable checkHash = new Hashtable();
checkHash.put("A",new Boolean(true));
checkHash.put("D",new Boolean(false));
yourQuickTable.getColumn(1).setCellEditor( new DBTableCellEditor(Column.CHECKBOX_CELL, checkHash, yourQuickTable));
radiobutton editor
radiobutton editor displayes a radiobutton, user will be able to edit the radiobutton by selecting or deselecting
set the celltype argument as Column.RADIOBUTTON_CELL
set the cellValueToDisplayHash to hashtable which contains a mapping of actual cell data to the
checkbox selection state
For example, lets say the database contains "A" for employee alive, "D" for employee dead
and if you want to set the radiobutton selected when "A" and unselected when "D"
Hashtable radioHash = new Hashtable();
radioHash.put("A",new Boolean(true));
radioHash.put("D",new Boolean(false));
yourQuickTable.getColumn(1).setCellEditor( new DBTableCellEditor(Column.RADIOBUTTON_CELL, radioHash, yourQuickTable));
comboBox editor
combox editor displayes a list of values in a combo box where user can select a value
For example, lets say the database contains "A" for employee alive, "D" for employee dead
and if you want to show "Alive" instead of "A" in the combo box list and "Dead" instead of "D"
Hashtable comboHash = new Hashtable();
comboHash.put("A","Alive");
comboHash.put("D","Dead");
yourQuickTable.getColumn(1).setCellEditor( new DBTableCellEditor(Column.COMBOBOX_CELL, comboHash, yourQuickTable));
In the above case the database values "A", "D" are diffrenet from the combo box listed values "Alive","Dead".
But in some cases database values & combo box listed values are same in that case, use the other constructor @see #DBTableCellEditor(JComboBox, CellPropertiesModel)
To create a combo box editor which contains the listed items from a Sql query use
yourQuickTable.getColumn(1).setBoundSql("select distinct status from employee:);
Date editor
Date editor displays a calendar from which the user can select a date
You have to pass the string date format in which you want the date to be displayed
Example
Hashtable datePatternHash = new Hashtable();
datePatternHash.put("pattern","DD-MM-YYYY");
yourQuickTable.getColumn(1).setCellEditor( new DBTableCellEditor(Column.DATE_CELL, datePatternHash, yourQuickTable));
cellType - Any one of Column.IMAGE_CELL or Column.CHECKBOX_CELL or Column.RADIOBUTTON_CELL or Column.COMBOBOX_CELL or Column.DATE_CELLcellValueToDisplayHashtable - hashtable which contains a mapping of actual cell data to the display datadBTable - quicktable in which this cell is usedColumn.setDateFormat(String),
DBTable.setCellComponent(Column , int , Hashtable)
public DBTableCellEditor(int cellType,
java.util.Hashtable cellValueToDisplayHashtable,
DBTable dBTable,
boolean addClearOption)
public DBTableCellEditor(int cellType,
java.util.Hashtable cellValueToDisplayHashtable,
java.lang.Object[] keysSortOrder,
DBTable dBTable,
boolean addClearOption)
| Method Detail |
public int getCellType()
public java.awt.Component getComponent()
public java.awt.Component getSecondaryEditorComponent()
public void setClickCountToStart(int count)
count - an int specifying the number of clicks needed to start editinggetClickCountToStart()public int getClickCountToStart()
public java.lang.Object getCellEditorValue()
getCellEditorValue in interface javax.swing.CellEditorpublic boolean isCellEditable(java.util.EventObject anEvent)
isCellEditable in interface javax.swing.CellEditorpublic boolean shouldSelectCell(java.util.EventObject anEvent)
shouldSelectCell in interface javax.swing.CellEditorpublic boolean stopCellEditing()
stopCellEditing in interface javax.swing.CellEditorpublic void cancelCellEditing()
cancelCellEditing in interface javax.swing.CellEditorpublic java.lang.Object convertDisplayToActual(java.lang.Object input)
public void addCellEditorListener(javax.swing.event.CellEditorListener l)
addCellEditorListener in interface javax.swing.CellEditorpublic void removeCellEditorListener(javax.swing.event.CellEditorListener l)
removeCellEditorListener in interface javax.swing.CellEditor
public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||