Oxygen XML Editor, Version 14.2

ro.sync.sample.plugin.converter
Class ConversionFormat

java.lang.Object
  extended by ro.sync.sample.plugin.converter.ConversionFormat

public class ConversionFormat
extends java.lang.Object

Manages a set of conversion entries, associated to a format. ("Length", "Force", etc)

Version:
$Revision: 1.18 $

Constructor Summary
ConversionFormat(org.w3c.dom.Node formatNode)
          Constructor for the ConversionFormat object.
 
Method Summary
 double convert(java.lang.String masterValue, java.lang.String slaveValue, double arg1, double arg2, boolean direct, int decimalsNumber)
          Based on masterValue and slaveValue it determines the conversion entry that knows how to convert the two values.
 java.lang.String getAssociatedLabel(java.lang.String measure)
          Get the label associated with a measure.
 java.util.Set getMasterValues(java.lang.String slaveValue)
          Get all the possible values that can be listed in the first combo box, in the context of the selected value in the second combo box.
 java.lang.String getName()
          Get the format name.
 java.util.Set getSlaveValues(java.lang.String masterValue)
          Get all the possible values that can be listed in the second combo box, in the context of the selected value in the first combo box.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversionFormat

public ConversionFormat(org.w3c.dom.Node formatNode)
                 throws ConversionException
Constructor for the ConversionFormat object.

Parameters:
formatNode - The root node for this format.
Throws:
ConversionException - If an entry for this format is invalid, or root node is null.
Method Detail

getName

public java.lang.String getName()
Get the format name.

Returns:
The format name.

getMasterValues

public java.util.Set getMasterValues(java.lang.String slaveValue)
Get all the possible values that can be listed in the first combo box, in the context of the selected value in the second combo box.

Parameters:
slaveValue - The value that is selected in the second combo box. If null, all the possible values for the first combo box will be returned.
Returns:
The master value.

getSlaveValues

public java.util.Set getSlaveValues(java.lang.String masterValue)
Get all the possible values that can be listed in the second combo box, in the context of the selected value in the first combo box.

Parameters:
masterValue - The value that is selected in the first combo box. If null, all the possible values for the second combo box will be returned.
Returns:
The slave value.

getAssociatedLabel

public java.lang.String getAssociatedLabel(java.lang.String measure)
Get the label associated with a measure. Used for displaying the labels in the text edit fields. If label not found then return null.

Parameters:
measure - The measure, for example "milimeters"
Returns:
The lable for the measure, example "mm"

convert

public double convert(java.lang.String masterValue,
                      java.lang.String slaveValue,
                      double arg1,
                      double arg2,
                      boolean direct,
                      int decimalsNumber)
               throws ConversionException
Based on masterValue and slaveValue it determines the conversion entry that knows how to convert the two values.

Parameters:
masterValue - The first section conversion measure. Eg "foot".
slaveValue - The second section conversion measure. Eg "meter".
arg1 - The value existing in the first edit.
arg2 - The value existing in the first edit.
direct - Is true when the conversion is made directly from the first measure into the second, or reversed.
decimalsNumber - The decimals number.
Returns:
The conversion result.
Throws:
ConversionException - Description of Exception

Oxygen XML Editor, Version 14.2

© Copyright Syncro Soft SRL 2002 - 2013. All rights reserved.