Ontimize 5.2072EN

com.ontimize.gui.field.document
Class HourDocument

java.lang.Object
  extended byjavax.swing.text.AbstractDocument
      extended byjavax.swing.text.PlainDocument
          extended bycom.ontimize.gui.field.document.HourDocument
All Implemented Interfaces:
javax.swing.text.Document, Internationalization, java.io.Serializable

public class HourDocument
extends javax.swing.text.PlainDocument
implements Internationalization

This document implements the model for managing dates in a JTextField

Version:
1.0 22/01/2002
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.text.AbstractDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement
 
Field Summary
static java.lang.String a_hh_mm_ss
           
static java.lang.String a_kk_mm_ss
           
protected  java.text.SimpleDateFormat dateFormat
           
static java.lang.String HH_mm_ss
           
static java.lang.String hh_mm_ss_a
           
protected  java.util.Date hour
           
protected  java.sql.Timestamp hourTimestamp
           
static java.lang.String KK_mm_ss
           
static java.lang.String kk_mm_ss_a
           
protected  java.util.Locale locale
           
protected  java.lang.String patternHour
           
static char SEPARATOR
           
static java.lang.String SEPARATOR_STR
           
 
Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
 
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 
Fields inherited from interface com.ontimize.gui.i18n.Internationalization
DEBUG_LANGUAGE
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
HourDocument()
           
 
Method Summary
protected  void buildPattern()
          Characters used in date format: k,K,h,H,m,s, a (format am-pm) Hour patterns could be:
- HH:mm:ss
- HH:mm:ss
- hh:mm:ss a
- kk:mm:ss a
- a hh:mm:ss
- a kk:mm:ss
- KK:mm:ss
 void format()
           
 java.text.SimpleDateFormat getFormat()
           
 java.util.Date getHour()
           
 java.lang.String getSampleHour()
           
 java.util.Vector getTextsToTranslate()
          Returns all the texts in the element suitable for being translated.
 void insertString(int offset, java.lang.String stringValue, javax.swing.text.AttributeSet attributes)
           
protected  void insertStringWithoutCheck(int offset, java.lang.String stringValue, javax.swing.text.AttributeSet attributes)
           
 boolean isValid()
           
 void setComponentLocale(java.util.Locale l)
           
 void setResourceBundle(java.util.ResourceBundle res)
          Sets the language resource bundle.
 
Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdate
 
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KK_mm_ss

public static final java.lang.String KK_mm_ss
See Also:
Constant Field Values

kk_mm_ss_a

public static final java.lang.String kk_mm_ss_a
See Also:
Constant Field Values

a_kk_mm_ss

public static final java.lang.String a_kk_mm_ss
See Also:
Constant Field Values

HH_mm_ss

public static final java.lang.String HH_mm_ss
See Also:
Constant Field Values

hh_mm_ss_a

public static final java.lang.String hh_mm_ss_a
See Also:
Constant Field Values

a_hh_mm_ss

public static final java.lang.String a_hh_mm_ss
See Also:
Constant Field Values

SEPARATOR

public static final char SEPARATOR
See Also:
Constant Field Values

SEPARATOR_STR

public static final java.lang.String SEPARATOR_STR
See Also:
Constant Field Values

locale

protected java.util.Locale locale

dateFormat

protected java.text.SimpleDateFormat dateFormat

patternHour

protected java.lang.String patternHour

hour

protected java.util.Date hour

hourTimestamp

protected java.sql.Timestamp hourTimestamp
Constructor Detail

HourDocument

public HourDocument()
Method Detail

getHour

public java.util.Date getHour()

buildPattern

protected void buildPattern()
Characters used in date format: k,K,h,H,m,s, a (format am-pm) Hour patterns could be:
- HH:mm:ss
- HH:mm:ss
- hh:mm:ss a
- kk:mm:ss a
- a hh:mm:ss
- a kk:mm:ss
- KK:mm:ss


setResourceBundle

public void setResourceBundle(java.util.ResourceBundle res)
Description copied from interface: Internationalization
Sets the language resource bundle. When the application changes the configured language, for all the objects that implement this interface this method must be called with the new file.
The method must translate all the elements that have texts in the GUI

Specified by:
setResourceBundle in interface Internationalization
Parameters:
res - the new language bundle.

getTextsToTranslate

public java.util.Vector getTextsToTranslate()
Description copied from interface: Internationalization
Returns all the texts in the element suitable for being translated.

Specified by:
getTextsToTranslate in interface Internationalization
Returns:
all the texts in the element suitable for being translated.

setComponentLocale

public void setComponentLocale(java.util.Locale l)
Specified by:
setComponentLocale in interface Internationalization

insertString

public void insertString(int offset,
                         java.lang.String stringValue,
                         javax.swing.text.AttributeSet attributes)
                  throws javax.swing.text.BadLocationException
Specified by:
insertString in interface javax.swing.text.Document
Throws:
javax.swing.text.BadLocationException

getFormat

public java.text.SimpleDateFormat getFormat()

format

public void format()

isValid

public boolean isValid()

getSampleHour

public java.lang.String getSampleHour()

insertStringWithoutCheck

protected void insertStringWithoutCheck(int offset,
                                        java.lang.String stringValue,
                                        javax.swing.text.AttributeSet attributes)
                                 throws javax.swing.text.BadLocationException
Throws:
javax.swing.text.BadLocationException

Ontimize