You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "borgo (JIRA)" <de...@cayenne.apache.org> on 2007/11/03 11:04:50 UTC

[JIRA] Created: (CAY-912) Lookup fields not working on jtable

Lookup fields not working on jtable
-----------------------------------

                 Key: CAY-912
                 URL: https://issues.apache.org/cayenne/browse/CAY-912
             Project: Cayenne
          Issue Type: Bug
          Components: DataViews
    Affects Versions: 2.0 [STABLE]
         Environment: JRE 1.5 + Windows Vista :-(
            Reporter: borgo
            Assignee: Andrus Adamchik


I have tried to use DataViews with the following example code (http://cayenne.apache.org/doc20/dataviews-in-action.html)

The DataViews documentation It's not clear about use the lookup when editing a JTable. 

Two problem arise:

1) Lookups combobox are always empty
I have look at createTableCellEditor() methods in CellEditors
Here the method field.getLookupValues() returns always an empty list.
The cause is getRootOwner().getLookupCache().getCachedValues(lookupField) that returns always an empty list.
I think it's because I haven't setting any data in the cache. 
But how could I do that ? Does I need to create query in the modeller ? 
Unluckly, documentation and examples doesn't help to understand how cache and lookup fields works.

2) So I have tried to use a custom method to load the lookup combobox.
Here is another problem: when I pickup an element, the cell in the table is not updated and becomes empty.
there is no way to update the cell choosing elements from the combo.

I'm very interested in DataViews. My first reason to use Cayenne is the presence of DataViews.
I'd like to give my contributes to that project but first we need a working base to develop on.

Regars

Andrea


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[JIRA] Commented: (CAY-912) Lookup fields not working on jtable

Posted by "Andrus Adamchik (JIRA)" <de...@cayenne.apache.org>.
    [ https://issues.apache.org/cayenne/browse/CAY-912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12576 ] 

Andrus Adamchik commented on CAY-912:
-------------------------------------

Andrea, I have no comments on the essence of your question, but please check out this page for the state of the DataViews technology in Cayenne (it is excluded from the core in 3.0 and not supported by the current group of committers) :

  http://cwiki.apache.org/CAYDV/

A number of people want to keep this technology alive, although nobody stepped up to do that within Cayenne (although there is a fork somewhere). Not very encouraging I guess, but that's where things are.

> Lookup fields not working on jtable
> -----------------------------------
>
>                 Key: CAY-912
>                 URL: https://issues.apache.org/cayenne/browse/CAY-912
>             Project: Cayenne
>          Issue Type: Bug
>          Components: DataViews
>    Affects Versions: 2.0 [STABLE]
>         Environment: JRE 1.5 + Windows Vista :-(
>            Reporter: borgo
>            Assignee: Andrus Adamchik
>
> I have tried to use DataViews with the following example code (http://cayenne.apache.org/doc20/dataviews-in-action.html)
> The DataViews documentation It's not clear about use the lookup when editing a JTable. 
> Two problem arise:
> 1) Lookups combobox are always empty
> I have look at createTableCellEditor() methods in CellEditors
> Here the method field.getLookupValues() returns always an empty list.
> The cause is getRootOwner().getLookupCache().getCachedValues(lookupField) that returns always an empty list.
> I think it's because I haven't setting any data in the cache. 
> But how could I do that ? Does I need to create query in the modeller ? 
> Unluckly, documentation and examples doesn't help to understand how cache and lookup fields works.
> 2) So I have tried to use a custom method to load the lookup combobox.
> Here is another problem: when I pickup an element, the cell in the table is not updated and becomes empty.
> there is no way to update the cell choosing elements from the combo.
> I'm very interested in DataViews. My first reason to use Cayenne is the presence of DataViews.
> I'd like to give my contributes to that project but first we need a working base to develop on.
> Regars
> Andrea

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[JIRA] Commented: (CAY-912) Lookup fields not working on jtable

Posted by "borgo (JIRA)" <de...@cayenne.apache.org>.
    [ https://issues.apache.org/cayenne/browse/CAY-912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12580 ] 

borgo commented on CAY-912:
---------------------------

Here's the solution:

// begin java code

DataObjectList doLookupList = new DataObjectList(dataContext
                .performQuery(new SelectQuery(Name.class)));

ObjEntityViewField viewField = dataView.getObjEntityView("ObjEntityViewName").getFieldForObjAttribute(
                "description");

 // using lookup cache to translate between combobox labels and DataObjects.
 viewField.getOwner().getOwner().getLookupCache().cache(viewField, doLookupList );

// You should use the previous code for every lookup fields you want to edit as a combobox in the jtable.

// ... then load the main dataobject list in the tableModel as illustrated in the following example:
// http://cayenne.apache.org/doc20/dataviews-in-action.html


// end java code

(I don't know how cache in dataview works. I hope someone will write a little description)

Regards 

Andrea

PS: (I have an enhanced  example for dataview that I wish to upload (its based on the 1.2 example but also show how to use combo in jtable as lookup fields. How can I upload it ? Do I need a svn account ?)


> Lookup fields not working on jtable
> -----------------------------------
>
>                 Key: CAY-912
>                 URL: https://issues.apache.org/cayenne/browse/CAY-912
>             Project: Cayenne
>          Issue Type: Bug
>          Components: DataViews
>    Affects Versions: 2.0 [STABLE]
>         Environment: JRE 1.5 + Windows Vista :-(
>            Reporter: borgo
>            Assignee: Andrus Adamchik
>
> I have tried to use DataViews with the following example code (http://cayenne.apache.org/doc20/dataviews-in-action.html)
> The DataViews documentation It's not clear about use the lookup when editing a JTable. 
> Two problem arise:
> 1) Lookups combobox are always empty
> I have look at createTableCellEditor() methods in CellEditors
> Here the method field.getLookupValues() returns always an empty list.
> The cause is getRootOwner().getLookupCache().getCachedValues(lookupField) that returns always an empty list.
> I think it's because I haven't setting any data in the cache. 
> But how could I do that ? Does I need to create query in the modeller ? 
> Unluckly, documentation and examples doesn't help to understand how cache and lookup fields works.
> 2) So I have tried to use a custom method to load the lookup combobox.
> Here is another problem: when I pickup an element, the cell in the table is not updated and becomes empty.
> there is no way to update the cell choosing elements from the combo.
> I'm very interested in DataViews. My first reason to use Cayenne is the presence of DataViews.
> I'd like to give my contributes to that project but first we need a working base to develop on.
> Regars
> Andrea

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.