Constructing Jtree with data from Database

Hi
I am new to JTree and I need some help. My problem goes like this. I have a table in the data base which has data like Folder_Nr, Folder_Name, Folder_Prev_Nr, Folder_Typ_Nr, Folder_Access.
If the Folder_Nr is 1 and folder_prev_nr =0, then it is a root folder and if folder no is 3 and folder_prev_no is 1 then it is a sub folder of the Folder_Nr 1. and so on is the data. I need to present all these folders in a JTree and be able to dynamically add and delete folders.
It will be of great help if anyone can provide me with some lead or some source code.
Thanking u in advance
BalaaP

Yes,using LiveCycle you could accomplish this easily.Once you have your invoice form ready based on predefined XSD, you can easily update the form data by fetching the values from database using JDBC operation.Also you could email this updated form using Email service.
Thanks,
Wasil

Similar Messages

  • How to populate Adobe LiveCycle Designer generated  PDF Forms with data from Database in Windows app

    Hi
    I have a PDF template designed in Adobe LiveCycle Designer. This template has form fields which needs to be filled with data programmatically. I am using windows application in C#.Net 2005 in which I want to retrieve data from database and merge this data into PDF form in respective fields.
    How this can be achieved?
    I searched a lot & I found that we can process the XDP file generated from PDF to acheive this. I created the XDP file out of the PDF template created in designer. But I don't know how to merge data from database into that XDP file in respective fields and again convert this XDP file back to PDF programmatically. Can anybody help me ? This is urgent.
    Thanks in advance.
    Sambhaji

    Please ignore the above code.<br />The following one is correct one.<br />using System;<br />using System.Data;<br />using System.Configuration;<br />using System.Web;<br />using System.Web.Security;<br />using System.Web.UI;<br />using System.Web.UI.WebControls;<br />using System.Web.UI.WebControls.WebParts;<br />using System.Web.UI.HtmlControls;<br />using System.Text;<br />public partial class _Default : System.Web.UI.Page <br />{<br />    protected void Page_Load(object sender, EventArgs e)<br />    {<br />        Response.ContentType = "application/vnd.adobe.xdp+xml";<br />        StringBuilder responseString = new StringBuilder();<br />        responseString.Append("<?xml version='1.0' encoding='UTF-8'?>");<br />        responseString.Append("<?xfa generator='AdobeLiveCycleDesigner_V8.0' APIVersion='2.5.6290.0'?>");<br />        responseString.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>");<br />        responseString.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>");<br />        responseString.Append("<xfa:data>");<br /><br />        responseString.Append("<form1>");<br />        responseString.Append("<TextField1>Homer</TextField1>");<br />        responseString.Append("<TextField2>Simpson</TextField2>");<br />        responseString.Append("<field name ='DropDownList1'>");<br />        responseString.Append("<items save='1'>");<br />        responseString.Append("<text>1</text>");<br />        responseString.Append("<text>2</text>");<br />        responseString.Append("<text>3</text>");<br />        responseString.Append("</items>");<br />        responseString.Append("</field>");<br /><br />        responseString.Append("</form1>");<br /><br />        responseString.Append("</xfa:data>");<br />        responseString.Append("</xfa:datasets>");<br />        responseString.Append("<pdf  href='C:\\Test.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />");<br />        responseString.Append("</xdp:xdp>");<br /><br />        Response.Write(responseString);<br />        Response.Flush();<br />        Response.End();<br />    }<br />}

  • Problem populating html form fields with data from database.

    I'm using a straight forward piece of code to populate a form with data from a database, to create and 'edit record' page. The code is as follows;
    TO RETREVE THE DATA FROM THE DATABASE;
         $query = "SELECT * FROM $table WHERE newsletter_id = '$newsletter_id'" ;
         mysql_select_db($database) ;
         $result = mysql_query($query, $connect);
         $numRows = mysql_num_rows($result);
         $dbnewsletter_title = mysql_result($result,$i,'newsletter_title');
    TO POPULATE THE FORM FEILD;
    <tr>
              <td width="140"><p class="admin">Newsletter title</p></td>
              <td><input name="newsletter_title" type="text" <? print "value=$dbnewsletter_title";}?> /></td>
            </tr>
    However, when I view the page, the string shows in the text feild, but seems to be split at the point of the first space. So basically only the first word of the string shows in the text field. If I try to print '$dbnewsletter_title' outside of the table, the string is shown in full as it should be.
    Does anyone know what is causing this problem?
    Many Thanks

    Put the value in quotes:
    <?php print "value='$dbnewsletter_title'"; ?>

  • Create JTree using data from DataBase

    Hi all,
    I have GUI with JTree, and i have data in database with ParentID, ChiledID fileds,
    i want to crate tree structure from using data in database.
    can you people tell me how can i proceed, I will get a data as List of Vectors from DB.
    Thanks
    Daya

    i got the solution,
    what i did i having object class extended DefaultMutableTreeNode and i have list of objects class refrence and i know which is parent and a child so just add the child refrence to parent refrence which stored in list.
    Thanks
    daya

  • Load interactive pdf with data from database

    I am trying to understand our options for loading database data into an interactive pdf..?   Some of the data is not stored in the database and needs to be manually entered by the user in the interactive pdf.
    Here is the interactive pdf I'm working with:
    http://www.dcma.mil/dcman/NPP/files/dd1149.pdf
    As I understand it, there are 2 options:
    1.  Create an xml file from the database data.   Users can manually import this xml file into this existing interactive pdf and then manually add the additional data, and save the interactive pdf.
    Would users need to use Adobe acrobat Standard or Pro edition to import the xml data?
    2.  Create a XFA PDF form that's made with LiveCycle Designer.   Can this method create an interactive pdf so that users can enter additional data later and save the pdf?  
       What adobe products are required to use this method?
    thanks for any assistance..
    -D

    Yes,using LiveCycle you could accomplish this easily.Once you have your invoice form ready based on predefined XSD, you can easily update the form data by fetching the values from database using JDBC operation.Also you could email this updated form using Email service.
    Thanks,
    Wasil

  • How to update image with data from database?

    hi,
    is it possible to update an image object which serves as template with some data from a database table like user name etc. by converting it to image bytes and how? The final image would show user name as part of the image

    anybody?

  • Drop Down list in table with data from database table

    Hi,
    I have created an interactive form in WD ABAP.
    In Context tab I have created the nodes as follows:
    ZSOHEADER node with cardinality 1..1
    |-> MATERIAL node with cardinality 0..n. Under MATERIAL node there are 2 attrib. MAKTX and MATNR.
    I am fetching data from MARA table into an internal table IT_MARA.
    The node MATERIAL is bound to internal table IT_MARA.
    I have created a table with property ' Body rows vary depending on data ' .
    I have only one row in table. The first cell of the row is a drop down field.
    I have bind the field to the node MATERIAL->DATA->MAKTX.
    Now the issue is even though I have created only one row in my table, in preview it is creating as many rows in the table as the no.of records in the internal table.
    I want only one row with the drop down list containing all values of the internal table.
    Kindly suggest what to do.
    Regards,
    Vinod

    Hi,
    In the WebDynpro Context, in the main node create another node like A1 with cardinality 0..n and in this node create attributes TEXT and VALUE.
    Now goto method and in that method using code wizard read the node A1.
    And use the below code snippet sample in your program, i.e. code this under respective method of the webdynpro.
    *Declare the TYPES
    TYPES : BEGIN OF TY_TABLE,
    TEXT TYPE SOMETYPE,
    VALUE TYPE SOMETYPE,
    END OF TY_UOM.
    *Define Internal Table and work area.
    DATA : IT_TABLE TYPE STANDARD TABLE OF TY_TABLE INITIAL SIZE 0,
    WA_TABLE TYPE TY_TABLE.
    SELECT TEXT VALUE FROM TABLENAME INTO TABLE IT_TABLE.
    lr_node_info->bind_table( IT_TABLE ).
    And in the Adobe Form Layout
    Go to Menu of the Adobe LiveCycle Designer:
    Tools>Options..>DataBinding
    In that window you just check the Show Dynamic properties Check Box.
    Now for the Drop Down go the binding tab in object palette and click on the list items and there specify the Internal Table and specify the text as the internal table text field and value as internal table value field.
    OR
    From the WebDynpro Native Library Palette use the Value Help Drop Down and in object pallette goto binding tab and provide the form interface binding. Before this in the WebDynpro goto Context and for the particular field under the properties provide the search help as dictionary search help and specify the name of the dictionary search help.
    OR
    We have another method of setting the Text and Value to the DDL directly in the WebDynpro by coding in the methods, I dont have much knowledge on this.
    Regards
    Pradeep Goli

  • Programmatically generate password for pdf with data from database

    Good day everyone,
      I would like to know is it possible to programmatically generate passwords for pdf??
    The main idea is to enable an automated process of pdf acquiring individualised password from a database (Excel, Access, you name it) and finally sending the pdf to individual recipient. Can I use javascript for this? And if yes, how?? If not, pls do advice me on the appropriate steps.
    Background (for clarity's sake): 
      Currently I am working on developing an automated process for the sending customised, password encrypted payslip to about 80 staff. The entire procedure is pretty much summarized as below:
    mail merg (UBS output in) excel to words -> convert words to pdf -> programmatically password encrypt the pdf -> email to individual recipients.
    Well my current status is - I am quite done with the batch mail merge and convertion part. And batch proccessing of password encryption is not a problem, but the idea is to allow acrobat to retrieve password automatically from a database and not key-in each and every password manually. The batch email for now is another problem but for now I have to work stepwise. (Any ideas on how to do it would equally be valued though! =D)
    System and software using:
    Windows  XP and 7 Professional
    Microsoft Office Proffesional 2010
    Adobe Acrobat X Pro
    I would be really grateful for any relevant replies to my question and any additional thoughts or ideas are welcome!!
    I would to thank any potential saviour in advance!
    Thank you for helping!

    Basically I need to automate the password generation from database extract
    e.g. Excel database with StaffID, StaffName, PayMonth, etc. Then when the pdf is created, its password would be <StaffID>_<PayMonth> which is extracted from excel.
    Is it possible for this to happen?? I dont mine using Javascript, I'll just have to learn it.
    Or how about recommending a program which does that??
    Whichever is fine as long there's a solution!
    Thanks!

  • Combo filled with data from database

    i want to display the list of schemas dynamically in a combo box and then display the tables in that schema. i tried a servlet; but the schemas are not displayed.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    public class try extends HttpServlet
         public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
         PrintWriter out;
         res.setContentType("text/html");
         out = res.getWriter ();
         try
         out.println("<html>");
         out.println("<head>");
         out.println("<script language='javascript'>");
         out.println("function one()");
         out.println("{");
         out.println(" ResultSet rs=st.executeQuery('select distinct owner from all_tab_columns')");
         out.println("while(rs.next())");
         out.println("{");
         out.println("var newElement=document.createElement('option')");
         out.println("newElement.value=rs.getString(1)");
         out.println("document.form1.table1.options.add(newElement))");
         out.println("}");
         out.println("}");
         out.println("</script>");
         out.println("</head>");
         out.println("<body>");
         out.println("<form name=form1 action=http://mysystem:9000/servlet/query method=post>");
         out.println("Schema name");
         out.println("<input type=textbox name='user'><br>");
         out.println("Password");
         out.println("<input type=password name='pwd'><br>");
         System.out.println("Password");
         out.println("Table Name");
         DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
         Connection m_connection;
    m_connection = DriverManager.getConnection("jdbc:oracle:thin:@mysystem:1521:oracle8","scott","tiger");
         Statement st=m_connection.createStatement();
         System.out.println(st);
         out.println("<select name='table1' onFocus=one();>");
         out.println("<option value=' '>");
         out.println("</option>");
         out.println("</select>");
         out.println("<br>");
         out.println("<input type=submit>");
         out.println("</form>");
         out.println("</body>");
         out.println("</html>");
         }catch(SQLException s){
              out.println("Trial");
         catch(java.lang.Exception x){ }
    }

    If you're wanting to get data back from the database you're actually going to have to execute a query. The Statement:out.println(" ResultSet rs=st.executeQuery('select distinct owner from all_tab_columns')"); will print out the query you wish to run, showing it to the user, but it won't execute it.
    Try instead:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection m_connection;
    m_connection = DriverManager.getConnection("jdbc:oracle:thin:@mysystem:1521:oracle8","scott","tiger");
    Statement st=m_connection.createStatement();
    out.println("<select name='table1' onFocus='one();'>");
    ResultSet rs=st.executeQuery("select distinct owner from all_tab_columns");
    while(rs.next()){
    String val = rs.getString(1);
    out.println("<OPTION VALUE='" + val + "'>" + val + "</OPTION>";
    rs.close();
    st.close();
    out.println("</select>");

  • Generate report with data from database package

    Hi
    Is it possible to generate a report where the values come from an oracle database package instead of from an sql query declared in the report itself?
    If yes, how is it done?
    Appreciate any help. Thx.

    Hi,
    You can use REF CURSORs to generate reports from a database package.
    For information about REF CURSORs, please see Chapter 40 'Building a Paper Report with REF CURSORs' of the Oracle Reports Building Reports manual.
    This chapter is at:
    http://download-uk.oracle.com/docs/html/B13895_01/orbr_refcur.htm#i1011693
    Hope this helps.
    Regards,
    Panna

  • Filling checkboxes with data from database

    Hello.
    I need help setting a checkbox value to checked if the corresponding field has "Yes" saved in the database.
    I can do this with textboxes, but haven't figured out how to do it with checkboxes or drop down lists.
    If you can help, please do.
    Thanks.

    In all honesty, problems like this is why programmers tend to make more money than web developers. :) You more or less need to figure out what you want to happen, and then write the code to make that happen. Let me give you an example...
    Let's say we're building a web site that requires people to register and then log in. When they register, they get a checkbox where they can opt in for spam. We've decided to store the user's preference in a database, essentially a field called spam which contains either a "yes" or a "no" value. When the time comes to send out those emails, we simply select all records in the database where that spam field is set to "yes".
    So far, so good.
    If the user decides to check that opt-in checkbox, then we want to set the spam field to "yes". If he already exists in the database, we can use an SQL update statement to set the field. If he doesn't exist, we'll have to create a record for him and set all relevant fields with an insert statement. If he unchecks the box (or leaves it unchecked), then we want to do the same thing but make sure the spam field is set to "no".
    When the user clicks on the submit button, the checkbox is submitted (or not) to the server as one of the parameters. We simply parse the parameters, see if the checkbox was checked or not, then write a little bit of JSP (or Java) code that sends the appropriate SQL statement as above, to the database.
    That's the basic concept.
    There are many slight variations. For example, several web sites will fill in that opt-in checkbox by default every time you visit their site, and you have to uncheck it if you don't want spam. The logic remains the same - just write a little bit of code that sees if the form passed you the checkbox filled in, and then either fill in, or erase the corresponding field in the database.
    (I'm not bothering to add code here because there are many ways to do this, and which way is best really depends on what code college_amy has written so far.)

  • Need help with data from databases

    Hi,
    I need to search several columns in a table, for ex. the Id column and the Headline column. Of cource the id must be connected to the right headline when I want to do something to the data.
    Now I get a Resultset and I have tried out different ways to get the data out from the Resultset but the result doesn't seems to be right. Can anyone help me, please.
    -Thanks-

    You can iterate on your ResultSet if it contains several
    rows.
    Let's imagine you have defined a class Element containing
    the values you want to use.
    List l = new ArrayList();
    // Calling rs.next() put the cursor on the next row
    // and return false if there is no more row
    while (rs.next()) {
    Element e = new Element(rs.getString(1), rs.getInt(2));
    l.add(e);

  • Urgent help with simple BPEL process for reading data from database

    Hello there,
    I need help with BPEL project.
    i have created a table Employee in Database.
    I did create application, BPEL project and connection to the database properly using Database Adapter.
    I need to read the records from the database and convert into xml fomat and it should to go approval for BPM worklist.
    Can someone please describe me step by step what i need to do.
    Thx,
    Dps

    I have created a table in Database with data like Empno,name,salary,comments.
    I created Database Connection in jsp page and connecting to BPEL process.
    It initiates the process and it goes automatically for approval.
    Please refer the code once which i created.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@page import="java.util.Map" %>
    <%@page import="com.oracle.bpel.client.Locator" %>
    <%@page import="com.oracle.bpel.client.NormalizedMessage" %>
    <%@page import="com.oracle.bpel.client.delivery.IDeliveryService" %>
    <%@page import="javax.naming.Context" %>
    <%@page import="java.util.Hashtable" %>
    <%@page import="java.util.HashMap" %>
    <%@ page import="java.sql.*"%>
    <%@ page import= "jspprj.DBCon"%>
    <html>
    <head>
    <title>Invoke CreditRatingService</title>
    </head>
    <body>
    <%
    DBCon dbcon=new DBCon();
    Connection conn=dbcon.createConnection();
    Statement st=null;
    PreparedStatement pstmt=null;
    Hashtable env= new Hashtable();
    ResultSet rs = null;
    Map payload =null;
    try
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.PROVIDER_URL, "opmn:ormi://localhost:port:home/orabpel");//bpel server
    env.put("java.naming.security.principal", "username");
    env.put("java.naming.security.credentials", "password");//bpel console
    Locator locator = new Locator("default","password",env);
    IDeliveryService deliveryService =
    (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
    // construct the normalized message and send to Oracle BPEL Process Manager
    NormalizedMessage nm = new NormalizedMessage();
    java.util.HashMap map = new HashMap();
    st=conn.createStatement();
    out.println("connected");
    String query1="Select * from EMPLOYEE";
    rs=st.executeQuery(query1);
    /*reading Data From Database and converting into XML format
    so that no need of going to BPEL console and entering the details.
    while (rs.next()){
    String xml1 = "<AsynchBPELProcess1ProcessRequest xmlns='http://xmlns.oracle.com/AsynchBPELProcess1'>"+
    "<Empno>"+rs.getString(1)+"</Empno>"+
    "<EmpName>"+rs.getString(2)+"</EmpName>"+
    "<Salary>"+rs.getString(3)+"</Salary>"+
    "<Comments>"+rs.getString(4)+"</Comments>"+
    "</AsynchBPELProcess1ProcessRequest>";
    out.println(xml1);
    nm.addPart("payload", xml1 );
    // EmployeeApprovalProcess is the BPEL process in which human task is implemented
    deliveryService.post("EmployeeApprovalProcess", "initiate", nm);
    // payload = res.getPayload();
    out.println( "BPELProcess CreditRatingService executed!<br>" );
    // out.println( "Credit Rating is " + payload.get("payload") );
    //Incase there is an exception while invoking the first server invoke the second server i.e lsgpas13.
    catch(Exception ee) {
    //("BPEL Server lsgpas14 invoking error.\n"+ee.toString());
    %>
    </body>
    </html>
    Its working fine.And i want it for Bulk approvals.please help me step by step procedure if any other way to implement this.

  • Want JTree e.g. of populating data from database.

    I want ur JTree example of populating data from database, can u plz give me that eg.?
    Awaiting 4 ur reply.

    Hi,
    AFAIK, there is no direct approach to populate a JTree directly from a resultset. However, JTree can use a DOM tree as its model by using the adapter pattern. The procedure to do this is well-documented in the SUN website and the link is provided below. The code to convert a resultset to XML is provided below:
    protected void resultSetToXML(OutputStream out,
    ResultSet rs,
    String stylesheet)
    throws IOException, ServletException {
    // Create reader and source objects
    SqlXMLReader sxreader = new SqlXMLReader();
    SqlInputSource sis = new SqlInputSource(rs);
    // Create SAX source and StreamResult for transform
    SAXSource source = new SAXSource(sxreader, sis);
    StreamResult result = new StreamResult(out);
    // Perform XSLT transform to get results. If "stylesheet"
    // is NULL, then use identity transform. Otherwise, parse
    // stylesheet and build transformer for it.
    try {
    // Create XSLT transformer
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t;
    if (stylesheet == null) {
    t = tf.newTransformer();
    } else {
    // Read XSL stylesheet from app archive and wrap it as
    // a StreamSource. Then use it to construct a transformer.
    InputStream xslstream = _config.getServletContext().
    getResourceAsStream(stylesheet);
    StreamSource xslsource = new StreamSource(xslstream);
    t = tf.newTransformer(xslsource);
    // Do transform
    t.transform(source, result);
    } catch (TransformerException tx) {
    throw new ServletException(tx);
    The classes SQLXMLReader and other classes used in this example are available in the following java packages.
    import java.sql.*;
    import javax.sql.DataSource;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.sax.*;
    import javax.xml.transform.stream.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.AttributesImpl;
    The following is the link that explains how to load a JTree from DOM.
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPDOM6.html
    Cheers,
    vidyut

  • JTable will not refresh with new data from database

    Hi,
    I have a JTable that does not recoginzed when the data has changed. The table is dynmaically populated with data from the database using a table model.
    Please help!!
    public JTable getUpdateContractTable() {
    QueryTableModel model;
    String [] dlrs = getSelectedDealers();
    String [] stats = getSelectedStatuses();
    String sql = buildContractQuery(dlrs, stats);
    try {
    if(isContractSet) {
    model = new QueryTableModel();
    model.setQuery(sql);
    table.setModel(model);
    table.setColumnModel(new UpdtCtrctColumnModel());
    table.invalidate();
    table.repaint();
    //model.fireTableChanged(new TableModelEvent(model));
    else {
    model = new QueryTableModel();
    UpdtCtrctColumnModel column = new UpdtCtrctColumnModel();
    model.setQuery(sql);
    table = new JTable(model, column);
    table.createDefaultColumnsFromModel();
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    model.fireTableChanged(null);
    isContractSet = true;
    catch (Exception e) {
    System.out.println(e.getMessage());
    //JOptionPane.show
    //.showMessageDialog("Error: " + e.getMessage(),
    // "Click Ok",
    // JOptionPane.INFORMATION_MESSAGE);
    return table;
    }

    thank you for your help. i finally got it to refresh. i have a follow-up question if you don't mind answering it. i have 2 jtables where one depends on the other. when i do a refresh i want the other table to disappear, so i call the getContentPane().remove(component), but the table doesn't disappear. what should i do.
    anthony

Maybe you are looking for

  • How to get the size of 'MyComponent'  when it is used in another place ?

    'My component' is JPanel based ( for example) I find problems to use the real size of MyComponent ( the size it has at the destiny) In 'Initialize' this.getheight gives me the size of the component by itself Must I use 'paintComponent' to know the re

  • Inserting a page break below an image using VBA for Word

    Hi all, I am trying to have about 50 screen shots in one file, automatically crop and resize each image, then add a page break at the end of each image, but then move down to the next screen shot and repeat this process to the end of the file. So far

  • Some albums are not alphabetical order

    so i added a album that begins with a P and S to ipod but it is placed with the Rs. But on my itunes it is sorted correctly is anyone else having this issue or had this issue before

  • CC&B LoginModule for Weblogic Change of Password

    Hi All, I realise this is more of a Weblogic question, though I'm specifically after a working example of LoginModule that can be used within CC&B on Weblogic to: a) Force users to change their password if their password is reset; b) Force users to c

  • List of Released accounting documents for Invoices.

    Hi All,        How to get the List of Released accounting doucments list for invoices,is any sap std tcode or any table.pls anybody those reply immediatly i apreciate. Thanks Rajan