edu.udo.cs.yale.gui.attributeeditor
Class AttributeEditor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by edu.udo.cs.yale.gui.attributeeditor.AttributeEditor
All Implemented Interfaces:
DataControlListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.Scrollable

public class AttributeEditor
extends javax.swing.JTable
implements java.awt.event.MouseListener, DataControlListener

A table for creating an attribute description file. Data can be read from files as single columns or as a value series. The value types are guessed and can be edited by the user.

Version:
$Id: AttributeEditor.java,v 1.12 2006/09/30 00:05:31 ingomierswa Exp $
Author:
Simon Fischer, Ingo Mierswa
See Also:
Serialized Form

Nested Class Summary
private  class AttributeEditor.AttributeTableModel
           
private  class AttributeEditor.DataCellRenderer
           
private  class AttributeEditor.GuessAllTypesAction
           
private  class AttributeEditor.GuessTypeAction
           
private  class AttributeEditor.RemoveColumnAction
           
private  class AttributeEditor.RemoveRowAction
           
private  class AttributeEditor.UseRowAsNamesAction
           
 
Nested classes/interfaces inherited from class javax.swing.JTable
javax.swing.JTable.AccessibleJTable, javax.swing.JTable.PrintMode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private static int BLOCK_NUMBER_ROW
           
private static int BLOCK_TYPE_ROW
           
private  CellEditors cellEditors
           
private  CellRenderers cellRenderers
           
private static int COLUMN_WIDTH
           
private  boolean dataChanged
           
private  java.util.Vector<java.util.Vector<java.lang.String>> dataColumnVector
           
private  DataControl dataControl
           
private  javax.swing.table.TableCellRenderer dataRenderer
           
private  Operator exampleSource
           
private  java.io.File file
           
private  int firstColumn
           
private  int firstRow
           
protected  javax.swing.Action GUESS_ALL_TYPES_ACTION
           
protected  javax.swing.Action GUESS_TYPE_ACTION
           
private  int lastColumn
           
private  int lastRow
           
static int LOAD_DATA
           
static int LOAD_SERIES_DATA
           
private  boolean metaDataChanged
           
private  AttributeEditor.AttributeTableModel model
           
private static int NAME_ROW
           
private static int NUM_OF_HEADER_ROWS
           
protected  javax.swing.Action REMOVE_COLUMN_ACTION
           
protected  javax.swing.Action REMOVE_ROW_ACTION
           
private  int rowCount
           
private static int SEPARATOR_ROW
           
private static long serialVersionUID
           
private  java.util.ArrayList<AttributeDataSource> sourceList
           
private static int TYPE_ROW
           
private static int UNIT_ROW
           
protected  javax.swing.Action USE_ROW_AS_NAMES_ACTION
           
private static int VALUE_TYPE_ROW
           
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AttributeEditor(Operator exampleSource, DataControl dataControl)
           
 
Method Summary
private  void addColumn(java.io.File file, int index, int valueType)
           
private  void autoSetValueType(int column)
           
private  boolean checkData(java.lang.Object value, int row, int column)
           
protected  void clear()
           
 void columnAdded(javax.swing.event.TableColumnModelEvent e)
           
private  void createNewColumn()
           
 javax.swing.JPopupMenu createPopupMenu(int column)
           
private  void ensureAttributeTypeIsUnique(java.lang.String type)
           
private  void evaluatePopup(java.awt.event.MouseEvent e)
           
 javax.swing.table.TableCellEditor getCellEditor(int row, int column)
           
 javax.swing.table.TableCellRenderer getCellRenderer(int row, int column)
           
private  AttributeDataSource getDataSource(int i)
           
private  java.lang.String getDatum(int row, int column)
           
private  int getDefaultMaximumNumber(java.lang.String limitName, int defaultNumber)
           
 java.io.File getFile()
           
 boolean hasDataChanged()
           
 boolean hasMetaDataChanged()
           
 boolean isCellEditable(int row, int col)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void openAttributeFile()
           
 void openAttributeFile(java.io.File file)
           
 void readData(java.io.File file, int dataType)
          Loads data from a file.
 void removeColumn(int column)
           
 void removeRow(int row)
           
 void saveAttributeFile()
           
private  void setDatum(int row, int column, java.lang.String value)
           
private  void update()
          This method should be invoked after data changes.
 void update(int firstRow, int lastRow, int firstColumn, int lastColumn, int what)
          Sets the new view data and fire a table structure changed event.
 void useRowAsNames(int row)
           
 void writeData(java.io.File file)
           
private  void writeXML(java.io.File attFile)
           
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, unconfigureEnclosingScrollPane, updateUI, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

LOAD_DATA

public static final int LOAD_DATA
See Also:
Constant Field Values

LOAD_SERIES_DATA

public static final int LOAD_SERIES_DATA
See Also:
Constant Field Values

COLUMN_WIDTH

private static final int COLUMN_WIDTH
See Also:
Constant Field Values

REMOVE_COLUMN_ACTION

protected javax.swing.Action REMOVE_COLUMN_ACTION

REMOVE_ROW_ACTION

protected javax.swing.Action REMOVE_ROW_ACTION

USE_ROW_AS_NAMES_ACTION

protected javax.swing.Action USE_ROW_AS_NAMES_ACTION

GUESS_TYPE_ACTION

protected javax.swing.Action GUESS_TYPE_ACTION

GUESS_ALL_TYPES_ACTION

protected javax.swing.Action GUESS_ALL_TYPES_ACTION

NAME_ROW

private static final int NAME_ROW
See Also:
Constant Field Values

TYPE_ROW

private static final int TYPE_ROW
See Also:
Constant Field Values

VALUE_TYPE_ROW

private static final int VALUE_TYPE_ROW
See Also:
Constant Field Values

BLOCK_TYPE_ROW

private static final int BLOCK_TYPE_ROW
See Also:
Constant Field Values

BLOCK_NUMBER_ROW

private static final int BLOCK_NUMBER_ROW
See Also:
Constant Field Values

UNIT_ROW

private static final int UNIT_ROW
See Also:
Constant Field Values

SEPARATOR_ROW

private static final int SEPARATOR_ROW
See Also:
Constant Field Values

NUM_OF_HEADER_ROWS

private static final int NUM_OF_HEADER_ROWS
See Also:
Constant Field Values

cellEditors

private CellEditors cellEditors

cellRenderers

private CellRenderers cellRenderers

dataRenderer

private javax.swing.table.TableCellRenderer dataRenderer

sourceList

private java.util.ArrayList<AttributeDataSource> sourceList

file

private java.io.File file

exampleSource

private Operator exampleSource

model

private AttributeEditor.AttributeTableModel model

rowCount

private int rowCount

firstRow

private int firstRow

lastRow

private int lastRow

firstColumn

private int firstColumn

lastColumn

private int lastColumn

dataChanged

private boolean dataChanged

metaDataChanged

private boolean metaDataChanged

dataColumnVector

private java.util.Vector<java.util.Vector<java.lang.String>> dataColumnVector

dataControl

private DataControl dataControl
Constructor Detail

AttributeEditor

public AttributeEditor(Operator exampleSource,
                       DataControl dataControl)
Method Detail

hasDataChanged

public boolean hasDataChanged()

hasMetaDataChanged

public boolean hasMetaDataChanged()

getDataSource

private AttributeDataSource getDataSource(int i)

getDatum

private java.lang.String getDatum(int row,
                                  int column)

setDatum

private void setDatum(int row,
                      int column,
                      java.lang.String value)

getDefaultMaximumNumber

private int getDefaultMaximumNumber(java.lang.String limitName,
                                    int defaultNumber)

createNewColumn

private void createNewColumn()

columnAdded

public void columnAdded(javax.swing.event.TableColumnModelEvent e)
Specified by:
columnAdded in interface javax.swing.event.TableColumnModelListener
Overrides:
columnAdded in class javax.swing.JTable

addColumn

private void addColumn(java.io.File file,
                       int index,
                       int valueType)

clear

protected void clear()

readData

public void readData(java.io.File file,
                     int dataType)
              throws java.io.IOException
Loads data from a file. The dataType defines if the data should be loaded as series data. Must be one out of LOAD_DATA and LOAD_SERIES_DATA.

Throws:
java.io.IOException


autoSetValueType

private void autoSetValueType(int column)

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Overrides:
isCellEditable in class javax.swing.JTable

getCellEditor

public javax.swing.table.TableCellEditor getCellEditor(int row,
                                                       int column)
Overrides:
getCellEditor in class javax.swing.JTable

getCellRenderer

public javax.swing.table.TableCellRenderer getCellRenderer(int row,
                                                           int column)
Overrides:
getCellRenderer in class javax.swing.JTable

checkData

private boolean checkData(java.lang.Object value,
                          int row,
                          int column)

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

evaluatePopup

private void evaluatePopup(java.awt.event.MouseEvent e)

createPopupMenu

public javax.swing.JPopupMenu createPopupMenu(int column)

removeColumn

public void removeColumn(int column)

removeRow

public void removeRow(int row)

useRowAsNames

public void useRowAsNames(int row)

ensureAttributeTypeIsUnique

private void ensureAttributeTypeIsUnique(java.lang.String type)

writeData

public void writeData(java.io.File file)
               throws java.io.IOException
Throws:
java.io.IOException

openAttributeFile

public void openAttributeFile()

openAttributeFile

public void openAttributeFile(java.io.File file)

saveAttributeFile

public void saveAttributeFile()

writeXML

private void writeXML(java.io.File attFile)
               throws java.io.IOException
Throws:
java.io.IOException

getFile

public java.io.File getFile()

update

private void update()
This method should be invoked after data changes. It defines new ranges for the data control object and invokes the update method of data control.


update

public void update(int firstRow,
                   int lastRow,
                   int firstColumn,
                   int lastColumn,
                   int what)
Sets the new view data and fire a table structure changed event.

Specified by:
update in interface DataControlListener



Copyright © 2001-2006