Package java.util

Examples of java.util.TreeMap


     * Default constructor with no initialization. Don't use this to instantiate
     * the class, as the class is immutable and this will leave it without any
     * properties.
     */
    private CascadedStyle() {
        cascadedProperties = new TreeMap();
    }
View Full Code Here


* @param name the table's name
*/
public Table(DataSource dataSource, String name) {
    this.dataSource = dataSource;
    this.name = name;
    columns = new TreeMap();
}
View Full Code Here

    return maxId;
  }//getMaxLineId

  public void sort()
  {
    TreeMap tmp = new TreeMap();
    Set s = this.keySet();
    Iterator itr = s.iterator();
    String sortMember = this.getSortMember();
    AccountingLineElement curr = null;
    while(itr.hasNext())
    {
      try
        {
          curr = (AccountingLineElement)this.get(itr.next());
          String newSortStr = ((ListElementMember)curr.get(sortMember)).getSortString() + curr.getElementId();
          tmp.put(newSortStr,curr);
        }//try
      catch(Exception e)
        {
          System.out.println("AccountingLines:Exception cought in while");
        }//catch
View Full Code Here

  /**
   * This method returns the CustomFieldData .
   */
  public TreeMap getCustomFieldData(String recordType)
  {
    TreeMap cusData = null;
    CVDal dl = new CVDal(dataSource);
    try {
      cusData = new TreeMap();
      dl.setSql("common.getCustomField");
      dl.setString(1, recordType);
      Collection col = dl.executeQuery();
      Iterator it = col.iterator();
      while (it.hasNext()) {
        CustomFieldVO field = new CustomFieldVO();
        HashMap hm = (HashMap) it.next();
        int fieldID = ((Long) hm.get("customfieldid")).intValue();
        String label = (String) hm.get("name");
        String fieldType = (String) hm.get("fieldtype");
        int recordTypeID = ((Long) hm.get("recordtype")).intValue();
        field.setFieldID(fieldID);
        field.setLabel(label);
        field.setFieldType(fieldType);
        field.setRecordTypeID(recordTypeID);
        cusData.put("" + fieldID, field);
      } // end of while
      dl.clearParameters();
      dl.setSql("common.getCustomFieldOption");
      dl.setString(1, recordType);
      col = dl.executeQuery();
      it = col.iterator();
      while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        int fieldID = ((Long) hm.get("customfieldid")).intValue();
        int valueID = ((Long) hm.get("valueid")).intValue();
        String value = (String) hm.get("value");
        CustomFieldVO cf = (CustomFieldVO) cusData.get(String.valueOf(fieldID));
        Vector vec = cf.getOptionValues();
        if (vec == null) {
          vec = new Vector();
          DDNameValue dd = new DDNameValue(valueID, value);
          vec.add(dd);
        } else {
          DDNameValue dd = new DDNameValue(valueID, value);
          vec.add(dd);
        }
        cf.setOptionValues(vec);
        cusData.put(String.valueOf(fieldID), cf);
      }
    } catch (Exception e) {
      logger.error("[getCustomFieldData]: Exception", e);
    } finally {
      dl.destroy();
View Full Code Here

   * @param recordID The record ID.
   * @return The values for the custom field.
   */
  public TreeMap getCustomFieldData(String recordType, int recordID)
  {
    TreeMap cusData = new TreeMap();
    CVDal dl = new CVDal(dataSource);
    try {
      // get the first three custom fields for a particular record type.
      dl.setSql("common.getCustomField");
      dl.setString(1, recordType);
      Collection col = dl.executeQuery();
      Iterator it = col.iterator();
      while (it.hasNext()) {
        CustomFieldVO field = new CustomFieldVO();
        HashMap hm = (HashMap) it.next();
        int fieldID = ((Long) hm.get("customfieldid")).intValue();
        String label = (String) hm.get("name");
        String fieldType = (String) hm.get("fieldtype");
        int recordTypeID = ((Long) hm.get("recordtype")).intValue();
        field.setFieldID(fieldID);
        field.setLabel(label);
        field.setFieldType(fieldType);
        field.setRecordTypeID(recordTypeID);
        cusData.put(String.valueOf(fieldID), field);
      } // end of while
      dl.setSqlQueryToNull();
      // now get the all the values of custom fields for this record
      String str = " SELECT cf.customfieldid, cf.name, cf.fieldtype,cf.recordType,cfv.valueid,cfv.value ,cfm.valueID as selected from customfield cf,customfieldvalue cfv left outer join customfieldmultiple cfm on ( cfv.customfieldid = cfm.customfieldid and cfv.valueid = cfm.valueid and cfm.recordid = "
          + recordID
          + " ),cvtable where cf.customfieldid = cfv.customfieldid and cf.recordtype = cvtable.tableid and  cvtable.name  =  '"
          + recordType + "' ";
      str = str
          + " union SELECT cf.customfieldid, cf.name, cf.fieldtype,cf.recordType,null ,cfs.value ,null as seleted from customfield cf,customfieldscalar cfs ,cvtable where cf.customfieldid = cfs.customfieldid and cf.recordtype = cvtable.tableid and  cvtable.name  =  '"
          + recordType + "'  and cfs.recordid = " + recordID + " order by value";
      dl.setSqlQuery(str);
      col = dl.executeQuery();
      it = col.iterator();
      while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        int fieldID = ((Number) hm.get("customfieldid")).intValue();
        String fieldType = (String) hm.get("fieldtype");
        // The query returns scalars with the ID as NULL
        // Also some non-selected multiples give NULL
        // So we have to do something about that
        Object valueIdObject = hm.get("valueid");
        int valueId = 0;
        if (valueIdObject != null) {
          try {
            valueId = Integer.parseInt(valueIdObject.toString());
          } catch (NumberFormatException nfe) {}
        }
        String value = (String) hm.get("value");
        Object selectedObject = hm.get("selected");
        String selected;
        if (selectedObject != null) {
          selected = selectedObject.toString();
        } else {
          selected = "";
        }
        // Dig the custom field back out and set the options and values on it.
        CustomFieldVO cf = (CustomFieldVO) cusData.get(String.valueOf(fieldID));
        if (fieldType.equals("MULTIPLE")) {
          Vector optionsVector = cf.getOptionValues();
          if (optionsVector == null) {
            optionsVector = new Vector();
            DDNameValue dd = new DDNameValue(valueId, value);
View Full Code Here

  @Test
  public void testMap() {
    Map map = DestBeanCreator.create(Map.class);
    assertTrue(map instanceof HashMap);

    TreeMap treeMap = DestBeanCreator.create(TreeMap.class);
    assertNotNull(treeMap);
  }
View Full Code Here

  // added in the moduleRights TreeMap
  public void addModule(String moduleName, Integer moduleId, Integer parentId)
  {
    if (moduleMap == null) {
      moduleMap = new TreeMap();
    }

    HashMap moduleRight = (HashMap)moduleMap.get(moduleId);
    if (moduleRight == null) {
      moduleRight = new HashMap();
View Full Code Here

  {
    this.pageFunction = new PageFunction();
    this.indexSeparator = ".";
    this.model = new TypedTableModel();
    this.dataFormula = new FormulaExpression();
    this.dataStorage = new TreeMap();
  }
View Full Code Here

  {
    final IndexDataGeneratorFunction instance = (IndexDataGeneratorFunction) super.getInstance();
    instance.model = new TypedTableModel();
    instance.pageFunction = (PageFunction) pageFunction.getInstance();
    instance.dataFormula = (FormulaExpression) dataFormula.getInstance();
    instance.dataStorage = new TreeMap();
    instance.initialized = false;
    return instance;
  }
View Full Code Here

        resources.getString("system-properties-table.column.name"),
        resources.getString("system-properties-table.column.value"),};

    final Properties sysProps = System.getProperties();

    final TreeMap data = new TreeMap(sysProps);
    final Map.Entry[] entries = (Map.Entry[]) data.entrySet().toArray(new Map.Entry[data.size()]);
    final DefaultTableModel properties = new DefaultTableModel(names, entries.length);
    for (int i = 0; i < entries.length; i++)
    {
      final Map.Entry entry = entries[i];
      properties.setValueAt(entry.getKey(), i, 0);
View Full Code Here

TOP

Related Classes of java.util.TreeMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.