ADF Faces: RicheTableau - how to create a richeTableau object

Hello. How to create a richeTableau object to put in a JSF page? I need to make a method that gets a list of column names and a list of list of data. This code I wrote do not work. What was my mistake?
        public RichTable getADFTable(
        List<String> lstCols, List< List<String> > lstLstData
    ){
        RichColumn adfCol = null;
        List<RichColumn> lstRichCols = new ArrayList<RichColumn>();
        
        int cont = 0;
        for( String col : lstCols ){
            adfCol = new RichColumn();
            adfCol.setDisplayIndex(cont++);
            adfCol.setHeaderText( col );
            adfCol.setMinimumWidth( "60" );
            lstRichCols.add( adfCol );
        }
        
        
        int contCols = 0;
        RichOutputText text = null;
        RichTable AdfTab = new RichTable();
        for( List<String> lstData : lstLstData){
            for( String data : lstData ){
                text = new RichOutputText();
                text.setValue(data);
                lstRichCols.get( contCols ).getChildren().add( text );
                contCols++;
            }
            contCols = 0;
        }
        
        AdfTab.setRows(this.lstEntit.size());
        
        cont = 0;
        for( RichColumn col : lstRichCols ){
            AdfTab.getChildren().add( col );
        }
        
        return AdfTab;
    }

I was looking for an example and I found it but the errors of the Pentecost, finally I fixed it and it works.

Just generate the data of your Web services and 'put' in this structure.

The java file (bean)

 

package view;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import java.util.Map;

import org.apache.myfaces.trinidad.model.CollectionModel;
import org.apache.myfaces.trinidad.model.SortableModel;

public class DynamicTable {
    private SortableModel model;
    private List columnNames;

    public DynamicTable() {
        columnNames = new ArrayList();
        columnNames.add("Col-1");
        columnNames.add("Col-2");
        generateColumnModel();
    }

    public void generateColumnModel() {
        this.model = new SortableModel(createRows(columnNames));
    }

    private List createRows(List columnNames) {
        int i = 0;
        List mapListforRows = new ArrayList();
        for (String name : columnNames) {
            Map newRow = new HashMap();
            mapListforRows.add(newRow);
            for (String col : columnNames) {
                newRow.put(col, "data");
            }
        }
        return mapListforRows;
    }

    // Get table model

    public CollectionModel getCollectionModel() {
        return model;
    }

    public void setColumnNames(List columnNames) {
        this.columnNames = columnNames;
    }

    public List getColumnNames() {
        return columnNames;
    }
}

The file jspx (page)

           
                
                  
                    
                  
                
              

Tags: Java

Similar Questions

  • [Table ADF Faces component] How to save the current state?

    Hello

    the ADF faces table component is great!
    You can drag-and - drop columns, sort columns...

    Now, we have an obligation to save the State of the table for subsequent sessions.
    The return of the user wants to get the same State as last time (order requirement or sort of column), even if he comes back a few days later.
    Is this possible?

    I discovered, that this information is stored in the session cookie. But this cookie is discarded in a few minutes...

    Any tips?

    fschulze,

    If you use 11 GR 1 material - you can read about MDS in chapters 33 and 34 of the Fusion for the ADF Developer's Guide - it does exactly what you ask... an update, don't know if it will save the sort order, but the documentation specifically mentions column reorganization as being recorded.

    John

  • ADF faces: the challenge of creating custom components

    Hi all

    My name is Juan Manuel Tamayo, and I start a project in which we will use ADF 11 g as part of our development, unless we find significant reasons not to do so. I don't have much experience with JSF or ADF, so please accept my apology for any obvious question.

    I would like to know your opinion about the declarative elements in ADF Faces. Are they easy to use? are they flexible enough to build all the components required for a large application? In case the declarative elements are not sufficient, what other options do I have for building new, complex visual components?

    I sincerely appreciate your help.

    Kind regards

    Juan Manuel Tamayo

    Published by: juanmtamayo on January 19, 2009 20:48

    Juan,

    If the component can be built out of existing components, so if it's a component of composite, then declarative components is a good and reusable approach. If you can't find what you are looking for your next step would be the Internet to see if you find a component JSF 1.2 compatible UI that you need and that co-exists with the set of components in ADF Faces. In any last resort, you can always write your own custom JSF component.

    Frank

  • How to create a Master object?

    Hey! Could you please tell me if it is possible to create a principal object in muse from adobe and I can change and it will automatically apply change to this object around where I used this object? For example, I have a button for downloading a file. This button is present on several pages of my site (However it is related to different files). Therefore, I want to be able to modify the design of this button and don't waste time on every page where it is present in order to implement a new design.

    Hello

    We do not have an option where in you can place the button on the master page and the same applies to the pages where you want this button to appear, and any changes made in the design gets automatically apply to all pages, however, in this case, it is not possible to connect to different files as objects on the master page can be changed on individual pages.

    So, I'm afraid that's not possible to get the functionality you are looking for within the Muse, at this stage of development.

  • ADF Faces: RicheTableau - how to create a richeTableau method of bean datacontrol object that returns a list of objects

    Build JDEVADF_12.1.2.0.0_GENERIC_130608.2330.6668

    I have a data bean control method that returns a list of SearchResultRow objects. Each SearchResultRow has a list of SearchResultColumn objects. SearchResultColumn is the attribute name, value, type of data.

    The method returned data looks like:

    SearchResultRow {col1, a1, string}, {col2, a2, date}, {col4, 13, number}, {col4, a4, string}

    SearchResultRow {col1, b1, string}, {col2, b2, date}, {col4, 23, number}, {col4, b4, string}

    SearchResultRow {col1, c1, string}, {col2, c2, date}, {col4, 33, number}, {col4, c4, string}

    I try to display searchResult table depending on whether it

    col1 col2 col3 col4

    A1 a2 a4 13

    B1 b2 b4 23

    C1 c2 c4 33

    I drag my return value of method to the jsf page to create a link to the tree.

    < Tree IterBinding = "retrieveSearchResultsIterator" id = "SearchResultRow" >

    < nodeDefinition DefName = 'model. SearchResultRow"name ="SearchResultRow0">

    < AttrNames >

    < item Value = "resultType" / >

    < / AttrNames >

    < accessors >

    < item Value = "searchResultColumns" / >

    < / accessors >

    < / nodeDefinition >

    < nodeDefinition DefName = 'model. ResultColumn"name ="SearchResultRow1">

    < AttrNames >

    < item Value = "name" / >

    < item Value = 'length' / >

    < item Value = "query" / >

    < item Value = 'type' / >

    < item Value = 'value' / >

    < / AttrNames >

    < / nodeDefinition >

    < / tree >

    On my jsf page, I added a table then reused the liaison of the tree.

    < af:table value = "#{bindings." SearchResultRow.collectionModel width}"= '100% '.

    var = "row" rowBandingInterval = "0" id = "t3" binding = "#{backingBeanScope.backing_Test4.t3}" partialTriggers ="": b1 ' columnStretching 'last' = > "

    My thought is in backing bean, loop through the table variable "line" which is my SearchResultRow and then loop SearchResultColumns of the line to build the RichColumn and add it to the table.

    My question is: is this feasible? How can I get hold of the var 'line' backing bean?

    Any other suggestions how to proceed?

    Thank you.

    I thought about it the adf table creation dynamically.

    This link is useful. ORACLE ADF (Application Development Framework): creating dynamic table

  • JDeveloper 10.1.3 ADF Faces &amp; BC: how to refactor a data control?

    Hi all

    Don't know if anyone else has experienced this problem, but as our application is iteratively, we ran in the case of uses of "Dialogues LOV' being required for several modules of the application. According to my experience as a swing developer, we can easily refactor a class an arch 'common' package-specific module and reduce code redundency. However, due to the nature of JSF/ADF and the mashup of technoglogies, this isn't a process in a straight line forward multiple dependencies (pageDef, viewobject/am/faces-config xml files, etc...) Does anyone have any suggestions on how to better approach question?

    Thank you
    Wes

    Hi Wes,

    I can say that things in r10.1.3.x of refactoring-based ADF BC is going to be a little painful.

    [url http://technology.amis.nl/blog/2859/fear-for-renaming-refactoring-adf-bc-objects-in-jdeveloper-is-not-unfounded] This blog is particularly detailed.

    Best,

    John

  • ADF Faces 10g: how to clear a &lt; af:table &gt; component?

    Hello

    I use JDeveloper/ADF 10.1.3.

    I have a page with 2 iterators on the same point of view (always in search mode), a search form and a table of results. As there are many rows in the view and I don't want to interrogate him without search criteria in order to avoid all the results, I put the refresh of the iterator property to ${adfFacesContext.postback == true}.

    I did a search button linking the Execute action and a reset button, forcing the find action. Now, when I hit the reset button, I also want to reset the table (query results) empty. How to do this? I couldn't find any method to empty all lines in lavel, nor to the iterator, table or view.

    Thanks in advance for your answers.

    Hello
    I don't have a declarative solution for you, but a few possible solutions or ideas to do.
    1 put a method in end of request module show the method to the client (data control). This method can either remove all the lines of the VO (call removeCurrentRowFromCollection() for each line currently in the t, but keep them in the DB).
    2. you can try to use executeEmptyRowSet() (I'm not sure that it is available in 10.1.3).) and hope that it deletes all rows of the rowset (the method is not documented, so I'm olny guess its function).
    3. run your search with parameters, you are sure that they will not return any result. This can be made from a bean to support.

    Timo

  • JDeveloper 10.1.3 ADF Faces &amp; BC: how to get the hostname of h

    Hi all

    How can I get the hostname of the server that your application is deployed via the request form?

    I know that on a javax.servlet.ServletRequest class, the method is called getLocalName(). Is there a way to access this information in the am?

    Thank you
    Wes

    Wes,

    Something like that?

    try {
            InetAddress addr = InetAddress.getLocalHost();
    
            // Get IP Address
            byte[] ipAddr = addr.getAddress();
    
            // Get hostname
            String hostname = addr.getHostName();
        } catch (UnknownHostException e) {
        }
    

    John

  • How to create LOV on object view with herself


    Hello

    My scenario is that I COUNTRY with columns Country_Code, Country_Name and table.

    I need to display the Country_Name under selectonechoice. The user selects a country name, and then I should get the Country_Code associated the Country_Name selected in the Managed bean.

    Could you please suggest how to achieve?

    Kind regards

    Vinod

    Hello

    My English is not very good.

    create an obj COUNTRY table view and then drag & drop data view obj as a single selection and Adf and select Select a choice and from here you can select the attribute to display.

    in managed bean, you can get the Country_Code from code below:

        DCBindingContainer = dcBindings
            (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();
        DCIteratorBinding = iteratorRow
            (DCIteratorBinding) dcBindings.get ("iterator to view obj name");
        Line = iteratorRow.getCurrentRow ();
        System.out.println ("rank [] =" + row.getAttribute (0));

    Habib

  • How to create a new object on the other list list

    Hello

    I'm trying to insert the result of a query in a list in order to put the new values based on the results of the first query: for example, I have this table which contains records:



    adfcal1.PNG


    My question is:OE to create a new list object on the other hand, if you see the picture shows my list, I want to create another list where I stock ordred values if we in line December we will put 1 in column 12 and if we April we put 1 in the 4th column and if we find in my current line November we put 1 in column 11 :

    I'm stuck in this function

    public List<VisiteCons> MyListResult() {

      
    Query query = em.createQuery("SELECT o FROM Visite o ");
      
    List<Visite> visites = query.getResultList();
      
    List<VisiteCons> result = new ArrayList<VisiteCons>();
      
    for(int row = 0 ; row < visites.size() ; row++) {

      
    int m1 = 0, m2 = 0, m3 = 0, m4 = 0, m5 = 0, m6 = 0, m7 = 0, m8 = 0, m9 = 0, m10 = 0, m11 = 0, m12 = 0;
      
    //Pour m1 january
      
    if(visites.get(row).getM1().equals("janvier")){
      m1
    = 1;
      
    }
      
    VisiteCons vc =  new VisiteCons( m1, m2, m3, m4, m5
      
    , m6, m7, m8, m9
      
    , m10, m11,m12);
      result
    .add(vc);
      
    }
      
    return  result;

    }

    VisiteCons is a constructor that I created.



    and this my entity:

    package model;

    import java.io.Serializable;

    Import javax.persistence.Column;

    Import javax.persistence.Entity;

    Import javax.persistence.Id;

    Import javax.persistence.NamedQueries;

    Import javax.persistence.NamedQuery;

    @Entity

    @NamedQueries ({@NamedQuery (name = "Visite.findAll", query = "select visit o o")})

    Visit/public class implements Serializable {}

    private public static final long serialVersionUID =-6069673717468618734 L;

    @Column (length = 4000)

    private String year;

    @Column (nullable = false, length = 100)

    customer private string;

    @Column (length = 4000)

    private String dep.

    @Column (length = 4000)

    private String State;

    @Id

    @Column (nullable = false, length = 100)

    private String idvisite;

    @Column (length = 4000)

    private String ingaff;

    @Column (length = 20)

    private String m1;

    @Column (length = 20)

    private String m10;

    @Column (length = 20)

    private String m11;

    @Column (length = 20)

    private String m12;

    @Column (length = 20)

    private String m2;

    @Column (length = 20)

    private String m3;

    @Column (length = 20)

    private String m4;

    @Column (length = 20)

    private String m5;

    @Column (length = 20)

    private String m6;

    @Column (length = 20)

    private String m7;

    @Column (length = 20)

    private String m8;

    @Column (length = 20)

    private String m9;

    @Column (length = 4000)

    private String moisvisite;

    @Column (length = 4000)

    private String nbvisites;

    @Column (length = 4000)

    private String prbvisite;

    public Visite() {}

    }

    Visit public (String year, String customer, String dep, State of, string idvisite, String ingaff, String m1,

    M10, m11 String, String m12, m2, m3, m4, m5 String String String String String, string m6, m7 of the chain,

    String m8, m9 String, String moisvisite, String nbvisites, String prbvisite) {}

    This.Annee = year;

    This.client = client;

    This.DEP = dep;

    This.Etat = State;

    This.idvisite = idvisite;

    This.ingaff = ingaff;

    This.M1 = m1;

    This.M10 = m10;

    This.M11 = m11;

    This.M12 = m12;

    This.M2 = m2;

    This.M3 = m3;

    This.M4 = m4;

    This.M5 = m5;

    This.M6 = m6;

    This.M7 = m7;

    This.M8 = m8;

    This.M9 = m9;

    This.moisvisite = moisvisite;

    This.nbvisites = nbvisites;

    This.prbvisite = prbvisite;

    }

    public String {} year

    return year;

    }

    {} public void Name\backup (String year)

    This.Annee = year;

    }

    public String getClient() {}

    customer feedback;

    }

    {} public void setClient (string customer)

    This.client = client;

    }

    public String getDep() {}

    return the dep;

    }

    {} public void setDep (String dep)

    This.DEP = dep;

    }

    public String getEtat() {}

    return status;

    }

    {} public void setEtat (String State)

    This.Etat = State;

    }

    public String getIdvisite() {}

    Return idvisite;

    }

    {} public void setIdvisite (String idvisite)

    This.idvisite = idvisite;

    }

    public String getIngaff() {}

    Return ingaff;

    }

    {} public void setIngaff (String ingaff)

    This.ingaff = ingaff;

    }

    public String getM1() {}

    return m1;

    }

    public void setM1 (String m1) {}

    This.M1 = m1;

    }

    public String getM10() {}

    return m10;

    }

    public void setM10 (String m10) {}

    This.M10 = m10;

    }

    public String getM11() {}

    return the m11;

    }

    public void setM11 (String m11) {}

    This.M11 = m11;

    }

    public String getM12() {}

    return m12;

    }

    public void setM12 (String m12) {}

    This.M12 = m12;

    }

    public String getM2() {}

    return m2;

    }

    public void setM2 (String m2) {}

    This.M2 = m2;

    }

    public String getM3() {}

    return m3;

    }

    public void setM3 (String m3) {}

    This.M3 = m3;

    }

    public String getM4() {}

    Return to m4;

    }

    public void setM4 (String m4) {}

    This.M4 = m4;

    }

    public String getM5() {}

    return m5;

    }

    public void setM5 (String m5) {}

    This.M5 = m5;

    }

    public String getM6() {}

    return of m6;

    }

    public void setM6 (String m6) {}

    This.M6 = m6;

    }

    public String getM7() {}

    return m7;

    }

    public void setM7 (String m7) {}

    This.M7 = m7;

    }

    public String getM8() {}

    back m8;

    }

    public void setM8 (String m8) {}

    This.M8 = m8;

    }

    public String getM9() {}

    return m9;

    }

    public void setM9 (String m9) {}

    This.M9 = m9;

    }

    public String getMoisvisite() {}

    Return moisvisite;

    }

    {} public void setMoisvisite (String moisvisite)

    This.moisvisite = moisvisite;

    }

    public String getNbvisites() {}

    Return nbvisites;

    }

    {} public void setNbvisites (String nbvisites)

    This.nbvisites = nbvisites;

    }

    public String getPrbvisite() {}

    Return prbvisite;

    }

    {} public void setPrbvisite (String prbvisite)

    This.prbvisite = prbvisite;

    }

    }

    You can create a view in the db which reads the data from the table and display it in a different way. Then you use the view to get the data in the format and display it in the user interface

    Sample:

    -create a test line

    Select 1 id, m1 'sep', 'mar' m2, m3 'Feb' from dual;

    -output:

    ID: M1 M2 M3

    ---------- --- --- ---

    1 sep mar Feb

    -which means that your table has a row with Id = 1 nd three visits (MS, mar and Feb).  Now give us a different look from these data using the select statement

    SELECT id,

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| (m3), "jan") > 0 then 'X' other ' ' end) jan.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| ((m3), "February") > 0 then 'X' other ' ' end) Feb.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| (m3), "mar") > 0 then 'X' other ' ' end) mar.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| (m3), ("apr") > 0 then 'X' other ' ' end) Apr.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| ((m3), 'can') > 0 then 'X' other ' ' end) may,

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| (m3), "jun") > 0 then 'X' other ' ' end) June,.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| (m3), "Jun") > 0 then 'X' other ' ' end) Jul.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| ((m3), "August") > 0 then 'X' other ' ' end) aug.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| (m3), "MS") > 0 then 'X' else ' ' end) Ms.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| (m3), 'OCTS') > 0 then 'X' other ' ' end) oct.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| (m3), "nov") > 0 then 'X' other ' ' end) nov.

    (case when ((m1||' +'|| m2 ||) instr)) » +'|| (m3), "dec") > 0 then 'X' other ' ' end) dec

    from (select 1 id, m1 'sep', 'mar' m2, m3 "feb" double);

    -output

    ID J F M A M J J A S O N D

    ---------- - - - - - - - - - - - -

    1 X X X

    or tabular

    You can create a similar sql statement (and there are better ways to do this, but I'm not the whiz sql) and use it to create a database from this view.

    I don't understand what you mean by

    .. and is there a solution of programmatly

    Timo

  • How to create the View object with several editable entity objects

    I want the two entities in the view object to support the creation of new lines, but when I give create insert that it allows to insert only on the parent and not the child. I found this link
    http://docs.Oracle.com/CD/E21043_01/Web.1111/b31974/bcadvvo.htm#CEGCAJCI which replaces the outgoing class. but I would like to do declarative. Is there another way to do it?

    I use Jdeveloper 11g 2 version.

    Thanks in advance,
    Rakesh

    Hello
    There is a checkbox in the tab "Updatable" entity objects, mark it checked and look in your vo
    Then, you can create the ViewObject also editable attribute
    Make sure that the Association is here.

    Rognard

  • How to create transparency between objects

    Hi, I'm hoping that you cam help with something that is troubling me.

    I have a circle divided into 5 segments (figure A).

    imageA.JPG

    All segments have a fill and stroke (1px) of white.

    What I want is for the SHOT to be transparent so that when I place the 5 segments on a different background color (image B), I see the color under where the white line would normally appear. To summarize - I would like to keep the width of the line and make the race coloue transparent...

    imageB.JPG

    I tried the opacity setting, but this applies to the object, not just the stroke.

    Your help would be welcome.

    Thank you. I'm on CS5

    Ah, I see how you draw on it.

    I would like to make a copy of your design. Delete the stroke. Draw a straight line from the size of the space you want. You will lose the difference in color (blue), but I would like to make a path is dedicated to shutters. Place a copy of the line on a joint. The pathfinder to cut a piece between two components. Make another copy of line, position, rinse and repeat.

    While my copy of your design began as a trace, you are welcome to it if it helps.

    http://www.wenzloffandsons.com/temp/shutter.AI

    Take care, Mike

  • How to create the View object dynamically

    Hello

    I HAV a requirement to create a dynamic display object.

    can someone help me please.

    Thank you
    NaN :)

    Hi Nani,

    Have you tried the given final code?

    Gerard

  • How to create a dynamic object in PSE 14

    Hi, can't find this feature under the layers button... where should I look?

    Thanks in advance

    Berthold

    felxscan wrote:

    Hi, can't find this feature under the layers button... where should I look?

    Thanks in advance

    Berthold

    Elements is not all "smart" objects and complete Photoshop filters.

    You can use the module elements + affordable:

    On the elements.

    Convert to smart object

  • [ADF, JDev12.1.3] How to create a reusable/configurable SelectOneChoiche that displays a range of years?

    Hallo,

    in my application, I would use SelectOneChoiche components a range of years including start/end of the year can be different based on other values/conditions of display.

    I found this thread helpful Andrejus Baranovskis Blog: select a choice with select elements Tag which explains how to fill a PLOUGHSHARE of a managed bean.

    Would it be possible (and how) to create a reusable component (something to drag them to the design-time user interface) configurable with expressions of start/end of year?

    This would avoid as me to write the code to fill the SOC whenever I need one of them.

    Thank you

    Federico

    You can see this example ADF practice: component example declarative ADF which shows how to create a component declarative which shows a decimal lov.

    This Oracle magazine article Oracle ADF: Build Your Own is another example that will guide you throughout the process.

    Timo

Maybe you are looking for

  • I watch and wifi

    can you please clarify If I already used my pair watch / iphone with a public wifi (in this case cloud wifi (uk)) I already install on my iphone, I'll be able to use the i shows without the phone using public wifi even?

  • ZSMCSNAP.exe error message!

    Whenever I boot Windows XP, SP 3 "zsmcsmap.exe" error message is displayed. Please help to get rid of it.

  • Need to go back to a previous set

    My Live One Care subscription has ended there is little time. Now I can't open any program at all without the suspended system. I can't get the modem or WiFi running, the USB ports do not respond, don't start iTunes. Explorer Windows sometimes will a

  • VPN to the internet

    Hi all Im having a cisco 877 so that I can vpn for it configured and my lan access equipment. It's that everything works fine... but I also want to access the internet with my own coupled provider im... I read something about vpn passthrough... but n

  • I am installation 5.1 SRM with EMC Recoverpoint

    Hi allI'm looking for more help on SRM 5.1 with recoverpoint instalation.I have instaled SRM 5.1 on two sites and two matching sites now. I'm confused about the Recoverpoint version works with MRS 5.1.Please post the link to download the version of E