uk.apl.jxc.tools
Class XMLSchemaItemCellEditor

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by uk.apl.jxc.tools.XMLSchemaItemCellEditor
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.util.EventListener, javax.swing.CellEditor, javax.swing.table.TableCellEditor

public class XMLSchemaItemCellEditor
extends javax.swing.AbstractCellEditor
implements java.awt.event.ActionListener, javax.swing.table.TableCellEditor

A table cell editor that allows user to enter input for XPath queries. It allows input to be typed and nodes to be selected from an XMLSchemaItemSelectorUI.

Author:
Andrew
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
XMLSchemaItemCellEditor(java.awt.Dialog parent, java.lang.String title, java.lang.Object[] items)
          Constructs a new XMLSchemaItemCellEditor using a JComboBox as the input component.
XMLSchemaItemCellEditor(java.awt.Frame parent, java.lang.String title)
          Constructs a new XMLSchemaItemCellEditor using a JTextField as the input component.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 java.lang.Object getCellEditorValue()
          Returns the user input entered into the cell editor component.
 java.awt.Component getComponent()
          Returns the cell editor component.
 java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int rowIndex, int vColIndex)
          Returns the cell editor component.
 void setSchema(XMLSchema schema, java.lang.String rootElement)
          Sets the XMLSchema that the user may select nodes as input from
static java.lang.String showInputDialog(javax.swing.JDialog parent, java.lang.Object[] items, XMLSchema schema, java.lang.String rootElement, java.lang.String title, java.lang.String prompt)
          Shows the cell editor component in a modal dialog for capturing user input outside of a JTable.
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing
 
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, stopCellEditing
 

Constructor Detail

XMLSchemaItemCellEditor

public XMLSchemaItemCellEditor(java.awt.Frame parent,
                               java.lang.String title)
Constructs a new XMLSchemaItemCellEditor using a JTextField as the input component.

Parameters:
parent - the parent frame
title - a title for the XMLSchema selector dialog

XMLSchemaItemCellEditor

public XMLSchemaItemCellEditor(java.awt.Dialog parent,
                               java.lang.String title,
                               java.lang.Object[] items)
Constructs a new XMLSchemaItemCellEditor using a JComboBox as the input component.

Parameters:
parent - the parent dialog
title - a title for the XMLSchema selector dialog
items - options for the cell editors combo box
Method Detail

setSchema

public void setSchema(XMLSchema schema,
                      java.lang.String rootElement)
Sets the XMLSchema that the user may select nodes as input from

Parameters:
schema - an XMLSchema from which nodes may be selected
rootElement - the highest node that may be selected from the schema

getComponent

public java.awt.Component getComponent()
Returns the cell editor component.

Returns:
the cell editor component

getTableCellEditorComponent

public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
                                                      java.lang.Object value,
                                                      boolean isSelected,
                                                      int rowIndex,
                                                      int vColIndex)
Returns the cell editor component.

Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor
Parameters:
table -
value -
isSelected -
rowIndex -
vColIndex -
Returns:
the cell editor component

getCellEditorValue

public java.lang.Object getCellEditorValue()
Returns the user input entered into the cell editor component.

Specified by:
getCellEditorValue in interface javax.swing.CellEditor
Returns:
user input entered

actionPerformed

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

showInputDialog

public static java.lang.String showInputDialog(javax.swing.JDialog parent,
                                               java.lang.Object[] items,
                                               XMLSchema schema,
                                               java.lang.String rootElement,
                                               java.lang.String title,
                                               java.lang.String prompt)
Shows the cell editor component in a modal dialog for capturing user input outside of a JTable.

Parameters:
parent - the parent dialog
items - options for the cell editors combo box
schema - an XMLSchema from which nodes may be selected
rootElement - the highest node that may be selected from the schema
title - a title for the modal dialog
prompt - a message to prompt the user for input
Returns:
the user input


Copyright 2010 Andrew Leigh. All Rights Reserved.