Table Rendering behaviour

Hy,
I have a renderer implementing the TableCellRenderer interface. The problem is that it's "getTableCellRendererComponent" method is continously excuted althoutgh there's no repainting or resizing of the component ? Is it the normal behavior for a Renderer ?
Thank's

It should not be continuously invoked.
However, if you move your mouse over a cell this will cause it to be invoked. This is required to support tooltip processing.

Similar Messages

  • Is there a way to not to execute a query on table rendering?

    Is there a way to not to execute a query associated with an af:table on table rendering on the page?
    I would like to control this programmatically.
    Any examples will be much appreciated.

    Yes, there is.
    {thread:id=2362354}

  • Table Rendering - Row level vs Column level

    Normally renderers are specified for a given class of data or column of data.
    So, how would you handle rendering requirements that are row or table dependent? For example, how do I:
    a) color alternate lines in a table
    b) change the border of the selected cell
    Traditional Approach
    Most answers in the forum would be something like "use a custom render". Sounds great, but what does it really mean? If all your data is displayed as a String then it really isn't too difficult to create a single renderer with the required logic and add it to the table as the default renderer.
    However, what if you table contains, String's, Dates, Integer's, Double's and Boolean's and you want your cell to retain the default formatting of each data type in addition to the above requirement? Now you have two options:
    a) render by class (multiple renderers). Each renderer would need to implement the default "formatting" of the data (dates: dd-MMM-yyy, numbers: right justified, etc) in addition to the "row/table" rendering requirements. So the answer really becomes "use five custom renderers". Now the "row/table" rendering code is found in 5 classes. Of course you could always move the "row/table" rendering code up to a common base class.
    b) render by table (single renderer). A single custom renderer would be created and would need to implement the default "formatting" for all data types in the table, in addition to the "row/table" rendering. The benefit is that all the rendering code is in one class. An example solution is include for this approach.
    Alternative Approach
    I recently came across an approach where the "formatting" of the data is still done by the default renderers and the "row/table" rendering is done at the table level by overriding the prepareRenderer() method. This approach is much simpler, but the rendering is done in two different places. Is this a problem?
    So, my question is which approach do you prefer:
    a) Traditional Approach - multiple renderers
    b) Triditional Approach - single renderer
    c) Alternative Approach
    Me, I like the alternative approach, but I'm more of a problem solver than I am a designer, so I don't know how the solution fits in a large scale application.
    Hopefully your response will consider:
    a) OO design principles
    b) class reusability
    c) class maintenance
    d) anything else you can think of
    import java.awt.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.table.*;
    public class TableRowRendering extends JFrame
        JTable table;
        Border selected = new LineBorder(Color.GREEN);
        public TableRowRendering()
            //  Model used by both tables
            Object[] columnNames = {"Type", "Date", "Company", "Shares", "Price"};
            Object[][] data =
                {"Buy", new Date(), "IBM", new Integer(1000), new Double(80.50)},
                {"Sell",new Date(), "MicroSoft", new Integer(2000), new Double(6.25)},
                {"Sell",new Date(), "Apple", new Integer(3000), new Double(7.35)},
                {"Buy", new Date(), "Nortel", new Integer(4000), new Double(20.00)}
            DefaultTableModel model = new DefaultTableModel(data, columnNames)
                public Class getColumnClass(int column)
                    return getValueAt(0, column).getClass();
            //  Traditional Approach
            table = new JTable( model );
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            getContentPane().add(new JScrollPane( table ), BorderLayout.WEST);
            TableCellRenderer custom = new CustomRenderer();
            table.setDefaultRenderer(Object.class, custom);
            table.setDefaultRenderer(String.class, custom);
            table.setDefaultRenderer(Date.class, custom);
            table.setDefaultRenderer(Number.class, custom);
            table.setDefaultRenderer(Double.class, custom);
            //  Alternative Approach
            table = new JTable( model )
                public Component prepareRenderer(
                    TableCellRenderer renderer, int row, int column)
                    Component c = super.prepareRenderer(renderer, row, column);
                    if (!isRowSelected(row))
                        String type = (String)getModel().getValueAt(row, 0);
                        c.setBackground(row % 2 == 0 ? null : Color.LIGHT_GRAY );
                    if (isRowSelected(row) && isColumnSelected(column))
                        ((JComponent)c).setBorder(selected);
                    return c;
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            getContentPane().add(new JScrollPane( table ), BorderLayout.EAST);
        //  Custom renderer used by Traditional approach
        class CustomRenderer extends DefaultTableCellRenderer
            DateFormat dateFormatter = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM);
            NumberFormat numberFormatter = NumberFormat.getInstance();
            public Component getTableCellRendererComponent(
                JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column)
                super.getTableCellRendererComponent(
                    table, value, isSelected, hasFocus, row, column);
                //  Code for data formatting
                setHorizontalAlignment(SwingConstants.LEFT);
                if ( value instanceof Date)
                    setText(dateFormatter.format((Date)value));
                if (value instanceof Number)
                    setHorizontalAlignment(SwingConstants.RIGHT);
                    if (value instanceof Double)
                        setText(numberFormatter.format(((Number) value).floatValue()));
                //  Code for highlighting
                if (!isSelected)
                    String type = (String)table.getModel().getValueAt(row, 0);
                    setBackground(row % 2 == 0 ? null : Color.LIGHT_GRAY );
                if (table.isRowSelected(row) && table.isColumnSelected(column))
                    setBorder(selected);
                return this;
        public static void main(String[] args)
            TableRowRendering frame = new TableRowRendering();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setLocationRelativeTo( null );
            frame.setVisible(true);
    }Before you make your final decision. What changes would be required for each solution in the following "what if " scenarios:
    a) what if, you added a Boolean column to the table
    b) what if, you added a second Double column to the table which should be formatted as a currency (ie. 1,234.5 --> $1,234.50).
    Here is an example of a currency renderer:
    class CurrencyRenderer extends DefaultTableCellRenderer
         private NumberFormat formatter;
         public CurrencyRenderer()
              super();
              formatter = NumberFormat.getCurrencyInstance();
              setHorizontalAlignment( SwingConstants.RIGHT );
         public void setValue(Object value)
              if ((value != null) && (value instanceof Number))
                   value = formatter.format(value);
              super.setValue(value);
    }

    Well, here's a partila solution using technique from a link you cited in another thread.
    import tests.basic.tables.ColorProvider;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.text.NumberFormat;
    public class DecoratedTablePrepareRenderer extends JFrame {
        JTable table;
        private DefaultTableModel model;
        public DecoratedTablePrepareRenderer() {
            Object[] columnNames = {"Type", "Company", "Price", "Shares", "Closed"};
            Object[][] data =
                        {"Buy", "IBM", new Double(80.50), new Double(1000), Boolean.TRUE},
                        {"Sell", "MicroSoft", new Double(6.25), new Double(2000), Boolean.FALSE},
                        {"Sell", "Apple", new Double(7.35), new Double(3000), Boolean.TRUE},
                        {"Buy", "Nortel", new Double(20.00), new Double(4000), Boolean.FALSE}
            model = new DefaultTableModel(data, columnNames);
            table = new JTable(model) {
                //  Returning the Class of each column will allow different
                //  renderers to be used based on Class
                public Class getColumnClass(int column) {
                    return getValueAt(0, column).getClass();
                public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
                    Component c = super.prepareRenderer(renderer, row, column);
                    if (isRowSelected(row))
                        c.setFont(c.getFont().deriveFont(Font.BOLD));
                    return c;
            ColorProvider prov = new TransactionColorProvider();
            ColorTableCellRenderer renderer = new ColorTableCellRenderer(table.getDefaultRenderer(Object.class),prov);
            ColorTableCellRenderer boolrenderer = new ColorTableCellRenderer(table.getDefaultRenderer(Boolean.class),prov);
            ColorTableCellRenderer doublerenderer = new ColorTableCellRenderer(table.getDefaultRenderer(Double.class),prov);
                    int priceIndex = model.findColumn("Price");
              table.getColumnModel().getColumn(priceIndex).setCellRenderer( new EtchedBorderTableCellRenderer(new ColorTableCellRenderer(new CurrencyRenderer(),prov) ));
            table.setDefaultRenderer(Object.class,new EtchedBorderTableCellRenderer(renderer));
            table.setDefaultRenderer(Double.class,new EtchedBorderTableCellRenderer(doublerenderer));
            table.setDefaultRenderer(Boolean.class, new EtchedBorderTableCellRenderer(boolrenderer));
            JScrollPane scrollPane = new JScrollPane(table);
            getContentPane().add(scrollPane);
        class CurrencyRenderer extends DefaultTableCellRenderer {
            private NumberFormat formatter;
            public CurrencyRenderer() {
                super();
                formatter = NumberFormat.getCurrencyInstance();
                setHorizontalAlignment(SwingConstants.RIGHT);
            public void setValue(Object value) {
                if ((value != null) && (value instanceof Number)) {
                    value = formatter.format(value);
                super.setValue(value);
        public static void main(String[] args) {
            DecoratedTablePrepareRenderer frame = new DecoratedTablePrepareRenderer();
            frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        class ColorTableCellRenderer implements TableCellRenderer{
            protected TableCellRenderer delegate;
            protected ColorProvider provider;
            public ColorTableCellRenderer(TableCellRenderer delegate, ColorProvider provider) {
                this.delegate = delegate;
                this.provider = provider;
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                Component c = delegate.getTableCellRendererComponent(table, value,isSelected,hasFocus,row, column);
                  c.setBackground(provider.getBackgroundColor(row, column));
                return c;
          class EtchedBorderTableCellRenderer implements TableCellRenderer{
            protected TableCellRenderer delegate;
            public EtchedBorderTableCellRenderer(TableCellRenderer delegate) {
                this.delegate = delegate;
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                JComponent c = (JComponent)delegate.getTableCellRendererComponent(table, value,isSelected,hasFocus,row, column);
                  JPanel panel = new JPanel(new GridLayout(0,1));
                  panel.add(c);
                  panel.setBorder(BorderFactory.createEtchedBorder());
                return panel;
        class TransactionColorProvider implements ColorProvider {
            private int keyIndex = 0;
            private Color sellColor = Color.yellow;
            private Color buyColor = Color.green;
            public TransactionColorProvider() {
                keyIndex = model.findColumn("Type");
            public Color getBackgroundColor(int row, int column) {
                 if( model.getValueAt(row,keyIndex).equals("Sell")){
                     return sellColor;
                else {
                     return buyColor;
            public Color getForegroundColor(int row, int column) {
                return Color.black;
    }Boolean values are problematical since JCheckBox does seem to like borders, using a panel as I did in the Etched renderer seems to work. This solution need a little more work, this is submitted as a prototype
    Cheers
    DB

  • IE table rendering issues. Any ideas how to eliminate extra cell spacing rendered by IE

    I have a problem with IE 9 rendering a table. This particular page has a larger table rendered for an application.
        1. I have disabled all CSS on the site (its strictly in the table render on the site)
        2. Removed as much spacing as possible in the RAZOR view of the application to try to eliminate whitespace issue in code  
        3. Ensured that there are no extra characters in the text (from the DB) so stripping out anything that is non alphanumeric.
    When IE renders this site note that there is not any extra table elemnents missing there are closing tags on all elements and no syntatical issues.
    I have seen other sites with this issue in IE 9 on Windows 7.
    A table is not ideal here but that is how it was written.
    (Since I don't see an e-mail or anything to verify my account here is a "non-link" to my screenshot of an example)
    i.imgur.com/av8FCZL.png
    Does anyone know how to solve this issue in IE? Also is a side by side of other browser results.

    Thanks Rob for the reply,
    The page passes validation. The CSS was only disabled on the site to determine if it was causing my spacing issue on the table. Initally the CSS was the suspect, but it was eliminated by only showing the raw table element with the same behavior in the browser.
    I will need to convert the table to CSS style or another format (probably a JQuery UI Data Table would be more appropriate in my case)... In any event  I inherited this site so I have not had the time to change the tables out yet. (That was the first
    thing out of my mouth when I reviewed the application was proposing not to use the HTML tables tag for that data). 
    Interestingly enough I can kid of remedy the behavior in IE if I remove line spaces from my Razor view so maybe IE is interpreting the spacing rendered by the Razor view on the table strangely from the code output? I did find a post with another person having
    a similar problem rendering large tables in razor view and they solved the issue by removing line spacing inside of the chtml file.  
    In any case this solves it for the time being... not an ideal solution but a workable one until the table view can be converted to a better format for such a large table. 

  • Columns in af:table rendering multiple times when filtering drop-down list

    Technology: JDeveloper 10.1.3.0.4 SU5, ADF Faces/BC
    Page design:
    Master-detail jspx.
    Each section is an af:table.
    Drop-down lists created using instructions from http://www.oracle.com/technology/products/jdev/tips/muench/screencasts/editabletabledropdown/dropdownlistineditabletable.html?_template=/ocom/technology/content/print
    Requirement:
    Data in a drop-down list on a child record needs to be filtered based on data from one or more columns in the currently selected row of the parent record.
    Issue:
    Drop-down lists have been successfully filtered using a couple of different methods, however, any time the data from the parent record is used to filter the data the columns in the child af:table begin to render multiple times. Navigating through the parent rows may cause the child records to have the correct number of columns displayed or multiple copies of the columns displayed.
    Removing any reference to the parent view object and hard-coding values instead causes this behavior to disappear.
    Each of the following methods has been tried. Each filters drop-down list data correctly and each causes apparently random extra column renders.
    1.     Cascading lists as per: http://www.oracle.com/technology/products/jdev/tips/mills/cascading_lists.html
    2.     Drop-down list based on view object that takes parameters.
    3.     Set where clause for drop down list in a method on the app module.
    4.     Set where clause for drop-down list in a new selection listener method for the af:table.
    Question:
    Is there a solution available that will filter the drop-down lists correctly and prevent the extra columns from being rendered?
    Thank you for any help that you can provide,
    Joanne

    bump

  • Table Filters Behaviour

    Is there a definitive resource or statement regarding the behaviour of Table Filters that anyone knows of please?
    I have a number of tables in my application (some based on EO/VOs and some sql-query VOs) and following a refresh of the page (and VO query) filter criteria previously entered is retained (although Dates now appear in a different format!?) and in some tables any previously entered criteria is reset...
    Does anyone know how this filter behaviour can be explained or how its behaviour can be relied upon?
    Thanks in advance... (using JDeveloper 11.1.2.1.0)

    Check this link - http://www.oracle.com/technetwork/developer-tools/adf/learnmore/30-table-filter-queries-169172.pdf

  • URGENT-Table renderer problem

    I created my own renderer(which renders JCombobox) for JTable.But the problem is when i select an item,it's not setting that item in the combobox.combobox remains blank. but when i click the combobox,it shows that selected item and shows popup menu.
    please give me some solution.
    thanx in advance.
    here is my piece of code.
    public class comboRenderer extends TableCellRenderer{
    JComboBox combo;
    /* In this constructor i am getting the combobox that is being used by the cell editor for editing a particular cell */
    public comboRenderer(JComboBox cmb){
    combo=cmb;
    public Component getTableCellRendererComponent(JTable table,Object value,boolean is Selected,boolean hasFocus,int row,int column){
    setSelectedItem(combo.getSelectedItem());
    //setting the currently selected item
    return this;
    //#################################

    In you getTableCellRendererComponent you are setting the combo to getSelectedItem(). To get the new value, you need to use the value passed into the method in the parameter list:
    combo.setSelectedItem(value.toString())

  • RowCount for WDA Tables based on SCROLLBAR table rendering

    Hi.
    We are using a standard WDA table to display some data. Our application doesn't have explicitly the app parameter WDTABLENAVIGATION set, but it is rendering our tables as scrollable (like we were using parameter 'SCROLLBAR'). I think that, probably, it is following a server parameter.
    Even if we set 'footervisible' to true, our footer is not displayed. As we need to display rowcount, does anyone have any idea on how to display it?
    Regards,
    Douglas Frankenberger

    >
    Douglas Frankenberger wrote:
    > Hi.
    >
    > We are using a standard WDA table to display some data. Our application doesn't have explicitly the app parameter WDTABLENAVIGATION set, but it is rendering our tables as scrollable (like we were using parameter 'SCROLLBAR'). I think that, probably, it is following a server parameter.
    >
    > Even if we set 'footervisible' to true, our footer is not displayed. As we need to display rowcount, does anyone have any idea on how to display it?
    >
    >
    > Regards,
    > Douglas Frankenberger
    I assume you are are on NetWeaver 7.0 Enhancement Package 1.  As of 7.01 the paginator option no longer exists and is ignored in all the settings.  Only the Scrollbar is possible.

  • Ajax4JSF and Tomahawk data table, strange behaviour

    Hi,
    I use the tomahawk data table to display a list of objects in my page with the following code snippet
    <t:dataList value="#{userGallery.images}" var="image" layout="simple">
      <a4j:region>
        <t:htmlTag value="div" styleClass="imageEntry">
          <!-- This is the interesting part -->
          <h:outputLink value="gallery.faces">
            <f:param name="imageId" value="#{image.id}" />
            <t:div styleClass="imageWrapper image_#{image.id} #{image.inCart ? 'inCart' : ''}">
              <h:graphicImage value="#{ftp.apacheThumbnails}#{image.imageName}" alt="#{image.imageName}"/>
            </t:div>
          </h:outputLink>
          <!-- End of the interesting part -->
          <t:htmlTag value="div" styleClass="textWrapper">
            <t:htmlTag value="div" styleClass="actions">
              <a4j:commandLink reRender="imageList,shoppingChart" styleClass="addToCart" value="+#{msg.detailCart}" action="#{shoppingCart.addImageToCart}" rendered="#{!image.inCart}">
                <f:setPropertyActionListener target="#{shoppingCart.chosenImageId}" value="#{image.id}" />                                     
              </a4j:commandLink>
              <a4j:commandLink reRender="imageList,shoppingChart" styleClass="removeFromCart" value="-#{msg.detailCart}" action="#{shoppingCart.removeImageFromCart}" rendered="#{image.inCart}">
                <f:setPropertyActionListener target="#{shoppingCart.chosenImageId}" value="#{image.id}" />                                     
              </a4j:commandLink>     
            </t:htmlTag>
         </t:htmlTag>
       </t:htmlTag>
      </a4j:region>
    </t:dataList>I have marked the interesting part of the text.
    When i first access the page then everything is rendered as it should be.
    When i now klick on the a4j:commandLink then i got the following result: (only the interesting snippet)
    <div class="imageEntry">
      <a href="gallery.faces?imageId=2"/>
      <div class="imageWrapper image_2 inCart">
         ..... (output as it should be)
      </div>
      <div  class="textWrapper">
         .... (output as it should be)
      </div>
    </div>So you see the link tag is closed to early, it should wrapp the complete <div class="imageWrapper> object.
    Anybody know how to solve this?
    Edited by: heissm on 19.05.2008 16:26 - shifting of the html tags

    Hi,
    I use the tomahawk data table to display a list of objects in my page with the following code snippet
    <t:dataList value="#{userGallery.images}" var="image" layout="simple">
      <a4j:region>
        <t:htmlTag value="div" styleClass="imageEntry">
          <!-- This is the interesting part -->
          <h:outputLink value="gallery.faces">
            <f:param name="imageId" value="#{image.id}" />
            <t:div styleClass="imageWrapper image_#{image.id} #{image.inCart ? 'inCart' : ''}">
              <h:graphicImage value="#{ftp.apacheThumbnails}#{image.imageName}" alt="#{image.imageName}"/>
            </t:div>
          </h:outputLink>
          <!-- End of the interesting part -->
          <t:htmlTag value="div" styleClass="textWrapper">
            <t:htmlTag value="div" styleClass="actions">
              <a4j:commandLink reRender="imageList,shoppingChart" styleClass="addToCart" value="+#{msg.detailCart}" action="#{shoppingCart.addImageToCart}" rendered="#{!image.inCart}">
                <f:setPropertyActionListener target="#{shoppingCart.chosenImageId}" value="#{image.id}" />                                     
              </a4j:commandLink>
              <a4j:commandLink reRender="imageList,shoppingChart" styleClass="removeFromCart" value="-#{msg.detailCart}" action="#{shoppingCart.removeImageFromCart}" rendered="#{image.inCart}">
                <f:setPropertyActionListener target="#{shoppingCart.chosenImageId}" value="#{image.id}" />                                     
              </a4j:commandLink>     
            </t:htmlTag>
         </t:htmlTag>
       </t:htmlTag>
      </a4j:region>
    </t:dataList>I have marked the interesting part of the text.
    When i first access the page then everything is rendered as it should be.
    When i now klick on the a4j:commandLink then i got the following result: (only the interesting snippet)
    <div class="imageEntry">
      <a href="gallery.faces?imageId=2"/>
      <div class="imageWrapper image_2 inCart">
         ..... (output as it should be)
      </div>
      <div  class="textWrapper">
         .... (output as it should be)
      </div>
    </div>So you see the link tag is closed to early, it should wrapp the complete <div class="imageWrapper> object.
    Anybody know how to solve this?
    Edited by: heissm on 19.05.2008 16:26 - shifting of the html tags

  • JSP Data table - Rendering for command buttons.

    Hi All,
    We are designing a JSP page where results from table have to be thrown on a data table. (h:dataTable)
    Based on one column value on the data table, we need to render a command button for each row of data table.
    For example, I select the employees from a table and throw it on data table.
    Only for those employees where address is not present, I need to enable an "Update address" command button.
    (Command button "Update address" is also part of data table.)
    Is it possible to accomplish this on a data table?
    If so how should we code the "rendered" tag of the command button in data table.
    Any help would be greatly appreciated.
    Thanks.

    Sounds like the JSF forum would be a closer alignment, but in general
    - retrieve your information from the database into a list of Employee beans.
    - Have your h:dataTable use the list of Employee beans as a datasource
    - have the rendered attribute of your update button depend on the value of employee.address maybe #{empty employee.address}
    cheers,
    evnafets

  • Table Renderer -- Urgent

    How to render the table using single object.
    The scenario is:
    I have a table with 10 columns of which 4 has to be rendered with JCombo box.
    Now if I add cell renderer to a TableColumn it is added renderer to all the cell.
    I want my table to using single object for rendering.
    Please advise
    Thanks

    How to render the table using single object.
    The scenario is:
    I have a table with 10 columns of which 4 has to be
    rendered with JCombo box.
    Now if I add cell renderer to a TableColumn it is
    added renderer to all the cell.
    I want my table to using single object for rendering.It should use only the renderer you pass to it -- You should be able to do a "new MySpecialColumnComboBoxRenderer()" only once and pass that same object to each TableColumn you want to use it. Are you creating a new one for each column? Perhaps post some code?

  • Customized table renderer

    I have written my own table cell renderer based somewhat on jdk?s DefaultTableCellRenderer - taking into account all performance issues mentioned in the Note section of JDK doc for that class.
    My renderer extends JPanel , contains a few JTextField components and the function getTableCellRendererComponent returns simply ?this? reference.
    In my JTable derived class in function addItem() I am iterating through all my data in the model. For every data item I am calling renderer?s getTableCellRendererComponent to initialize renderer component and then I ask that component for its preferred size (calling getPreferredSize) saving the biggest width found so far.
    Somehow the renderer component always returns to me the width that is correct for the very first data item from model.
    Below is fragment of my code, any idea what is wrong with my code?
    JD
    * This method picks good column sizes.
    * If all column heads are wider than the column's cells'
    * contents, then you can just use column.sizeWidthToFit().
    private void initColumnSizes()
    MyTableModel model = (MyTableModel)actionTable.getModel();
    TableColumn column = null;
    Component comp = null;
    int headerWidth = 0;
    int cellWidth = 0;
    int maxCellWidth = 0;
    for(int j = 0; j < model.getRowCount(); j++)
    for (int i = 0; i < model.getColumnCount(); i++)
    column = actionTable.getColumnModel().getColumn(i);
    comp = actionTable.getTableHeader().getDefaultRenderer().
    getTableCellRendererComponent(null, column.getHeaderValue(),
    false, false, 0, 0);
    headerWidth = comp.getPreferredSize().width;
    comp = actionTable.getDefaultRenderer(model.getColumnClass(i)).
    getTableCellRendererComponent(actionTable, model.getValueAt(j, i),
    false, false, 0, i);
    cellWidth = comp.getPreferredSize().width;// !!!!
    maxCellWidth = Math.max(maxCellWidth, Math.max(headerWidth, cellWidth));
    column.setPreferredWidth(maxCellWidth);

    The renderer components are just used for drawing purposes.
    Therefor, you can not iterate through them to find the widest of them for your data, because in most cases, there will only be a single one for your whole table.
    You need to iterate through the data of your model and use that as a basis for calculating the width of each column, not the cellrenderer.

  • Facet  and rendered behaviour

    This fragment works as expected
    <h:column>
    <h:outputText value="Step #{navigation.currentStep}" rendered="#{navigation.stepLabelVisible}" style="color: White;"/>
    </h:column>
    whereas that one doesn't ( always invisible )
    <h:column>
    <f:facet>
    <h:outputText value="Step #{navigation.currentStep}" rendered="#{navigation.stepLabelVisible}" style="color: White;"/>
    </f:facet>
    </h:column>
    Is this expected behaviour ?

    Hi,
    you need to make sure the af:switcher "FacetName" property is set to the name of the current visible facet. If do this e.g from a managed bean in request scope, then pressing the command button clears this information and the default facet is shown. The reason it works for the other button only seems to be because its the default.
    http://download.oracle.com/docs/cd/E17904_01/apirefs.1111/e12419/tagdoc/af_switcher.html
    Frank

  • Web App table rendering

    I'm wanting to use a jQuery script to sort the table cells on the List view of a web app I'm building. Something like this one I think. http://tablesorter.com/docs/. Does anyone know a work around that prevents an entire table being rendered when a list of web app items is displayed?
    I currently have the list to display:
    <table border="0" cellspacing="0" cellpadding="8">
        <tbody>
            <tr>
                <td style="width: 200px;"><strong>Species:</strong> {tag_fish species}</td>
                <td style="width: 200px;"><strong>Where:</strong> {tag_water body}</td>
                <td style="width: 200px;"><strong>Angler:</strong> {tag_name}</td>
                <td style="width: 200px;"><strong>Weight:</strong> {tag_pounds} Lbs, {tag_ounces} Oz's</td>
                <td style="width: 100px;"><strong>Year:</strong> {tag_year of catch}</td>
                <td style="width: 100px;"><strong>Method:</strong> {tag_method of capture}</td>
            </tr>
        </tbody>
    </table>
    I was thinking if I can get it to render out something like this:
    <table border="0" cellspacing="0" cellpadding="8">
        <tbody>
    {web app detail}
        </tbody>
    </table>
    While using something like this for the List layout in the web app:
            <tr>
                <td style="width: 200px;"><strong>Species:</strong> {tag_fish species}</td>
                <td style="width: 200px;"><strong>Where:</strong> {tag_water body}</td>
                <td style="width: 200px;"><strong>Angler:</strong> {tag_name}</td>
                <td style="width: 200px;"><strong>Weight:</strong> {tag_pounds} Lbs, {tag_ounces} Oz's</td>
                <td style="width: 100px;"><strong>Year:</strong> {tag_year of catch}</td>
                <td style="width: 100px;"><strong>Method:</strong> {tag_method of capture}</td>
            </tr>
    I tried this but the WYSIWYG editor strips the <tr> and <td> structure out when I hit save.
    Any help would be apprected!

    Hi Scott,
    You can do that through Dreamweaver or FTP. The online editor/browser will try to correct the incomplete table ending in disaster.
    Cheers,
    Mario

  • ADF Table Renderer while fetching data in a Table

    When I run my application and try to display some data in a table, It throws the following adf exception. I checked the log and it doesn't point to any file in my application. It is pure adf related issue.
    In the pop-up it says -- "An unknown error occurred during data streaming. Ask your System Administrator to inspect the server-side logs."
    The exception in log is -
    <Apr 13, 2012 8:00:52 PM IST> <Error> <oracle.adfinternal.view.faces.config.rich.RegistrationConfigurator> <BEA-000000> <ADF_FACES-60096:Server Exception during PPR, #3
    java.lang.NullPointerException
    at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.renderDataBlockRows(TableRenderer.java:2042)
    at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer._renderSingleDataBlock(TableRenderer.java:1778)
    at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer._handleDataFetch(TableRenderer.java:1087)
    at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.encodeAll(TableRenderer.java:559)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1431)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
    at org.apache.myfaces.trinidad.component.UIXCollection.encodeEnd(UIXCollection.java:538)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at oracle.adfinternal.view.faces.util.rich.InvokeOnComponentUtils$EncodeChildVisitCallback.visit(InvokeOnComponentUtils.java:113)
    at org.apache.myfaces.trinidadinternal.context.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:222)
    at org.apache.myfaces.trinidad.component.UIXIterator.visitTree(UIXIterator.java:251)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:326)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at oracle.adf.view.rich.component.rich.RichDocument.visitTree(RichDocument.java:198)
    at org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:443)
    at oracle.adfinternal.view.faces.util.rich.InvokeOnComponentUtils.renderChild(InvokeOnComponentUtils.java:43)
    at oracle.adfinternal.view.faces.streaming.StreamingDataManager._pprComponent(StreamingDataManager.java:778)
    at oracle.adfinternal.view.faces.streaming.StreamingDataManager.execute(StreamingDataManager.java:529)
    at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer._encodeStreamingResponse(DocumentRenderer.java:3597)
    at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1512)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1431)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
    at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:942)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:387)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:225)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.help.web.rich.OHWFilter.doFilter(Unknown Source)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.bpel.worklistapp.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:222)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:126)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    What is the cause for this exception and how can it be resolved?
    Thanks in advance

    Probably you can try increasing logging level by -
    -Djbo.debugoutput=console in project Properties Run->Debug Profile .. java Options.
    There should be some issue in your code similar to this post -
    An unknown error occurred during data streaming

Maybe you are looking for

  • Scanning multiple pages with preview and brother MFC-7440n

    Hi, because of some problems with my old scanner after i installed snow leopard, i bought a new compatible one. It's a brother MFC-7440n with apple build-in drivers. When i start scanning to preview with more than one page, there will be a pdf docume

  • Help with Importing Photo Albums from Iphoto

    I have created a bunch of albums in iphoto and wish to transfer them to my ipod. However, when i go to the photos tab of itunes when my ipod is plugged in and i try to select Sync from Iphoto it says that i have 0 photos in iphoto. i have tried selec

  • Photo not showing correctly after import from iPhone 4

    Hi, Has anyone experienced this issue? https://discussions.apple.com/thread/6065160 If so is there a solution? Thanks

  • Delete Document Level Script Using JavaScript?

    Hello all. Is there a way for a document level script to delete itself? I am running Adobe Acrobat Professional 11. My situation is that I am currently analysing data using a Java application. The Java application taylors a script to suit each specif

  • IPhone 3G won't boot up

    Recently, I used the reset option in the iPhone 3G General Settings. Everything went fine. Just after that, when the iPhone restarted, it refuses to start up. It actually freezes at the "apple" screen. I tried forced restart (home + power button), co