Re: Modeler Attribute Order Question.

From: Mike Kienenberger (mkienen..mail.com)
Date: Wed Oct 26 2005 - 20:48:55 EDT

  • Next message: Robert Zeigler: "Re: Tapestry integration"

    I think you're confused about what cgen is.

    Cgen is the class generation code. It's the same class generation
    code that's called from the modeler. Not all of the functionality of
    cgen is yet available from the modeler, but the command-line ant cgen
    task is trivial to use.

    And by providing a tool, I don't mean extending the modeler or
    extending cgen itself.

    It's as trivial as creating an independent POJO java class with the
    following method, and using the VPPConfig-based config element to
    stick it into your configuration as orderTool.

    public List orderAttributeList(String ObjEntityName, List
    unorderedListOfObjAttributes) { /* your ordering logic here */ }

    Then in your template you use:

    #foreach( $attr in $orderTool.orderAttributeList($objEntity.name,
    $objEntity.DeclaredAttributes) )

    That's certainly not as complicated as writing UI-generating templates :)

    On 10/26/05, Ahmed Mohombe <amohomb..ahoo.com> wrote:
    > > First off, I understand your situation because I frequently generate
    > > UI files from my Cayenne models.
    > Well, than it should be done something about this.
    >
    > > However, I don't think it's likely that you're going to see the
    > > ability to custom-order attributes in the modeler as it's outside of
    > > Cayenne's core functionality to generate UI files from the data model.
    > Well, than this is sad. I think a confortable Modeler should have
    > such a thing (plus undo/redo), the help called from the 'Help' menu, etc.
    >
    > > However, if you're using Cayenne 1.2, the cgen task (when set to
    > > version=1.2) gives you a great deal of flexibility.
    > Sorry, but I don't intend to use cgen.
    > The only reason I use Cayenne is CayenneModeler.
    > This is the same for many programmers I know.
    > Everyone who worked with WebObjects has no lust to edit XMLs for such things :).
    >
    >
    > > You can create a
    > > new velocity tool that you can inject into your template that can sort
    > > your attributes and relationships. I'd recommend that such a tool
    > > read the ordering from a configuration file. That way you can easily
    > > control the ordering on a per-entity level.
    > This sounds too complicated to me.
    > I studied the Cayenne Modeler but it looks just to complicated for me
    > to extend it.
    > It seem simpler for me to make new one for my needs directly from the DB Stature :).
    >
    > > If you decide to create such a tool, consider posting it back here.
    > > I'd probably use it, and depending on how it's implemented, it might
    > > even get committed into the cgen package as a default velocity tool.
    > Of course :).
    >
    > Ahmed.
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Oct 26 2005 - 20:48:57 EDT