[Swing ADF] add a new row based on existing one

Hi all,
I start with ADF and here is my problem:
In a swing ADF application, I'd like to allow user to create new records based on a record already present in the DB. The user selects a record in the data table and then push a button that fill in some JTextField. He can then change whatever he wants. These JTextField are in fact arguments of a method of my Application Module. Then, when a button "add", that is created by drag and drop the method, is pushed, the method of the AM is called.
The problem is: argument are null. This occure when I fill in the gap (JTextField) programmatically (by getting the currentRow of the iterator of the table). But if the user fill in the gap himself, then arguments are not null.
Is there someone to help me?
Thanks a lot!
Regards

Hi,
I created the method, dragged the arguments as textFields and added the method call as a button.
I then dragged and dropped teh Departments ViewObject as a table and created a button with the following action code
private void jButton2_actionPerformed(ActionEvent e) {
DCIteratorBinding dciter = (DCIteratorBinding) panelBinding.get("DepartmentsView1Iterator");
Number deptId = (Number) dciter.getCurrentRow().getAttribute("DepartmentId");
String dname = (String) dciter.getCurrentRow().getAttribute("DepartmentName");
Number locId = (Number) dciter.getCurrentRow().getAttribute("LocationId");
((JUTextFieldBinding) panelBinding.get("deptId")).setInputValue(deptId);
((JUTextFieldBinding) panelBinding.get("dname")).setInputValue(dname);
((JUTextFieldBinding) panelBinding.get("locationId")).setInputValue(locId);
panelBinding.refresh();
Pressing the button copies the values to the input arguments and pressing the method button sends the values to the method
Frank

Similar Messages

  • Insert new rows based on user selection on a table display on the screen

    Hi..
    In my requirement i need to display the line items of a PO# to the user on the screen for specific fields. Each row should also include an additonal checkbox when displayed for the user. When the user checks this check box or clicks on it a new row should be inserted below to that row with the existing data of that row being copied to newly inserted row and allowing the user to make any changes.
    The newly inserted row should also include a check box , so that when the user checks it again a new row should get inserted. Finally what ever data user enters on the screen, i should be able to update my internal table with those new values and records.
    Appreciate if anyone can guide me on how to proceed on this or any alternative approaches.
    Will reward helpful answers.
    Thanks.

    Hi ..
    Can you please be more detailed. First I need to know how to create the initial table display for the existing line items and then the techniques for inserting the new rows based on the check marks and finally add those news rows to my existing internal table..
    Appreciate ur help.
    Thanks.

  • Need to add a new row at the end of the table

    Experts,
    working jdev 11.1.1.3.0
    i am adding row programetically, my requirement need to add the row at after last row.
    i tried different ways.
    Row newLastRow = getPWBBidLaneVO().last();
    int lastRowIndex = getPWBBidLaneVO().getRangeIndexOf(newLastRow);
    getPWBBidLaneVO().insertRowAtRangeIndex(lastRowIndex - 1,
    laneRow);
    this is giving --- java.lang.ArrayIndexOutOfBoundsException: 0
    and
    http://kohlivikram.blogspot.com/2008/10/add-new-row-in-adf-table-on-button.html --- its giving index out of bound because vo.getRangeSize() is 25. We set this value at vo for performance improment suggestions.
    is there a way to add a new row at the end of the table?

    Add this to the view row impl class
           public void insertRow(Row row) {
               //go to the end of Rowset if it has rows
               Row lastRow = this.last();
               if (lastRow !=null){
                    //insert new row at the end and make it current
                   int indx = this.getRangeIndexOf(lastRow)+1;
                   this.insertRowAtRangeIndex(indx,row);
                   this.setCurrentRow(row);
               }else { // empty Rowset
               super.insertRow(row);
               }

  • How do I add a new row to an AbstractTableModel?

    I'm having an issue with adding new data to a table row. Every row I add contains the same data which is always the last data I grabbed from my database. I'm not sure if my issue has to do with how I set up the data to be passed or the table itself or both... Any help would be appreciated. It seems like the tablemodel is holding the memory spot ArrayList I'm passing. If I have to set up an arraylist of arraylists, to pass how do I do that?
    My output is always:
    1,4,Laser,10,120,100
    1,4,Laser,10,120,100
    1,4,Laser,10,120,100
    1,4,Laser,10,120,100
    Desired output:
    1,1,Beam,10,99,100
    1,2,Canon,10,120,100
    1,3,Missile,10,66,100
    1,4,Laser,10,120,100
         * Extract weaponIDs by hullType from weapon database
    private void setWeapons(int hullType){
    // equpModel is the tableModel
        equipModel.clearTable();
        Weapon tempWeapon = new Weapon();
        ArrayList newData = new ArrayList();
        for (Iterator <Weapon> i = dataBaseManager.weaponList.iterator(); i.hasNext(); ){
            tempWeapon = i.next();
            if (tempWeapon.weaponClass == hullType){
                newData.add(0,1);
                newData.add(1,tempWeapon.weaponID);
                newData.add(2,tempWeapon.weaponName);
                newData.add(3,tempWeapon.weaponCps);
                newData.add(4,tempWeapon.weaponMass);
                newData.add(5,tempWeapon.weaponCost);
                equipModel.insertRow(newData);
    }Here is a snipet from the table class
    public class GenTableModel extends AbstractTableModel {
      private ArrayList data; // Holds the table data
      private String[] columnNames; // Holds the column names.
       * Constructor: Initializes the table structure, including number of columns
       * and column headings. Also initializes table data with default values.
       * @param columnscolumns[] array of column titles.
       * @param defaultvdefaultv array of default value objects, for each column.
       * @param rowsrows number of rows initially.
      public GenTableModel(String[] columns, Object[] defaultv, int rows) {
        // Initialize number of columns and column headings
        columnNames = new String[ columns.length ];
        for(int i = 0; i < columns.length; i++) {
          columnNames [ i ] = new String(columns [ i ]);
        // Instantiate Data ArrayList, and fill it up with default values
        data = new ArrayList();
        for(int i = 0; i < rows; i++) {
          ArrayList cols = new ArrayList();
          for(int j = 0; j < columns.length; j++) {
            cols.add(defaultv [ j ]);
          data.add(cols);
       * Adds a new row to the table.
       * @param newrowArrayList new row data
      public void insertRow(ArrayList newrow) {     
        data.add(newrow);
        super.fireTableDataChanged();
       * Clears the table data.
      public void clearTable() {
        data = new ArrayList();
        super.fireTableDataChanged();
    }

    Hi thanks again for responding
    Here is the Initialization, including the panel and scrollpane it sits on.
          // Table attempt
            JPanel tablePanel = new JPanel(new BorderLayout());
            tablePanel.setBounds(PANEL_X+2*PANEL_DISTANCE, PANEL_Y, PANEL_WIDTH+300, PANEL_HEIGHT);
            title = BorderFactory.createTitledBorder(blackLine, "Table List");
            tablePanel.setBorder(title);
    // This is column tile plus one dummy initilization set.
            String[] columnNames = {"DB", "ID", "Name", "CPS", "Energy", "Mass", "Cost"};
            Object[] data = {new Integer(0),new Integer(0), "Empty", new Integer(0),
                        new Integer(0),new Integer(0),new Integer(0)};
    // here is the GenTableModel creation
            equipModel = new GenTableModel(columnNames, data, 1);
            equipmentTable = new JTable(equipModel);
            equipmentTable.setRowSelectionAllowed(true);
            equipmentTable.setFillsViewportHeight(true);
            equipmentTable.setColumnSelectionAllowed(false);
            TableColumn column = null;
            column = equipmentTable.getColumnModel().getColumn(0);
            column.setPreferredWidth(20);
            column = equipmentTable.getColumnModel().getColumn(1);
            column.setPreferredWidth(20);
            JScrollPane scrollPane = new JScrollPane(equipmentTable);
            tablePanel.add(scrollPane);
            add(tablePanel);
        Here is the full code for GenTableModel. It is as you guessed.
    public class GenTableModel extends AbstractTableModel {
      private ArrayList data; // Holds the table data
      private String[] columnNames; // Holds the column names.
      public GenTableModel(String[] columns, Object[] defaultv, int rows) {
        // Initialize number of columns and column headings
        columnNames = new String[ columns.length ];
        for(int i = 0; i < columns.length; i++) {
          columnNames [ i ] = new String(columns [ i ]);
        // Instantiate Data ArrayList, and fill it up with default values
        data = new ArrayList();
        for(int i = 0; i < rows; i++) {
          ArrayList cols = new ArrayList();
          for(int j = 0; j < columns.length; j++) {
            cols.add(defaultv [ j ]);
          data.add(cols);
      public int getColumnCount() {
        return columnNames.length;
      public int getRowCount() {
        return data.size();
      public String getColumnName(int col) {
        return columnNames [ col ];
      public Object getValueAt(int row, int col) {
        ArrayList colArrayList = (ArrayList) data.get(row);
        return colArrayList.get(col);
      public Class getColumnClass(int col) {
        // If value at given cell is null, return default class-String
        return getValueAt(0, col) == null ? String.class
                                          : getValueAt(0, col).getClass();
      public void setValueAt(Object obj, int row, int col) {
        ArrayList colArrayList = (ArrayList) data.get(row);
        colArrayList.set(col, obj);
      public void insertRow(ArrayList newrow) {     
        data.add(newrow);
        super.fireTableDataChanged();
      public void deleteRow(int row) {
        data.remove(row);
        super.fireTableDataChanged();
      public void deleteAfterSelectedRow(int row) {
        int size = this.getRowCount();
        int n = size - (row + 1);
        for(int i = 1; i <= n; i++) {
          data.remove(row + 1);
        super.fireTableDataChanged();
      public ArrayList getRow(int row) {
        return (ArrayList) data.get(row);
      public void updateRow(ArrayList updatedRow, int row) {
        data.set(row, updatedRow);
        super.fireTableDataChanged();
      public void clearTable() {
        data = new ArrayList();
        super.fireTableDataChanged();
    }

  • Add a new row at the top of a table in GUI

    Hi,
    I am using JDev 11.1.1.1.0. I need to be able to let users add a new row at the top of a table and not anywhere else in the middle of table rows. I cannot seem to find a way to do it. note that it does not matter where a new row gets inserted in the db, i am only concerned about restricting the insert in the GUI to the topmost line/row.
    Thanks,
    AJ

    Hi
    Can you try with writing your custom create method in application module and calling same from UI on command button action like
    public void createNewRow()
    ViewObjectImpl vo = getVO1();
    Row newRow= vo.createRow()
    vo.insertRowAtRangeIndex(0, newRow);
    Vikram

  • How to add new row and update existing rows at a time form the upload file

    hi
    How to add new row and update existing rows at a time form the upload file
    example:ztable(existing table)
    bcent                      smh            nsmh         valid date
    0001112465      7.4                       26.06.2007
    0001112466      7.5                       26.06.2007
    000111801                      7.6                       26.06.2007
    1982                      7.8                       26.06.2007
    Flat file structure
    bcent                       nsmh         valid date
    0001112465     7.8     26.06.2007  ( update into above table in nsmh)
    0001112466     7.9     26.06.2007  ( update into above table in nsmh) 
    000111801                     7.6      26.06.2007 ( update into above table in nsmh
    1985                      11              26.06.2007   new row it should insert in table
    thanks,
    Sivagopal R

    Hi,
    First upload the file into an internal table. If you are using a file that is on application server. Use open dataset and close dataset.
    Then :
    Loop at it.
    *insert or modify as per your requirement.
    Endloop.
    Regards,
    Srilatha.

  • How can I add a new row in a JTable dynamically?

    Dear Sir(s)
    I want to add a new row in a Jtable as I press enter key the time focus is on the last cell of the row? pls help

    TomDooley wrote:
    Hello,
    ...I write directly to a cvs file ...my loop slows down to 0.2 Hz
    Writing a series of 5 values to a file should not take so long. There is probably something wrong in the way you are saving your data. May be you should post a simplified version of your vi, so we could see how to improve your code.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Add a new row in Detail form in MASTER DETAIL FORM

    Hello Everyone,
    I need help on the following.I have master detail form .In detail form i have Add Row button which adds a new row and i have save button to save the record .But now if i am adding a row its not adding a new row .It says it process but didn't show the new row .
    Can somebody help me on this
    thanks in advance

    Hello,
    How many records do you show in your detaii region and how many are there for that master? Maybe the new row is in the next set of records - or at the 'bottom' of the last set of records?
    Did you check if the row is inserted in the database (and just didn't show up for one reason or another)?
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.logica.com/

  • Trying to automatically add a new row w/o mutating table error...

    I'm using Oracle 10g express. I'm trying to automatically add a new row with the same e_ID, (RDD + 6 months) as the updated row when RC is updated. I'm fairly new to Oracle, so I need some help on creating a trigger. If you need more details let me know. Thanks in advance.
    create table E
    e_id number(6,0) not null,
    constraint e_pk primary key(e_id)
    create Table ER
    e_Id Number(6,0) Not Null,
    SC Date,
    RDD Date,
    RC Date,
    Constraint ER_Fk Foreign Key(E_Id) References E(E_Id)
    );

    mookjais wrote:
    I'm using Oracle 10g express. I'm trying to automatically add a new row with the same e_ID, (RDD + 6 months) as the updated row when RC is updated. I'm fairly new to Oracle, so I need some help on creating a trigger. If you need more details let me know. Thanks in advance.
    create table E
    e_id number(6,0) not null,
    constraint e_pk primary key(e_id)
    create Table ER
    e_Id Number(6,0) Not Null,
    SC Date,
    RDD Date,
    RC Date,
    Constraint ER_Fk Foreign Key(E_Id) References E(E_Id)
    );Do you mean following(example)?
    create trigger after_insert_e
    after
      insert
    on  e /*This is table name*/
    referencing new as new old as old
    for each row
    begin
    insert into  ER(e_Id,SC,rdd,rc)
    values(:new.ed_id,sysdate,sysdate,sysdate);
    end;

  • How can I add new row/column into existing jTable?

    Hi add!
    Can you help me how can I add new row/column into existing jTable?
    Tnx in adv!

    e.g
    Create two buttons inside the Table ( "Add New Row" ) and ("Add new Column")
    their handlers are:
    add new row:
    //i supose u already have
    DefaultTabelModel tablemodel = new DefaultTableModel(rowdata, columnNames);
    //and   
       JTabel jtable = new JTable(tablemodel);
    // Handler (row)
    jbtAddRow.addActionListener(new ActionListener(){
       public void actionPerformed(ActionEvent e) {
          if(jtable.getSelectedRow() >= 0 )
              tablemodel.insertRow(jtable.getSelectedRow(), new java.util.Vector());  
           else  
                tablemodel.addRow(new java.util.Vector());
        });to add new columns its the same but inside actionPerformed method:
    ask for e.g "Whats the name for the new column"
    then,
       tablemodel.addColumn(nameOfColumn, new java.util.Vector());   Joao
    Message was edited by:
    Java__Estudante

  • How to add a footer row to an existing table?

    The LiveCycle on-line help is pretty cryptic on this one . . . .
    I have an existing table in a form in which the designer (me) left off a footer row by mistake. In lieu of deleting the table and rebuilding it using the Table Assistant, is there a way to add a footer row to the existing table? The on-line help seems to indicate that it's possible, but offers little in the way of instruction on how to do it.
    Thanks in advance!
    Bill

    Hi Bill,
    in your hierarchy view of your table,
    selsct the body row of your tabke and
    right-click and select 'Insert'.
    Then select 'Rows below'.
    You will see a new row beneath your original body row.
    Select your new row, and in your Object tab, select 'Footer Row' under type.
    Now, under the Pagination tab select wether you want to see the footer row on every page or just the last page.
    Good Luck!
    Zoe

  • How to add a new data element for existing table filed(Primary key field)

    Hi Experts,
    How to add a new data element for existing table field(Primary key field)
    For this filed ther is no foreign key relation ships and even check table.
    while activating table it is giving message like below.
    can you help any one to solve this and wil steps to add new dataelement for existing primary key filed of a table.
    Check table (NAMING SPACE/TABLE NAME(EX:/TC/VENDOR)) (username/19.02.10/03:29)           
    Primary key change not permitted for value table /TC/VENDOR
    Check on table  /TC/VENDOR resulted in errors              
    Thanks
    Ravi

    Hi,
    Easiest way is to download the table eg into an Excel table (if possible) or text table. Drop the table from the database. Build your table with the new key field. Build the database table again and fill it.
    You can do it also over the database into a new table. Drop the old one. Build the enhanced one and fill it. Afterwards drop your (temporary) table.
    Maybe there are other ways, but this works.
    Success,
    Rob

  • Add a new field to an existing Condition table

    How can I add a new field to an existing condition table?
    I have table 971 and I want to add INCOTERMS (INCO1) to this existing table but do not see how to add it.
    Thanks

    Hi Vicky,
        I dont think you can add new fields to the condition table once you have activated the condition table.
    SAP says you can only make limited changes to the condition table, like changing the description, fast entry screen, header and footer fields, but not able to add new fields to the table, and I think that is the correct approch or else for the same table you will have two sets of condition records.
    Please refer to the below link:
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/de/7a8534c960a134e10000009b38f83b/frameset.htm
    What you can do is create a new condition table with additional field and assign this table before the currently used table in the access sequence.
    Hope this helps.
    Regards
    Raj

  • Add a new table to an existing Print Layout Designer report

    Is it possible to add a new table to an existing Print Layout Designer report? For example, in the Production Order there is a Sales Order field (which is displayed on the report), I would like to display some information from UDFs found on the Sales Order, but when I add a Database Field to the report the Sales Order tables does not appear in the list (OWOR).

    Hi
    It is possible provided there is a relationship which exists between two tables.
    You can add a Database field. Goto the Properties and selct Content Tab.
    Now in the Table dropdown, hold the Alt Key and click. This displays all the tables in B1. After selecting the Table, you can select the related Column.
    Remember there should be a relationship which exists between this column and existing columns.
    Because PLD works completely on Joins to my understanding

  • Can we add a new attachment to an existing SC from any other custom page in SoCo PO View

    Hi Experts,
    Need your expert advice on the below requirement.
    We have created a custom view in SoCo PO page. There we have a New custom view called Notes&attachement.which contains same value from Notes & attachment of Shopping Cart.
    We are updating existing Notes of SC by FM 'bbp_pd_sc_update' and same is reflected in SC of same item guid & same header guid.
    Similarly trying to add a new Attachment to already existing attachment. New attachment is reflected in custom page and the describe link is working perfectly. but if come out of SoCo page , lets say in SC the new added attachment is shown but display_url,phio_size etc are not stored properly in DB.
    in bbp_pd transaction every thing looks same for new and existing attachment. we are using same FM 'BBP_PD_SC_UPDATE' by passing new internal table of attachment in import statement. Even 'BBP_PROC_DOC_UPADTE' has same result that is attachment is partially updated.
    Suppose, SC has one attachment at the time of creation. then adding a new attachment in custom view of SoCo PO page then every thing works fine in SoCo PO page but out of that SoCo PO or in SC the newly added attachment is not properly updated.
    I have added mime_type,phio_size,disp_url,file_name,file_ext,ev_content of new attachment in existing attachment internal table and calling above FM for update.
    Can we  add new attachment outside SC to existing SC ? if yes , then how?
    Thanks,
    Partha

    Hi Partha,
    Please post this query in the category: SAP SRM. Your post currently shows up on the forum - SRM User Interface Add-on. As your query is not related to the new ad-on, you might not get as many responses in this forum as you would have if you had posted the query in the general SRM forum (http://scn.sap.com/community/srm).
    Hope this helps
    Cheers,
    Yateesh

Maybe you are looking for

  • Spent thousands of dollars and can't even use basic features

    MacBook Pro - $2000 iPhone - $800 Apple TV - $100 What the **** is going on with Apple? I can't sync my iPhone and MacBook Pro. Sometimes is discovers both devices but then fails to sync. Other times neither recognises each other even when they're bo

  • MySAP Skills

    Sorry folks. This is an offbeat question. Appreciate if you could still spare a few moments to answer it. The phrase "mySAP" is normally prefixed to SAP Business suite components like PLM, CRM, SCM, SRM and ERP. What does one make out when someone sa

  • Combo box error

    I have the following code: try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String sourceURL = "jdbc:odbc:my_Library"; Connection databaseConnection = DriverManager.getConnection(sourceURL); Statement statement = databaseConnection.createStatement(

  • IOS upgrade - can no longer resize pictures for messaging or email

    Hi before the recent iOS upgrade, if I wanted to send a photo from my iPhone by either MMS or email I had the option to choose the file size of the photo before I sent the message. This option now seems to have disappeared. Does anyone know if this o

  • HOW TO WRITE QUERY OR PL/SQL PROGRAM FOR THIS

    I HAVE TABLE X SELECT ENO FROM X ENO 123 423 332 562 678 986 621 WHEN I RUN PL/SQL PROGRAM I WILL PASS PARAMETER FOR EXAMPLE LIKE 134 I NEED OUTPUT LIKE 134 EXIST OUTPUT 123 423 332 562 621 134 NOT EXIST OUTPUT 678 986 Regards Dev