Dynamic Column Selector in OBIEE - Solution required

Hello Experts,
I am pretty new to OBIEE. Please help me to get OBIEE solution for below requirement.
I have one 25 column dimension table in database. Created OBIEE .rpd file and published in BI server. Now I need to provide one user interface in which user should be able to chose any number of columns of his choice and he should get record set of those selected columns. Something in my mind is like this.
I should be providing list of 25 column names with check box to select one or many. Assuming that if user selects Col1, Col3,Col5 and Col7 then he should get the result in excel file with record set of those 4 columns.
I am using OBIEE 10g.
Any solution for this is highly appreciated.
Edited by: user7850154 on Dec 5, 2010 9:22 AM

user,
Usually, dynamic column seletor is implemented through "column selector view" available within compund layout of OBIEE Answers.
But, it does allow you to select only single column rather than multiple columns - which in your case is required.
J
-bifacts
http://www.obinotes.com

Similar Messages

  • Dynamic column name in OBIEE

    Hi all,
    In my report i need to show one chart view. I'm having one prompt. There the user is asked to select a no. for eg. say 10. and a date eg. 10-JAN-09. So my report should show the data from 10-JAN-09 and go backwards to 10 days. if he selects 5 days then only 5 days of data only need to show from that date. This part is ok. The chart has five sections in it. They are
    1) 80-100% of the time period
    2) 60-80%
    3) 40-60%
    4) 20-40%
    5) <20%
    So the legends should vary according to this.
    Suppose if the user selects 10 days then the legend should be,
    1) 8-10 days
    2) 6-7 days
    3) 4-5 days
    4) 2-3 days
    5) less than 2 days
    If user selects 5 means then the legend should be,
    1) 5 days
    2) 4 days
    3) 3 days
    4) 2 days
    5) 1 day
    In the prompt im saving this value in one variable. So all i need to do is to apply aggregation on the variable and place it in the column name. But i dont know where to give it. Please help.
    Thanks,
    Karthick

    Hi when you dynamically change the table column that will automatically reflect in the chart legend.
    please check the following link for dynamically changing column header name
    http://oraclebizint.wordpress.com/2008/01/25/oracle-bi-ee-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting/

  • Dynamic Column sorting in OBIEE?

    Hi,
    Does anybody knows how to sort columns dynamically in a report on asc or desc order.Any automatic mechanism.

    Gianluca Ancarani wrote:
    You can use in the RPD (in the Business Model Layer) a specific COLUMN SORT to sort a scecific Logical Column, in this way a column in a report is always sorted, but you have to build the specific COLUMN SORT inside the physical table or in the business model layer.
    See this blog: http://obiee101.blogspot.it/2008/11/obiee-sort-order-column-property.html
    Regards,
    GianlucaI think the user is trying to sort the report based on the Names of the columns rather than the data in a specific column.

  • OBIEE UI Interface is missing prompt functionality and Column Selector

    Hi,
    OBIEE UI Interface is missing prompt functionality and Column Selector in Answers when creating a report. This problem occurs on all the reports. Also the problem occurs in firefox too. Could you please suggest me any suggestion to overcome this issue.
    Thanks and Regards

    May sound stupid, but do you have the Privileges to add these things to a report? These features can be turned on/off from the Privilege Administration Screen, for a group or user. Have a look.
    Cheers,
    A.

  • Obiee 11g: Including derived columns into column selector

    Hi All,
    The attributes appearing in the left pane while editing an answer can be included in a column selector.
    But in the UI the is there any way to specify the columns (measures) which are created using the existing columns based on some formula. (Front end measures) to be included in the column selector.
    Please help me..
    Thanks in advance.
    SwatP
    Edited by: 983356 on Mar 5, 2013 8:39 PM

    Hi,
    Have a look at the following links:
    http://oraclebizint.wordpress.com/2008/01/25/oracle-bi-ee-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting/
    show the presentation variable on table column header
    Define presentation variable in column header
    hope it helps.
    Regards,
    Kalyan Chukkapalli
    http://123obi.com

  • Dynamic Column depending on Column Selector Help

    Hi everyone, i have an issue with one of the requests
    The Subject Area Sales has Columns Report Date and Sales Facts
    Sales (Subject Area)
    Report Date (Column1)
    Date
    Day Ago Date
    Week Ago Date
    Month Ago Date
    Sales Facts (Column2)
    Gross Sales
    Day Ago Gross Sales
    Week Ago Gross Sales
    Month Ago Gross Sales
    The Request is to see the Date, Gross Sales, any one Historic Gross Sales (Day Ago or Week Ago or Month Ago) and the Historic Date.
    I created the answer request with a column selector on the Day Ago Gross Sales and added Week Ago Gross Sales and Month Ago Agross Sales as items in the selector
    Request:
    Column Selector: Prior Period[Day Ago Gross Sales]
    Date------------------Gross Sales-------------- Day Ago Gross Sales-----------Historic Date
    9/1/2008------------$100--------------------------$150------------------------------------????????
    9/2/2008------------$99----------------------------$89-------------------------------------????????
    9/3/2008------------$35----------------------------$22-------------------------------------????????
    The Column Selector works great.(AKA, when I select Prior Period as Week Ago Gross Sales, I get the Date, Gross Sales and Week Ago Gross Sales as expected.
    Issue:
    How would I get the Historic Date, dynamically based on the Column Selector?
    ex: 1. When the column Selector, Prior Period = [Day Ago Gross Sales] Then I would like to see the Day Ago Dates under the Historic Date bucket
    2. When the column Selector, Prior Period = [Week Ago Gross Sales] Then I would like to see the Week Ago Dates under the Historic Date bucket. and so on......
    Can any one please help me how do i link the [Historic Gross Sales] with the [Historic Dates]
    Please let me know if the above situation is not explained well and I will try to give more inputs.
    Any help is greatly appreciated.
    Thanks
    Sai
    Edited by: Sai Kumar Reddiboyina on Sep 10, 2008 1:26 PM
    Edited by: Sai Kumar Reddiboyina on Sep 10, 2008 1:26 PM
    Edited by: Sai Kumar Reddiboyina on Sep 10, 2008 1:27 PM

    Hi Vency, thanks for the response.
    I am sure your logic might have satisfied my request. I did a slight different approach using Dashboard Prompts and Guided Navigation for which there is a good example in the forums.
    The only reason I did not go with the pivot table approach was that my answer request needs to display a Narrative View of the selected Date Range and the Prior Date Range.
    I mean, if the user wants to see the Gross Sales for the Current Week, compared with the Gross Sales a Week Ago, then the Pivot Table approach would satisfy the main graph portion, but there is't any easy way to feed the Narrative View that shows only the Begin and End dates of Current Week and the Compare Week.
    If anyone needs an example or sample code for my requests, please feel free to ask here and I will respond accordingly.
    Thanks Very Much
    Sai

  • Dynamically display title based on value selected in column selector

    Hi All,
    Can it be possible to show the report title dynamically based on value selected in column selector . suppose i have two column status and region . When i will select status in the column selector the title of the report will show " Status Summary" when i will select region then the title will change to "Region Summary". Please help me...

    Hi,
    create dashboard prompt with column selector functionality like following way
    write the following query in your dashboard prompt sql results
    select region name from subject area name
    Union all
    select sub_region name from subject area name
    like this and put one presentation variable for this dashboard prompt like var1
    in your report write formula in your column like this *case when @{var1)='region column' then 'Region Summary' else ' ' end*
    and refer this column in narrative view like @1 then narrative act like a title view.
    Hope this helps you
    Regards
    Naresh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • OBIEE 11g (11.1.1.5...)Column Selectors and Action Links

    All,
    I think we have bug - we have a column selector for 3 columns. One of them is configured to navigate to another analyses page (we have only one action link configured) . we have checked the option - "Do not display in a popup if only one action link is available at runtime". The issue is the pop-up still shows up even if there is only one action link. The issue is only for a column group.
    Please let us know if anyone has figured out a work around.
    Thanks
    Edited by: user709926 (Kottresh Kogali) on Sep 13, 2011 2:00 PM

    Hi,
    Yes, we do face this issue.There is no workaround for this issue as of now.
    Rgds,
    Dpka

  • Dynamic columns in column selector

    Hi All,
    I have a report with two column selector for X and Y axis . I want to change the columns in the column selector based on the value selected in the dashboard promt.
    Please help me ..

    Read about Presentation Variables in the Answers documentation. That should do the trick

  • How to create a dynamic RTF report which creates dynamic columns based on dynamic column selection from a table?

    Hi All,
    Suppose I have table, whose structure changes frequently on daily basis.
    For eg. desc my_table gives you following column name on Day 1
    SQL > desc my_table;
    Output
    Name
    Age
    Phone
    On Day 2, two more columns are added, viz, Address and Salary.
    SQL > desc my_table;
    Output
    Name
    Age
    Phone
    Address
    Salary
    Now I want to create an Dynnamic RTF report which would fetch data from ALL columns from my_table on daily basis. For that I have defined a concurrent program with XML as output type and have attached a data template/data definition to it which takes in XML as input and gives final output of conc program in EXCEL layout. I am able to do this for constant number of columns, but dont know how to do it when the number of columns to be displayed changes dynamically.
    For Day 1 my XML file should be like this.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    SELECT Name
    ,Age
    ,Phone
    FROM my_table
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_my_table" source="Q2">
      <element name="Name" value="Name" />
      <element name="Age" value="Age" />
      <element name="Phone" value="Phone" />
    </group>
    </dataStructure>
    </dataTemplate>
    And my Day 1, EXCEL output from RTF template should be like this.
    Name     Age     Phone
    Swapnill     23     12345
    For Day 2 my XML file should be like this. With 2 new columns selected in SELECT clause.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    SELECT Name
    ,Age
    ,Phone
    ,Address
    ,Salary
    FROM my_table
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_my_table" source="Q2">
      <element name="Name" value="Name" />
      <element name="Age" value="Age" />
      <element name="Phone" value="Phone" />
      <element name="Address" value="Address" />
      <element name="Salary" value="Salary" />
    </group>
    </dataStructure>
    </dataTemplate>
    And my Day 2, EXCEL output from RTF template should be like this.
    Name     Age     Phone     Address     Salary
    Swapnill     23     12345         Madrid     100000
    Now, I dont know below things.
    Make the XML dynamic as in on Day 1 there must be 3 columns in the SELECT statement and on Day 2, 5 columns. I want to create one dynamic XML which should not be required to be changed if new columns are added in my_table. I dont know how to create this query and also create their corresponding elements below.
    Make the RTF template dyanamic as in Day1 there must 3 columns in EXCEL output and on Day 2, 5 columns. I want to create a Dynamic RTF template which would show all the columns selected in Dynamic XML.I dont know how the RTF will create new XML tags and how it will know where to place it in the report. Means, I can create RTF template on Day 1, by loading XML data for 3 columns and placing 3 XML tags in template. But how will it create and place tags for new columns on Day 2?
    Hope, you got my requirement, its a challenging one. Please let me know how I can implement the required solution using RTF dynamically without any manual intervention.
    Regards,
    Swapnil K.
    Message was edited by: SwapnilK

    Hi All,
    I am able to fulfil above requirement. Now I am stuck at below point. Need your help!
    Is there any way to UPDATE the XML file attached to a Data Definition (XML Publisher > Data Definition) using a standard package or procedure call or may be an API from backend? I am creating an XML dynamically and I want to attach it to its Data Definition programmatically using SQL.
    Please let me know if there is any oracle functionality to do this.
    If not, please let me know the standard directories on application/database server where the XML files attached to Data Definitions are stored.
    For eg, /$APPL_TOP/ar/1.0/sql or something.
    Regards,
    Swapnil K.

  • Problem with dynamic columns in smartforms.

    Dear SDN Experts,
    I have a requirement in smartforms for dynamic columns.
    i have used template with 10 columns, So from these 10 columns,Columns may vary monthly MIN 2 to MAX 10 depending on
    readings with them  for that month.
    i cannot fix column headings also,Because headings also changes dynamically.
    So Problem is if there is no data in columns,Columns is displayng empty.
    For EX: In this month i have 2 columns data remaining all columns is displaying empty boxes.
    Please suggest me a solution  is this posible in smartforms if i use table also.
    <removed by moderator>
    Regrds,
    MNR
    Edited by: Thomas Zloch on Sep 11, 2011 3:50 PM

    Hi friend,
    See the link below it is having the solution of hiding the columns in smart forms
    Hide table columns in smart form?
    Create a table to display your values with 12 col and hide the columns based on the idea provided in the link above.
    I think this will solve your issue if you still have queries please revert back to me i will help you.
    Thanks,
    Sri Hari

  • GoNav function with dynamic columns 10g

    Hi,
    I have a report with a dashboard prompt that dynamic change the report column. The result of this prompt is set into a presentation variable @{dimension}.
    Now I want to use the GoNav function on the column that dynamically changes.
    The data format for this column should be:
    @[html]"<font class="Nav" onclick=\"javaScript:GoNav(event, '/users/Administrator/Test', 'Department', 'Department_name' ,'"@"','_self');\">"@"".
    But this syntax only works for the column Department.Department_name. If the prompt on the dashboard is changed to another column the navigate link doesn't work anymore.
    Is there a solution to make this work so that also the column can be set dynamically for the navigation?

    I have a report with a dashboard prompt that dynamic change the report column. The result of this prompt is set into a presentation variable @{dimension}.
    Now I want to use the GoNav function on the column that dynamically changes.
    The data format for this column should be:
    @[html]"<font class="Nav" onclick=\"javaScript:GoNav(event, '/users/Administrator/Test', 'Department', 'Department_name' ,'"@"','_self');\">"@"".
    But this syntax only works for the column Department.Department_name. If the prompt on the dashboard is changed to another column the navigate link doesn't work anymore.
    As per your comments above you are using Column selector kind of functionality using a Dashboard prompt and in your GO nav you are taking column Department that's way it is working for that column only , if you change the Column in Dashboard prompt also still GO nav point to Department column only...make the GO NAV to take dynamic columns..
    I am not sure whether we can pass presentation variable .....with my knowledge its not..use GO URL instead of GO NAV

  • Dynamic columns with grouping.... in crystal report...using java /c# api ??

    I need to create a report with dynamic columns
    for e.g/
                                           Pre   Scen 1   Scen 2   Scen 3   Scen 4   Scen 5   Scen 6      .....
    *Total                          4.5118   4.5118    4.5118   4.5118   4.5118        4.5118   4.5118     *
    *Canada                    1.7180    1.7180    1.7180   1.7180  1.4103     8.4103      8.4103     *
       BG                           1.6224    0.9641    1.0473   1.0473  6.4635     6.4635  1.6224     
       BI                              0.044     0.0827     0.3578   0.3578 0.0560     0.0560   0.0744     
      DIN                    0.0056     -0.0655     -0.0215     -0.0215     -0.0210     -0.0210     0.0056     
    *Czech Republic     1.7180     1.7180     1.7180     1.7180     18.4103     18.4103     18.4103     *
      CEE               0.0275     1.0000     0.7359     100.0000     0.0858     0.0858     0.0275     
    *Israel               1.7180     1.7180     1.7180     1.7180     18.4103     18.4103     18.4103     *
      F                    0.0077     1.0000     0.7359     100.0000     -0.0035     -0.0035     0.0077     
    *United States          1.7180     1.7180     1.7180     1.7180     18.4103     18.4103     18.4103     *
      A                    0.0144     0.1871     91.0473     0.0679     0.0544     0.0544     0.0144     
      AA                    0.0428     0.0626     0.3578     0.0675     0.1175     0.1175     0.0428     
      AB                    0.0431     0.1553     -0.0215     0.1685     0.1199     0.1199     0.0431     
    in this report....grouping will be parameterized ....and total also required at every stage...
    so how can i add the columns dynamically ?
    number of columns are not fixed...they may be 20...30....etc

    Requirement is...
    I have a table scn ... where i can make entries any time....assume they are some rules...
    I have another table called t1 ... where i need to calculate values of t1 again some specific rules are table scn.
    So for each t1 there will be one row with columns as scn entries which I select on interface.
             Original Value  --  Sc1 ......  Sc2  ...... Sc3  ......  Sc4 ......  Sc5 . . . . . .. .
    t1...................xx...... xx..........xx..........xx........ xx........ xx
    t3...... .............xx...... xx..........xx..........xx........ xx........ xx
    t4....................xx...... xx..........xx..........xx........ xx........ xx
    selection of these scn columns will be dynamic....so i cant create n number of columns in the report template and hide them as per requirement....it will not work.
    Wat is a feasible solution to create such kind of report ?
    Can we create template in C# or .net ?
    IF yes...do we have to save every time in order to render report ?
    e.g.   one report may contain 4 columns and other 10 ... so do i have to create new rpt file each in order to render the report ?
    Please if any1 have approach to create this kind of report then it will very helpful....
    Edited by: pchawan on Jul 19, 2011 11:28 PM

  • Calculated column of a request from Column Selector View.

    hi,
    A user wants to select the calculated column of a request from Column Selector View.
    But he is able to select only those columns which are available in Selection Pane.
    How can he fulfill this request

    Hi,
    Take a column in your request criteria and change the name of the column and forumala to f(x)=qty* amount which is your calculated column and using column selector use this column as your user wish too.
    UPDATED POST
    I dont know how your proceeding,the solution i gave will definately work .Here are the steps
    1)pull a column into the request criteria
    2)rename the name of the column
    3)go to formula in f(x) change according to your requirement for example:- quantity*unitprice
    4) run the report and in results you would see the column.
    5)From compound layout select column selector and see what you want is getting displayed.
    Hope helps you.Award points.
    Cheers,
    KK
    Edited by: Kranthi on Jan 19, 2011 7:23 AM

  • JTable (dynamic columns)

    Well guys, voil� my problem...
    I've a Person class, who has some methods to get the person information, like getName(), getAge(), getAdresse(), etc... I would display the information of all the persons in the diary in a JTable... Ok, it's all right, i made a class who extends AbstractModelTable, overriding the getValueAt(int, int) with a switch:
    // private static final int COLUMN_NAME = 0;
    // private static final int COLUMN_NAME = 1;
    switch (column) {
            case COLUMN_NAME:
                  return cols[rowIndex].getName();
             case COLUMN_AGE:
                   return cols[rowIndex].getAge();
              default:
                    return;
    }The code it's something like that... I'm sorry i don't show the code, i've not the source here!
    It works very fine!... But now, i want to let the user choose witch columns to display...
    I made a lot of tries, but i could not get the solution... The only one thing I could, was to eliminate the columns with zero value in the conf file, but the headers were not in the correct order!... And there's another problem too, when I switch the columnIndex, if it equals to COLUMN_EMAIL = 15 means that JTree is getting the value of the 15th column, but if the user had removed the 2 column for example, the 15th column is not more the email column, it's the 15+1 columns :S... is it clair? I think it's a little difficult to explain, and as you see, i don't speak english very well :P...
    Summary: I would create a class extending JTable with columns configurables, i mean, let the user choose witch columns should be showed... Any idea ?... I can avoid the JTable component, so If you've another solution, it will be ok...
    Greetings and thank you guys...

    Your requirement is very general so we can't give you an exact solution, but I can try explaining how JTable works.
    The TableModel is used to store the data. The JTable is used to display the data. When a table is first created using a TableModel a TableColumnModel is created. Each TableColumn in the TableColumnModel maps directly to a column in the TableModel.
    Now what happens if the user moves column 15 to the first column in the table? The data hasn't changed, only the view of the data has changed. So even though the column is in column 0 of the table, the data must still come from column 15 in the TableModel. The TableColumns of the TableColumnModel do the mapping for you so you don't need to worry about the reordering of columns.
    However, if you have some code in your program that accesses the data directly, then you need to be aware of this situation. Fortunately JTable has some methods to make this mapping easy.
    table.getValueAt(...) will get data from the requested column in the view of the table
    table.getModel().getValueAt(...) will get data form the requested column in the TableModel.
    You can also do the mapping between "view" and "model" columns using the methods:
    table.convertColumnIndexToModel(...)
    table.convertColumnIndexToView(...) So what does this mean with dynamic columns? Well, you would build your table normally, then you would remove the TableColumns from the TableColumnModel that the user does not want to see.
    The following example is so code I wrote a while ago that will help in manipulating the TableColumnModel. Right click on the TableHeader to see the visible/hidden status of each column:
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableColumnManager implements MouseListener, ActionListener
         private static final String HIDDEN_COLUMN = "HiddenColumn:";
         //  Reference to the Singleton instance of this class
         private static TableColumnManager singleton;
         *  Use a private constructor so we can create a Singleton.
         private TableColumnManager()
         *  Get the Singleton instance of the <code>TableColumnManager</code>.
         *  @return  the Singlton instance of <code>TableColumnManager</code>
         private static TableColumnManager getInstance()
              if (singleton == null)
                   singleton = new TableColumnManager();
              return singleton;
         *  Add support for the management of visible <code>TableColumns</code>
         *  for a given <code>JTable</code>.
         *  @param  table the table to provide support for
         public static void install(JTable table)
              table.getTableHeader().addMouseListener( getInstance() );
         *  Remove support for the management of visible <code>TableColumns</code>
         *  for a given <code>JTable</code>.
         *  @param  table the table to remove support from
         public static void uninstall(JTable table)
              table.getTableHeader().removeMouseListener( getInstance() );
         *  Hide a column from view in the table.
         *  @param  table        the table from which the column is removed
         *  @param  modelColumn  the column index from the TableModel
         *                       of the column to be removed
         public static void hideColumn(JTable table, int modelColumn)
              int viewColumn = table.convertColumnIndexToView( modelColumn );
              if (viewColumn != -1)
                   TableColumn column = table.getColumnModel().getColumn(viewColumn);
                   hideColumn(table, column);
         *  Hide a column from view in the table.
         *  @param  table        the table from which the column is removed
         *  @param  columnName   the column name of the column to be removed
         public static void hideColumn(JTable table, String columnName)
              try
                   TableColumnModel tcm = table.getColumnModel();
                   int index = tcm.getColumnIndex( columnName );
                   TableColumn column = tcm.getColumn( index );
                   hideColumn(table, column);
              catch(IllegalArgumentException e) {}
         *  Hide a column from view in the table.
         *  @param  table   the table from which the column is removed
         *  @param  column  the TableColumn to be removed from the
         *                  TableColumnModel of the specified table
         public static void hideColumn(JTable table, TableColumn column)
              table.getColumnModel().removeColumn( column );
              //  Save the column so it can be redisplayed
              ArrayList list = (ArrayList)table.getClientProperty(HIDDEN_COLUMN);
              if (list == null)
                   list = new ArrayList();
                   table.putClientProperty(HIDDEN_COLUMN, list);
              list.add(column);
         *  Show a hidden column in the table.
         *  @param  table        the table to which the column is added
         *  @param  modelColumn  the column index from the <code>TableModel</code>
         *                       of the column to be added
         public static void showColumn(JTable table, int modelColumn)
              ArrayList list = (ArrayList)table.getClientProperty(HIDDEN_COLUMN);
              if (list == null) return;
              ListIterator it = list.listIterator();
              while (it.hasNext())
                   TableColumn column = (TableColumn)it.next();
                   if (column.getModelIndex() == modelColumn)
                        table.getColumnModel().addColumn( column );
                        it.remove();
                        break;
         *  Show a hidden column in the table.
         *  @param  table        the table to which the column is added
         *  @param  columnName   the column name from the <code>TableModel</code>
         *                       of the column to be added
         public static void showColumn(JTable table, String columnName)
              ArrayList list = (ArrayList)table.getClientProperty(HIDDEN_COLUMN);
              if (list == null) return;
              ListIterator it = list.listIterator();
              while (it.hasNext())
                   TableColumn column = (TableColumn)it.next();
                   if (column.getHeaderValue().equals(columnName))
                        table.getColumnModel().addColumn( column );
                        it.remove();
                        break;
         //  Implement the MouseListener
         public void mousePressed(MouseEvent e)
              checkForPopup( e );
         public void mouseReleased(MouseEvent e)
              checkForPopup( e );
         public void mouseClicked(MouseEvent e) {}
         public void mouseEntered(MouseEvent e) {}
         public void mouseExited(MouseEvent e) {}
         private void checkForPopup(MouseEvent e)
              if (e.isPopupTrigger())
                   JTableHeader header = (JTableHeader)e.getComponent();
                   int column = header.columnAtPoint( e.getPoint() );
                   showPopup(header.getTable(), column);
         *  Show a hidden column in the table.
         *  @param  table        the table to which the column is added
         *  @param  columnName   the column name from the <code>TableModel</code>
         *                       of the column to be added
         public static void showPopup(JTable table, int tableColumn)
              int columns = table.getModel().getColumnCount();
              JCheckBoxMenuItem[] items = new JCheckBoxMenuItem[columns];
              //  Create menu items for hidden columns
                 ArrayList list = (ArrayList)table.getClientProperty(HIDDEN_COLUMN);
                 if (list != null)
                   ListIterator it = list.listIterator();
                   while (it.hasNext())
                        TableColumn column = (TableColumn)it.next();
                        String columnName = column.getHeaderValue().toString();
                        JCheckBoxMenuItem item = new JCheckBoxMenuItem( columnName );
                        item.setSelected( false );
                        item.addActionListener(getInstance());
                        items[column.getModelIndex()] = item;
              //  Create menu items for visible columns
              TableColumnModel columnModel = table.getColumnModel();
              int columnCount = columnModel.getColumnCount();
              for (int i = 0; i < columnCount; i++)
                   TableColumn column = columnModel.getColumn(i);
                   String columnName = column.getHeaderValue().toString();
                   JCheckBoxMenuItem item = new JCheckBoxMenuItem( columnName );
                   item.setSelected( true );
                   item.addActionListener(getInstance());
                   items[column.getModelIndex()] = item;
              //  Create popup menu from array of menu items.
              //  Override the setSelected method to select the
              //  specified menu item. (ie. this is a bug fix)
              JPopupMenu popup = new JPopupMenu()
                   public void setSelected(Component sel)
                        int index = getComponentIndex( sel );
                        getSelectionModel().setSelectedIndex(index);
                        final MenuElement me[] = new MenuElement[2];
                        me[0]=(MenuElement)this;
                        me[1]=getSubElements()[index];
                        SwingUtilities.invokeLater(new Runnable()
                             public void run()
                                  MenuSelectionManager.defaultManager()
                                       .setSelectedPath(me);
              for (int i = 0; i < items.length; i++)
                   if (items[i] != null)
                        popup.add( items[i] );
              //  Display the popup below the TableHeader
              JTableHeader header = table.getTableHeader();
              Rectangle r = header.getHeaderRect( tableColumn );
              popup.show(header, r.x, r.height);
              int modelColumn = table.convertColumnIndexToModel( tableColumn );
              popup.setSelected( items[modelColumn] );
         *  Responsible for processing the ActionEvent. A column will either be
         *  added to the table or removed from the table depending on the state
         *  of the menu item that was clicked.
         * @param event the ActionEvent.
         public void actionPerformed(ActionEvent event)
              JMenuItem item = (JMenuItem)event.getSource();
              JPopupMenu popup = (JPopupMenu)item.getParent();
              JTableHeader header = (JTableHeader)popup.getInvoker();
              JTable table = header.getTable();
              if (item.isSelected())
                   showColumn(table, item.getText());
              else
                   hideColumn(table, item.getText());
         public static void main(String[] args)
              JTable table = new JTable( new DefaultTableModel(5, 10) );
              TableColumnManager.install(table);
              TableColumnManager.hideColumn(table, 2);
              TableColumnManager.hideColumn(table, "E");
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              frame.getContentPane().add( new JScrollPane(table) );
              frame.pack();
              frame.setVisible( true );
    }Hopefully I've made some sense.

Maybe you are looking for

  • Can itune 9.2 and iOS4 shared by iphone 4g and 3GS

    I upgraded to iphone 4g, but I still like to keep my old 3gs as a back up, but in order to get iOS4 in 3gs working properly, I had to do "set up a new iphone" instead of "restore" which I did and the 3gs is good now, but just without any of my iphone

  • How to get J2EE installation directory?

    when we install J2EE, we install it in a directory, i.e. c: \ j2sdkee1.4 but how to get the directory programmatically on Windows OS using Java or C++ launguage? thx

  • Safari 5 Crashes all time when i write something on the toolbar

    ok so this is the problem, i start safari, i try to write any web direction on the toolbar and then safari crashes. btw i can enter to a web by topsites and i can write web direction in the search bar, but i cant write anything on the toolbar i am th

  • FireWire HD(10.4.7) starts G5 2.5DP tower but won't boot iMac G5.Any ideas?

    I use my bootable FW HD (Oxford 911 chips) with 10.4.7 installed to troubleshoot other Macs. It readily boots the G5 tower; however, when trying to boot an iMac G5 1.8Ghz, after trying for a few minutes I get a gray circle with a line through it. Any

  • Timeout setting for Realtime-Sequence execution

    Hello, I'm referring to the "Timeout" setting in the stimulus profile editor or the "Timeout" parameter of the SequenceCallInfo Constructor. The description of this parameter is as follows: The timeout in milliseconds within which the sequence must c