dcsimg
Jtree Structure with various attributes inside JTable ,and also passing the parent and child data thru hashtable
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Neelesh_Tandon
Posted On:   Thursday, April 3, 2003 01:21 AM

Hi Folks, This is Neelesh here.I just wanted to get some info or code snipet wherein I have to show data which will be in the form of a JTree strcuture inside a JTable.This data will be dependent on the user profile and will have various attributes like pending amount ,amount,temp name etc etc.The further functionality required will be sorting the Jtree structure and also to have ascending and descending funcionality.So one row of data may have 1 or more rows of record as children records and if no records are there then its shown as a leaf. I am trying to pass this Data through hashtable after making an object of this data class with different attributes like System,firm,main,account import java.util.*; import java.io.*;    More>>

Hi Folks, This is Neelesh here.I just wanted to get some info or code snipet wherein I have to show data which will be in the form of a JTree strcuture inside a JTable.This data will be dependent on the user profile and will have various attributes like pending amount ,amount,temp name etc etc.The further functionality required will be sorting the Jtree structure and also to have ascending and descending funcionality.So one row of data may have 1 or more rows of record as children records and if no records are there then its shown as a leaf.
I am trying to pass this Data through hashtable after making an object of this data class with different attributes like System,firm,main,account

import java.util.*;
import java.io.*;


public class TLMDataValueHash
{

TLMDataValue dat1=new TLMDataValue();
TLMDataValue dat2=new TLMDataValue();
TLMDataValue dat3=new TLMDataValue();
TLMDataValue dat4=new TLMDataValue();

public TLMDataValueHash()
{
getData();
}

public Hashtable getData()
{
Hashtable hash = new Hashtable();
//Hashtable hashParent = new Hashtable();
//Hashtable hashChild = new Hashtable();
dat1.t_system=new String("A");
dat1.t_firm=new String("A");
dat1.t_main=new String("N1");
dat1.t_account=new String("30350");
dat1.t_remote=new String("Y");
dat1.t_level=new String("E1-USD");
dat1.t_amount=new Double("100000");
dat1.t_agreedAmount=new Double("-100000");
dat1.t_pendingAmount=new Double("0");
dat1.t_valueDate=new String("9th Jan");
dat1.t_tempName=new String("30350 E1");
dat1.t_userId=new String("Rinkoo");
dat1.t_location=new String("NA");
dat1.t_status=new String("Flat");
dat1.t_id=new String("A1");
dat1.t_query=new String("Set");
dat1.t_method=new String("Fax");
dat1.t_time=new String("9am");
dat1.t_rule=new String("MCM");
dat1.t_zeroised=new String("Y");
dat1.t_warning=new String("Warn");
dat1.t_comments=new String("OK");
//dat1.t_parentState=new String("Y");

dat2.t_system=new String("A");
dat2.t_firm=new String("A");
dat2.t_main=new String("N1");
dat2.t_account=new String("30360");
dat2.t_remote=new String("Y");
dat2.t_level=new String("E1-USD");
dat2.t_amount=new Double("100000");
dat2.t_agreedAmount=new Double("-100000");
dat2.t_pendingAmount=new Double("0");
dat2.t_valueDate=new String("8 am ");
dat2.t_tempName=new String("30350 E1");
dat2.t_userId=new String("Tandon");
dat2.t_location=new String("NA");
dat2.t_status=new String("Flat");
dat2.t_id=new String("Nt");
dat2.t_query=new String("Select");
dat2.t_method=new String("Fax");
dat2.t_time=new String("9am");
dat2.t_rule=new String("MCM");
dat2.t_zeroised=new String("Y");
dat2.t_warning=new String("Status");
dat2.t_comments=new String("Tested");
//dat2.t_parentState=new String("N");

dat3.t_system=new String("B");
dat3.t_firm=new String("B");
dat3.t_main=new String("N1");
dat3.t_account=new String("30370");
dat3.t_remote=new String("Y");
dat3.t_level=new String("E1-USD");
dat3.t_amount=new Double("100000");
dat3.t_agreedAmount=new Double("-100000");
dat3.t_pendingAmount=new Double("0");
dat3.t_valueDate=new String("10 pm");
dat3.t_tempName=new String("30350 E1");
dat3.t_userId=new String("Pravin");
dat3.t_location=new String("NA");
dat3.t_status=new String("Flat");
dat3.t_id=new String("D12");
dat3.t_query=new String("Update");
dat3.t_method=new String("Fax");
dat3.t_time=new String("9am");
dat3.t_rule=new String("MCM");
dat3.t_zeroised=new String("Y");
dat3.t_warning=new String("Good");
dat3.t_comments=new String("Passed");
//dat3.t_parentState=new String("N");

dat4.t_system=new String("A");
dat4.t_firm=new String("A");
dat4.t_main=new String("N1");
dat4.t_account=new String("30350");
dat4.t_remote=new String("Y");
dat4.t_level=new String("E1-USD");
dat4.t_amount=new Double("100000");
dat4.t_agreedAmount=new Double("-100000");
dat4.t_pendingAmount=new Double("0");
dat4.t_valueDate=new String("4 pm");
dat4.t_tempName=new String("30350 E1");
dat4.t_userId=new String("Rajiv");
dat4.t_location=new String("NA");
dat4.t_status=new String("Flat");
dat4.t_id=new String("C2");
dat4.t_query=new String("Insert");
dat4.t_method=new String("Fax");
dat4.t_time=new String("9am");
dat4.t_rule=new String("MCM");
dat4.t_zeroised=new String("Y");
dat4.t_warning=new String("Alert");
dat4.t_comments=new String("OK");
//dat4.t_parentState=new String("N");

hash.put("dat1",dat1);
System.out.println("data1 "+dat1);
hash.put(dat1,dat2);
System.out.println("data2 "+dat2);
hash.put(dat1,dat3);
System.out.println("data3 "+dat3);
hash.put(dat1,dat4);
System.out.println("data4 "+dat4);
System.out.println("hastable is "+hash);
/*hashParent.put("Parent1",dat1);
hashChild.put("Child1",dat2);
hashChild.put("Child2",dat3);
hashChild.put("Child3",dat4);
hash.put(hashParent,hashChild);*/
return hash;


}
}


I have tried all the ways but I am able to get only one row that is the last row of data ie dat4.
Please give me ur urgent feedback on the same

Thanks in advance

   <<Less
About | Sitemap | Contact