public class DataUtil
Utility class to facilitate Javascript programming for data operation. The basic data type such as int, double, boolean and string are exchangeable between JavaScript and Java, which means these types of JavaScript variables can be directly used as parameters of Java methods, but array is not exchangeable between JavaScript and Java. This utility class provides methods to create Java array or convert JavaScript array to Java array.
Method Summary | |
---|---|
static double[] |
getDoubleArray(int size)
Returns a new double array with given size. |
static int[] |
getIntArray(int size)
Returns a new int array with given size. |
static org.csstudio.opibuilder.util.MacrosInput |
createMacrosInput(boolean include_parent_macros)
Create a MacrosInput, which can be used as the macros input for a container widget or display. |
static double[] |
toJavaDoubleArray(org.mozilla.javascript.NativeArray jsArray)
Convert JavaScript array to Java double array. |
static int[] |
toJavaIntArray(org.mozilla.javascript.NativeArray jsArray)
Convert JavaScript array to Java int array. |
Method Detail |
---|
public static final double[] getDoubleArray(int size)
size
- the size of the array
public static final int[] getIntArray(int size)
size
- the size of the array
public static final double[] toJavaDoubleArray(org.mozilla.javascript.NativeArray jsArray)
jsArray
- JavaScript array
public static final int[] toJavaIntArray(org.mozilla.javascript.NativeArray jsArray)
jsArray
- JavaScript array
public static final org.csstudio.opibuilder.util.MacrosInput createMacrosInput(boolean include_parent_macros)
MacrosInput.put(String macroName, String macroValue);
include_parent_macros
- If parent macros should be included.