Combo Box in Jide TAble

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Combo Box in Jide TAble

Postby Kalyani » Sun Jan 15, 2012 11:23 pm

Hi ,

My client wants me to convert one column of the JIDE Table into a combo box. So, instead of an editable cell, he will get a combo box for one column only. Is that possible ?
Kindly help.

Regards,
Kalyani
Kalyani
 
Posts: 10
Joined: Fri Nov 11, 2011 12:59 am

Re: Combo Box in Jide TAble

Postby JIDE Support » Mon Jan 16, 2012 12:15 am

Let me make sure I got it correctly. Do you mean just ONE combobox for a WHOLE column? No cells at all in that column?
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Combo Box in Jide TAble

Postby Kalyani » Tue Jan 17, 2012 2:51 am

No. Am sorry for not having been clear. I want a comboBox for every cell in that column. So instead of seeing a cell where you enter data in that column, you will view a comboBox.
Kalyani
 
Posts: 10
Joined: Fri Nov 11, 2011 12:59 am

Re: Combo Box in Jide TAble

Postby JIDE Support » Tue Jan 17, 2012 9:13 am

It sounds like you want to use a combobox as the cell editor. If you are using JIDE Grids, the recommended way is to register a cell editor based on JComboBox or ExComboBox using CellEditorManager using a data type and an EditorContext, then implement ContextSensitiveTableModel interface on your table model and return the data type and the EditorContext to match your registration on the CellEditorManager. JIDE Grids provided a bunch of cell editors based on ExComboBox such as for Enums, Date, Calendar, Insets etc.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Combo Box in Jide TAble

Postby Kalyani » Fri Jan 27, 2012 5:06 am

Yes that did it.. THanks a lot :)
Kalyani
 
Posts: 10
Joined: Fri Nov 11, 2011 12:59 am

Re: Combo Box in Jide TAble

Postby infn » Mon Dec 24, 2012 11:14 am

Hi,
I am trying to show comboBox in one of the table columns..As suggested in above post, i registered a editor context by creating a celleditor like:
Code: Select all
  ObjectConverterManager.initDefaultConverter();
        CellRendererManager.initDefaultRenderer();
        CellEditorManager.initDefaultEditor();

        CellEditorManager.registerEditor(String.class, new CellEditorFactory() {

            public CellEditor create()
            {
                AbstractComboBoxCellEditor editor = new AbstractComboBoxCellEditor() {
                    @Override
                    public AbstractComboBox createAbstractComboBox()
                    {
                        DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel(
                                new String[]{"One", "Two"});
                        return new ListComboBox(comboBoxModel);
                    }
                };
                return editor;
            }
        }, PN_CONTEXT);


and in table model which implmenet ContextSensitiveTableModel, getEditorcontext is overridden as :

Code: Select all
return column == 1 ? ListStyleOptionsDialog.PN_CONTEXT : super.getEditorContextAt(row, column);


Still, comboBox is not shown in column 1 and also, no other columns are selected when a row is selected exception column 0.
Note: column 0 is a tristatecheckbox
infn
 
Posts: 333
Joined: Thu Jun 14, 2007 9:41 pm

Re: Combo Box in Jide TAble

Postby JIDE Support » Tue Dec 25, 2012 11:40 am

Please try to instantiate a ListComboBoxCellEditor instead of AbstractComboBoxCellEditor.

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

Re: Combo Box in Jide TAble

Postby infn » Thu Jan 10, 2013 6:02 pm

Thanks for your quick reply..I am able to show combo box in table column.

Can I filter values in combo box based on selected row? like show only subset of values specified in editor context...

Also as soon as I add a row, i want to focus combo box column .Below code doesnt seem to be working... only new row is being selcted.

_sortableTable.getSelectionModel().setSelectionInterval(index, index);
_sortableTable.changeSelection(index,2,false,true);

_sortableTable.requestFocusInWindow();
infn
 
Posts: 333
Joined: Thu Jun 14, 2007 9:41 pm

Re: Combo Box in Jide TAble

Postby JIDE Support » Thu Jan 10, 2013 6:56 pm

Please give JIDE PropertyPaneDemo a try. The property "Multiple Values" will change its selectable entries based on the value of the property "priority".

Please try to invoke JTable#setColumnSelectionAllowed(true) to select the cell only.

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

Re: Combo Box in Jide TAble

Postby infn » Thu Jan 10, 2013 7:45 pm

JTable#setColumnSelectionAllowed(true) selects specific column only.

I want to highlight the column within the selected row..
[img]
combo.png
combo.png (1.05 KiB) Viewed 32351 times

[/img]
infn
 
Posts: 333
Joined: Thu Jun 14, 2007 9:41 pm

Re: Combo Box in Jide TAble

Postby JIDE Support » Fri Jan 11, 2013 10:10 am

JTable#ChangeSelection() should be able to "highlight" the cell, which has a dash line surrounding the cell. It looks to me like a editing status from the image you posted. If this is what you want, please try to manipulate a key event or mouse event to invoke JTable#editCellAt().

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


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

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

cron