org.formaria.swing.table
Class TableModelHelper

java.lang.Object
  extended by org.formaria.swing.table.TableModelHelper

public class TableModelHelper
extends java.lang.Object

Title:

Description:

Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.

$Revision: 1.3 $


Method Summary
static double addModels(DataModel model1, DataModel model2)
           
static DataModel clone(DataModel src)
          Clones the current model node.
static java.lang.String getAttrib(DataModel model, java.lang.String name)
           
static boolean getBooleanValue(BaseModel model)
           
static double getDoubleValue(BaseModel model, java.lang.String att)
           
static double getDoubleValue(BaseModel model, java.lang.String att, double defaultValue)
           
static double getDoubleValue(DataModel model)
           
static TableModelHelper getInstance()
           
static int getIntValue(BaseModel model, java.lang.String att)
           
static int getIntValue(BaseModel model, java.lang.String att, int defaultValue)
           
static int getIntValue(DataModel model)
           
static BaseModel getParent(BaseModel model, int level)
           
static int getPositionInModel(BaseModel refmodel)
           
static java.lang.String getTempVar(java.lang.String name)
           
static java.lang.String getValue(java.lang.Object model)
           
static boolean isChildNode(BaseModel ref, BaseModel parent)
           
static void merge(DataModel mainModel, DataModel newModel)
          merge the conents of one model with another.
static double multipyAttribs(BaseModel model, java.lang.String attrib1, java.lang.String attrib2)
           
static double multipyModels(DataModel model1, DataModel model2)
           
static void setAttrib(DataModel model, java.lang.String name, java.lang.String value)
           
static void setTempVar(java.lang.String name, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TableModelHelper getInstance()

clone

public static DataModel clone(DataModel src)
Clones the current model node. Need to call cloneChildren which iterated the children and creates new instances of the children. The call to super.clone() does not create new instance of the child nodes.

Returns:
the newly created DataModel.

merge

public static void merge(DataModel mainModel,
                         DataModel newModel)
merge the conents of one model with another. Calls cloneChildren which transfers the data.

Parameters:
mainModel - the model which is to be updated
newmodel - the model which contains the data to be merged with this model.

getAttrib

public static java.lang.String getAttrib(DataModel model,
                                         java.lang.String name)

setAttrib

public static void setAttrib(DataModel model,
                             java.lang.String name,
                             java.lang.String value)

getParent

public static BaseModel getParent(BaseModel model,
                                  int level)

getPositionInModel

public static int getPositionInModel(BaseModel refmodel)

getValue

public static java.lang.String getValue(java.lang.Object model)

getDoubleValue

public static double getDoubleValue(DataModel model)

getDoubleValue

public static double getDoubleValue(BaseModel model,
                                    java.lang.String att)

getDoubleValue

public static double getDoubleValue(BaseModel model,
                                    java.lang.String att,
                                    double defaultValue)

getIntValue

public static int getIntValue(DataModel model)

getIntValue

public static int getIntValue(BaseModel model,
                              java.lang.String att)

getIntValue

public static int getIntValue(BaseModel model,
                              java.lang.String att,
                              int defaultValue)

addModels

public static double addModels(DataModel model1,
                               DataModel model2)

multipyModels

public static double multipyModels(DataModel model1,
                                   DataModel model2)

multipyAttribs

public static double multipyAttribs(BaseModel model,
                                    java.lang.String attrib1,
                                    java.lang.String attrib2)

setTempVar

public static void setTempVar(java.lang.String name,
                              java.lang.String value)

getTempVar

public static java.lang.String getTempVar(java.lang.String name)

getBooleanValue

public static boolean getBooleanValue(BaseModel model)

isChildNode

public static boolean isChildNode(BaseModel ref,
                                  BaseModel parent)