Code example for SimpleDateFormat

Methods: setLenient, setTimeZone, toLocalizedPattern

0
    return false; 
  } 
 
  public TableCellRenderer getCellRenderer(final int row, final int viewColumn)
  { 
    final TableModel tableModel = getModel();
    if (tableModel instanceof PropertyTableModel)
    { 
      final PropertyTableModel model = (PropertyTableModel) getModel();
      final int column = convertColumnIndexToModel(viewColumn);
 
      final Class columnClass = model.getClassForCell(row, column);
      if (columnClass.isArray())
      { 
        return arrayCellRenderer;
      } 
 
      final PropertyEditor propertyEditor = model.getEditorForCell(row, column);
      if (propertyEditor != null)
      { 
        propertyEditorCellRenderer.setPropertyEditor(propertyEditor);
        return propertyEditorCellRenderer;
      } 
 
      final TableColumn tableColumn = getColumnModel().getColumn(column);
      final TableCellRenderer renderer = tableColumn.getCellRenderer();
      if (renderer != null)
      { 
        return renderer;
      } 
 
      final TableCellRenderer defaultRenderer = getDefaultRenderer(columnClass);
      if (defaultRenderer != null)
      { 
        return defaultRenderer;
      } 
 
      if (logger.isTraceEnabled())
      { 
        logger.trace("No renderer for column class " + columnClass); // NON-NLS
      } 
      return getDefaultRenderer(Object.class);
    } 
     
    return super.getCellRenderer(row, viewColumn);
  } 
 
  public TableCellEditor getCellEditor(final int row, final int viewColumn)
  { 
    final TableModel tableModel = getModel();
    if (tableModel instanceof PropertyTableModel)
    { 
      final PropertyTableModel model = (PropertyTableModel) getModel();
      final int column = convertColumnIndexToModel(viewColumn);
 
      final PropertyEditor propertyEditor = model.getEditorForCell(row, column);
      final Class columnClass = model.getClassForCell(row, column);
 
      if (propertyEditor != null)
      { 
        final String[] tags = propertyEditor.getTags();
 
        if (columnClass.isArray())
        { 
          arrayCellEditor.setPropertyEditorType(propertyEditor.getClass());
        } 
        else if (tags == null || tags.length == 0)
        { 
          propertyEditorCellEditor.setPropertyEditor(propertyEditor);
          return propertyEditorCellEditor;
        } 
        else 
        { 
          taggedPropertyEditorCellEditor.setPropertyEditor(propertyEditor);
          return taggedPropertyEditorCellEditor;
        } 
      } 
 
      final TableColumn tableColumn = getColumnModel().getColumn(column);
      final TableCellEditor renderer = tableColumn.getCellEditor();
      if (renderer != null)
      { 
        return renderer;
      } 
 
      if (columnClass.isArray())
      { 
        return arrayCellEditor;
      } 
 
      final TableCellEditor editor = getDefaultEditor(columnClass);
      if (editor != null && logger.isTraceEnabled())
      { 
        logger.trace("Using preconfigured default editor for column class " + columnClass + ": " + editor); // NON-NLS
      } 
      return editor;
    } 
    return super.getCellEditor(row, viewColumn);
  } 
 
  public void stopEditing() 
  { 
    final TableCellEditor cellEditor = getCellEditor();
    if (cellEditor != null)
    { 
      cellEditor.stopCellEditing();
    } 
  } 
}