Quantcast

Newbie: dynamic scaffolding from another object

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Newbie: dynamic scaffolding from another object

mfk0213
This post was updated on .
Hi,

I'm trying to set up a dynamic application that can read the database and scaffold basic crud functionality.

Here is the case: the user creates "configuration items", which are basically a name and a type.  I want to be able to assemble these into versioned "configuration worksheets", which is a set of configuration items, just with an added value.   The user needs to be able to put in a value for each configuration item on the configuration worksheet.  I would like each configuration worksheet to be in its own table, if possible.  I'm basically trying to implement a collection of key/value maps, where the keys are defined by configuration items (which are currently scaffolded and work correctly).

Basically, I have hundreds of configuration items, and I don't want to maintain them in a domain class file - I want to manage the grouping on the fly at run time.

I'm not married to the architecture - just trying to get something that works in an extensible manner.  

Any advice, help, suggestions, etc, would be much appreciated.  

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Dynamic scaffolding from another object

Jean Barmash-3
Mo,

I am not sure I completely understand what you are trying to do, perhaps you can provide a more concrete example.  However, it sounds like what you are doing is very similar to the Screen Wizard Plugin. 
   http://grails.org/plugin/screen-wiz

Cheers,

Jean


From: mfk0213 <[hidden email]>
To: [hidden email]
Sent: Fri, November 13, 2009 4:10:23 AM
Subject: [grails-user] Dynamic scaffolding from another object


Hi,

Let me start off by saying I'm new to Grails.  Please don't disregard this
post, just wanted to give you the opportunity to do so.

Pleasantries aside, I'm trying to set up a dynamic application that can read
the database and scaffold basic crud functionality.

Here is the case: the user creates "configuration items", which are
basically a name and a type.  I want to be able to assemble these into
versioned "configuration worksheets", which is a set of configuration items,
just with an added value.  The user needs to be able to put in a value for
each configuration item on the configuration worksheet.  I would like each
configuration worksheet to be in its own table, if possible.  I'm basically
trying to implement a collection of key/value maps, where the keys are
defined by configuration items (which are currently scaffolded and work
correctly).

Basically, I have hundreds of configuration items, and I don't want to
maintain them in a domain class file - I want to manage the grouping on the
fly at run time.

I'm not married to the architecture - just trying to get something that
works in an extensible manner. 

Any advice, help, suggestions, etc, would be much appreciated. 

Thanks,
Mo
--
View this message in context: http://old.nabble.com/Dynamic-scaffolding-from-another-object-tp26333411p26333411.html
Sent from the grails - user mailing list archive at Nabble.com.


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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Dynamic scaffolding from another object

mfk0213
Hi Jean,

Thanks for the reply - I appreciate it.  I think the plugin you are mentioning might solve the problem.  

Right now, scaffolding is generated off static classes, which basically are the table structure.  I need the scaffolding structure to be based off the table data, not just the structure.  For example, one of my users adds a row to ConfigurationItem table.  Then, in the corresponding ConfigurationWorksheet view, there is now another item that can be CRUD-ed.  Does that make sense?  Basically, I could hardcode a class that includes all the configurationItems, and do an auto scaffold on it.  However, that limits my system to only working with the current configurationItems, and would allow for zero-expandability without having to re-code.  I'm trying to set it up so the user can add items without my having to recode.

Thanks for your help.

-Mo

Jean Barmash wrote
Mo,

I am not sure I completely understand what you are trying to do, perhaps you can provide a more concrete example.  However, it sounds like what you are doing is very similar to the Screen Wizard Plugin.  
   http://grails.org/plugin/screen-wiz

Cheers,

Jean




________________________________
From: mfk0213 <mfk0213@gmail.com>
To: user@grails.codehaus.org
Sent: Fri, November 13, 2009 4:10:23 AM
Subject: [grails-user] Dynamic scaffolding from another object


Hi,

Let me start off by saying I'm new to Grails.  Please don't disregard this
post, just wanted to give you the opportunity to do so.

Pleasantries aside, I'm trying to set up a dynamic application that can read
the database and scaffold basic crud functionality.

Here is the case: the user creates "configuration items", which are
basically a name and a type.  I want to be able to assemble these into
versioned "configuration worksheets", which is a set of configuration items,
just with an added value.   The user needs to be able to put in a value for
each configuration item on the configuration worksheet.  I would like each
configuration worksheet to be in its own table, if possible.  I'm basically
trying to implement a collection of key/value maps, where the keys are
defined by configuration items (which are currently scaffolded and work
correctly).

Basically, I have hundreds of configuration items, and I don't want to
maintain them in a domain class file - I want to manage the grouping on the
fly at run time.

I'm not married to the architecture - just trying to get something that
works in an extensible manner.  

Any advice, help, suggestions, etc, would be much appreciated.  

Thanks,
Mo
--
View this message in context: http://old.nabble.com/Dynamic-scaffolding-from-another-object-tp26333411p26333411.html
Sent from the grails - user mailing list archive at Nabble.com.


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

    http://xircles.codehaus.org/manage_email
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Dynamic scaffolding from another object

Jean Barmash-3
Yes, I think Screen Wizard plugin will do what you are looking for. 

I actually wrote a layer on top of it that allows me to have experience closer to dynamic scaffolding (i.e. specify a few properties that I want to display, and it automatically does it for me). 

Here is how it works.  Suppose you have a domain object Bill

class Bill {
  LocalDate endDate
  float daysBilled  //this may be useful for smaller increments than day
  double cost
  double amount

}

To create the CRUD screen, just create a controller that subclasses AbstractEditScreenController (a class I wrote).   The class defines screenArea Parameters (what you call configurationItems) that need to be used to construct the screen.  As you can see, screenAreaBillParams below defines the property name to be displayed, which template is needed to render it (it actually needs three templates, one for edit page, and two for list page - I am sure you can adopt it for your own layouts). 

class ScreenBillController extends  AbstractEditScreenController {

 static def screenAreaBillParams = [
            [displayName: "End Date", propertyName: "endDate", templateName: "localDate", listHeaderTemplateName: "listHeader", listItemTemplateName: "listItem"]
            , [displayName: "Days Billed", propertyName: "daysBilled", templateName: "default", listHeaderTemplateName: "listHeader", listItemTemplateName: "listItem"]
            , [displayName: "Disable", propertyName: "disable", templateName: "checkItem", listHeaderTemplateName: "listHeader", listItemTemplateName: "listItem"]
            , [displayName: "Amount", propertyName: "cost", templateName: "default", listHeaderTemplateName: "listHeader", listItemTemplateName: "listItem"]
         ]

  def fillInFilteredProperties(def domainObject) {
     log.info "Filling in Filtered Properties while Saving Object, setting Bill Properties"
     domainObject.site = BaseController.currentSite(session)
     domainObject.utilityAccount = BaseController.currentUA(session)
  }


  String getCurrentDOName () { "Bill" }
  String getDisplayDOName() { "My Bill" }
  def getThisClass() { Bill.class }

  List getScreenAreaDefinitions() {
    screenAreaBillParams 
  }
}

The result is a nice CRUD screen (attaching the screenshot for a very similar GasBill from the app I am working on).

I am going to send you the modified plugin code privately.  If anybody else is interested, let me know.

Jean


From: mfk0213 <[hidden email]>
To: [hidden email]
Sent: Mon, November 16, 2009 10:48:51 AM
Subject: Re: [grails-user] Dynamic scaffolding from another object


Hi Jean,

Thanks for the reply - I appreciate it.  I think the plugin you are
mentioning might solve the problem. 

Right now, scaffolding is generated off static classes, which basically are
the table structure.  I need the scaffolding structure to be based off the
table data, not just the structure.  For example, one of my users adds a row
to ConfigurationItem table.  Then, in the corresponding
ConfigurationWorksheet view, there is now another item that can be CRUD-ed.
Does that make sense?  Basically, I could hardcode a class that includes all
the configurationItems, and do an auto scaffold on it.  However, that limits
my system to only working with the current configurationItems, and would
allow for zero-expandability without having to re-code.  I'm trying to set
it up so the user can add items without my having to recode.

Thanks for your help.

-Mo


Jean Barmash wrote:
>
> Mo,
>
> I am not sure I completely understand what you are trying to do, perhaps
> you can provide a more concrete example.  However, it sounds like what you
> are doing is very similar to the Screen Wizard Plugin. 
>    http://grails.org/plugin/screen-wiz

>
> Cheers,
>
> Jean
>
>
>
>
> ________________________________
> From: mfk0213 <[hidden email]>
> To: [hidden email]
> Sent: Fri, November 13, 2009 4:10:23 AM
> Subject: [grails-user] Dynamic scaffolding from another object
>
>
> Hi,
>
> Let me start off by saying I'm new to Grails.  Please don't disregard this
> post, just wanted to give you the opportunity to do so.
>
> Pleasantries aside, I'm trying to set up a dynamic application that can
> read
> the database and scaffold basic crud functionality.
>
> Here is the case: the user creates "configuration items", which are
> basically a name and a type.  I want to be able to assemble these into
> versioned "configuration worksheets", which is a set of configuration
> items,
> just with an added value.  The user needs to be able to put in a value
> for
> each configuration item on the configuration worksheet.  I would like each
> configuration worksheet to be in its own table, if possible.  I'm
> basically
> trying to implement a collection of key/value maps, where the keys are
> defined by configuration items (which are currently scaffolded and work
> correctly).
>
> Basically, I have hundreds of configuration items, and I don't want to
> maintain them in a domain class file - I want to manage the grouping on
> the
> fly at run time.
>
> I'm not married to the architecture - just trying to get something that
> works in an extensible manner. 
>
> Any advice, help, suggestions, etc, would be much appreciated. 
>
> Thanks,
> Mo
> --
> View this message in context:
> http://old.nabble.com/Dynamic-scaffolding-from-another-object-tp26333411p26333411.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>

--
View this message in context: http://old.nabble.com/Newbie%3A-dynamic-scaffolding-from-another-object-tp26333411p26374194.html
Sent from the grails - user mailing list archive at Nabble.com.


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

    http://xircles.codehaus.org/manage_email



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

    http://xircles.codehaus.org/manage_email

GasBillScreen.png (68K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Dynamic scaffolding from another object

Brent Baxter-2
In reply to this post by mfk0213
It sounds to me like you need to implement a controller to read the configuration items for the view, assemble them into a collection, and pass them to your GSP.  The GSP will then need to iterate the collection of configuration items to render the form correctly.

Brent


--
Brent Baxter
Chariot Solutions
[hidden email]


On Mon, Nov 16, 2009 at 10:48 AM, mfk0213 <[hidden email]> wrote:

Hi Jean,

Thanks for the reply - I appreciate it.  I think the plugin you are
mentioning might solve the problem.

Right now, scaffolding is generated off static classes, which basically are
the table structure.  I need the scaffolding structure to be based off the
table data, not just the structure.  For example, one of my users adds a row
to ConfigurationItem table.  Then, in the corresponding
ConfigurationWorksheet view, there is now another item that can be CRUD-ed.
Does that make sense?  Basically, I could hardcode a class that includes all
the configurationItems, and do an auto scaffold on it.  However, that limits
my system to only working with the current configurationItems, and would
allow for zero-expandability without having to re-code.  I'm trying to set
it up so the user can add items without my having to recode.

Thanks for your help.

-Mo


Jean Barmash wrote:
>
> Mo,
>
> I am not sure I completely understand what you are trying to do, perhaps
> you can provide a more concrete example.  However, it sounds like what you
> are doing is very similar to the Screen Wizard Plugin.
>    http://grails.org/plugin/screen-wiz
>
> Cheers,
>
> Jean
>
>
>
>
> ________________________________
> From: mfk0213 <[hidden email]>
> To: [hidden email]
> Sent: Fri, November 13, 2009 4:10:23 AM
> Subject: [grails-user] Dynamic scaffolding from another object
>
>
> Hi,
>
> Let me start off by saying I'm new to Grails.  Please don't disregard this
> post, just wanted to give you the opportunity to do so.
>
> Pleasantries aside, I'm trying to set up a dynamic application that can
> read
> the database and scaffold basic crud functionality.
>
> Here is the case: the user creates "configuration items", which are
> basically a name and a type.  I want to be able to assemble these into
> versioned "configuration worksheets", which is a set of configuration
> items,
> just with an added value.   The user needs to be able to put in a value
> for
> each configuration item on the configuration worksheet.  I would like each
> configuration worksheet to be in its own table, if possible.  I'm
> basically
> trying to implement a collection of key/value maps, where the keys are
> defined by configuration items (which are currently scaffolded and work
> correctly).
>
> Basically, I have hundreds of configuration items, and I don't want to
> maintain them in a domain class file - I want to manage the grouping on
> the
> fly at run time.
>
> I'm not married to the architecture - just trying to get something that
> works in an extensible manner.
>
> Any advice, help, suggestions, etc, would be much appreciated.
>
> Thanks,
> Mo
> --
> View this message in context:
> http://old.nabble.com/Dynamic-scaffolding-from-another-object-tp26333411p26333411.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>

--
View this message in context: http://old.nabble.com/Newbie%3A-dynamic-scaffolding-from-another-object-tp26333411p26374194.html
Sent from the grails - user mailing list archive at Nabble.com.


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

   http://xircles.codehaus.org/manage_email





Loading...