How to hide the "Show All Hidden Columns" menu item in table

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

How to hide the "Show All Hidden Columns" menu item in table

Postby sks » Fri Feb 13, 2009 2:48 pm

Hello,
A quick question, how can I hide the "Show All Hidden Columns" menu item that shows on the header of a Sortable table? I tried different things but didn't work. After I hide the Connection Id and Results Id, I don't want to let the user show them by selecting the "Show All Hidden Columns" menu item. The code and classes I'm using are:


Code: Select all
  TableHeaderPopupMenuInstaller installer = new TableHeaderPopupMenuInstaller(
        this.table);
    installer
        .addTableHeaderPopupMenuCustomizer(new AutoResizePopupMenuCustomizer());
    TableColumnChooserPopupMenuCustomizer tableColMenuCustomizer = new TableColumnChooserPopupMenuCustomizer();
    tableColMenuCustomizer.setHiddenColumns(new int[] { connectionIdColIndex,
        resultIdColIndex });
   
    installer.addTableHeaderPopupMenuCustomizer(tableColMenuCustomizer);


Thanks,
SKS
sks
 
Posts: 48
Joined: Thu Sep 25, 2008 12:23 pm

Re: How to hide the "Show All Hidden Columns" menu item in table

Postby JIDE Support » Fri Feb 13, 2009 4:53 pm

We value your request and will provide APIs in next release so you can customize your own popup menu. Will let you know when we release the version.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to hide the "Show All Hidden Columns" menu item in table

Postby sks » Tue Feb 17, 2009 8:37 am

Sorry, but that doesn't really answer my question if there is a way to hide the "Show All Hidden Columns". There isn't any way currently?

I would appreciate a specific answer.


Thanks
sks
 
Posts: 48
Joined: Thu Sep 25, 2008 12:23 pm

Re: How to hide the "Show All Hidden Columns" menu item in table

Postby JIDE Support » Tue Feb 17, 2009 8:41 am

You can already do that by overriding customizePopupMenu. Call super first then remove any menu item you want from the popupMenu. It is just right now you need to hard code which menu item is the Show All Hidden Columns menu item in order to remove it. In next release, we will setName on each menu item so that you can remove the menu item based on the name.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to hide the "Show All Hidden Columns" menu item in table

Postby sks » Tue Feb 17, 2009 12:46 pm

Thanks, it works well now.

SKS
sks
 
Posts: 48
Joined: Thu Sep 25, 2008 12:23 pm

Re: How to hide the "Show All Hidden Columns" menu item in table

Postby JIDE Support » Wed Feb 25, 2009 6:23 pm

Just so you know, we added show all hidden columns to 2.5.4 we just released.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to hide the "Show All Hidden Columns" menu item in t

Postby majid » Fri Nov 22, 2013 9:14 am

Hi

I have a similar issue but with "Set to default" menu
So I want to override its behaviour, I want to get the menu with the name CONTEXT_MENU_RESET_COLUMNS and change the actionPerformed action to a custom one.

The parameter popup of the method :customizePopupMenu does not seem to have an accesor to this menu
Any idea ?

Regards,
majid
 
Posts: 24
Joined: Fri Jan 25, 2013 9:40 am

Re: How to hide the "Show All Hidden Columns" menu item in t

Postby JIDE Support » Fri Nov 22, 2013 10:22 am

Please give the following sample code a try.
Code: Select all
        installer.addTableHeaderPopupMenuCustomizer(new TableColumnChooserPopupMenuCustomizer() {
            @Override
            public void customizePopupMenu(JTableHeader header, JPopupMenu popup, int clickingColumn) {
                super.customizePopupMenu(header, popup, clickingColumn);
                // find the menu item here and reset its action as you design
            }
        });

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to hide the "Show All Hidden Columns" menu item in t

Postby majid » Tue Nov 26, 2013 5:07 am

Thanks for your reply
Here what I did, it is working fine
Code: Select all
  super.customizePopupMenu( header, popup, clickingColumn );

            Component[] components = popup.getComponents();
            for( Component component : components )
            {
                if( component instanceof JMenuItem
                    && CONTEXT_MENU_RESET_COLUMNS.equals( ( (JMenuItem) component ).getName() ) )
                {
                    JMenuItem resetMenu = (JMenuItem) component;
                    final javax.swing.Action action = resetMenu.getAction();
                    resetMenu.setAction( new AbstractAction(
                                                             getResourceString( CONTEXT_MENU_RESET_COLUMNS ) )
                    {
                        private static final long serialVersionUID = 1363294215712070529L;

                        public void actionPerformed( ActionEvent e )
                        {
                            action.actionPerformed( e );
                            //doSomethingElse()
                        }
                    } );
                    break;
                }
            }

However, it sounds not really a proper way :(
majid
 
Posts: 24
Joined: Fri Jan 25, 2013 9:40 am

Re: How to hide the "Show All Hidden Columns" menu item in t

Postby JIDE Support » Tue Nov 26, 2013 8:36 am

Unfortunately that's the way although it doesn't look the cleanest.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to hide the "Show All Hidden Columns" menu item in t

Postby majid » Tue Nov 26, 2013 10:05 am

Thanks for your feedback.

After hiding some columns of the table.
I want to generate some html file with only the remaining shown columns.
From the table itself, I don't have the information about which column is hidden/shown (without keeping a reference to TableColumnChooserPopupMenuCustomizer
Is there anyway to iterate over only shown columns ? (or utility method )
majid
 
Posts: 24
Joined: Fri Jan 25, 2013 9:40 am

Re: How to hide the "Show All Hidden Columns" menu item in t

Postby JIDE Support » Tue Nov 26, 2013 10:12 am

table.getColumnModel() will give you the TableColumnModel which has all the visible columns.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to hide the "Show All Hidden Columns" menu item in t

Postby majid » Wed Nov 27, 2013 3:20 am

With this method, I can get the visible columns, mainly headers information, but I need the values in the rows as well.
majid
 
Posts: 24
Joined: Fri Jan 25, 2013 9:40 am

Re: How to hide the "Show All Hidden Columns" menu item in t

Postby majid » Wed Nov 27, 2013 5:00 am

I found how to fix that, thanks :)
majid
 
Posts: 24
Joined: Fri Jan 25, 2013 9:40 am


Return to Product Suggestions

Who is online

Users browsing this forum: Google [Bot] and 13 guests