Anyone have any thoughts on this?

Steve Holmes wrote:
> 
> Yes, just like in the demo, I am hoping that on an add or edit City it
> will give me the list of Stats (States) as a select drop down.  Right now
> I'm getting State as a text field that I can enter in anything I want,
> even if it doesn't exist in the STAT table. If I'm doing it wrong how did
> you do it in the demo?  How can I get a select drop down that only shows
> the Stats from the STAT table?
> 
> 
> Geert Bevin wrote:
>> 
>> Hmmm, just checking, are you trying to get a select drop down for  
>> this manyToOne relationship in RIFE/Crud?
>> 
>> On 07 Dec 2006, at 23:06, Steve Holmes wrote:
>> 
>>>
>>> Sure Geert, here they are and I'm including CityMetaData so it is  
>>> all in one
>>> place. And thanks for the fast reply!
>>>
>>> public class CityMetaData extends MetaData<ConstrainedBean,
>>> ConstrainedProperty> {
>>>     public void activateMetaData() {
>>>         addConstraint(new ConstrainedBean()
>>>                 .defaultOrder("name")
>>>                 .textualIdentifier(new
>>> AbstractTextualIdentifierGenerator<City>() {
>>>             public String generateIdentifier() {
>>>                 return mBean.getId() + " : " + mBean.getName();
>>>             }
>>>         }));
>>>
>>>         addConstraint(new ConstrainedProperty("id")
>>>                 .editable(false).identifier(true));
>>>
>>>         addConstraint(new ConstrainedProperty("name")
>>>                 .editable(true)
>>>                 .notNull(true)
>>>                 .listed(true)
>>>                 .maxLength(255));
>>>
>>>         addConstraint(new ConstrainedProperty("statId")
>>>                 .notNull(true).listed(true)
>>>                 .manyToOne(Stat.class, "id"));
>>>     }
>>> }
>>>
>>> public class StatMetaData extends MetaData<ConstrainedBean,
>>> ConstrainedProperty> {
>>>     public void activateMetaData() {
>>>         addConstraint(new ConstrainedBean()
>>>                 .defaultOrder("name")
>>>                 .defaultOrder("abreviation")
>>>                 .textualIdentifier(new
>>> AbstractTextualIdentifierGenerator<Stat>() {
>>>             public String generateIdentifier() {
>>>                 return mBean.getId() + " : " + mBean.getName();
>>>             }
>>>         }));
>>>
>>>         addConstraint(new ConstrainedProperty("id")
>>>                 .editable(false).identifier(true));
>>>
>>>         addConstraint(new ConstrainedProperty("name")
>>>                 .notNull(true).notEmpty(true)
>>>                 .maxLength(255).listed(true));
>>>
>>>         this.addConstraint(new ConstrainedProperty("abbreviation")
>>>                 .editable(true)
>>>                 .notNull(true)
>>>                 .unique(true)
>>>                 .maxLength(2));
>>>     }
>>> }
>>>
>>> public class City {
>>>     private Integer id;
>>>     private Integer statId;
>>>     private String name;
>>>
>>>     public Integer getStatId() {
>>>         return statId;
>>>     }
>>>
>>>     public void setStatId(Integer statId) {
>>>         this.statId = statId;
>>>     }
>>>
>>>     public Integer getId() {
>>>         return id;
>>>     }
>>>
>>>     public void setId(Integer id) {
>>>         this.id = id;
>>>     }
>>>
>>>     public String getName() {
>>>         return name;
>>>     }
>>>
>>>     public void setName(String name) {
>>>         this.name = name;
>>>     }
>>> }
>>>
>>> public class Stat {
>>>     private Integer id;
>>>     private String name;
>>>     private String abbreviation;
>>>
>>>     public Integer getId() {
>>>         return id;
>>>     }
>>>
>>>     public void setId(Integer id) {
>>>         this.id = id;
>>>     }
>>>
>>>     public String getName() {
>>>         return name;
>>>     }
>>>
>>>     public void setName(String name) {
>>>         this.name = name;
>>>     }
>>>
>>>     public String getAbbreviation() {
>>>         return abbreviation;
>>>     }
>>>
>>>     public void setAbbreviation(String abbreviation) {
>>>         this.abbreviation = abbreviation;
>>>     }
>>> }
>>>
>>>
>>> Geert Bevin wrote:
>>>>
>>>> Hi Steve,
>>>>
>>>> can you please paste the City bean, the Stat bean and the
>>>> StatMetaData class also?
>>>>
>>>> Best regards,
>>>>
>>>> Geert
>>>>
>>>> On 07 Dec 2006, at 22:19, Steve Holmes wrote:
>>>>
>>>>>
>>>>> Hello All!
>>>>> I have been trying my hand with Rife once again and am a bit
>>>>> confused with
>>>>> Rife/CRUD.  I am using Rife 1.5.1 and CRUD 1.3.1 and my DB is derby
>>>>> just
>>>>> like in the tutorial.  I was more or less following Geert's
>>>>> Tutorial which I
>>>>> think is absolutely great since I use intellij.
>>>>>
>>>>> The problem is that my manyToOne constraints are not producing
>>>>> select drop
>>>>> downs.  As an example, I have cities and States.  A state can
>>>>> contain many
>>>>> cities so a city will have a manyToOne constraint.  Here is my
>>>>> CityMetaData
>>>>> class:
>>>>>
>>>>> public class CityMetaData extends MetaData<ConstrainedBean,
>>>>> ConstrainedProperty> {
>>>>>     public void activateMetaData() {
>>>>>         addConstraint(new ConstrainedBean()
>>>>>                 .defaultOrder("name")
>>>>>                 .textualIdentifier(new
>>>>> AbstractTextualIdentifierGenerator<City>() {
>>>>>             public String generateIdentifier() {
>>>>>                 return mBean.getId() + " : " + mBean.getName();
>>>>>             }
>>>>>         }));
>>>>>
>>>>>         addConstraint(new ConstrainedProperty("id")
>>>>>                 .editable(false).identifier(true));
>>>>>
>>>>>         addConstraint(new ConstrainedProperty("name")
>>>>>                 .editable(true)
>>>>>                 .notNull(true)
>>>>>                 .listed(true)
>>>>>                 .maxLength(255));
>>>>>
>>>>>         addConstraint(new ConstrainedProperty("statId")
>>>>>                 .notNull(true).listed(true)
>>>>>                 .manyToOne(Stat.class, "id"));
>>>>>     }
>>>>> }
>>>>>
>>>>> Notice the manyToOne to statId.  Shouldn't that produce a Select
>>>>> drop down
>>>>> on the add city page like in the tutorial?  If not, how do I do it?
>>>>>
>>>>> Thanks in advance!
>>>>> -Steve
>>>>> -- 
>>>>> View this message in context: http://www.nabble.com/ManyToOne-and-
>>>>> Rife-CRUD-tf2777133.html#a7747868
>>>>> Sent from the RIFE - users mailing list archive at Nabble.com.
>>>>>
>>>>> _______________________________________________
>>>>> Rife-users mailing list
>>>>> [email protected]
>>>>> http://lists.uwyn.com/mailman/listinfo/rife-users
>>>>>
>>>>
>>>> --
>>>> Geert Bevin
>>>> Uwyn "Use what you need" - http://uwyn.com
>>>> RIFE Java application framework - http://rifers.org
>>>> Music and words - http://gbevin.com
>>>>
>>>>
>>>> _______________________________________________
>>>> Rife-users mailing list
>>>> [email protected]
>>>> http://lists.uwyn.com/mailman/listinfo/rife-users
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context: http://www.nabble.com/ManyToOne-and- 
>>> Rife-CRUD-tf2777133.html#a7748653
>>> Sent from the RIFE - users mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> Rife-users mailing list
>>> [email protected]
>>> http://lists.uwyn.com/mailman/listinfo/rife-users
>>>
>> 
>> --
>> Geert Bevin
>> Uwyn "Use what you need" - http://uwyn.com
>> RIFE Java application framework - http://rifers.org
>> Music and words - http://gbevin.com
>> 
>> 
>> _______________________________________________
>> Rife-users mailing list
>> [email protected]
>> http://lists.uwyn.com/mailman/listinfo/rife-users
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ManyToOne-and-Rife-CRUD-tf2777133.html#a7763445
Sent from the RIFE - users mailing list archive at Nabble.com.

_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to