[Lift] Re: New features

2009-08-25 Thread Randinn
Anyone have code showing this in action as it were? On Aug 6, 8:39 am, Naftoli Gugenheim naftoli...@gmail.com wrote: Oh, I think I know what the problem is. I think I should classify it as a bug. Since you're adding a Role that isn't saved yet, and ManyToMany tracks the children via the join

[Lift] Re: New features

2009-08-25 Thread Naftoli Gugenheim
This meaning the problem, or meaning ManyToMany? It's pretty simple to use. You're mapper should extend ManyToMany, and you should have a field: object m2m extends MappedManyToMany(.../*the two MetaMappers and foreign keys, see the docs/source*/) Then you can treat m2m as a Buffer, adding and

[Lift] Re: New features

2009-08-25 Thread glenn
I have a working example of ManyToMany that adds roles to users. I would be happy to share my work but I have an aversion to github. I don't like it, It's a slower-than- molasses interface. It's buggy and user-hostile in my opinion. I'm looking for an alternative to make it public. Any

[Lift] Re: New features

2009-08-25 Thread Naftoli Gugenheim
Google code? Sourceforge? ProjectLocker? There are a lot of choices... On Tue, Aug 25, 2009 at 12:37 PM, glenngl...@exmbly.com wrote: I have a working example of ManyToMany that adds roles to users. I would be happy to share my work but I have an aversion to github. I don't like it, It's a

[Lift] Re: New features

2009-08-25 Thread glenn
Well, I managed to upload to github. Here is the repository: git://github.com/glennSilverman/UserMon.git Any feedback is appreciated. Glenn... On Aug 25, 10:43 am, Naftoli Gugenheim naftoli...@gmail.com wrote: Google code? Sourceforge? ProjectLocker? There are a lot of choices... On Tue,

[Lift] Re: New features

2009-08-25 Thread Randinn
Great! Thank you both for you help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to

[Lift] Re: New features

2009-08-10 Thread Naftoli Gugenheim
It looks like some .is's need to be explicit. I wonder if the implicit doesn't apply now that it's using member types? David, if you choose to volunteer to add .is to references to primaryKeyField it will get on github sooner than if I do it, but I can do it if you don't.

[Lift] Re: New features

2009-08-10 Thread glenn
David, I'm using your new ManyToMany trait and ran across this error: Message: java.lang.ClassCastException: net.liftweb.mapper.ProtoUser$id $ cannot be cast to java.lang.Long scala.runtime.BoxesRunTime.unboxToLong(Unknown Source)

[Lift] Re: New features

2009-08-10 Thread David Pollak
I've got negative available time. Sorry. On Mon, Aug 10, 2009 at 1:28 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: It looks like some .is's need to be explicit. I wonder if the implicit doesn't apply now that it's using member types? David, if you choose to volunteer to add .is to

[Lift] Re: New features

2009-08-10 Thread Naftoli Gugenheim
Okay, done. Wait until hudson builds it. - glenngl...@exmbly.com wrote: I assume this could take a while to fix. Meantime, could someone revert 1.1-SNAPSHOT back to before this change? Thanks Glenn... On Aug 10, 1:43 pm, David Pollak

[Lift] Re: New features

2009-08-08 Thread Naftoli Gugenheim
Thanks, David. Glenn, as far as the issue of adding unsaved children, I was thinking about it. If the same Role can be referenced by multiple users, why are you creating Roles at the same time that you are adding them to a User? Shouldn't there be one screen to manage Roles and the User screen

[Lift] Re: New features

2009-08-06 Thread glenn
Naftoli, At the risk of discussing something obviously beyond my pay grade, isn't the real issue Scala traits and the use of parameterized types. The ManyToMany trait is defined as: trait ManyToMany[K,T:KeyedMapper[K, T]] But this isn't really correct,is it, the parameter is too broad, and

[Lift] Re: New features

2009-08-06 Thread Naftoli Gugenheim
In your use case it can only be Long and User. But there has to be a type parameter because other people might have a String key and a Request mapper. And the contents of ManyToMany have to be type safe to enforce their consistency with however the user of ManyToMany wants them to use it.So I

[Lift] Re: New features

2009-08-06 Thread glenn
Naftoli, As I said at the outset, this is really beyond my expertise. But I think it's too broad and maybe, even unnecessary. In my example, K can only be one type, Long, and T can only be of type User. Anything else, and the compiler can't be guaranteed to catch it, but try running the

[Lift] Re: New features

2009-08-06 Thread David Pollak
There are dependent types that mirror the parameterized types for Mapper, KeyedMapper, etc. I've updated ManyToMany to use the dependent types... it should eliminate the need to have the type parameters. If it breaks thing, please revert the changes. On Thu, Aug 6, 2009 at 9:55 AM, Naftoli

[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim
Correction: ModelSnippet.load takes the actual Mapper instance, not the ModelView wrapper. - Naftoli Gugenheimnaftoli...@gmail.com wrote: To answer your immediate question, the listing should not refer to the snippet's view but new ModelView instances for

[Lift] Re: New features

2009-08-05 Thread glenn
Naftoli, I fixed my code per your comments and now I can edit and remove users from a list, as long as I populate the list with ModelView instances, as you said. As for the docs, this step was not clear to me at all. I just assumed that the list was just populated with User entities and the view

[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim
I'll try. By the way, as per my correction, you can implement list the regular way without ModelView, and just use ModelSnippet's load function in your edit link or button, passing it the User instance. - glenngl...@exmbly.com wrote: Naftoli, I fixed my

[Lift] Re: New features

2009-08-05 Thread glenn
Naftoli, Hate to do this to you, but I'm getting the following error using ManyToMany for Users to Roles: Message: java.lang.RuntimeException: Broken join scala.Predef$.error(Predef.scala:76) net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$

[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim
First of all, let me tell you what the error means. It means that there is a relevant row in the join table that doesn't have a corresponding element in the other table. Specifically, calling joinRecord.childMappedForeignKey.obj, so to speak, returns Empty. The question is how it got to this

[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim
Oh, I think I know what the problem is. I think I should classify it as a bug. Since you're adding a Role that isn't saved yet, and ManyToMany tracks the children via the join table, it can't access the child. As a workaround save the Role before adding it, although the need to do so is against

[Lift] Re: New features

2009-08-05 Thread glenn
Naftoli, While your working on this issue, there seems to be another. Here's what's happening: If I make a coding mistake, and code User as follows: class User extends MegaProtoUser[User] with ManyToMany[Long,Role]{ def getSingleton = User // what's the meta server object roles

[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim
Building causes a stack overflow? So the question is, is it the resident compiler or plain scalac also crashes? Or just the presentation compiler? What do you see in the error log view or file? I get compiler crashes very often when doing fancy mapper type related tricks.

[Lift] Re: New features

2009-08-04 Thread Naftoli Gugenheim
To answer your immediate question, the listing should not refer to the snippet's view but new ModelView instances for each entity. Then editAction is shorthand for the snippet's link method with a callback to call load on the ModelView. To set the snippet's view's entity, either call load on

[Lift] Re: New features

2009-08-03 Thread glenn
Naftoli, Liked your OneToMany article, but not sure how the new ModelView and ModelSnippet code can be applied to ManyToMany. Can you provide a sample? Glenn... On Aug 2, 1:21 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: I put an article on the wiki about OneToMany

[Lift] Re: New features

2009-08-03 Thread glenn
Just to add to what I just wrote, I don't see how your ModelView can be applied to User, which already extends a class, MegaProtoUser. Maybe I'm not comprehending this correctly. Glenn... On Aug 3, 3:48 pm, glenn gl...@exmbly.com wrote: Naftoli, Liked your OneToMany article, but not sure

[Lift] Re: New features

2009-08-03 Thread Naftoli Gugenheim
Your snippet should extend ModelSnippet (which extends StatefulSnippet). Then write: val view = new ModelView(new User, this) {} Calling load on another ModelView that references the snippet will load its entity into that view val. It has a number of methods of possible interest, like save

[Lift] Re: New features

2009-07-31 Thread glenn
Naftoli, I set up my mapper to use your new ManyToMany trait, but I'm not sure how exactly to use it in a snippet or view. Here's what I have so far, a User, Role and UserRole for my model classes: class Role extends LongKeyedMapper[Role] with IdPK { def getSingleton = Role object name

[Lift] Re: New features

2009-07-31 Thread Naftoli Gugenheim
I didn't yet look at your code too closely, but the idea is that the field that represents the relationship implements Buffer, so you can add, remove, and iterate its elements, which are the other side of the relationship. These changes are remembered until you call save, when they are acted

[Lift] Re: New features

2009-07-31 Thread Naftoli Gugenheim
I should probably take Mapped out of the name, because it's not a MappedField. - glenngl...@exmbly.com wrote: Naftoli, I set up my mapper to use your new ManyToMany trait, but I'm not sure how exactly to use it in a snippet or view. Here's what I have so

[Lift] Re: New features

2009-07-28 Thread Naftoli Gugenheim
In the meantime, if there are any scaladoc comments that could be improved or clarified, please tell me! - marius d.marius.dan...@gmail.com wrote: Would you please add some examples on the wiki so that people can actually visualize how these things can be

[Lift] Re: New features

2009-07-28 Thread glenn
Naftoli, The ManyToMany class is in the new lift-mapper jar, but the source is not available in 1.1-SNAPSHOT-sources. Could you provide? Thanks, Glenn... On Jul 27, 3:50 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: I committed it last night, so I think it should be there. To use

[Lift] Re: New features

2009-07-28 Thread David Pollak
THis is all very good stuff. Thanks for contributing this excellent stuff to Lift! On Mon, Jul 27, 2009 at 12:57 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: I committed some code last night, which can help building mapper-based view snippets, with G-d's help. It includes the following

[Lift] Re: New features

2009-07-27 Thread marius d.
Would you please add some examples on the wiki so that people can actually visualize how these things can be used? As far as XmlMenu goes why do we want to express menus as xml ? Br's, Marius On Jul 27, 10:57 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: I committed some code last night,

[Lift] Re: New features

2009-07-27 Thread Naftoli Gugenheim
I will try but I may not have a chance in the next few days. I did write up scaladocs, although I haven't pushed some clarifications for TableEditor. You probably don't want to use XmlMenu, but David said I may as well throw it in. The advantage is if you want to read it in from an xml file.

[Lift] Re: New features

2009-07-27 Thread glenn
Sounds great. I've been using hacks such as adding code like this to my mapper classes just to create a Many-to-Many relationship between say, tag and content tables (using an intermediary ContentTag table). Similarly, I've done User/Roles relationships. private object _dbTags extends

[Lift] Re: New features

2009-07-27 Thread Naftoli Gugenheim
I committed it last night, so I think it should be there. To use many-to-many, simply mix ManyToMany to your mapper, then create a MappedManyToMany field like any other field. See the scaladocs for specifics. Then in your view you can use the field like a collection, e.g., remove an element