Get domain persistent properties in order

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Get domain persistent properties in order

sergiomichels
Is there some way to retrieve the persistent properties of a Domain Class in the same order I declared them in the class?

I tried to use DomainClassPropertyComparator but no success.


--
Sérgio Michels

Reply | Threaded
Open this post in threaded view
|

Re: Get domain persistent properties in order

Nathan Wells
Just to clarify... you're looking to get a Map version of the object that has keys sorted by the order they're declared in the class? Or just a reference to the Field objects declared on the class in the order declared? A little more detail about what you're trying to accomplish may be helpful.

Nathan Wells


On Wed, Nov 14, 2012 at 11:10 AM, Sergio Michels <[hidden email]> wrote:
Is there some way to retrieve the persistent properties of a Domain Class in the same order I declared them in the class?

I tried to use DomainClassPropertyComparator but no success.


--
Sérgio Michels


Reply | Threaded
Open this post in threaded view
|

Re: Get domain persistent properties in order

bksaville
Your best bet is to probably define the constraints in the order you would like and then access the contrainedProperties.  That will retain order and in fact is what is used for things like the fields plugin to keep some order for the fields.

-Brian

On Wed, Nov 14, 2012 at 9:19 PM, Nathan Wells <[hidden email]> wrote:
Just to clarify... you're looking to get a Map version of the object that has keys sorted by the order they're declared in the class? Or just a reference to the Field objects declared on the class in the order declared? A little more detail about what you're trying to accomplish may be helpful.

Nathan Wells



On Wed, Nov 14, 2012 at 11:10 AM, Sergio Michels <[hidden email]> wrote:
Is there some way to retrieve the persistent properties of a Domain Class in the same order I declared them in the class?

I tried to use DomainClassPropertyComparator but no success.


--
Sérgio Michels



Reply | Threaded
Open this post in threaded view
|

Re: Get domain persistent properties in order

sergiomichels
Thanks Brian. The only bad thing of this is that you need to remember all developers to declare all fields in constraints, even if is just to add a nullable: false, if not, your order will be broken.

--
Sérgio Michels



On Thu, Nov 15, 2012 at 3:00 AM, Brian Saville <[hidden email]> wrote:
Your best bet is to probably define the constraints in the order you would like and then access the contrainedProperties.  That will retain order and in fact is what is used for things like the fields plugin to keep some order for the fields.

-Brian


On Wed, Nov 14, 2012 at 9:19 PM, Nathan Wells <[hidden email]> wrote:
Just to clarify... you're looking to get a Map version of the object that has keys sorted by the order they're declared in the class? Or just a reference to the Field objects declared on the class in the order declared? A little more detail about what you're trying to accomplish may be helpful.

Nathan Wells



On Wed, Nov 14, 2012 at 11:10 AM, Sergio Michels <[hidden email]> wrote:
Is there some way to retrieve the persistent properties of a Domain Class in the same order I declared them in the class?

I tried to use DomainClassPropertyComparator but no success.


--
Sérgio Michels




Reply | Threaded
Open this post in threaded view
|

Re: Get domain persistent properties in order

Jeff Brown-4
In reply to this post by sergiomichels

On Nov 14, 2012, at 12:10 PM, Sergio Michels <[hidden email]> wrote:

> Is there some way to retrieve the persistent properties of a Domain Class in the same order I declared them in the class?
>
> I tried to use DomainClassPropertyComparator but no success.
>
>
> --
> Sérgio Michels
>

I am curious to know why you want them in the order they are declared.  Can you summarize what you are doing?

Thanks.



JSB
--
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Get domain persistent properties in order

sergiomichels
We evaluate the FilterPane plugin and decided to make our own instead of customizing that. We already have a structure to fit the fields for our needs (text, date, datetime, decimal, integer and so on) and now we are building the view for filters. Instead of adding a static field for define the order of the presentation, we think in organize them as the order they appear in the class.

--
Sérgio Michels



On Thu, Nov 15, 2012 at 11:56 AM, Jeff Brown <[hidden email]> wrote:

On Nov 14, 2012, at 12:10 PM, Sergio Michels <[hidden email]> wrote:

> Is there some way to retrieve the persistent properties of a Domain Class in the same order I declared them in the class?
>
> I tried to use DomainClassPropertyComparator but no success.
>
>
> --
> Sérgio Michels
>

I am curious to know why you want them in the order they are declared.  Can you summarize what you are doing?

Thanks.



JSB
--
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Get domain persistent properties in order

sergiomichels
Brian, the plugin that you said that use contrainedProperties is grails-fields? I looked at the FormFieldsTagLib.groovy  and it seems to use persistentProperties too.

--
Sérgio Michels



On Thu, Nov 15, 2012 at 12:46 PM, Sergio Michels <[hidden email]> wrote:
We evaluate the FilterPane plugin and decided to make our own instead of customizing that. We already have a structure to fit the fields for our needs (text, date, datetime, decimal, integer and so on) and now we are building the view for filters. Instead of adding a static field for define the order of the presentation, we think in organize them as the order they appear in the class.

--
Sérgio Michels



On Thu, Nov 15, 2012 at 11:56 AM, Jeff Brown <[hidden email]> wrote:

On Nov 14, 2012, at 12:10 PM, Sergio Michels <[hidden email]> wrote:

> Is there some way to retrieve the persistent properties of a Domain Class in the same order I declared them in the class?
>
> I tried to use DomainClassPropertyComparator but no success.
>
>
> --
> Sérgio Michels
>

I am curious to know why you want them in the order they are declared.  Can you summarize what you are doing?

Thanks.



JSB
--
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Get domain persistent properties in order

bksaville
My bad, must have been another plugin.  Well, at least the default scaffolding includes the use of constrainedProperties at some point to get the order of fields in the scaffolds right.  At least that's how it used to work in 1.3.7/2.0.

-Brian

On Tue, Nov 20, 2012 at 8:05 AM, Sergio Michels <[hidden email]> wrote:
Brian, the plugin that you said that use contrainedProperties is grails-fields? I looked at the FormFieldsTagLib.groovy  and it seems to use persistentProperties too.

--
Sérgio Michels



On Thu, Nov 15, 2012 at 12:46 PM, Sergio Michels <[hidden email]> wrote:
We evaluate the FilterPane plugin and decided to make our own instead of customizing that. We already have a structure to fit the fields for our needs (text, date, datetime, decimal, integer and so on) and now we are building the view for filters. Instead of adding a static field for define the order of the presentation, we think in organize them as the order they appear in the class.

--
Sérgio Michels



On Thu, Nov 15, 2012 at 11:56 AM, Jeff Brown <[hidden email]> wrote:

On Nov 14, 2012, at 12:10 PM, Sergio Michels <[hidden email]> wrote:

> Is there some way to retrieve the persistent properties of a Domain Class in the same order I declared them in the class?
>
> I tried to use DomainClassPropertyComparator but no success.
>
>
> --
> Sérgio Michels
>

I am curious to know why you want them in the order they are declared.  Can you summarize what you are doing?

Thanks.



JSB
--
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email