Ontimize 5.2072EN

com.ontimize.gui.field.document
Class CurrencyDocument

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

public class CurrencyDocument
extends AdvancedRealDocument

This document implements the model for managing currency values. Only Ptas and euros are supported. Internally, value is stored in a variable called floatValue. When actual mode is Pta, values are processed like Pta. Otherwise, when mode is Euro, values are managed like euros.

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
 java.lang.String euro
           
static double EURO
           
static java.lang.String pst
           
protected  java.text.NumberFormat pstFormatter
           
 
Fields inherited from class com.ontimize.gui.field.document.AdvancedRealDocument
advancedQueryMode, BETWEEN, EQUAL, LESS, LESS_EQUAL, MORE, MORE_EQUAL, NOT, OR
 
Fields inherited from class com.ontimize.gui.field.document.RealDocument
floatValue, formatter, symbology
 
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
CurrencyDocument()
           
 
Method Summary
 void currencyChange()
          This function updates the content in field when currency changes (PTA<=>EURO).
 void format()
           
 java.lang.String formatPst(double d)
           
 java.lang.Double getDoubleValue(java.lang.String s)
           
 SearchValue getQueryValue()
           
 boolean getShownEuros()
           
 java.lang.Number getValue()
           
 void setComponentLocale(java.util.Locale l)
           
 void setShowEuros(boolean showEuros)
           
 void setValue(java.lang.Number value)
           
protected  void updateValue()
           
 
Methods inherited from class com.ontimize.gui.field.document.AdvancedRealDocument
getDocumentFirstSymbol, insertString, isOROffset, isORSymbolAllowed, isStartSymbol, isSymbolFirst, isValid, remove, setAdvancedQueryMode
 
Methods inherited from class com.ontimize.gui.field.document.RealDocument
getFormat, getTextsToTranslate, insertStringWithoutCheck, removeWithoutCheck, setFractionDigits, setGrouping, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setResourceBundle
 
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, 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

EURO

public static final double EURO
See Also:
Constant Field Values

euro

public java.lang.String euro

pst

public static java.lang.String pst

pstFormatter

protected java.text.NumberFormat pstFormatter
Constructor Detail

CurrencyDocument

public CurrencyDocument()
Method Detail

setShowEuros

public void setShowEuros(boolean showEuros)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getShownEuros

public boolean getShownEuros()

currencyChange

public void currencyChange()
                    throws java.lang.Exception
This function updates the content in field when currency changes (PTA<=>EURO). If actual currency is EURO, document only shows the same value. However, when current currency is PTA, showed value is multiplied by 166.386.

Throws:
java.lang.Exception

format

public void format()
Overrides:
format in class AdvancedRealDocument

updateValue

protected void updateValue()
Overrides:
updateValue in class RealDocument

getValue

public java.lang.Number getValue()
Overrides:
getValue in class RealDocument

getDoubleValue

public java.lang.Double getDoubleValue(java.lang.String s)
Overrides:
getDoubleValue in class RealDocument

setValue

public void setValue(java.lang.Number value)
Overrides:
setValue in class RealDocument

getQueryValue

public SearchValue getQueryValue()
Overrides:
getQueryValue in class AdvancedRealDocument

formatPst

public java.lang.String formatPst(double d)

setComponentLocale

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

Ontimize