Select new row in tree after add

In quite a few of our pages in our application we have trees and tree tables that can have rows added through separate popup windows. After the user successfully adds the record and closes the popup the tree/treetable is refreshed properly, however we also want the new node/row to be selected, and also make sure that it's parent is expanded. We've found a variety of examples of logic that does something close or sort of close, but we're having difficulties. Is there any easy or even moderate way to find a node/row in a tree based on the VO's primary key or some other value? I think I know how to make the found node/row selected and it's parent expanded, but how do I find the node/row? I keep running into issues because the tree isn't necessarily completely expanded or because the range of rows in the iterator isn't huge and the new row isn't in the initial range of rows pulled back.

Hi,
I just posted a demo and source code on my blog: Auto select New Item in Tree component
In above example i use loopAndFind() custom function.
Hope it helps!
Mariush T.
Blog: http://mariusht.com/blog/

Similar Messages

  • Auto select new item in tree

    Hi
    I have a tree that i allow user to drag and drop items to it - what is the easiest way so the new item is automatically selected? ie, tree.selectedIndex should point to the new item's index.
    Unfortunately it thought this was easy apparently it was not - like if the nodes in the tree control are collapsed, the selectedIndex is different than when all the nodes are expanded.
    Do note that the way i populate my tree is through a data provider - so i populate a class that would become the tree's data provider, so when the tree refreshes, i simply do this:
    myTree.dataProvider = project.p;   
    I can track where my new item was inserted in my "project" instance - but like i said earlier, the tree itself have different selectedIndex when the nodes are collapsed and when they are not.
    THanks

    Hi,
    I just posted a demo and source code on my blog: Auto select New Item in Tree component
    In above example i use loopAndFind() custom function.
    Hope it helps!
    Mariush T.
    Blog: http://mariusht.com/blog/

  • Creation of new Row in Tree Table

    We are creating a new row using CreateListener which is written in Bean, after creating the row, we are adding it to the iterator and the new row is not getting highlighted and focus is not in new row in the table by default. It takes an click to make it editable. 'setActiveRowKey()' method didnot help here which is used in the af:table component to achieve the same.
    Any pointers regarding this issue would be helpful..
    Thanks,
    Shruthi

    Hi Max:
    According to what you described, it's really wierd. An ADF table is Surrounded by a panelCollection or not doesn't matter in terms of CreateInsert operations, I think. Also each step you said OK doesn't mean that step is 100% problem free towards your final goal. For example, when you drag and drop and ADF table onto a JSF page, you forget to turn on 'row selection', it will be OK, you won't get any error message, but later on when you find that you need to turn it back on, you have to go back to JSF page source, to manually added codes to do so.
    The simpliest solution and quickest one is to reinitiate a clean ADF project and do it all over again. It's simple straightforward in my view. Probably don't use PanelCollection first, just drop your ADF table on a form, or af:panelForm, but make sure your table and 'CreateInsert' button is surrounded by a form, otherwise, when you click on 'CreateInsert', nothing will happen. When everything works, then probably back it up and replace your form or af:panelForm with panelCollection. See how it goes.
    Thanks,
    Alex

  • EDIT method doesn't work after adding new row

    I would like to start editing after adding new row into TableView.
    I copied example from Oracle website: [Using JavaFX UI Controls - 13 Table View|http://docs.oracle.com/javafx/2/ui_controls/table-view.htm#CJAGDAHE]. Then I put additional button for adding new row and define action for the button.
        final Button addButton = new Button("Add");
        addButton.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent arg0) {
                Person p = new Person("", "", "");
                table.getItems().add(p);               
                table.getSelectionModel().select(p);
                table.edit(table.getSelectionModel().getSelectedIndex(), table.getColumns().get(2));
        });In result I can see selected new row but the table doesn't start edditing in the third column.
    I have similar method for editing existing rows and it works properly.
        final Button editButton = new Button("Edit");
        editButton.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent arg0) {
                table.edit(table.getSelectionModel().getSelectedIndex(), table.getColumns().get(2));
        });Could you help me what I do wrong?

    Try wrapping the setCaretPosition(...) method in a SwingUtilities.invokeLater(...)
    caret=outputArea.getDocument().getText(0,outputArea.getDocument().getLength()).length();Should be:
    caret = outputArea.getDocument().getLength();

  • Add new row to a table bound to ArrayList in backing bean

    Hi,
    I have a Arralist<CustomObject> in the backing bean.
    I want to create a table with Add/Delete new row buttons which will add/delete objects from the ArrayList.
    I am using Jdev 11g and I am not using ADF BC.
    Please give me some heads up or links.
    Thanks

    Then that's your problem, change the class to something like:
    public class TableHandlerConsumer
        private static final String LIST_PAGE_FLOW_ATTR = "consumers:" + TableHandlerConsumer.class.getName();
        public TableHandlerConsumer()
            Collection data = new ArrayList<Consumer>();
            buildModel(data);
            tableModel = new SortableModel(data);
            Map<String, Object> pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
            pageFlowScope.put(LIST_PAGE_FLOW_ATTR, tableModel);
        private void buildModel(Collection data)
            baris.add(new Consumer("", "", "", "", ""));
            baris.add(new Consumer("", "", "", "", ""));
            baris.add(new Consumer("", "", "", "", ""));
        public void addRow()
            Consumer consumer = new Consumer();
            ((Collection)tableModel.getWrappedData()).add(Consumer);
        public SortableModel getTableModel()
            Map<String, Object> pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
            return (SortableModel)pageFlowScope.get(LIST_PAGE_FLOW_ATTR);
    }Note that if you're using 10g then change Requestcontext to AdfFacesContext and getPageFlowScope to getProcessScope
    Regards,
    ~ Simon

  • Adding a new row programatically

    I have the following use case :
    1) I have a jsf page having adf table which displays all the records from the employees table of hr schema.
    2) pagination was implemented on this table and this table contains two buttons "Add New Row" and "Save".These buttons will be displayed in every page.
    3) when the "Add New Row" is clicked,a new row has to be inserted as the last record of adf table in jsf page.
    i.e suppose if the employees table contains 45 records,the adf table in my .jspx page displays 5 pages(each page contains 10 records).If i click "Add new row" button in page 2,the new record should be inserted as the 46th record in the 5 th page and the control should transfer to 5th page to enter the values for the new row.
    4)After entering the values and save button is clicked,all the values of newly inserted rows should be inserted into the database.
    How to acheive this functionality.
    I did the following :
    1)created the entity and view objects.
    2)written a bussiness method in AMImpl to insert a new row when the 'Add new row" button is clicked.But this method is inserting the new row as the last record in the same page that I performed the operation.
    Below is my code snippet :
    public void addNewRow(){
    Row newRow=getEmployeeObj().createRow();
    newRow.setNewRowState(Row.STATUS_INITIALIZED);
    EmployeeUVOImpl vo = (EmployeeUVOImpl)getEmployeeObj();
    int res=vo.getFetchedRowCount()/vo.getRangeSize();
    int remin=vo.getFetchedRowCount()%vo.getRangeSize();
    if((vo.getFetchedRowCount()%vo.getRangeSize())>0){
    vo.insertRowAtRangeIndex(vo.getRangeSize(),newRow);
    else{
    vo.insertRowAtRangeIndex(vo.getRangeSize()-1,newRow);
    Thanks in Advance,
    Regards,
    Siva

    Hi,
    the code below works in JDeveloper 11g. However, it works similar for 10.1.3 so you may want to have a look
        public String newRowAction() {
            CollectionModel tableModel = (CollectionModel) table1.getValue();
            JUCtrlHierBinding adfModel = (JUCtrlHierBinding) tableModel.getWrappedData();
            DCIteratorBinding dciter = adfModel.getDCIteratorBinding();
            Row lastRow = dciter.getNavigatableRowIterator().last();
            Row newRow  =  dciter.getNavigatableRowIterator().createRow();
            newRow.setNewRowState(Row.STATUS_INITIALIZED);
            int lastRowIndex = dciter.getNavigatableRowIterator().getRangeIndexOf(lastRow);
            dciter.getNavigatableRowIterator().insertRowAtRangeIndex(lastRowIndex+1, newRow);
            dciter.setCurrentRowWithKey(newRow.getKey().toStringFormat(true));
            //table should have its displayRow attribute set to "selected"
            AdfFacesContext.getCurrentInstance().addPartialTarget(table1);
            return null;
        }Frank

  • Add Row Before Or After Selected Row In af:Table

    Hi,
    Please let me know how can we add a row either before or after the selected row in the af:table.
    Currently i have a table with 2 toolbar buttons. 1.Add Before 2.Add After.
    User selects the row and clicks either AddBefore/After button ... then, an empty row should get added in the table as per the button clicked.
    Please suggest me your inputs.
    Thanks,
    Kiran

    chk this
    http://mjabr.wordpress.com/2011/07/02/how-to-control-the-location-of-the-new-row-in-aftable/

  • If I add artwork by dragging a jpg to the artwork area after selecting several rows, in some instances a single icon is created in the flipper;  in others one is created for each song. Why? How can I get one image per album every time?

    If I add artwork by dragging a jpg to the artwork area after selecting several rows, in some instances a single icon is created in the flipper;  in others one is created for each song. Why? How can I get one image per album every time?

    If I add artwork by dragging a jpg to the artwork area after selecting several rows, in some instances a single icon is created in the flipper;  in others one is created for each song. Why? How can I get one image per album every time?

  • To add new row with the checkbox selected ....

    Hi All,
    In my project I have to create a table with 2 columns, 1 column is checkbox and other column is String type. In the same JFrame one textarea and one add button should be there. When we type text in the textarea and click add button, it should add a new row in the table with the checkbox selected and the 2nd column containing the text.
    I want to use AbstractTableModel.
    Please help me to solve this issue. If you have sample code that will be more helpful.
    Thank you,
    Regards,
    mkumar

    It would be better if you extend from DefaultTableModel rather than from Abstract Table Model. That is because DefaultTableModel provides functionality to add a row. In fact, you can directly use DefaultTableModel .
    In the button's action performed,
    public void actionPerformed(ActionEvent e)
      if(e.getSource() == bAdd)
        Vector newRow = new Vector(2);
        newRow.add(new Boolean(Boolean.TRUE));
        newRow.add(" ");
        DefaultTableModel dm = (DefaultTableModel)yourTable.getModel();
        dm.addRow(newRow);
    }Note : For the above code, Initialize the JTable with a DefaultTableModel parameter than directly with Vectors/ Arrays.
    This is because when we try to cast from TableModel to DefaultTableModel as in the above code, there is a possibility of an
    Exception if the Table is not initialized without a model.
    For the CheckBox in the first column, you need to set an editor and a renderer so that you can manipulate and see your boolean values as the state of the check boxes.
      JCheckBox b = new JCheckBox();
      DefaultTableCellRenderer dr = new DefaultTableCellRenderer(b);
      DefaultTableCellEditor de = new DefaultTableCellEditor(b);
      yourTable.getColumnModel().getColumn(0).setCellEditor(de);
      yourTable.getColumnModel().getColumn(0).setCellRenderer(dr);That should do it !
    Cheers

  • Error after using a servlet in ADF  - unable to select another row in table

    Hello,
    I have a go button and when I select a row in a table it call a download servlet. After I open or save the document I'm unable to make other selection in the table or make another action.
    The table has single row selection active.
    The servlet make part from a task-flow.
    Here is the code for the sevlet and my jdev version is 11.1.1.2.0
    public class DownloadServlet extends HttpServlet {
    @Override
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    public void doGet(HttpServletRequest request,
    HttpServletResponse response) throws ServletException,
    IOException {
    String id= null;
    String den= null;
    InitialContext ic;
    try {
    ic = new InitialContext();
    } catch (NamingException e) {
    DataSource ds = null;
    Connection conn = null;
    PreparedStatement cStmt = null;
    ResultSet rset= null;
    byte[] bdata = null;
    String rezult_null = "";
    id_fisier_lcl = request.getParameter("id");
    den_fisier_lcl = request.getParameter("fileName");
    rezult_null = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
    "<Body>Fisierul a fost arhivat</Body>";
    try {
    ic = new InitialContext();
    ds = (DataSource)ic.lookup("jdbc/ConnDS");
    conn = ds.getConnection();
    cStmt = conn.prepareStatement("commit");
    cStmt.execute();
    conn.commit();
    cStmt= conn.prepareStatement("SELECT a.item FROM table a WHERE a.id = " + id);
    rset = cStmt.executeQuery();
    if (rset.next()) {
    weblogic.jdbc.wrapper.Clob clob =
    (weblogic.jdbc.wrapper.Clob)rset.getClob("content");
    oracle.sql.CLOB oclob = (oracle.sql.CLOB)clob.getVendorObj();
    bdata = new byte[(int)oclob.length()];
    InputStream is = oclob.getAsciiStream();
    is.read(bdata);
    rset.close();
    cStmt.close();
    } else {
    bdata = new byte[(int)rezult_null.length()];
    bdata = rezult_null.getBytes();
    rset.close();
    cStmt.close();
    } catch (NamingException e) {
    } catch (SQLException e) {
    String username_lcl = null;
    username_lcl =
    ADFContext.getCurrent().getSecurityContext().getUserName();
    OutputStream outputStream =response.getOutputStream();
    String mimetype = "";
    FacesContext facesContext =FacesContext.getCurrentInstance();
    response.setContentType( (mimetype != null) ? mimetype : "application/x-download" );
    response.setHeader( "Content-Disposition", "attachment; filename=\"" + den_fisier_lcl + ".xml\"" );
    try {
    outputStream.write(bdata);
    outputStream.flush();
    outputStream.close();
    catch (Exception e) {
    e.printStackTrace();
    FacesMessage msg =
    new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(),
    facesContext.addMessage(null, msg);
    How can I fix it?
    Thank you.

    Hi,
    have you seen this ?
    http://download.oracle.com/docs/cd/E21764_01/apirefs.1111/e12419/tagdoc/af_fileDownloadActionListener.html
    If you want to continue with your approach, then a way out of your problem could be to add an af:clientListener onto the command button. The JavaScript function would be
    function onDownload(evt){
      evt.noResponseExpected();
    }Frank

  • Af:table and selectOneChoice, creating a new row resets selected value

    Hello,
    I have a table containing 4 columns, first two are read-only (outputtext) and next 2 contains selectOneChoice , table model is baed on java.util.List
    adding a new row, works fine but it resets the selectOneChoice(dropbox) selected value to First Index For All Rows
    so everytime you add a new row, it resets the value to the very First Value in the dropbox for all rows,
    it seems after PPR it loses the selected value in SelectOneChoice for each row...
    any ideas?
    Thanks,

    Hi,
    What is the EL expression given for value property of selectOneChoice list?
    I guess it is the bean variable and it is same for each row, due to which selection in any selectOneChoice list in table modifies the same bean variable and sets the same value for lists in all other rows too(same happens in case of new insertion also, when you insert new record selectonechoice list points to the first value if no selection item is not added), in case of selectonechoice list you need to handle the selected values differently for each row. If you can share sample code, I can tell you what could be the problem.
    Sireesha

  • Creating new row right after popup opens (JBO-35007 because of  trigger)

    Hi,
    I have the same popup (with an ADF form) to add and to edit data. But i have two buttons which displays this popup - Add new and Edit, Edit works OK, on add, i insert new record like this:
            DCIteratorBinding dciter =
                (DCIteratorBinding)bindingContainer.get(iterator);
            ViewObject view = dciter.getViewObject();
            Row newRow = view.createRow();
            view.insertRow(newRow);
            view.setCurrentRow(newRow);before popup is open. And it adds a new record. But the record has id -10 (or some other negative number). This -10 is shown on calling page (the page from which the popup is open) in ADF ReadOnly table as -10 as id and other cells in row empty. That shouldn't happen (se bellow why). User then edits empty form in popup, and commits - then i get JBO-35007 because -10 changed to 123 - because of trigger.
    I tried to requery - it doesn't help, see Refresh after pop-up window closes.
    Can you suggest a solution on how to create a row right after popup opens?
    Also,
    i create new record on button's LaunchListener method. This method seems to execute before popup is open and so it affects the calling page also. I think the problem would be solved if new row would be created after popup is opened, not while opening it. (clicking create in popup works fine)

    in my real case, i usually don't show ids; but to simplify debugging, i created test project where i show as many things as possible.
    you mean, creating new record like following?
            bindings.getOperationBinding("Create").execute();I don't use that because i don't get empty fields in popup window (although new record is created). Actually, i don't know how to set this created record to be selected one. Suggestions?
    And I did some more testing, if I create new record with clicking on Create (not creating new row automatically), i get JBO-35007 only if there was selected any other than the first row in table.
    and i tried to move create method binding in pagedef, so it's the first one.. But it seems like there is no effect.
    btw, i found this in one of examples on web:
       <invokeAction Binds="Execute"
                      id="refreshTableViewObjectAfterAddingNewApp"
                      Refresh="prepareModel"
                      RefreshCondition="#{processScope.addedNewApp}" />refresh condition must be true when adding new row and false for everything else. I'm not sure what that does, but it seems to work... :)
    I really shouldn't use the same View Objects in popup and 'master' page, should I?

  • JTable checkboxes doesn't retain their selection when a new row is added!!

    HI,
    My gui has the JTable component which has 5 columns. out of which 4 columns are checkboxes. whenever i select an item from the Jlist and click on the add button it will add a new row in JTable.
    but the problem is whenever a new row is added to the table. the previously selected checkboxes of previous rows are being deselected. But i want to retain the selection of my previous rows even when a new row is added. please help me how to achieve this..i am posting my JTable code here:
    class FunctionTableModel extends AbstractTableModel{
           /** The instances who's attribute structure we are reporting */
        //protected InitModel m_init;
        protected String func_element;
        protected int counter;
        //protected String[] func_array;
        protected Vector func_vector;
        /** The flag for whether the instance will be included */
        protected boolean [] m_Sum;
        protected boolean [] m_Min;
        protected boolean [] m_Avg;
        protected boolean [] m_Max;
        protected boolean [] m_SD;
         * Creates the tablemodel with the given set of instances.
         * @param instances the initial set of Instances
        public FunctionTableModel() {
          counter =0;
             func_vector = new Vector();
         public FunctionTableModel(Vector vec) {
            func_vector = vec;
        public Vector getDataVector(){
            return func_vector;
         * Sets the tablemodel to look at a new set of instances.
         * @param instances the new set of Instances.
        public void setElement(Vector vec) {
               for(int i=0;i<vec.size();i++){
            func_vector.add(vec.elementAt(i));
            counter++;
          fireTableDataChanged();   
          m_Sum = new boolean [counter];
          m_Min = new boolean[counter];
          m_Avg = new boolean[counter];
          m_Max = new boolean[counter];
          m_SD = new boolean[counter];
         * Gets the number of attributes.
         * @return the number of attributes.
        public int getRowCount() {
               return func_vector.size();
         * Gets the number of columns: 3
         * @return 3
        public int getColumnCount() {
          return 6;
         * Gets a table cell
         * @param row the row index
         * @param column the column index
         * @return the value at row, column
        public Object getValueAt(int row, int column) {
          switch (column) {
          case 0:
            return func_vector.elementAt(row);
          case 1:
            return new Boolean(m_Sum[row]);
          case 2:
            return new Boolean(m_Min[row]);
          case 3:
            return new Boolean(m_Avg[row]);
          case 4:
            return new Boolean(m_Max[row]);
          case 5:
            return new Boolean(m_SD[row]); 
          default:
            return null;
        public void removeAll(){
            func_vector.removeAllElements();
            fireTableDataChanged();
         * Gets the name for a column.
         * @param column the column index.
         * @return the name of the column.
        public String getColumnName(int column) {
          switch (column) {
          case 0:
            return new String("Function Selected");
          case 1:
            return new String("Sum");
          case 2:
            return new String("Min");
          case 3:
            return new String("Avg");
          case 4:
            return new String("Max");
          case 5:
            return new String("SD");   
          default:
         return null;
         * Sets the value at a cell.
         * @param value the new value.
         * @param row the row index.
         * @param col the column index.
        public void setValueAt(Object value, int row, int col) {
          if(col == 0){
            counter++;
            func_vector.add(counter,value.toString());
          if (col == 1)
            m_Sum[row] = ((Boolean) value).booleanValue();
          if (col == 2)
            m_Min[row] = ((Boolean) value).booleanValue();
          if (col == 3)
            m_Avg[row] = ((Boolean) value).booleanValue();
          if (col == 4)
            m_Max[row] = ((Boolean) value).booleanValue();
          if (col == 5)
            m_SD[row] = ((Boolean) value).booleanValue();       
         * Gets the class of elements in a column.
         * @param col the column index.
         * @return the class of elements in the column.
        public Class getColumnClass(int col) {
             return getValueAt(0, col).getClass();
         * Returns true if the column is the "selected" column.
         * @param row ignored
         * @param col the column index.
         * @return true if col == 1.
        public boolean isCellEditable(int row, int col) {
          if (col >= 1) {
             return true;
          return false;
        public void removeRow(int row){
            if(row<=func_vector.size()){
                          func_vector.removeElementAt(row);
                counter--;
            fireTableDataChanged();
        }

    hi parvathi,
    i have made changes to my previous code and here's the code:
      class FunctionTableModel extends DefaultTableModel{
           /** The instances who's attribute structure we are reporting */
        //protected InitModel m_init;
        protected String func_element;
        protected int counter;
        protected int counter1;
        //protected String[] func_array;
        protected Vector func_vector;
        /** The flag for whether the instance will be included */
        protected boolean [] m_Sum;
        protected boolean [] m_Min;
        protected boolean [] m_Avg;
        protected boolean [] m_Max;
        protected boolean [] m_SD;
        //protected Vector m_Sum1;
        //protected Vector m_Min1;
        //protected Vector m_Avg1;
        //protected Vector m_Max1;
        //protected Vector m_SD1;
         * Creates the tablemodel with the given set of instances.
         * @param instances the initial set of Instances
        public FunctionTableModel() {
            System.out.println("entered the constr");
          counter =0;
          //counter1=0;
          //m_Sum1 = new Vector();
          //m_Min1 = new Vector();
          //m_Avg1 = new Vector();
          //m_Max1 = new Vector();
          //m_SD1 = new Vector();
          //func_array = new String[];
          func_vector = new Vector();
         public FunctionTableModel(Vector vec) {
            func_vector = vec;
            //setElement(func_vector);
        public Vector getDataVector(){
            return func_vector;
         * Sets the tablemodel to look at a new set of instances.
         * @param instances the new set of Instances.
        public void addRow(Vector vec) {
          //counter++; 
          //func_element = ele;
          //System.out.println("FunctionTableModel- setElement() method");
          for(int i=0;i<vec.size();i++){
            func_vector.add(vec.elementAt(i));
            counter++;  
           //System.out.println("counter ="+counter+new boolean[counter]); 
            //m_Sum1 = m_Sum;
            //m_Min1 = m_Min;
            //m_Avg1 = m_Avg;
            //m_Max1 = m_Max;
            //m_SD1 = m_SD;
            //m_Sum = new boolean[counter];
            //System.out.println("at setElement");
            m_Sum = new boolean[counter];
            //System.out.println(counter);
            m_Min = new boolean[counter];
            //m_Min;
            m_Avg = new boolean[counter];
            //m_Avg1 = m_Avg;
            m_Max = new boolean[counter];
            //m_Max1 = m_Max;
            m_SD = new boolean[counter];
            //m_SD1 = m_SD;
            //counter1++;
          //func_array[counter]=ele;
          //func_vector.add(counter,ele);
          fireTableDataChanged();  
         * Gets the number of attributes.
         * @return the number of attributes.
        //public int getRowCount() {
          //System.out.println("FunctionTableModel- getRowCount() method");
          //return func_vector.size();
         * Gets the number of columns: 3
         * @return 3
        public int getColumnCount() {
          return 6;
         * Gets a table cell
         * @param row the row index
         * @param column the column index
         * @return the value at row, column
        public Object getValueAt(int row, int column) {
          switch (column) {
          case 0:
            return func_vector.elementAt(row);
          case 1:{
            //System.out.println("in case 1");
            //Boolean m_Sum_Value = new Boolean(m_Sum[row]);
            //System.out.println("m_Sum_Value:"+m_Sum_Value.booleanValue());
            return new Boolean(m_Sum[row]);
            //m_Sum1.add(m_Sum_Value);
            //return m_Sum_Value;
          case 2:
            return new Boolean(m_Min[row]);
          case 3:
            return new Boolean(m_Avg[row]);
          case 4:
            return new Boolean(m_Max[row]);
          case 5:
            return new Boolean(m_SD[row]); 
          default:
            return null;
        public void removeAll(){
            func_vector.removeAllElements();
            //m_Sum1.removeAllElements();
            fireTableDataChanged();
         * Gets the name for a column.
         * @param column the column index.
         * @return the name of the column.
        public String getColumnName(int column) {
          switch (column) {
          case 0:
            return new String("Function Selected");
          case 1:
            return new String("Sum");
          case 2:
            return new String("Min");
          case 3:
            return new String("Avg");
          case 4:
            return new String("Max");
          case 5:
            return new String("SD");   
          default:
         return null;
         * Sets the value at a cell.
         * @param value the new value.
         * @param row the row index.
         * @param col the column index.
        public void setValueAt(Object value, int row, int col) {
          if(col == 0){
            counter++;
            func_vector.add(counter,value.toString());
          if (col == 1) {
            m_Sum[row] = ((Boolean) value).booleanValue();
            //System.out.println("m_Sum length "+m_Sum.length);
            //for(int i=0;i<=row;i++)
            //    System.out.println("m_Sum1 "+i+((Boolean)m_Sum1.elementAt(i)).booleanValue());
            //System.out.println("m_Sum1["+row+"] "+ ((Boolean)m_Sum1.elementAt(row)).booleanValue());
            //    System.out.println("m_Sum["+i+"] "+ m_Sum);
    if (col == 2)
    m_Min[row] = ((Boolean) value).booleanValue();
    if (col == 3)
    m_Avg[row] = ((Boolean) value).booleanValue();
    if (col == 4)
    m_Max[row] = ((Boolean) value).booleanValue();
    if (col == 5)
    m_SD[row] = ((Boolean) value).booleanValue();
    * Gets the class of elements in a column.
    * @param col the column index.
    * @return the class of elements in the column.
    public Class getColumnClass(int col) {
    return getValueAt(0, col).getClass();
    * Returns true if the column is the "selected" column.
    * @param row ignored
    * @param col the column index.
    * @return true if col == 1.
    public boolean isCellEditable(int row, int col) {
    if (col >= 1) {
         return true;
    return false;
    public void removeRow(int row){
    if(row<=func_vector.size()){
    func_vector.removeElementAt(row);
    counter--;
    fireTableDataChanged();
    previouslu i was using the setElement method. now i have replaced with the addRow method...
    but anyways...the control is not going to any of these overridden methods...and none of the elements are added to the table. But i comment of all the addRow, getValueAt, getColumnClass methods...then it's adding rows to the table but with only the first column all the remaiing columns are just empty...
    i am fed up with this...if you observe i have commented out somany lines...becoz i am trying to save my boolean array values into a vector..but that was also in vain...
    i appreciate for ur help...
    thanks
    sri

  • 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);
               }

  • Trying to add a new row to a JTable

    I'm having trouble adding a row dynamically to a JTable. I've been able to populate the table with an array and that works well, but how do you add new rows after the program is running?

    You need to make TableModel that does dynamic resizing od the underlying data 2d array. This one will resize for both rows and columns.
        private Vector dataNames= new Vector();
        private Vector dataData =new Vector();
            javax.swing.table.TableModel dataModel = new javax.swing.table.AbstractTableModel()
                public int getColumnCount()
                    return dataNames.size();
                public int getRowCount()
                    return dataData.size();
                public Object getValueAt(int row, int col)
                    try
                        java.util.Vector v=(java.util.Vector)dataData.elementAt(row);
                        return v.elementAt(col);
                    catch(Exception e)
                        System.out.println("e :"+e.getMessage());
                        return null;
                public String getColumnName(int column)
                    return (String)dataNames.elementAt(column);
                public Class getColumnClass(int col)
                    if(getValueAt(0,col)!=null)
                        return getValueAt(0,col).getClass();
                    else
                        if(col==0)
                            return Integer.class;
                        else if(col==1 || col==2)
                            return Double.class;
                        else
                            return String.class;
                public boolean isCellEditable(int row, int col)
                    if(col > 0 && col <4)
                        return mapTableEditable;
                    else
                        return false;
                public void setValueAt(Object aValue, int row, int column)
                    if(row>=dataData.size())
                        if(dataData.size()==0)
                            for(int i=0;i<row+1;i++)
                                dataData.addElement(new java.util.Vector());
                                java.util.Vector v2=(java.util.Vector)dataData.lastElement();
                                v2.setSize(getColumnCount());
                        else
                            java.util.Vector v1=(java.util.Vector)dataData.lastElement();
                            int dataSize=row-dataData.size()+1;
                            for(int i=0;i<dataSize;i++)
                                dataData.addElement(new java.util.Vector());
                                java.util.Vector v2=(java.util.Vector)dataData.lastElement();
                                v2.setSize(v1.size());
                    java.util.Vector v=(java.util.Vector)dataData.elementAt(0);
                    if(column>=v.size())
                        for(int i=0;i<dataData.size();i++)
                            v=(java.util.Vector)dataData.elementAt(i);
                            v.setSize(column+1);
                    if(row<dataData.size())
                        v=(java.util.Vector)dataData.elementAt(row);
                        v.setElementAt(aValue,column);
            };

Maybe you are looking for

  • Pixel bender wont open on win 7

    i have been tryign to install pixel bender toolkit 2.5 so i can pplay with the droste filter that was not added to creative cloud a bit disapointed its nto in the new creative suite thta i pay for but that sneither here nor there the pixelbender prog

  • PS CS2 lens correction causes "Maximize Compatibility" issue in LR

    Question: why does PS CS2/3 convert the layer "Background" to "Layer 0"? This is the problem (and solution): I encountered the widely discussed "Maximize Compatiblity" issue with a bunch of PSD files (slide scans) that contained only one layer. Puzzl

  • [svn] 1150: More direct syntax tree generation work-in-progress.

    Revision: 1150 Author: [email protected] Date: 2008-04-08 14:56:01 -0700 (Tue, 08 Apr 2008) Log Message: More direct syntax tree generation work-in-progress. FlexStore now compiles and runs with -generate-abstract-syntax-tree set to true, but we stil

  • Project apis

    Hi All, I am a fresher. I have no experience in oracle apps. can you help me out with using the APIs in oracle to insert data to Oracle ebs apps? if there is any sort of tutorial or material please do mention Thanks, spark

  • Backing up all of my iTines Songs and everything that I can so I can...

    I need to re-install everything everything on my Mac because I was to get back programs that I took. I know there is an easy way of doing this but I am going to just do an erase and selectivly install what I need. Is there anyway that I could easily