zinger.bsheet
Class CellFormatEditor

java.lang.Object
  extended by zinger.bsheet.DialogEditor
      extended by zinger.bsheet.CellFormatEditor
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class CellFormatEditor
extends DialogEditor

Format picker used for cell and column formatting. A Format object is created using its class and a format pattern string. Therefore Format implementations used must

The area of format editing is going to be readdressed in the near future to be more compatible with the Java Beans-based persistance logic and to allow easy custom formatting definitions.

Author:
Alexey Zinger (inline_four@yahoo.com)

Field Summary
protected static java.lang.Class[] DEFAULT_FORMAT_CLASSES
           
protected  java.lang.Class[] formatClasses
           
protected  javax.swing.JComboBox formatPattern
           
protected  javax.swing.JComboBox formatType
           
protected static java.lang.Class[] NO_PARAMS_SIGNATURE
           
protected static java.lang.Class[] PATTERN_FORMAT_CONSTRUCTOR_SIGNATURE
           
 
Fields inherited from class zinger.bsheet.DialogEditor
acceptButton, acceptCommand, acceptLabel, cancelButton, cancelCommand, cancelLabel, cellEditCommand, changesAccepted, colEditCommand, dialog, dialogTitle, lock, table
 
Constructor Summary
CellFormatEditor(javax.swing.JTable table)
          Uses DEFAULT_FORMAT_CLASSES to call CellFormatEditor(JTable, Class[]).
CellFormatEditor(javax.swing.JTable table, java.lang.Class[] formatClasses)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ev)
           
 java.text.Format askFormat(java.text.Format format)
          Pops up a format editor dialog window.
protected  void createDialog()
           
protected  java.text.Format createFormat(int formatIndex, java.lang.String formatPattern)
           
protected  void editCells()
          Uses askFormat(Format) to pick a format and apply it to selected cells.
protected  void editColumns()
          Uses askFormat(Format) to pick a format and apply it to selected columns.
protected  java.lang.String getFormatLabel(int formatIndex)
           
protected  void populateFromFormat(java.text.Format format)
           
protected  void refreshFormatPattern()
           
 
Methods inherited from class zinger.bsheet.DialogEditor
buildButtonPanel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_FORMAT_CONSTRUCTOR_SIGNATURE

protected static final java.lang.Class[] PATTERN_FORMAT_CONSTRUCTOR_SIGNATURE

NO_PARAMS_SIGNATURE

protected static final java.lang.Class[] NO_PARAMS_SIGNATURE

DEFAULT_FORMAT_CLASSES

protected static final java.lang.Class[] DEFAULT_FORMAT_CLASSES

formatType

protected javax.swing.JComboBox formatType

formatPattern

protected javax.swing.JComboBox formatPattern

formatClasses

protected final java.lang.Class[] formatClasses
Constructor Detail

CellFormatEditor

public CellFormatEditor(javax.swing.JTable table)
Uses DEFAULT_FORMAT_CLASSES to call CellFormatEditor(JTable, Class[]).

See Also:
DEFAULT_FORMAT_CLASSES

CellFormatEditor

public CellFormatEditor(javax.swing.JTable table,
                        java.lang.Class[] formatClasses)
Method Detail

editColumns

protected void editColumns()
Uses askFormat(Format) to pick a format and apply it to selected columns.

Specified by:
editColumns in class DialogEditor
See Also:
askFormat(java.text.Format)

editCells

protected void editCells()
Uses askFormat(Format) to pick a format and apply it to selected cells.

Specified by:
editCells in class DialogEditor
See Also:
askFormat(java.text.Format)

askFormat

public java.text.Format askFormat(java.text.Format format)
Pops up a format editor dialog window. Upon closing of the dialog window, a Format object is created if the dialog was accepted.

See Also:
createFormat(int, java.lang.String)

createFormat

protected java.text.Format createFormat(int formatIndex,
                                        java.lang.String formatPattern)

populateFromFormat

protected void populateFromFormat(java.text.Format format)

getFormatLabel

protected java.lang.String getFormatLabel(int formatIndex)

createDialog

protected void createDialog()
Overrides:
createDialog in class DialogEditor

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class DialogEditor

refreshFormatPattern

protected void refreshFormatPattern()