Re: D2W automatically assign a value to an attribute

2010-12-07 Thread Francesco Romano

On 06/dic/2010, at 22.44, David LeBer wrote:

> 
> On 2010-12-06, at 4:35 PM, Francesco Romano wrote:
> 
>> Ok.. today I'm asking stupid questions.. but.. D2W is not so simple with the 
>> rule system :)
>> I have a page (CreateMovie) which is displayed only if a user is logged in 
>> (I disabled the automatic login and added a condition in the navigation menu 
>> bind to session.isUserLoggedIn).
>> I have a required attribute in the Movie entity named "uploader". What I 
>> want to do is not allow the user to insert that name, but retrieve it from 
>> session.username().
>> How can I do this? I tried a lot of things, but either they don't work or 
>> they give exception..
>> 
>> Francesco
>> 
>> PS: the big picture is to make the login on a LDAP server, and then save the 
>> username in the session.
> 
> If what you are asking is how to set the username on the EO try:
> 
> Use awakeFromInsertion or (ERXGenericRecord's) willInsert to set the username 
> in the EO, obtaining the username from ERXThreadStorage.
> 
> Push the username into ERXThreadStorage in the Session awake().
> 
> ;david


Thank you.
It works! 
(before I tried to do something in the willInsert method, but I don't have 
access to session and I din't know the existence of ERXThreadStorage :)

Francesco

PS: yesterday i did't reply to the list but only to david.. sorry :)
> 
> --
> David LeBer
> Codeferous Software
> 'co-def-er-ous' adj. Literally 'code-bearing'
> site: http://codeferous.com
> blog: http://davidleber.net
> profile:  http://www.linkedin.com/in/davidleber
> twitter:  http://twitter.com/rebeld
> --
> Toronto Area Cocoa / WebObjects developers group:
> http://tacow.org
> 
> 
> 
> 


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


D2W automatically assign a value to an attribute

2010-12-06 Thread Francesco Romano
Ok.. today I'm asking stupid questions.. but.. D2W is not so simple with the 
rule system :)
I have a page (CreateMovie) which is displayed only if a user is logged in (I 
disabled the automatic login and added a condition in the navigation menu bind 
to session.isUserLoggedIn).
I have a required attribute in the Movie entity named "uploader". What I want 
to do is not allow the user to insert that name, but retrieve it from 
session.username().
How can I do this? I tried a lot of things, but either they don't work or they 
give exception..

Francesco

PS: the big picture is to make the login on a LDAP server, and then save the 
username in the session.

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Launching task after an object creation (D2W)

2010-12-06 Thread Francesco Romano
Thank you..
So simple :)

Francesco

On 06/dic/2010, at 13.15, Kieran Kelleher wrote:

> ERXGenericRecord.didInsert().   Override that. 
> 
> Regards, Kieran.
> 
> 
> On Dec 6, 2010, at 6:57 AM, Francesco Romano  wrote:
> 
>> Hi.
>> I have a d2w application with two pages: a "list movies" and a "add movie".
>> What I want to do is call a background task after a movie is added in the db 
>> (I have to call an applescript script that can take a lot of time depending 
>> of movie size..)
>> Where should I add the
>> 
>> ConverterTask task = new 
>> ConverterTask((EOGlobalID)ERXEOControlUtilities.convertEOtoGID(m));
>> ERXExecutorService.executorService().execute(task);
>> 
>> I tried in the Movie.java file, but the CreateMovie method is not called in 
>> D2W...
>> 
>> Thank you
>> 
>> Francesco
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com
>> 
>> This email sent to kelleh...@gmail.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Launching task after an object creation (D2W)

2010-12-06 Thread Francesco Romano
Hi.
I have a d2w application with two pages: a "list movies" and a "add movie".
What I want to do is call a background task after a movie is added in the db (I 
have to call an applescript script that can take a lot of time depending of 
movie size..)
Where should I add the

ConverterTask task = new 
ConverterTask((EOGlobalID)ERXEOControlUtilities.convertEOtoGID(m));
ERXExecutorService.executorService().execute(task);

I tried in the Movie.java file, but the CreateMovie method is not called in 
D2W...

Thank you

Francesco

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: automatically session creation

2010-11-28 Thread Francesco Romano
Then is good also for me :D

Thank you

Francesco

On 27/nov/2010, at 14.47, Simon wrote:

> looks good to me...
> 
> simon
> 
> On 27 November 2010 12:33, Francesco Romano  wrote:
>> What I want to do is changing this code inside a direct action (which does
>> not create a session but does not allow me to change its secure flag)
>> nextPage = pageWithName(RegisterUser.class);
>> nextPage.takeValueForKey(Boolean.TRUE, "success");
>> return nextPage;
>> to something equivalent where I can change the secure flag...
>> If I understand correctly if I use ERXRedirect I have to use direct actions,
>> so... I have to create a "dummy" direct action which simply redirect to the
>> page I want, and than user ERXRedirect
>> This is my code:
>> ERXRedirect redirect = pageWithName(ERXRedirect.class);
>> redirect.setUrl(context().directActionURLForActionNamed("UserAction/helpRedirect",
>> new NSDictionary(new Object[] {Boolean.TRUE}, new String[]
>> {"registration"}),
>> false,
>> true));
>> 
>> return redirect;
>> public WOActionResults helpRedirectAction() {
>> 
>> WOComponent nextPage = pageWithName(UtilitiesPage.class);
>> NSArray dict = request().formValueKeys();
>> for (String key: dict)
>> nextPage.takeValueForKey(request().formValueForKey(key), key);
>> return nextPage;
>> 
>> }
>> 
>> and in my utilities page:
>> public void setRegistration(Object value) {
>> if (value != null) {
>> if (value.getClass().equals(String.class))
>> this._registration = new BooleanHolder(Boolean.parseBoolean((String)value));
>> else if (value.getClass().equals(Boolean.class))
>> this._registration = new BooleanHolder((Boolean)value);
>> }
>> 
>> else
>> _registration = null;
>> }
>> 
>> It seems to work, but is this really necessary?
>> Francesco
>> On 27/nov/2010, at 11.08, Simon wrote:
>> 
>> look at the source code to ERXRedirect, line 175:
>> 
>> WOSession aSession = session();
>> 
>> bingo. A session gets created.
>> 
>> a quick scan through the code suggests that this only happens when
>> handing a component to the redirect. Redirect to a DA or an explicit
>> URL and you shouldn't get a session
>> 
>> simon
>> 
>> On 27 November 2010 08:17, Francesco Romano  wrote:
>> 
>> I don't understand...
>> 
>> Ok for Ajax.. I think that I'll keep the session.
>> 
>> But.. what abut going from secure to non secure page?
>> 
>> Francesco
>> 
>> On 26/nov/2010, at 13.31, Henrique Gomes wrote:
>> 
>> A session is always created if you use statefull components or form actions.
>> 
>> The page needs to be all made with stateless components and the form must
>> use direct actions.
>> 
>> As for Ajax, well, you might have to rethink it:
>> 
>> http://osdir.com/ml/webobjects-dev/2009-07/msg00319.html
>> 
>> 
>> Henrique Gomes
>> 
>> 
>> On Nov 26, 2010, at 11:05 AM, Francesco Romano wrote:
>> 
>> Hi.
>> 
>> The title is not clear, I know... that's because I've 2 question related to
>> session, redirection and direct action.
>> 
>> 1) I have two pages which are secure (login and registration page).
>> 
>> What I want to do is, after a successful login (or registration), redirect
>> to a non secure page (like the home page).
>> 
>> The submit buttons link to two Direct Actions.
>> 
>> I don't have problem with the login page, because I need a session, so I do
>> something like:
>> 
>>  nextPage = pageWithName(Main.class);
>> 
>>  ERXRedirect redirect = pageWithName(ERXRedirect.class);
>> 
>>  redirect.setSecure(false);
>> 
>>  redirect.setComponent(nextPage);
>> 
>>  return redirect;
>> 
>> but.. for a registration page I  don't want to create a session.. what can i
>> do?
>> 
>> 2) Ajax components need session? Because I've a "ajax" list product page and
>> a session is automatically created
>> 
>> Thank you
>> 
>> Francesco Romano
>> 
>> ___
>> 
>> Do not post admin requests to the list. They will be ignored.
>> 
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> 
>> Help/Unsubscribe/Update your Subscription:
>> 
>> http://lists.apple.com/mailman/options/webobjects-dev/lists%40farol.pt
>> 

Re: automatically session creation

2010-11-27 Thread Francesco Romano
What I want to do is changing this code inside a direct action (which does not 
create a session but does not allow me to change its secure flag)

nextPage = pageWithName(RegisterUser.class);
nextPage.takeValueForKey(Boolean.TRUE, "success");
return nextPage;

to something equivalent where I can change the secure flag...
If I understand correctly if I use ERXRedirect I have to use direct actions, 
so... I have to create a "dummy" direct action which simply redirect to the 
page I want, and than user ERXRedirect 

This is my code:

ERXRedirect redirect = pageWithName(ERXRedirect.class);
redirect.setUrl(context().directActionURLForActionNamed("UserAction/helpRedirect",
new NSDictionary(new Object[] {Boolean.TRUE}, 
new String[] {"registration"}),
false,
true));

return redirect;

public WOActionResults helpRedirectAction() {

WOComponent nextPage = pageWithName(UtilitiesPage.class);
NSArray dict = request().formValueKeys();
for (String key: dict)
nextPage.takeValueForKey(request().formValueForKey(key), key);
return nextPage;
}

and in my utilities page:

public void setRegistration(Object value) {
if (value != null) {
if (value.getClass().equals(String.class))
this._registration = new 
BooleanHolder(Boolean.parseBoolean((String)value));
else if (value.getClass().equals(Boolean.class))
this._registration = new BooleanHolder((Boolean)value); 

}

else
_registration = null;
}


It seems to work, but is this really necessary?

Francesco

On 27/nov/2010, at 11.08, Simon wrote:

> look at the source code to ERXRedirect, line 175:
> 
> WOSession aSession = session();
> 
> bingo. A session gets created.
> 
> a quick scan through the code suggests that this only happens when
> handing a component to the redirect. Redirect to a DA or an explicit
> URL and you shouldn't get a session
> 
> simon
> 
> On 27 November 2010 08:17, Francesco Romano  wrote:
>> I don't understand...
>> Ok for Ajax.. I think that I'll keep the session.
>> 
>> But.. what abut going from secure to non secure page?
>> 
>> Francesco
>> 
>> On 26/nov/2010, at 13.31, Henrique Gomes wrote:
>> 
>>> A session is always created if you use statefull components or form actions.
>>> The page needs to be all made with stateless components and the form must 
>>> use direct actions.
>>> 
>>> As for Ajax, well, you might have to rethink it:
>>> 
>>> http://osdir.com/ml/webobjects-dev/2009-07/msg00319.html
>>> 
>>> 
>>> Henrique Gomes
>>> 
>>> 
>>> On Nov 26, 2010, at 11:05 AM, Francesco Romano wrote:
>>> 
>>>> Hi.
>>>> The title is not clear, I know... that's because I've 2 question related 
>>>> to session, redirection and direct action.
>>>> 
>>>> 1) I have two pages which are secure (login and registration page).
>>>> What I want to do is, after a successful login (or registration), redirect 
>>>> to a non secure page (like the home page).
>>>> The submit buttons link to two Direct Actions.
>>>> 
>>>> I don't have problem with the login page, because I need a session, so I 
>>>> do something like:
>>>> 
>>>>  nextPage = pageWithName(Main.class);
>>>>  ERXRedirect redirect = pageWithName(ERXRedirect.class);
>>>>  redirect.setSecure(false);
>>>>  redirect.setComponent(nextPage);
>>>>  return redirect;
>>>> 
>>>> but.. for a registration page I  don't want to create a session.. what can 
>>>> i do?
>>>> 
>>>> 2) Ajax components need session? Because I've a "ajax" list product page 
>>>> and a session is automatically created
>>>> 
>>>> Thank you
>>>> 
>>>> Francesco Romano
>>>> 
>>>> ___
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/webobjects-dev/lists%40farol.pt
>>>> 
>>>> This email sent to li...@farol.pt
>>> 
>> 
>>  ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk
>> 
>> This email sent to si...@potwells.co.uk
>> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: automatically session creation

2010-11-27 Thread Francesco Romano
I don't understand...
Ok for Ajax.. I think that I'll keep the session.

But.. what abut going from secure to non secure page?

Francesco

On 26/nov/2010, at 13.31, Henrique Gomes wrote:

> A session is always created if you use statefull components or form actions.
> The page needs to be all made with stateless components and the form must use 
> direct actions.
> 
> As for Ajax, well, you might have to rethink it:
> 
> http://osdir.com/ml/webobjects-dev/2009-07/msg00319.html
> 
> 
> Henrique Gomes
> 
> 
> On Nov 26, 2010, at 11:05 AM, Francesco Romano wrote:
> 
>> Hi.
>> The title is not clear, I know... that's because I've 2 question related to 
>> session, redirection and direct action. 
>> 
>> 1) I have two pages which are secure (login and registration page).
>> What I want to do is, after a successful login (or registration), redirect 
>> to a non secure page (like the home page).
>> The submit buttons link to two Direct Actions.
>> 
>> I don't have problem with the login page, because I need a session, so I do 
>> something like:
>> 
>>  nextPage = pageWithName(Main.class);
>>  ERXRedirect redirect = pageWithName(ERXRedirect.class);
>>  redirect.setSecure(false);
>>  redirect.setComponent(nextPage);
>>  return redirect;
>> 
>> but.. for a registration page I  don't want to create a session.. what can i 
>> do?
>> 
>> 2) Ajax components need session? Because I've a "ajax" list product page and 
>> a session is automatically created
>> 
>> Thank you
>> 
>> Francesco Romano
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/lists%40farol.pt
>> 
>> This email sent to li...@farol.pt
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


automatically session creation

2010-11-26 Thread Francesco Romano
Hi.
The title is not clear, I know... that's because I've 2 question related to 
session, redirection and direct action. 

1) I have two pages which are secure (login and registration page).
What I want to do is, after a successful login (or registration), redirect to a 
non secure page (like the home page).
The submit buttons link to two Direct Actions.

I don't have problem with the login page, because I need a session, so I do 
something like:

nextPage = pageWithName(Main.class);
ERXRedirect redirect = pageWithName(ERXRedirect.class);
redirect.setSecure(false);
redirect.setComponent(nextPage);
return redirect;

but.. for a registration page I  don't want to create a session.. what can i do?

2) Ajax components need session? Because I've a "ajax" list product page and a 
session is automatically created

Thank you

Francesco Romano

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: ERAttachment... to-many and thumbs

2010-11-23 Thread Francesco Romano
On 23/nov/2010, at 12.30, Denis Frolov wrote:

> I think ERAttachmentViewer doesn't resize the image itself - it just passes 
> the width/height to WOImage. So, this approach is indeed "heavy". You can 
> create thumbnails upon upload and add them to "childrenAttachments" 
> relationship. After that you can show the thumbnail by accessing it via 
> "childrenAttachments" relationship on your list pages (you can add a cover 
> method for thumbnail to Product.java).

So I have to create the thumb...
How can I manage the upload? 
Now I override willUpdate and willInsert in ProductERAttachment entity.

@Override
public void willInsert() {
this.updateThumbnail();
super.willInsert();
}

@Override
public void willUpdate() {
this.updateThumbnail();
super.willUpdate();
}

private void updateThumbnail() {

ERImageProcessor.imageProcessor().thumbnail(40, 40, inputFile, 
outputFile);

}

But... what about inputFile? How can I retrieve it from the ERAttachment object?


> 
> To fix the exception try adding the rule like this:
> 
> entity.name = 'Product' and task = 'edit' and propertyKey = 'photos' => 
> destinationEntityName = 'ERFileAttachment'

It doesn't fix the problem...This is strange... in a previous test (some days 
ago) I did not have this error... just the form encryption exception...

Francesco

> 
> Denis
> 
> On Tue, Nov 23, 2010 at 1:51 PM, Francesco Romano  
> wrote:
> Some updates after some hours of work
> Let's start with thumbnails.
> First of all... if in the ERAttachmentViewer I bind either the width or 
> height, it resize correctly the picture.. now.. the question is can this 
> become "heavy"? I think I'll use the thumbs only in list pages..or is better 
> to create the thumb on insertion and simply display it later?
> 
> About D2W rule... if i use as a component ERDList, I don't have the new 
> button to add the image.
> This is the entity I create:
> 
> 
> If I don't create any rule, this is what I see in the CreateProduct page:
> 
> 
> Then, if I press New: 
> 
> Nov 23 11:47:47 PNStoreAdmin[5100] WARN  NSLog  - 
> : Exception occurred while handling request:
> com.webobjects.foundation.NSForwardException 
> [java.lang.InstantiationException] null: is 
> an abstract class. It can not be instantiated !
> [2010-11-23 11:47:47 CET]  
> com.webobjects.foundation.NSForwardException 
> [java.lang.InstantiationException] null: is 
> an abstract class. It can not be instantiated !
>   at 
> com.webobjects.foundation._NSUtilities._explainInstantiationException(_NSUtilities.java:616)
>   at 
> com.webobjects.foundation._NSUtilities.instantiateObjectWithConstructor(_NSUtilities.java:665)
> 
> 
> 
> Francesco
> 
> On 23/nov/2010, at 08.48, Francesco Romano wrote:
> 
>>> Are you actually going to display multiple photos for a Product?
>>> 
>>> Or are you displaying ... 
>>> 
>>> one thumbnail 
>>> or
>>> one big photo
>>> or
>>> one medium photo
>>> 
>>> David
>> 
>> What I want is the possibility to have many photos for a product. And i need 
>> one thumbnail (but I think I'll thumbnail every photos, otherwise it'l 
>> become a bit complex to manage everything..).. So in the list page I display 
>> the thumb, in the Inspect page I display all the photos (I don't know if 
>> every photo in the same moment, or just a sort of embedded gallery in the 
>> page with next and previous button..)
>> 
>> I'll try this morning creating a new project and a new db connection, to not 
>> destroy my old one, until I find the right migration 
>> 
>> On 23/nov/2010, at 06.41, Denis Frolov wrote:
>> 
>>> On Mon, Nov 22, 2010 at 11:27 PM, Francesco Romano
>>>  wrote:
>>>> Ok.. I'll try this for the thumbnail..
>>>> 
>>>> About D2W...
>>>> I have something like
>>>> 
>>>> Product <-->> ERAttachment for a photos property.
>>>> But.. i watched the tutorial of David and he created a many-to-many, so
>>>> Product <-->> ProductPhotos <<--> ERAttachment
>>>> Product has a "photos" property (so a NSArray of ERAttachment).
>>>> But.. I don't know how to manage this with the rules, both on Inspect and 
>>>> on Edit/Create configuration.
>>>> BTW: how can I select the first object of an 

Re: ERAttachment... to-many and thumbs

2010-11-22 Thread Francesco Romano
> Are you actually going to display multiple photos for a Product?
> 
> Or are you displaying ... 
> 
> one thumbnail 
> or
> one big photo
> or
> one medium photo
> 
> David

What I want is the possibility to have many photos for a product. And i need 
one thumbnail (but I think I'll thumbnail every photos, otherwise it'l become a 
bit complex to manage everything..).. So in the list page I display the thumb, 
in the Inspect page I display all the photos (I don't know if every photo in 
the same moment, or just a sort of embedded gallery in the page with next and 
previous button..)

I'll try this morning creating a new project and a new db connection, to not 
destroy my old one, until I find the right migration 

On 23/nov/2010, at 06.41, Denis Frolov wrote:

> On Mon, Nov 22, 2010 at 11:27 PM, Francesco Romano
>  wrote:
>> Ok.. I'll try this for the thumbnail..
>> 
>> About D2W...
>> I have something like
>> 
>> Product <-->> ERAttachment for a photos property.
>> But.. i watched the tutorial of David and he created a many-to-many, so
>> Product <-->> ProductPhotos <<--> ERAttachment
>> Product has a "photos" property (so a NSArray of ERAttachment).
>> But.. I don't know how to manage this with the rules, both on Inspect and on 
>> Edit/Create configuration.
>> BTW: how can I select the first object of an array with a rule?
> 
> You could try "phot...@objectatindex.0" but I think a better way would
> be to add a cover method "thumbnail" to your Product.java returning
> the attachment you need and use it in rule.
> 
>> What I want to do is:
>> In ListProduct configuration I want to display the thumbnail
> 
> Cover method above would help you with this.

I'll go for the cover method

> 
>> In Edit/Create Product configuration I want to display all the photos in 
>> "maximum" size (i don't know yet the size.. I'll decide later)
> 
> We use our own custom component for this, but I think you could use
> ERDList or ERMDEditRelationship to display/edit the list of photos,
> e.g.:
> 
> entity.name = 'Product' and task = 'edit' and propertyKey = 'photos'
> => componentName = 'ERDList'
> 

I think I already tried something like that and it didn't work I'll try 
again..

Francesco

> Denis
> 
>> 
>> Thanks again for your answers
>> 
>> Francesco
>> 
>> On 22/nov/2010, at 21.05, Denis Frolov wrote:
>> 
>>> Hi,
>>> 
>>> In fact, the support for thumbnails is already there in the model of
>>> ERAttachment. Note the "parentAttachment"/"childrenAttachments"
>>> relationships and "thumbnail" attribute. Just create a new
>>> ERAttachment for thumbnail and add it to "childrenAttachments" of
>>> original attachment. You can use "thumbnail" attribute to specify the
>>> size of the thumbnail in case you need multiple thumbnails of
>>> different sizes. We use strings like "200x150" for "thumbnail"
>>> attribute.
>>> 
>>> As for the D2W, could you be more specific on what the problem is?
>>> 
>>> Denis
>>> 
>>> On Mon, Nov 22, 2010 at 7:49 PM, Francesco Romano
>>>  wrote:
>>>> Hi.
>>>> I have two questions about ERAttachment.
>>>> 1) Thumbnails are not available, yet, but.. what do I have to do to add 
>>>> support to them? I don't understand how to implement them "inside" 
>>>> erattachment
>>>> 2) I'd like to have a many-to-many relationship between my entity and 
>>>> erattachment. I don't have problems in modeling, but.. how can I manage 
>>>> them using D2W and rules? (I'm creating two apps: an admin app using D2W 
>>>> Modern look, and a "front-end" app without D2W. I have problem in the D2W 
>>>> side...)
>>>> 
>>>> Thank for any help
>>>> Francesco Romano
>>>> 
>>>>  ___
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/webobjects-dev/dfrolov%40demax.ru
>>>> 
>>>> This email sent to dfro...@demax.ru
>>>> 
>> 
>>  ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/dfrolov%40demax.ru
>> 
>> This email sent to dfro...@demax.ru
>> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ERAttachment... to-many and thumbs

2010-11-22 Thread Francesco Romano
Ok.. I'll try this for the thumbnail..

About D2W...
I have something like

Product <-->> ERAttachment for a photos property.
But.. i watched the tutorial of David and he created a many-to-many, so
Product <-->> ProductPhotos <<--> ERAttachment
Product has a "photos" property (so a NSArray of ERAttachment).
But.. I don't know how to manage this with the rules, both on Inspect and on 
Edit/Create configuration.
BTW: how can I select the first object of an array with a rule? 
What I want to do is:
In ListProduct configuration I want to display the thumbnail
In Edit/Create Product configuration I want to display all the photos in 
"maximum" size (i don't know yet the size.. I'll decide later)

Thanks again for your answers

Francesco

On 22/nov/2010, at 21.05, Denis Frolov wrote:

> Hi,
> 
> In fact, the support for thumbnails is already there in the model of
> ERAttachment. Note the "parentAttachment"/"childrenAttachments"
> relationships and "thumbnail" attribute. Just create a new
> ERAttachment for thumbnail and add it to "childrenAttachments" of
> original attachment. You can use "thumbnail" attribute to specify the
> size of the thumbnail in case you need multiple thumbnails of
> different sizes. We use strings like "200x150" for "thumbnail"
> attribute.
> 
> As for the D2W, could you be more specific on what the problem is?
> 
> Denis
> 
> On Mon, Nov 22, 2010 at 7:49 PM, Francesco Romano
>  wrote:
>> Hi.
>> I have two questions about ERAttachment.
>> 1) Thumbnails are not available, yet, but.. what do I have to do to add 
>> support to them? I don't understand how to implement them "inside" 
>> erattachment
>> 2) I'd like to have a many-to-many relationship between my entity and 
>> erattachment. I don't have problems in modeling, but.. how can I manage them 
>> using D2W and rules? (I'm creating two apps: an admin app using D2W Modern 
>> look, and a "front-end" app without D2W. I have problem in the D2W side...)
>> 
>> Thank for any help
>> Francesco Romano
>> 
>>  ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/dfrolov%40demax.ru
>> 
>> This email sent to dfro...@demax.ru
>> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ERAttachment... to-many and thumbs

2010-11-22 Thread Francesco Romano
Hi.
I have two questions about ERAttachment.
1) Thumbnails are not available, yet, but.. what do I have to do to add support 
to them? I don't understand how to implement them "inside" erattachment
2) I'd like to have a many-to-many relationship between my entity and 
erattachment. I don't have problems in modeling, but.. how can I manage them 
using D2W and rules? (I'm creating two apps: an admin app using D2W Modern 
look, and a "front-end" app without D2W. I have problem in the D2W side...)

Thank for any help
Francesco Romano

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: build wonder sources

2010-10-24 Thread Francesco Romano
Thanks..
Some frameworks/examples/applications have errors, but others are ok..
The 2 frameworks are ERJQuery and ERWOAdaptor..

Francesco

On 24/ott/2010, at 14.19, Ramsey Lee Gurley wrote:

> 
> On Oct 24, 2010, at 7:35 AM, Francesco Romano wrote:
> 
>> Hi to everyone.
>> I'd like to take a look to ERModernLook and to try to create my first D2W 
>> application.
>> I've a new iMac that I want to set up to develop with WebObjects, but I 
>> can't build Wonder...
>> 
>> So.. this is what I've done till now:
>> 1) downloaded Eclipse 3.6 for Cocoa 64bit, and installed WOLips stable 
>> version
>> 2) followed this link to install WO frameworks: 
>> http://wiki.objectstyle.org/confluence/display/WOL/Using+WOLips+With+Multiple+Versions+of+WebObjects
>> I created the wolips.543.properties file linking to my frameworks, tested a 
>> WonderApplication (simple Hello World) in Eclipse and it works.
>> 3) tried to install Wonder: 
>> http://wiki.objectstyle.org/confluence/display/WONDER/Download+Wonder+Source%2C+Build%2C+Install+and+Upgrade
>> I checkout the repository, linked the build.properties file to the WOLips 
>> file and... it can't build the frameworks:
>> it fails on every import.. (just the first lines)
> 
> 1. Same for me
> 2. Same for me
> 3. Instead, I install the latest SVN 
> (http://www.collab.net/downloads/community/), latest subclipse, then checkout 
> Wonder 5.4 branch into the workspace.  From there, I do a "File->Import" of 
> all the frameworks into a "Wonder Frameworks" working set, the apps into a 
> "Wonder Applications" working set, the Examples into a "Wonder Examples" 
> working set, and the tests into a "Wonder Tests" working set.  
> 
> Now, everything builds inside Eclipse for me and there's no command line 
> magic to remember.  If I want to update to the latest version of wonder, I 
> just need to select the wonder folder and right click -> "Team -> Update to 
> Head". Most importantly, I can now set breakpoints in Wonder, edit the 
> source, a create/apply patches with right click -> "Team -> * Patch".
> 
> Ramsey
> 
>>> [wocompile] 
>>> /Users/makaveli/Projects/WonderSource/Build/build/generic.xml:268: warning: 
>>> 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set 
>>> to false for repeatable builds
>>> [wocompile] Compiling 58 source files to 
>>> /Users/makaveli/Projects/Java/WonderBuild/classes/JavaWOExtensions
>>> [wocompile] 
>>> /Users/makaveli/Projects/WonderSource/Frameworks/Core/JavaWOExtensions/Sources/com/webobjects/woextensions/JSAlertPanel.java:10:
>>>  package com.webobjects.appserver does not exist
>>> [wocompile] import com.webobjects.appserver.WOContext;
>>> [wocompile]^
>>> [wocompile] 
>>> /Users/makaveli/Projects/WonderSource/Frameworks/Core/JavaWOExtensions/Sources/com/webobjects/woextensions/JSAlertPanel.java:11:
>>>  package com.webobjects.foundation does not exist
>> 
>> Some ideas?
>> 
>> Thanks
>> 
>> Francesco
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40mac.com
>> 
>> This email sent to rgur...@mac.com
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


build wonder sources

2010-10-24 Thread Francesco Romano
Hi to everyone.
I'd like to take a look to ERModernLook and to try to create my first D2W 
application.
I've a new iMac that I want to set up to develop with WebObjects, but I can't 
build Wonder...

So.. this is what I've done till now:
1) downloaded Eclipse 3.6 for Cocoa 64bit, and installed WOLips stable version
2) followed this link to install WO frameworks: 
http://wiki.objectstyle.org/confluence/display/WOL/Using+WOLips+With+Multiple+Versions+of+WebObjects
I created the wolips.543.properties file linking to my frameworks, tested a 
WonderApplication (simple Hello World) in Eclipse and it works.
3) tried to install Wonder: 
http://wiki.objectstyle.org/confluence/display/WONDER/Download+Wonder+Source%2C+Build%2C+Install+and+Upgrade
I checkout the repository, linked the build.properties file to the WOLips file 
and... it can't build the frameworks:
it fails on every import.. (just the first lines)
> [wocompile] 
> /Users/makaveli/Projects/WonderSource/Build/build/generic.xml:268: warning: 
> 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set 
> to false for repeatable builds
> [wocompile] Compiling 58 source files to 
> /Users/makaveli/Projects/Java/WonderBuild/classes/JavaWOExtensions
> [wocompile] 
> /Users/makaveli/Projects/WonderSource/Frameworks/Core/JavaWOExtensions/Sources/com/webobjects/woextensions/JSAlertPanel.java:10:
>  package com.webobjects.appserver does not exist
> [wocompile] import com.webobjects.appserver.WOContext;
> [wocompile]^
> [wocompile] 
> /Users/makaveli/Projects/WonderSource/Frameworks/Core/JavaWOExtensions/Sources/com/webobjects/woextensions/JSAlertPanel.java:11:
>  package com.webobjects.foundation does not exist

Some ideas?

Thanks

Francesco

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


AjaxInPlace

2009-09-22 Thread Francesco Romano

Hi..

I'm using an AjaxInPlace component.
I'd like to perform a validation.
I bound the ajaxinplace with a saveaction.
But... even if my "validation" fails, the edit template switch to the  
view template.
I'd like to stay in the edit mode until either the user presses cancel  
or the validation is successful.
I see the canSave bindings, but it is checked before the saveAction,  
so that binding is not the right one..


What can I use??

Francesco

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Localization

2009-09-18 Thread Francesco Romano

Ok.. please.. don't beat me
I've already checked that but... it was commented!!
That row and all the localization properties (and.. yesterday I was  
wondering why only the english localization worked...)


So... I've only one problem left.. (this is not truly a problem..)
If I set the localization of the numberformatter in the "static" way  
(NSNumberFormatter.setDefaultLocalizesPattern(true)) in the  
Application constructor, the formatters are not localized.

If I set it using the "instance" way it works..
Why?

Francesco.

On 18/set/2009, at 04.01, Ramsey Lee Gurley wrote:


That works for me.  Did you add

# Project Encoding
er.extensions.ERXApplication.DefaultEncoding=UTF-8

to your properties file?

Ramsey


On Sep 17, 2009, at 10:33 AM, Francesco Romano wrote:


I set the currency in the constructor of the component:

numberFormatter = new NSNumberFormatter("$ #,##0.00");
numberFormatter.setLocalizesPattern(true);
numberFormatter.setCurrencySymbol("€");

But this is the rendered html:
? 3.500,00




Francesco

Il giorno 17/set/2009, alle ore 13.49, Ramsey Lee Gurley ha scritto:


Hi Francesco,

Where is the EURO sign failing?  Is it stored in the database, the  
localized strings file, the component...?


Ramsey

On Sep 17, 2009, at 2:26 AM, Francesco Romano wrote:


Ok.. I'll take a look to ERXLocalizer.
(I thought having different wo component very similar to have  
different .nib files..plus using the .string file for  
"programmatic" localization).


And.. what about the EURO sign? Why I can't render it??

Il giorno 17/set/2009, alle ore 01.24, Ramsey Lee Gurley ha  
scritto:



Hi Francesco,

I'll second what Pascal is saying.  Unless you really _need_ a  
localized component, stick to localized strings.  You'll just  
end up making your app *a lot* harder to maintain with lots of  
localized WOComponents.  It's simple math... two components =  
twice the work. :-)


Ramsey

On Sep 16, 2009, at 3:17 PM, Pascal Robert wrote:

Do yourself a favor and use ERXLocalizer. The method of having  
one WO component per language is purely trouble.



Hi..
I need to localize a WO app in two languages: italian and  
english.

So.. I read this page: 
http://wiki.objectstyle.org/confluence/display/WO/Web+Applications-Development-Localization+and+Internationalization
I create two folders in Resources: Italian.lproj and  
English.lproj.
Than I move every WO file into italian, and then copied all to  
English.

When I start the app nothing appear and this is the log:


set 16 20:52:42 PNStore[5100] DEBUG NSLog  - Waiting for  
requests...
set 16 20:52:43 PNStore[5100] DEBUG NSLog  -  
 No  
template found for component Main at "file:/Users/makaveli/ 
Projects/Java/PNStore/build/PNStore.woa/Contents/Resources/ 
Main.wo".


A second thing about localization: localizing a  
NSNumberFormatter: I want that the currency is Euro, but the  
formatter is "localized" (so english has a dot as decimal  
separator and italian has a comma).
For the currency: if I type: numberFormatter.setCurrencySymbol 
("€"); I see a ? instead of the symbol.

For the localization: if I add this to Application constructor:
NSNumberFormatter.setDefaultLocalizesPattern(true);
nothing changes, but if I write this for every formatter it  
works:

numberFormatter = new NSNumberFormatter("$ #,##0.00");
numberFormatter.setLocalizesPattern(true);
numberFormatter.setCurrencySymbol("Euro");

Thanks!!
Francesco
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects- 
d...@lists.apple.com)

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca

This email sent to prob...@macti.ca



---
Pascal Robert

http://www.macti.ca | http://www.linkedin.com/in/macti

Skype | Twitter | AIM/iChat : MacTICanada

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40mac.com

This email sent to rgur...@mac.com




Francesco

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40mac.com

This email sent to rgur...@mac.com




Francesco

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update 

Re: Localization

2009-09-17 Thread Francesco Romano
I set the currency in the constructor of the component:numberFormatter = new NSNumberFormatter("$ #,##0.00");numberFormatter.setLocalizesPattern(true);numberFormatter.setCurrencySymbol("€");But this is the rendered html:? 3.500,00FrancescoIl giorno 17/set/2009, alle ore 13.49, Ramsey Lee Gurley ha scritto:Hi Francesco,Where is the EURO sign failing?  Is it stored in the database, the localized strings file, the component...?RamseyOn Sep 17, 2009, at 2:26 AM, Francesco Romano wrote:Ok.. I'll take a look to ERXLocalizer.(I thought having different wo component very similar to have different .nib files..plus using the .string file for "programmatic" localization).And.. what about the EURO sign? Why I can't render it??Il giorno 17/set/2009, alle ore 01.24, Ramsey Lee Gurley ha scritto:Hi Francesco,I'll second what Pascal is saying.  Unless you really _need_ a localized component, stick to localized strings.  You'll just end up making your app *a lot* harder to maintain with lots of localized WOComponents.  It's simple math... two components = twice the work. :-)RamseyOn Sep 16, 2009, at 3:17 PM, Pascal Robert wrote:Do yourself a favor and use ERXLocalizer. The method of having one WO component per language is purely trouble.Hi..I need to localize a WO app in two languages: italian and english.So.. I read this page: http://wiki.objectstyle.org/confluence/display/WO/Web+Applications-Development-Localization+and+InternationalizationI create two folders in Resources: Italian.lproj and English.lproj.Than I move every WO file into italian, and then copied all to English.When I start the app nothing appear and this is the log:set 16 20:52:42 PNStore[5100] DEBUG NSLog  - Waiting for requests...set 16 20:52:43 PNStore[5100] DEBUG NSLog  -  No template found for component Main at "file:/Users/makaveli/Projects/Java/PNStore/build/PNStore.woa/Contents/Resources/Main.wo".A second thing about localization: localizing a NSNumberFormatter: I want that the currency is Euro, but the formatter is "localized" (so english has a dot as decimal separator and italian has a comma).For the currency: if I type: numberFormatter.setCurrencySymbol("€"); I see a ? instead of the symbol.For the localization: if I add this to Application constructor:NSNumberFormatter.setDefaultLocalizesPattern(true);nothing changes, but if I write this for every formatter it works:numberFormatter = new NSNumberFormatter("$ #,##0.00");numberFormatter.setLocalizesPattern(true);numberFormatter.setCurrencySymbol("Euro");Thanks!!Francesco___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:http://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.caThis email sent to prob...@macti.ca---Pascal Roberthttp://www.macti.ca | http://www.linkedin.com/in/mactiSkype | Twitter | AIM/iChat : MacTICanada___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40mac.comThis email sent to rgur...@mac.comFrancesco___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40mac.comThis email sent to rgur...@mac.com
Francesco

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Localization

2009-09-16 Thread Francesco Romano

Ok.. I'll take a look to ERXLocalizer.
(I thought having different wo component very similar to have  
different .nib files..plus using the .string file for "programmatic"  
localization).


And.. what about the EURO sign? Why I can't render it??

Il giorno 17/set/2009, alle ore 01.24, Ramsey Lee Gurley ha scritto:


Hi Francesco,

I'll second what Pascal is saying.  Unless you really _need_ a  
localized component, stick to localized strings.  You'll just end up  
making your app *a lot* harder to maintain with lots of localized  
WOComponents.  It's simple math... two components = twice the  
work. :-)


Ramsey

On Sep 16, 2009, at 3:17 PM, Pascal Robert wrote:

Do yourself a favor and use ERXLocalizer. The method of having one  
WO component per language is purely trouble.



Hi..
I need to localize a WO app in two languages: italian and english.
So.. I read this page: 
http://wiki.objectstyle.org/confluence/display/WO/Web+Applications-Development-Localization+and+Internationalization
I create two folders in Resources: Italian.lproj and English.lproj.
Than I move every WO file into italian, and then copied all to  
English.

When I start the app nothing appear and this is the log:


set 16 20:52:42 PNStore[5100] DEBUG NSLog  - Waiting for requests...
set 16 20:52:43 PNStore[5100] DEBUG NSLog  -  
 No  
template found for component Main at "file:/Users/makaveli/ 
Projects/Java/PNStore/build/PNStore.woa/Contents/Resources/Main.wo".


A second thing about localization: localizing a NSNumberFormatter:  
I want that the currency is Euro, but the formatter is  
"localized" (so english has a dot as decimal separator and italian  
has a comma).
For the currency: if I type: numberFormatter.setCurrencySymbol 
("€"); I see a ? instead of the symbol.

For the localization: if I add this to Application constructor:
NSNumberFormatter.setDefaultLocalizesPattern(true);
nothing changes, but if I write this for every formatter it works:
numberFormatter = new NSNumberFormatter("$ #,##0.00");
numberFormatter.setLocalizesPattern(true);
numberFormatter.setCurrencySymbol("Euro");

Thanks!!
Francesco
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca

This email sent to prob...@macti.ca



---
Pascal Robert

http://www.macti.ca | http://www.linkedin.com/in/macti

Skype | Twitter | AIM/iChat : MacTICanada

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40mac.com

This email sent to rgur...@mac.com




Francesco

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Localization

2009-09-16 Thread Francesco Romano

Hi..
I need to localize a WO app in two languages: italian and english.
So.. I read this page: 
http://wiki.objectstyle.org/confluence/display/WO/Web+Applications-Development-Localization+and+Internationalization
I create two folders in Resources: Italian.lproj and English.lproj.
Than I move every WO file into italian, and then copied all to English.
When I start the app nothing appear and this is the log:


set 16 20:52:42 PNStore[5100] DEBUG NSLog  - Waiting for requests...
set 16 20:52:43 PNStore[5100] DEBUG NSLog  -  
 No template  
found for component Main at "file:/Users/makaveli/Projects/Java/ 
PNStore/build/PNStore.woa/Contents/Resources/Main.wo".


A second thing about localization: localizing a NSNumberFormatter: I  
want that the currency is Euro, but the formatter is "localized" (so  
english has a dot as decimal separator and italian has a comma).
For the currency: if I type: numberFormatter.setCurrencySymbol("€"); I  
see a ? instead of the symbol.

For the localization: if I add this to Application constructor:
NSNumberFormatter.setDefaultLocalizesPattern(true);
nothing changes, but if I write this for every formatter it works:
numberFormatter = new NSNumberFormatter("$ #,##0.00");
numberFormatter.setLocalizesPattern(true);
numberFormatter.setCurrencySymbol("Euro");

Thanks!!
Francesco ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simple Question about bindings

2009-08-27 Thread Francesco Romano

I thought it was only a "Object" wrapper around a double number..
I changed to this:

public BigDecimal totalPrice() {
BigDecimal qta = new BigDecimal(quantity);
return (qta.multiply(product().prezzo()));

}

The bad thing about @sum binding is that now I have the warning :p

Francesco

On 27/ago/09, at 09:17, Mike Schrag wrote:

I use BigDecimal. But I can't multiply an int with a BigDecimal, so  
I get the doubleValue from it..
you create a BigDecimal out of the int and .multiply the original  
with it to create the resulting BigDecimal ... converting to double  
is a really bad idea -- you WILL get burned by it.


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/fra.makaveli%40gmail.com

This email sent to fra.makav...@gmail.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simple Question about bindings

2009-08-27 Thread Francesco Romano

Yeah, what you want is:

value = order.ca...@sum.totalprice;

John


I used that in Cocoa.. maybe I should use it here too...


Also, using "double" for the price is a very bad idea.  Use  
BigDecimal.


John

I use BigDecimal. But I can't multiply an int with a BigDecimal, so I  
get the doubleValue from it..




I guess, the cause of this problem is the fact that NSArray  
implements NSKeyValueCoding interface and has valueForKey method.


Obviously extending NSMutableArray is really bad idea...


I remember now, that to use the keyvalue coding I implemented the  
protocol in a class... maybe this it the problem... I'll change  
everything..


On 26/ago/09, at 20:02, Chuck Hill wrote:

I am not sure what the problem is, but it is very unusual (and  
probably just wrong) to sub-class NSArray etc.  I think you want this:



privateNSMutableArray cart;




I tried that first, but I had to rewrite a lot of methods, like isEmpty:
public boolean isEmpty() {
return cart.isEmpty;
}

And I thought the other thing could work..


The add and cartTotal methods belong in the TemporaryOrder class.

Chuck




On Aug 26, 2009, at 10:20 AM, Francesco Romano wrote:


Hi..
This is a very simple question, and I was able to find a  
workaround.. but I'd like to know where is the problem...


I've this class:

public class OrderComponent extends ERXComponent {

private TemporaryOrder order;

public OrderComponent(WOContext context) {
super(context);
}

public void setOrder(TemporaryOrder order) {
this.order = order;
}

public TemporaryOrder order() {
return order;
}

@Override
public void awake() {
super.awake();
setOrder(null);
}

}

All my order classes inherit from that class. (this only to have  
the order object without rewriting it every time..).


If I have this binding:

CartSubtotal: WOString {
value = order.cart.cartTotal;
numberformat = "$#0.00";
}
When I render the page I get this exception:

valueForKey(): lookup of unknown key: 'cartTotal'. This class does  
not have an instance variable of the name cartTotal or _cartTotal,  
nor a method of the name cartTotal, _cartTotal, getCartTotal, or  
_getCartTotal' object  
'com.portonapoleone.store.utils.carti...@eac903' key 'cartTotal'>


If I change the binding to this I have no problem:

CartSubtotal: WOString {
value = cartTotal;
numberformat = "$#0.00";
}

public double cartTotal() {
return order().cart().cartTotal();
}

These are the other classes involved:

public class TemporaryOrder {
private CartArray cart;
private String shipmentAddress;

public TemporaryOrder(CartArray c) {
cart = c;
}

public CartArray cart() {
return cart;
}

public void setShipmentAddress(String shipmentAddress) {
this.shipmentAddress = shipmentAddress;
}

public String shipmentAddress() {
return shipmentAddress;
}

}

public class CartArray extends NSMutableArray {

public boolean add(Prodotto p) {
return add(p,1);
}

public boolean add(Prodotto p, int i) {
CartItem ci = new CartItem(p);
if (contains(ci)) {
CartItem oldCI = objectAtIndex(indexOf(ci));
oldCI.quantity += i;
return true;
}
else {
ci.quantity = i;
return super.add(ci);
}
}

public double cartTotal() {
double total = 0;
Iterator it = this.iterator();
CartItem ci = null;
while (it.hasNext()) {
ci = it.next();
total += ci.totalPrice();
}

return total;
}

}

Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to ch...@global-village.net


--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects








 ___
Do not post admin requests to the list. They will be ignored.
Webobj

Re: Simple Question about bindings

2009-08-26 Thread Francesco Romano

Little change...
Because some problem with refresh I moved the TemporaryOrder object  
from the component to the session.


This does not change the problem..


PS:
How radio button &C. work??
(I've seen WORadioButtonList is deprecated.. Should I use  
ERXRadioButtonMatrix?... but selection is not.. selected!)


Francesco
On 26/ago/09, at 19:20, Francesco Romano wrote:


Hi..
This is a very simple question, and I was able to find a  
workaround.. but I'd like to know where is the problem...


I've this class:

public class OrderComponent extends ERXComponent {

private TemporaryOrder order;

public OrderComponent(WOContext context) {
super(context);
}

public void setOrder(TemporaryOrder order) {
this.order = order;
}

public TemporaryOrder order() {
return order;
}

@Override
public void awake() {
super.awake();
setOrder(null);
}

}

All my order classes inherit from that class. (this only to have the  
order object without rewriting it every time..).


If I have this binding:

CartSubtotal: WOString {
value = order.cart.cartTotal;
numberformat = "$#0.00";
}
When I render the page I get this exception:

valueForKey(): lookup of unknown key: 'cartTotal'. This class does  
not have an instance variable of the name cartTotal or _cartTotal,  
nor a method of the name cartTotal, _cartTotal, getCartTotal, or  
_getCartTotal' object  
'com.portonapoleone.store.utils.carti...@eac903' key 'cartTotal'>


If I change the binding to this I have no problem:

CartSubtotal: WOString {
value = cartTotal;
numberformat = "$#0.00";
}

public double cartTotal() {
return order().cart().cartTotal();
}

These are the other classes involved:

public class TemporaryOrder {
private CartArray cart;
private String shippingAddress;

public TemporaryOrder(CartArray c) {
cart = c;
}

public CartArray cart() {
return cart;
}

public void setShipmentAddress(String shipmentAddress) {
this.shipmentAddress = shipmentAddress;
}

public String shipmentAddress() {
return shipmentAddress;
}

}

public class CartArray extends NSMutableArray {

public boolean add(Prodotto p) {
return add(p,1);
}

public boolean add(Prodotto p, int i) {
CartItem ci = new CartItem(p);
if (contains(ci)) {
CartItem oldCI = objectAtIndex(indexOf(ci));
oldCI.quantity += i;
return true;
}
else {
ci.quantity = i;
return super.add(ci);
}
}

public double cartTotal() {
double total = 0;
Iterator it = this.iterator();
CartItem ci = null;
while (it.hasNext()) {
ci = it.next();
total += ci.totalPrice();
}

return total;
}

}

Francesco





 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Simple Question about bindings

2009-08-26 Thread Francesco Romano

Hi..
This is a very simple question, and I was able to find a workaround..  
but I'd like to know where is the problem...


I've this class:

public class OrderComponent extends ERXComponent {

private TemporaryOrder order;

public OrderComponent(WOContext context) {
super(context);
}

public void setOrder(TemporaryOrder order) {
this.order = order;
}

public TemporaryOrder order() {
return order;
}

@Override
public void awake() {
super.awake();
setOrder(null);
}

}

All my order classes inherit from that class. (this only to have the  
order object without rewriting it every time..).


If I have this binding:

CartSubtotal: WOString {
value = order.cart.cartTotal;
numberformat = "$#0.00";
}
When I render the page I get this exception:

valueForKey(): lookup of unknown key: 'cartTotal'. This class does not  
have an instance variable of the name cartTotal or _cartTotal, nor a  
method of the name cartTotal, _cartTotal, getCartTotal, or  
_getCartTotal' object 'com.portonapoleone.store.utils.carti...@eac903'  
key 'cartTotal'>


If I change the binding to this I have no problem:

CartSubtotal: WOString {
value = cartTotal;
numberformat = "$#0.00";
}

public double cartTotal() {
return order().cart().cartTotal();
}

These are the other classes involved:

public class TemporaryOrder {
private CartArray cart;
private String shipmentAddress;

public TemporaryOrder(CartArray c) {
cart = c;
}

public CartArray cart() {
return cart;
}

public void setShipmentAddress(String shipmentAddress) {
this.shipmentAddress = shipmentAddress;
}

public String shipmentAddress() {
return shipmentAddress;
}

}

public class CartArray extends NSMutableArray {

public boolean add(Prodotto p) {
return add(p,1);
}

public boolean add(Prodotto p, int i) {
CartItem ci = new CartItem(p);
if (contains(ci)) {
CartItem oldCI = objectAtIndex(indexOf(ci));
oldCI.quantity += i;
return true;
}
else {
ci.quantity = i;
return super.add(ci);
}
}

public double cartTotal() {
double total = 0;
Iterator it = this.iterator();
CartItem ci = null;
while (it.hasNext()) {
ci = it.next();
total += ci.totalPrice();
}

return total;
}

}

Francesco



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Redirect to a component action

2009-08-23 Thread Francesco Romano

On 22/ago/09, at 15:31, Hugi Thordarson wrote:

Well, you have passed the login page an instance of your component,  
so you can invoke any method you like on it. If you'd like to do  
this in a flexible way, you could for example pass a selector to the  
login component, and use it to invoke a method on a successful  
login. Here's a little example of this might work, see the attached  
components.




Note that the action you call can of course be the saveCart()  
action, and then return its WOActionResults. (In this case, you'd  
just skipt the whole "pageToReturn"-thingamabob, and on login, just  
return the selector's invocation results). Just make sure saveCart()  
is then returning an instance of a new/different component and not  
"null" or "context().page()". Otherwise you'll just be returning the  
login component again :).


Cheers,
- hugi





Because the login action is a DirectAction I can't pass objects...
So.. I did something like this... it seems to work, but I don't know  
if is correct:

(Login action)
if (redirect != null) {
if (redirect.equals("saveCart")) {
nextPage = pageWithName(ShowCart.class);
return ((ShowCart)nextPage).saveCart();
        }



Francesco





On 22.8.2009, at 13:12, Francesco Romano wrote:



On 22/ago/2009, at 14.32, Hugi Thordarson  wrote:


Hi Francesco.

One option you have is to store a reference to the original page  
in the Login page. Something like this (warning: uncompiled  
pseudocode):


/*--*/
// in your shopping cart component:
/*--*/
public WOActionResults saveCart() {

 if( session().user() == null ) {
 LoginPage nextPage = pageWithName( nextPage.class );
 nextPage.componentToReturnToAfterLogin = context().page();
 return nextPage;
 }
 else {
 // Do your thing;
 }
}


/*--*/
In your login page
/*--*/

public WOComponent componentToReturnToAfterLogin;

public WOActionResults login() {
 // authenticate the user. Then, on successful login...
 componentToReturnToAfterLogin.ensureAwakeInContext( context() );
 return componentToReturnToAfterLogin;
}

/*--*/

This way, your user will be returned to the original page after  
logging in. Note, however, that this will of course not invoke  
your saveCart() action when you return, you'll have to do that in  
a different way.




So it's impossible to call an action from another component?

Maybe I can set a flag in the cart component and manually call the  
action..

What do you think?

Francesco

Cheers,
- Hugi

// Hugi Thordarson
// http://hugi.karlmenn.is/



On 22.8.2009, at 08:40, Francesco Romano wrote:


Hi..
I have a component action that does a check if the user is logged  
in..

If the user is not logged in, I redirect to a login page.
Now... I would like that, after the successful login, the first  
component action is called...

So.. something like this:

public WOActionResult saveCart() {
 if (session().user == null)
 ->redirect to LoginPage
 else
 doSomething

The login action is a direct action..
How can I redirect from the login action to the saveCart action??

Thanks.

Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is

This email sent to h...@karlmenn.is






 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Redirect to a component action

2009-08-22 Thread Francesco Romano


On 22/ago/2009, at 14.32, Hugi Thordarson  wrote:


Hi Francesco.

One option you have is to store a reference to the original page in  
the Login page. Something like this (warning: uncompiled pseudocode):


/*--*/
// in your shopping cart component:
/*--*/
public WOActionResults saveCart() {

   if( session().user() == null ) {
   LoginPage nextPage = pageWithName( nextPage.class );
   nextPage.componentToReturnToAfterLogin = context().page();
   return nextPage;
   }
   else {
   // Do your thing;
   }
}


/*--*/
In your login page
/*--*/

public WOComponent componentToReturnToAfterLogin;

public WOActionResults login() {
   // authenticate the user. Then, on successful login...
   componentToReturnToAfterLogin.ensureAwakeInContext( context() );
   return componentToReturnToAfterLogin;
}

/*--*/

This way, your user will be returned to the original page after  
logging in. Note, however, that this will of course not invoke your  
saveCart() action when you return, you'll have to do that in a  
different way.




So it's impossible to call an action from another component?

Maybe I can set a flag in the cart component and manually call the  
action..

What do you think?

Francesco

Cheers,
- Hugi

// Hugi Thordarson
// http://hugi.karlmenn.is/



On 22.8.2009, at 08:40, Francesco Romano wrote:


Hi..
I have a component action that does a check if the user is logged  
in..

If the user is not logged in, I redirect to a login page.
Now... I would like that, after the successful login, the first  
component action is called...

So.. something like this:

public WOActionResult saveCart() {
   if (session().user == null)
   ->redirect to LoginPage
   else
   doSomething

The login action is a direct action..
How can I redirect from the login action to the saveCart action??

Thanks.

Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is

This email sent to h...@karlmenn.is



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Redirect to a component action

2009-08-22 Thread Francesco Romano

Hi..
I have a component action that does a check if the user is logged in..
If the user is not logged in, I redirect to a login page.
Now... I would like that, after the successful login, the first  
component action is called...

So.. something like this:

public WOActionResult saveCart() {
if (session().user == null)
->redirect to LoginPage
else
doSomething

The login action is a direct action..
How can I redirect from the login action to the saveCart action??

Thanks.

Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Session... when are they created?

2009-08-10 Thread Francesco Romano
I think I handle sessions in the default way (not with cookies.. maybe  
in the future if I need to save something in the client-side..).


This is what I'm doing:
 The user select a category (direct action, no session), the user  
want to see a product (direct action, no session), the user add a  
product to a cart (direct action but I create the session).
Now.. the user wants to log in... (direct action, have a session BUT  
during the direct action "doLogin" it seems it doesn't have a session  
and another is created)..
Direct actions are handled by the class DirectAction, but all the  
direct actions related to login are handled by a Login class.


This is the login form:



Username:
			Password:tr>





loginForm: WOForm {
name = "loginForm";
actionClass = "Login";
directActionName = "doLogin";
?redirect = redirectTo;
}

userField: WOTextField {
name = "username";
value = username;
}

passwordField: WOPasswordField {
name = "password";
value = password;
}

loginButton: WOSubmitButton {
actionClass = "Login";
directActionName = "doLogin";
?redirect = redirectTo;
}

Now.. I noticed that the url show the action name and not the page  
name, after the login...


http://192.168.1.87:5100/cgi-bin/WebObjects/PNStore.woa/wa/Login/doLogin
but I'm in the showAccount page...

Francesco


On 10/ago/09, at 20:03, Mark Gowdy wrote:





2) Let's say an anonymous user has a session... then he logs in.  
And... I don't want the session change!!
This is the code (it's a direct action, called from a submit button  
in a form)



In the case where the user has a session, can you show us:
1) The component html (in eclipse) for this login form.
2) And can you show us the rendered html source from the browser and  
the URL that got you to that login page.


Are sessions being handled in the default way, or are you using  
cookies (or another way)?


Regards,

Mark



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Session... when are they created?

2009-08-10 Thread Francesco Romano

I read that page...
I added in the session constructor a log...
But I can't understand why even if I have a session, calling an action  
create another session (and context.hasSession says that there is no  
session... so.. it seems like I'm losing a session)..



Francesco

On 07/ago/09, at 16:16, George Domurot wrote:


Take a looks at this page:

http://wiki.objectstyle.org/confluence/display/WO/Debugging+the+Request-Response+Loop

In particular, update your session constructor to monitor exactly  
where/when sessions are being created (see code snip on page).


There are cases where you end up lazily creating sessions when not  
intending to, that then somehow are detached or unregistered  
correctly, and they will never timeout.  Before accessing your  
session, there may be a spot in your code where you should check  
hasSession() first.


-George

On Aug 7, 2009, at 3:11 AM, Francesco Romano wrote:


Hi...
I've 2 problems with sessions...

1) When are they created? I thought that they are created either  
when you call the session() method or when you use some component  
that need a session...

I don't understand why a new session is created calling this page:



"app" />




		>












Learn More






Descrizione






prezzoString: WOString {
value = product.prezzo;
numberformat = "$ 0.00";
}

 The page wrapper should not create a session (I use it in every  
page, and it not create a session...)


That page is called from this:

productLink: WOHyperlink {
directActionName = "showProduct";
actionClass = "DirectAction";
?product = aProduct.prodID;
}

public WOActionResults showProductAction() {
WOComponent nextPage = pageWithName(ShowProduct.class);
		nextPage.takeValueForKey(request().formValueForKey("product"),  
"product");

return nextPage;
}

 I'm sure that some days ago it worked


2) Let's say an anonymous user has a session... then he logs in.  
And... I don't want the session change!!
This is the code (it's a direct action, called from a submit button  
in a form)


public WOActionResults doLoginAction() {

WOComponent nextPage = null;
EOEditingContext ec = ERXEC.newEditingContext();
String username = (String) 
request().formValueForKey("username");
String password = (String) 
request().formValueForKey("password");
Object redirect = request().formValueForKey("redirect");


		Cliente user = Cliente.fetchCliente(ec,  
Cliente.EMAIL.eq(username));

if (user == null) {
//errore.. utente nn trovato;
nextPage = pageWithName(LoginPage.class);
nextPage.takeValueForKey("utente non trovato", "error");
nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
if (! user.password().equals(password)) {
//errore.. password sbagliata
nextPage = pageWithName(LoginPage.class);
nextPage.takeValueForKey("password sbagliata", "error");
nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
if (user.activationDate() != 0) {
//errore.. utente non attivo
nextPage = pageWithName(LoginPage.class);
			nextPage.takeValueForKey("Utente non ancora attivo. Per favore  
procedi con l'attivazione", "error");

nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
		ERXApplication.log.info(context().hasSession()); // it returns  
false
		user = (Cliente)  
EOUtilities 
.localInstanceOfObject(session().defaultEditingContext(), user);		

ERXApplication.log.info(context().hasSession()); // it returns 
true
((Session)session()).setUser(user);
if (redirect.equals("account"))
nextPage = pageWithName(AccountP

Re: Many to many relationship... some problem

2009-08-07 Thread Francesco Romano

But it's the primary key of Cart...
Francesco



On 07/ago/09, at 16:29, Ricardo J. Parada wrote:



On Aug 7, 2009, at 4:09 AM, Francesco Romano wrote:

The relationship order is optional but the attribute id does not  
allow nulls.




I think you need to make the foreign key 'id' in cart optional so  
that it can take a null when the order relationship is null.





 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Session... when are they created?

2009-08-07 Thread Francesco Romano

On 07/ago/09, at 14:08, Mike Schrag wrote:




I didn't notice it before...
Is it possible to pass an object to a Direct Action? Or I can only  
pass strings?
What I want is that until a user press that hyperlink I don't want to  
have a session, but if the user press the link.. I need the session..


Francesco


On Aug 7, 2009, at 6:11 AM, Francesco Romano wrote:


Hi...
I've 2 problems with sessions...

1) When are they created? I thought that they are created either  
when you call the session() method or when you use some component  
that need a session...

I don't understand why a new session is created calling this page:



"app" />




		>












Learn More






Descrizione






prezzoString: WOString {
value = product.prezzo;
numberformat = "$ 0.00";
}

 The page wrapper should not create a session (I use it in every  
page, and it not create a session...)


That page is called from this:

productLink: WOHyperlink {
directActionName = "showProduct";
actionClass = "DirectAction";
?product = aProduct.prodID;
}

public WOActionResults showProductAction() {
WOComponent nextPage = pageWithName(ShowProduct.class);
		nextPage.takeValueForKey(request().formValueForKey("product"),  
"product");

return nextPage;
}

 I'm sure that some days ago it worked


2) Let's say an anonymous user has a session... then he logs in.  
And... I don't want the session change!!
This is the code (it's a direct action, called from a submit button  
in a form)


public WOActionResults doLoginAction() {

WOComponent nextPage = null;
EOEditingContext ec = ERXEC.newEditingContext();
String username = (String) 
request().formValueForKey("username");
String password = (String) 
request().formValueForKey("password");
Object redirect = request().formValueForKey("redirect");


		Cliente user = Cliente.fetchCliente(ec,  
Cliente.EMAIL.eq(username));

if (user == null) {
//errore.. utente nn trovato;
nextPage = pageWithName(LoginPage.class);
nextPage.takeValueForKey("utente non trovato", "error");
nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
if (! user.password().equals(password)) {
//errore.. password sbagliata
nextPage = pageWithName(LoginPage.class);
nextPage.takeValueForKey("password sbagliata", "error");
nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
if (user.activationDate() != 0) {
//errore.. utente non attivo
nextPage = pageWithName(LoginPage.class);
			nextPage.takeValueForKey("Utente non ancora attivo. Per favore  
procedi con l'attivazione", "error");

nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
		ERXApplication.log.info(context().hasSession()); // it returns  
false
		user = (Cliente)  
EOUtilities 
.localInstanceOfObject(session().defaultEditingContext(), user);		

ERXApplication.log.info(context().hasSession()); // it returns 
true
((Session)session()).setUser(user);
if (redirect.equals("account"))
nextPage = pageWithName(AccountPage.class);
return nextPage;
}

The problem is that it seems he don't have a session..(tested in  
the context.hasSession()).. but.. this is the log:


Aug 07 12:08:08 PNStore[5100] INFO   
er.extensions.appserver.ERXApplication  - Created Session  
xqBvrhS2xvYiy2k7g00IMg

 ...
Aug 07 12:08:19 PNStore[5100] INFO   
er.extensions.appserver.ERXApplication  - false
Aug 07 12:08:19 PNStore[5100] INFO   
er.extensions.appserver.ERXApplication  - Created Session  
tucshimhkohHUgesq7l9nw
Aug 07 12:08:19 PNStore[5100] INFO   
er.extensions.app

Session... when are they created?

2009-08-07 Thread Francesco Romano

Hi...
I've 2 problems with sessions...

1) When are they created? I thought that they are created either when  
you call the session() method or when you use some component that need  
a session...

I don't understand why a new session is created calling this page:







		p>












Learn More






Descrizione






prezzoString: WOString {
value = product.prezzo;
numberformat = "$ 0.00";
}

 The page wrapper should not create a session (I use it in every  
page, and it not create a session...)


That page is called from this:

productLink: WOHyperlink {
directActionName = "showProduct";
actionClass = "DirectAction";
?product = aProduct.prodID;
}

public WOActionResults showProductAction() {
WOComponent nextPage = pageWithName(ShowProduct.class);
		nextPage.takeValueForKey(request().formValueForKey("product"),  
"product");

return nextPage;
}

 I'm sure that some days ago it worked


2) Let's say an anonymous user has a session... then he logs in.  
And... I don't want the session change!!
This is the code (it's a direct action, called from a submit button in  
a form)


public WOActionResults doLoginAction() {

WOComponent nextPage = null;
EOEditingContext ec = ERXEC.newEditingContext();
String username = (String) 
request().formValueForKey("username");
String password = (String) 
request().formValueForKey("password");
Object redirect = request().formValueForKey("redirect");


Cliente user = Cliente.fetchCliente(ec, 
Cliente.EMAIL.eq(username));
if (user == null) {
//errore.. utente nn trovato;
nextPage = pageWithName(LoginPage.class);
nextPage.takeValueForKey("utente non trovato", "error");
nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
if (! user.password().equals(password)) {
//errore.. password sbagliata
nextPage = pageWithName(LoginPage.class);
nextPage.takeValueForKey("password sbagliata", "error");
nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
if (user.activationDate() != 0) {
//errore.. utente non attivo
nextPage = pageWithName(LoginPage.class);
			nextPage.takeValueForKey("Utente non ancora attivo. Per favore  
procedi con l'attivazione", "error");

nextPage.takeValueForKey(username, "username");
nextPage.takeValueForKey(redirect, "redirectTo");
return nextPage;
}
ERXApplication.log.info(context().hasSession()); // it returns 
false
		user = (Cliente)  
EOUtilities.localInstanceOfObject(session().defaultEditingContext(),  
user);		

ERXApplication.log.info(context().hasSession()); // it returns 
true
((Session)session()).setUser(user);
if (redirect.equals("account"))
nextPage = pageWithName(AccountPage.class);
return nextPage;
}

The problem is that it seems he don't have a session..(tested in the  
context.hasSession()).. but.. this is the log:


Aug 07 12:08:08 PNStore[5100] INFO   
er.extensions.appserver.ERXApplication  - Created Session  
xqBvrhS2xvYiy2k7g00IMg

 ...
Aug 07 12:08:19 PNStore[5100] INFO   
er.extensions.appserver.ERXApplication  - false
Aug 07 12:08:19 PNStore[5100] INFO   
er.extensions.appserver.ERXApplication  - Created Session  
tucshimhkohHUgesq7l9nw
Aug 07 12:08:19 PNStore[5100] INFO   
er.extensions.appserver.ERXApplication  - true



What is wrong??

Thanks.

Francesco



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Many to many relationship... some problem

2009-08-07 Thread Francesco Romano

Maybe (hope) the last thing:

This is my model (right now only on paper..)
Product <->> LineItem <<->Cart
Cart <<-> Customer
Cart <-> Order
Customer <->> Order

So.. the tables should be:

Product (...)
Customer (...)
LineItem (... , ProdID, CartID) (Foreign keys to Product.id and  
Cart.id, mandatory)
Cart (... , CustomerID*) (Foreign Key to Customer.id, optional because  
used only if the customer saves the cart)
Order (... , CustomerID, CartID) (Foreign keys to Customer.id and  
Cart.id, mandatory)


Now.. The problem is that I can't do a one-to-one relationship between  
Cart and Order.
I want Order to have the foreign key (an order must have a cart, but a  
cart could not have an order if it is saved - using the customer  
relationship)
But.. using the UI I can't make a one-to-one.. so I create a one-to- 
many putting the foreign key field in order.
Than I changed in the cart entity the relationship with order to a to- 
one and optional but I have this warning:


The relationship order is optional but the attribute id does not allow  
nulls.


I'm a bit confused... in a "relational" way it should work.. but here  
in WO??


Thanks

On 04/ago/09, at 15:16, Francesco Romano wrote:


And.. if I change to this ?

Product <->> LineItem <<-> Cart

And Cart is linked to:
Cart <<-> Customer
Cart <-> Order

The customer and order foreign keys are both optional and both  
inside the Cart Entity.
So.. if a user want to save a cart (and not place an order) I link  
the cart directly to a customer.
If the user want to place the order, the cart is linked to the order  
and unlinked from the customer (this because Order <<-> Customer)



What do you think? Can this be correct?

Francesco

On 04/ago/09, at 11:32, Amedeo Mantica wrote:



On 03/ago/09, at 19:45, Francesco Romano wrote:


Ok.. I'll postpone this,,

Now.. for the model I was thinking at this:

Order <->> LineItem(has quantity as attribute) << - >Product
This should solve the to-many problem..

To save the cart... I thought to:
Customer <->> LineItem
Or:
Customer <-> Cart <->> LineItem
(Cart entity is useless, but I can add a LastUpdated date ...)

What do you think?



as a first rapid look seem to be ok
Ciao
Amedeo


On 03/ago/09, at 19:02, Amedeo Mantica wrote:


you can do it via webobjects but is a bit "hard"

is more easy to do a call to a directaction using "curl" sheduled  
via launchd or cron


Regards
Amedeo

On 03/ago/09, at 18:51, Francesco Romano wrote:


On 03/ago/09, at 18:49, Amedeo Mantica wrote:



On 03/ago/09, at 18:40, Francesco Romano wrote:



On 03/ago/09, at 18:29, Amedeo Mantica wrote:


why do you want to put the quantity in that table ???

leave the relationship alone

create a table " cart " with a relationship to product and a  
column quantity.


then create a relationship cart to order

Regards
Amedeo



Because I was thinking to save the cart in the cookies..  
Should I save the cart of every customer even if they don't  
place an order? (this is a question.. I don't know how things  
work..)


yes, so you can give customers choice to save cart and finish  
order later, if the order is not finished within some days you  
trash the cart


Amedeo


Yeah.. I have to change the model a bit :p
Btw.. how can I trash the cart automatically? Is it possible  
with WO?




Francesco

On 03/ago/09, at 18:16, Francesco Romano wrote:


On 03/ago/09, at 18:04, Lachlan Deck wrote:


On 04/08/2009, at 1:39 AM, Francesco Romano wrote:


On 03/ago/09, at 16:10, Lachlan Deck wrote:


On 03/08/2009, at 7:21 PM, Francesco Romano wrote:


Hi..
I'm having some problem with a many-to-many relationship.
I've two entities: Order and Product.
They have a many-to-many relationship, and an attribute:  
quantity.
The strange thing is that I don't see the OrderProduct  
model generated...


Check the value of Class Name in the model. It's probably  
EOGenericRecord. Change it to you.model.OrderProduct


You are right.. Now I see the class



Well.. to be honest I don't understand how many-to-many  
works... (In WO.. I know the "DB-theory")...


OrderProduct orderProduct =  
(OrderProduct)EOUtilities.createAndInsertInstance(ec,  
OrderProduct.ENTITY_NAME);

// or
OrderProduct orderProduct =  
OrderProduct.createOrderProduct(ec, product, order);

orderProduct.setQuantity(quantity);

ec.saveChanges();


Little problem.. the only method createOrderProduct has as  
arguments: editingContext, quantity.


1) Your OrderProduct should (usually) have a compound  
primary key. (orderID, productID). Both keys shouldn't  
allow null. Both relationships (order, product) should be  
manditory. Then regenerate your class.


I attach an image..  it's the OrderProduct entity.




So.. I can't set it's pk

Re: Many to many relationship... some problem

2009-08-04 Thread Francesco Romano

And.. if I change to this ?

Product <->> LineItem <<-> Cart

And Cart is linked to:
Cart <<-> Customer
Cart <-> Order

The customer and order foreign keys are both optional and both inside  
the Cart Entity.
So.. if a user want to save a cart (and not place an order) I link the  
cart directly to a customer.
If the user want to place the order, the cart is linked to the order  
and unlinked from the customer (this because Order <<-> Customer)



What do you think? Can this be correct?

Francesco

On 04/ago/09, at 11:32, Amedeo Mantica wrote:



On 03/ago/09, at 19:45, Francesco Romano wrote:


Ok.. I'll postpone this,,

Now.. for the model I was thinking at this:

Order <->> LineItem(has quantity as attribute) << - >Product
This should solve the to-many problem..

To save the cart... I thought to:
Customer <->> LineItem
Or:
Customer <-> Cart <->> LineItem
(Cart entity is useless, but I can add a LastUpdated date ...)

What do you think?



as a first rapid look seem to be ok
Ciao
Amedeo


On 03/ago/09, at 19:02, Amedeo Mantica wrote:


you can do it via webobjects but is a bit "hard"

is more easy to do a call to a directaction using "curl" sheduled  
via launchd or cron


Regards
Amedeo

On 03/ago/09, at 18:51, Francesco Romano wrote:


On 03/ago/09, at 18:49, Amedeo Mantica wrote:



On 03/ago/09, at 18:40, Francesco Romano wrote:



On 03/ago/09, at 18:29, Amedeo Mantica wrote:


why do you want to put the quantity in that table ???

leave the relationship alone

create a table " cart " with a relationship to product and a  
column quantity.


then create a relationship cart to order

Regards
Amedeo



Because I was thinking to save the cart in the cookies.. Should  
I save the cart of every customer even if they don't place an  
order? (this is a question.. I don't know how things work..)


yes, so you can give customers choice to save cart and finish  
order later, if the order is not finished within some days you  
trash the cart


Amedeo


Yeah.. I have to change the model a bit :p
Btw.. how can I trash the cart automatically? Is it possible with  
WO?




Francesco

On 03/ago/09, at 18:16, Francesco Romano wrote:


On 03/ago/09, at 18:04, Lachlan Deck wrote:


On 04/08/2009, at 1:39 AM, Francesco Romano wrote:


On 03/ago/09, at 16:10, Lachlan Deck wrote:


On 03/08/2009, at 7:21 PM, Francesco Romano wrote:


Hi..
I'm having some problem with a many-to-many relationship.
I've two entities: Order and Product.
They have a many-to-many relationship, and an attribute:  
quantity.
The strange thing is that I don't see the OrderProduct  
model generated...


Check the value of Class Name in the model. It's probably  
EOGenericRecord. Change it to you.model.OrderProduct


You are right.. Now I see the class



Well.. to be honest I don't understand how many-to-many  
works... (In WO.. I know the "DB-theory")...


OrderProduct orderProduct =  
(OrderProduct)EOUtilities.createAndInsertInstance(ec,  
OrderProduct.ENTITY_NAME);

// or
OrderProduct orderProduct =  
OrderProduct.createOrderProduct(ec, product, order);

orderProduct.setQuantity(quantity);

ec.saveChanges();


Little problem.. the only method createOrderProduct has as  
arguments: editingContext, quantity.


1) Your OrderProduct should (usually) have a compound  
primary key. (orderID, productID). Both keys shouldn't allow  
null. Both relationships (order, product) should be  
manditory. Then regenerate your class.


I attach an image..  it's the OrderProduct entity.




So.. I can't set it's pks.


2) This is good. :-) You're dealing with objects now, not  
database artifacts like pks and foreign keys. You'll be  
setting object relationships not pk/fk relationships.


Simply fetch the product/order _objects_ and
orderProduct.setOrder(order);
orderProduct.setProduct(product);



With pks I meant that I don't have the setProduct and  
setOrder method (and in the constructor).



with regards,
--

Lachlan Deck



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com 
)

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/amedeomailing%40insigno.it

This email sent to amedeomail...@insigno.it









___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/amedeomailing%40insigno.it

This email sent to amedeomail...@insigno.it





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailin

Re: Many to many relationship... some problem

2009-08-03 Thread Francesco Romano

Ok.. I'll postpone this,,

Now.. for the model I was thinking at this:

Order <->> LineItem(has quantity as attribute) << - >Product
This should solve the to-many problem..

To save the cart... I thought to:
Customer <->> LineItem
Or:
Customer <-> Cart <->> LineItem
(Cart entity is useless, but I can add a LastUpdated date ...)

What do you think?

On 03/ago/09, at 19:02, Amedeo Mantica wrote:


you can do it via webobjects but is a bit "hard"

is more easy to do a call to a directaction using "curl" sheduled  
via launchd or cron


Regards
Amedeo

On 03/ago/09, at 18:51, Francesco Romano wrote:


On 03/ago/09, at 18:49, Amedeo Mantica wrote:



On 03/ago/09, at 18:40, Francesco Romano wrote:



On 03/ago/09, at 18:29, Amedeo Mantica wrote:


why do you want to put the quantity in that table ???

leave the relationship alone

create a table " cart " with a relationship to product and a  
column quantity.


then create a relationship cart to order

Regards
Amedeo



Because I was thinking to save the cart in the cookies.. Should I  
save the cart of every customer even if they don't place an  
order? (this is a question.. I don't know how things work..)


yes, so you can give customers choice to save cart and finish  
order later, if the order is not finished within some days you  
trash the cart


Amedeo


Yeah.. I have to change the model a bit :p
Btw.. how can I trash the cart automatically? Is it possible with WO?




Francesco

On 03/ago/09, at 18:16, Francesco Romano wrote:


On 03/ago/09, at 18:04, Lachlan Deck wrote:


On 04/08/2009, at 1:39 AM, Francesco Romano wrote:


On 03/ago/09, at 16:10, Lachlan Deck wrote:


On 03/08/2009, at 7:21 PM, Francesco Romano wrote:


Hi..
I'm having some problem with a many-to-many relationship.
I've two entities: Order and Product.
They have a many-to-many relationship, and an attribute:  
quantity.
The strange thing is that I don't see the OrderProduct  
model generated...


Check the value of Class Name in the model. It's probably  
EOGenericRecord. Change it to you.model.OrderProduct


You are right.. Now I see the class



Well.. to be honest I don't understand how many-to-many  
works... (In WO.. I know the "DB-theory")...


OrderProduct orderProduct =  
(OrderProduct)EOUtilities.createAndInsertInstance(ec,  
OrderProduct.ENTITY_NAME);

// or
OrderProduct orderProduct =  
OrderProduct.createOrderProduct(ec, product, order);

orderProduct.setQuantity(quantity);

ec.saveChanges();


Little problem.. the only method createOrderProduct has as  
arguments: editingContext, quantity.


1) Your OrderProduct should (usually) have a compound primary  
key. (orderID, productID). Both keys shouldn't allow null.  
Both relationships (order, product) should be manditory. Then  
regenerate your class.


I attach an image..  it's the OrderProduct entity.




So.. I can't set it's pks.


2) This is good. :-) You're dealing with objects now, not  
database artifacts like pks and foreign keys. You'll be  
setting object relationships not pk/fk relationships.


Simply fetch the product/order _objects_ and
orderProduct.setOrder(order);
orderProduct.setProduct(product);



With pks I meant that I don't have the setProduct and setOrder  
method (and in the constructor).



with regards,
--

Lachlan Deck



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/amedeomailing%40insigno.it

This email sent to amedeomail...@insigno.it









___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/amedeomailing%40insigno.it

This email sent to amedeomail...@insigno.it





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Many to many relationship... some problem

2009-08-03 Thread Francesco Romano

On 03/ago/09, at 18:49, Amedeo Mantica wrote:



On 03/ago/09, at 18:40, Francesco Romano wrote:



On 03/ago/09, at 18:29, Amedeo Mantica wrote:


why do you want to put the quantity in that table ???

leave the relationship alone

create a table " cart " with a relationship to product and a  
column quantity.


then create a relationship cart to order

Regards
Amedeo



Because I was thinking to save the cart in the cookies.. Should I  
save the cart of every customer even if they don't place an order?  
(this is a question.. I don't know how things work..)


yes, so you can give customers choice to save cart and finish order  
later, if the order is not finished within some days you trash the  
cart


Amedeo


Yeah.. I have to change the model a bit :p
Btw.. how can I trash the cart automatically? Is it possible with WO?




Francesco

On 03/ago/09, at 18:16, Francesco Romano wrote:


On 03/ago/09, at 18:04, Lachlan Deck wrote:


On 04/08/2009, at 1:39 AM, Francesco Romano wrote:


On 03/ago/09, at 16:10, Lachlan Deck wrote:


On 03/08/2009, at 7:21 PM, Francesco Romano wrote:


Hi..
I'm having some problem with a many-to-many relationship.
I've two entities: Order and Product.
They have a many-to-many relationship, and an attribute:  
quantity.
The strange thing is that I don't see the OrderProduct model  
generated...


Check the value of Class Name in the model. It's probably  
EOGenericRecord. Change it to you.model.OrderProduct


You are right.. Now I see the class



Well.. to be honest I don't understand how many-to-many  
works... (In WO.. I know the "DB-theory")...


OrderProduct orderProduct =  
(OrderProduct)EOUtilities.createAndInsertInstance(ec,  
OrderProduct.ENTITY_NAME);

// or
OrderProduct orderProduct =  
OrderProduct.createOrderProduct(ec, product, order);

orderProduct.setQuantity(quantity);

ec.saveChanges();


Little problem.. the only method createOrderProduct has as  
arguments: editingContext, quantity.


1) Your OrderProduct should (usually) have a compound primary  
key. (orderID, productID). Both keys shouldn't allow null. Both  
relationships (order, product) should be manditory. Then  
regenerate your class.


I attach an image..  it's the OrderProduct entity.




So.. I can't set it's pks.


2) This is good. :-) You're dealing with objects now, not  
database artifacts like pks and foreign keys. You'll be setting  
object relationships not pk/fk relationships.


Simply fetch the product/order _objects_ and
orderProduct.setOrder(order);
orderProduct.setProduct(product);



With pks I meant that I don't have the setProduct and setOrder  
method (and in the constructor).



with regards,
--

Lachlan Deck



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/amedeomailing%40insigno.it

This email sent to amedeomail...@insigno.it









___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Many to many relationship... some problem

2009-08-03 Thread Francesco Romano

On 03/ago/09, at 18:04, Lachlan Deck wrote:


On 04/08/2009, at 1:39 AM, Francesco Romano wrote:


On 03/ago/09, at 16:10, Lachlan Deck wrote:


On 03/08/2009, at 7:21 PM, Francesco Romano wrote:


Hi..
I'm having some problem with a many-to-many relationship.
I've two entities: Order and Product.
They have a many-to-many relationship, and an attribute: quantity.
The strange thing is that I don't see the OrderProduct model  
generated...


Check the value of Class Name in the model. It's probably  
EOGenericRecord. Change it to you.model.OrderProduct


You are right.. Now I see the class



Well.. to be honest I don't understand how many-to-many works...  
(In WO.. I know the "DB-theory")...


OrderProduct orderProduct =  
(OrderProduct)EOUtilities.createAndInsertInstance(ec,  
OrderProduct.ENTITY_NAME);

// or
OrderProduct orderProduct = OrderProduct.createOrderProduct(ec,  
product, order);

orderProduct.setQuantity(quantity);

ec.saveChanges();


Little problem.. the only method createOrderProduct has as  
arguments: editingContext, quantity.


1) Your OrderProduct should (usually) have a compound primary key.  
(orderID, productID). Both keys shouldn't allow null. Both  
relationships (order, product) should be manditory. Then regenerate  
your class.


I attach an image..  it's the OrderProduct entity.
<>




So.. I can't set it's pks.


2) This is good. :-) You're dealing with objects now, not database  
artifacts like pks and foreign keys. You'll be setting object  
relationships not pk/fk relationships.


Simply fetch the product/order _objects_ and
orderProduct.setOrder(order);
orderProduct.setProduct(product);



With pks I meant that I don't have the setProduct and setOrder method  
(and in the constructor).



with regards,
--

Lachlan Deck



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Many to many relationship... some problem

2009-08-03 Thread Francesco Romano


On 03/ago/09, at 16:10, Lachlan Deck wrote:


On 03/08/2009, at 7:21 PM, Francesco Romano wrote:


Hi..
I'm having some problem with a many-to-many relationship.
I've two entities: Order and Product.
They have a many-to-many relationship, and an attribute: quantity.
The strange thing is that I don't see the OrderProduct model  
generated...


Check the value of Class Name in the model. It's probably  
EOGenericRecord. Change it to you.model.OrderProduct


You are right.. Now I see the class



Well.. to be honest I don't understand how many-to-many works...  
(In WO.. I know the "DB-theory")...


OrderProduct orderProduct =  
(OrderProduct)EOUtilities.createAndInsertInstance(ec,  
OrderProduct.ENTITY_NAME);

// or
OrderProduct orderProduct = OrderProduct.createOrderProduct(ec,  
product, order);

orderProduct.setQuantity(quantity);

ec.saveChanges();



Little problem.. the only method createOrderProduct has as arguments:  
editingContext, quantity.

So.. I can't set it's pks.



What particular questions do you have?

with regards,
--

Lachlan Deck



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Many to many relationship... some problem

2009-08-03 Thread Francesco Romano

Hi..
I'm having some problem with a many-to-many relationship.
I've two entities: Order and Product.
They have a many-to-many relationship, and an attribute: quantity.
The strange thing is that I don't see the OrderProduct model  
generated...


Well.. to be honest I don't understand how many-to-many works... (In  
WO.. I know the "DB-theory")...


Some kind help?

Thanks

Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Textfield and change event

2009-07-25 Thread Francesco Romano

Thanks!
I updated wonder and the class binding works.
I also found the example of the trigger and now everything work...

One last thing about the observe field.
The event is triggered when the field lose the focus.
I don't like this. Is it possible to trigger it when the user change  
the value?
I've seen in the api that I can bind a "observeFieldFrequency".. but..  
I don't want a continuos polling..


Thanks.
Francesco

On 24/lug/09, at 21:42, Johann Werner wrote:

The AjaxObserveField should honor your class binding. For me it is  
working. Do you have a recent version of Wonder?
For the AjaxUpdateTrigger I think you should find an example in  
AjaxExample. Have a look at it.


jw


Am 24.07.2009 um 18:07 schrieb Francesco Romano:


Good idea...
but...
I pass a class binding but it's not used:





qtaObserveField: AjaxObserveField {
class = "cprod-item-qta";
action = quantityChanged;
updateContainerID = "cartListContainer";
elementName = "li";
}



ASB.observeDescendentFields('cartListContainer',  
</tt><tt>'e_11_3_1_0_1_5', null, true, null, {_asbn:'11.3.1.0.1.5'});
Further more... how can I use th ajaxUpdateTrigger? The doc is not  
so clear...

Francesco



On 24/lug/09, at 17:49, Johann Werner wrote:


Hi Francesco,





Now I remember why.. because the observer is a div and it  
"destroyed" my layout.. but I found the right place and now it  
seems to work


you could use the binding 'elementName' of AjaxObserveField to let  
it use e.g. li instead of div


jw



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jw%40oyosys.de

This email sent to j...@oyosys.de




 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Textfield and change event

2009-07-24 Thread Francesco Romano

Good idea...
but...
I pass a class binding but it's not used:





qtaObserveField: AjaxObserveField {
class = "cprod-item-qta";
action = quantityChanged;
updateContainerID = "cartListContainer";
elementName = "li";
}



ASB.observeDescendentFields('cartListContainer',  
'e_11_3_1_0_1_5', null, true, null, {_asbn:'11.3.1.0.1.5'});
Further more... how can I use th ajaxUpdateTrigger? The doc is not so  
clear...

Francesco



On 24/lug/09, at 17:49, Johann Werner wrote:


Hi Francesco,





Now I remember why.. because the observer is a div and it  
"destroyed" my layout.. but I found the right place and now it  
seems to work


you could use the binding 'elementName' of AjaxObserveField to let  
it use e.g. li instead of div


jw



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Textfield and change event


On 24/lug/09, at 14:41, Johann Werner wrote:


Am 24.07.2009 um 12:30 schrieb Francesco Romano:


I was thinking 
Maybe I'm totally wrong...
Looking at the log I can see that it reload all the page.. this is  
right... because my container contains almost all the page..

But.. i don't like this...
The problem is that:
1) the removeItem link must reload all the page (it changes the  
array)


why must it reload all the page? It is sufficient if the  
updateContainer encloses the part of the page where the array is used.




Yes



but
2) the observeField event must change only few part of the page (5  
static strings)
The problem is that those part are not near, so I can't use a  
unique ajaxcontainer.. but.. in the observeField I can only pass a  
unique container ID..


You could use AjaxUpdateTrigger or use directly javascript. To  
update an updateContainer there is a function  
Update() you can use.




I'll try with AjaxUpdateTrigger




What can I do?

Francesco


On 24/lug/09, at 12:22, Francesco Romano wrote:


I changed to this:

...




 <-- it's simply a 





why not replace this:






with


 


and eliminate the id bindings of both tags? Just one possible  
pitfall less...





Now I remember why.. because the observer is a div and it "destroyed"  
my layout.. but I found the right place and now it seems to work




...











___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Textfield and change event


Ok.. I've some problems...
The first thing I tried is to add the ObserveField to observe one field.
It works.. but... I realized that the field to be observed is inside a  
wo:loop.. so I removed the binding observeFieldID but now it doesn't  
work...


This is a piece of the html:

  <--- the ajaxUpdateContainer




   <--- 
the observefield






"$anItem.product.nome" framework = "app"/>










			 <--this it the field(s)  
to be observed		



























The wod (only the ajax-related)

quantityField: WOTextField {
value = anItem.quantity;
otherTagString = "size = \"3\"";
numberformat = "0";
//id = "qtaField";
}

removeItem: AjaxUpdateLink {
 action = removeItem;
 string = "Rimuovi";
 updateContainerID = "cartListContainer";
}

qtaObserveField: AjaxObserveField {
//observeFieldID = "qtaField";
action = quantityChanged;
updateContainerID = "cartListContainer";
}


cartUpdateContainer: AjaxUpdateContainer {
id = "cartListContainer";
}

By the way... the removeItem update link works.


Francesco

On 23/lug/09, at 19:35, Amedeo Mantica wrote:


use AjaxObserveField

Regards
Amedeo

On 23/lug/09, at 18:29, Francesco Romano wrote:


Hi.

I have a WOTextfield in a page.
I'd like to call an action if the content of the textfield changes.
I tried to insert it inside a woform but this "destroyed" my html  
layout, and the event is called only after the "return" button is  
pressed.
I don't need (now, but in the future I'll add some ajax functions  
to the site) to do this in the "ajax-way", only to call the action.


Thanks.

Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/amedeomailing%40insigno.it

This email sent to amedeomail...@insigno.it





 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Textfield and change event


Hi.

I have a WOTextfield in a page.
I'd like to call an action if the content of the textfield changes.
I tried to insert it inside a woform but this "destroyed" my html  
layout, and the event is called only after the "return" button is  
pressed.
I don't need (now, but in the future I'll add some ajax functions to  
the site) to do this in the "ajax-way", only to call the action.


Thanks.

Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about fetching

I want to say that this is the first time I do something dynamic for  
the web (like an e-commerce site, or a web app) and it's not my job..  
I'm a student and I'm doing a favor to my father...

So... I'm open to every advices, even not related to WO.

Now, my ideas (maybe I've already written this..) is to use direct  
actions (well.. stateless component, not using a session, etc) until a  
customer add a product to a cart. In that moment the session is  
created and saves the products/quantity. When a customer want to  
checkout the order he must login, passing to a https page, etc...  
(It's a bit far right now... First I've to finish the "presentation"  
part..).


So.. that was my idea.. but... due to my inexperience it can be wrong.  
(completely or partially).


So.. from what you write to me I've to doubts:
1) During the "presentation" part I don't want/need a session.. so I  
use direct actions.

This is an example URL:
.../PNStore.woa/wa/listProducts?merceologia=7
Is it wrong to pass a pk in the URL? (right now I don't know if I'll  
use an custom identifier for my products.. maybe I will (it's better)  
but I've to talk with my father to decide the format...

So.. maybe is better to pass this ProductID and fetch it?

2) The "cart system"
Now I don't save the cart... So if the session expires, you don't have  
the cart saved...

Do you think I've to save it?
And.. if yes.. I don't understand how.. Well.. for registered customer  
I can save in the db, but for anonymous? I'd like that someone could  
choose the products and only before paying login...


Bye.. and... thanks!


Francesco



On 21/lug/09, at 15:26, Christian Trotobas wrote:



On 21 juil. 2009, at 15:19, Francesco Romano wrote:



On 21/lug/09, at 12:43, Christian Trotobas wrote:



On 21 juil. 2009, at 12:19, Francesco Romano wrote:


Thanks to both.
I read that chapter in the Apple documentation.
If I understand correctly the globalID has its scope in the  
editingcontext.
I don't know why but I create a new editing context for each  
page... so this is bad. Should I keep a single editing context?  
(until a customer add the first product in the cart I don't have  
a session.., so I don't have access to  
session().defaultEditingContext()).


Take a look at EOSharedEditingContext. Seems to me this is what  
you are looking for.

http://devworld.apple.com/documentation/InternetWeb/Reference/WO542Reference/com/webobjects/eocontrol/EOSharedEditingContext.html

Search the mailing list for EOSharedEditingContext, too.



Ok.. I read that.
For every read-only fetch I changed
ERXEC.newEditingContext()
with
EOSharedEditingContext.defaultSharedEditingContext();



Except this problem, I can do this: (?)

	Number pk = product.primaryKey(); //it's a string.. I'll cast to  
number

EOEditingContext ec = ERXEC.newEditingContext()
	EOEntity entity =  
EOModelGroup.defaultGroup().entityNamed("Product");

EOGlobalID gid = entity.globalIDForRow(new NSDictionary(pk,"id"));
Product p = (product) ec.faultForGlobalID(gid);
Looks good. But Andrew's advice was more an example on how things  
work, rather than an advise on what exactly your code should look  
like.
Use a shareEditingContext for Products, then a simple  
defaultEditingEditing from your Session to store the cart.


Christian


I don't understand " then a simple defaultEditingEditing from your  
Session to store the cart."

I thought to use a simple NSMutableArray in the session.


Well... that could work, but you ought to go the EOF way. And it is  
something like having an EO to store your customer, then have  
another EO to store the cart, then other EO to store the fact that a  
Product is in the cart.

Something like :

Customer <-->> Cart ->> Lines -> Product

All but Product "belong" to an editingContext in the Session, aka  
the defaultEditingContext to make it simple.


Lines could store the quantity, the price, etc, etc.

Christian




Francesco





Thanks
Francesco





Hello Francesco;

You can construct an EOGlobalID from the primary key an fault  
it.  I would generally not advocate using the primary key in  
this manner as it may be volatile owing to migration of schema  
or database product migration.  That concern aside, assuming you  
have a primary key and it has an attribute name of "id";


Number pk = ???
EOEditingContext ec = ???
	EOEntity entity =  
EOModelGroup.defaultGroup().entityNamed("FooBar");
	EOGlobalID gid = entity.globalIDForRow(new  
NSDictionary(pk,"id"));

FooBar = (FooBar) ec.faultForGlobalID(gid);

Hope this helps.

cheers.


On 21/lug/09, at 11:24, Christian Trotobas wrote:


Hi Francesco


On 21 juil. 2009, at 09:56, Francesco Romano wrote:


Hi..
This is a simpl

Re: Question about fetching



On 21/lug/09, at 12:43, Christian Trotobas wrote:



On 21 juil. 2009, at 12:19, Francesco Romano wrote:


Thanks to both.
I read that chapter in the Apple documentation.
If I understand correctly the globalID has its scope in the  
editingcontext.
I don't know why but I create a new editing context for each  
page... so this is bad. Should I keep a single editing context?  
(until a customer add the first product in the cart I don't have a  
session.., so I don't have access to  
session().defaultEditingContext()).


Take a look at EOSharedEditingContext. Seems to me this is what you  
are looking for.

http://devworld.apple.com/documentation/InternetWeb/Reference/WO542Reference/com/webobjects/eocontrol/EOSharedEditingContext.html

Search the mailing list for EOSharedEditingContext, too.



Ok.. I read that.
For every read-only fetch I changed
ERXEC.newEditingContext()
with
EOSharedEditingContext.defaultSharedEditingContext();



Except this problem, I can do this: (?)

	Number pk = product.primaryKey(); //it's a string.. I'll cast to  
number

EOEditingContext ec = ERXEC.newEditingContext()
	EOEntity entity =  
EOModelGroup.defaultGroup().entityNamed("Product");

EOGlobalID gid = entity.globalIDForRow(new NSDictionary(pk,"id"));
Product p = (product) ec.faultForGlobalID(gid);
Looks good. But Andrew's advice was more an example on how things  
work, rather than an advise on what exactly your code should look  
like.
Use a shareEditingContext for Products, then a simple  
defaultEditingEditing from your Session to store the cart.


Christian


I don't understand " then a simple defaultEditingEditing from your  
Session to store the cart."

I thought to use a simple NSMutableArray in the session.

Francesco





Thanks
Francesco





Hello Francesco;

You can construct an EOGlobalID from the primary key an fault it.   
I would generally not advocate using the primary key in this  
manner as it may be volatile owing to migration of schema or  
database product migration.  That concern aside, assuming you have  
a primary key and it has an attribute name of "id";


Number pk = ???
EOEditingContext ec = ???
	EOEntity entity =  
EOModelGroup.defaultGroup().entityNamed("FooBar");

EOGlobalID gid = entity.globalIDForRow(new NSDictionary(pk,"id"));
FooBar = (FooBar) ec.faultForGlobalID(gid);

Hope this helps.

cheers.


On 21/lug/09, at 11:24, Christian Trotobas wrote:


Hi Francesco


On 21 juil. 2009, at 09:56, Francesco Romano wrote:


Hi..
This is a simple (and maybe stupid) question.

No question is stupid on this list. Feel free to ask.

I'm doing an application (an e-commerce application.. maybe wo is  
not the best choice, but I know java better than ruby..), and  
I've some pages accessed with directaction.
WebObjects is a pretty good choice for ecommerce; take a look at  
the Apple Store to be sure :)


Maybe I'm wrong, but I can pass values to a page only with the  
url, so.. only strings.
In a page I select an EntityObject and I've to pass to the other  
page.
If I can't pass the whole object, I would like to pass the  
primary key, so fetching should be faster..

But.. I can get the key, but I can't fetch an Object with it's PK.
Now i pass a name (a description string..).. but it's not unique,  
so even with low probability, there can be collisions..
You should use a product ID which would be unique, like a part  
number for example. It will be usefull too for accounting purpose,  
and not only for the app internals. As a unique key, the PK could  
be used, but depending on the nature of your business, you might  
want to avoid exposing PK on the web: they should be considered  
both confidential and subject to changes for technical reasons  
(though it is very unlikely to occur).


In WebObjects, the EOF framework provides a unique identifier for  
EO: it is the EOGlobalID. Basically, it is a compound from the  
EOEntity name and the PK from the table (out of the box, it is how  
it works; for specific reason out of the scope of your question,  
it happens that it is not the PK; again, it is very unlikeky to  
occur for standard/simple uses, so don't bother about this, it was  
just for information purpose). Therefore, in your app, if you are  
looking for a unique identifier for your EO objects, you have to  
use the EOGlobalID and not the PK. Understanding how EOF handles  
the uniquing of objects is one the keys for your successfull  
development with WebObjects.

Take a close look at:
http://developer.apple.com/documentation/Webobjects/Enterprise_Objects/Fetching/Fetching.html#/ 
/apple_ref/doc/uid/TP30001011-CH206-BADHCCEE


Hope that helps.
Christian Trotobas




What can I do?

Thanks

Francesco Romano



___
Do not post admin requests to the l

Re: Question about fetching


Thanks to both.
I read that chapter in the Apple documentation.
If I understand correctly the globalID has its scope in the  
editingcontext.
I don't know why but I create a new editing context for each page...  
so this is bad. Should I keep a single editing context? (until a  
customer add the first product in the cart I don't have a session..,  
so I don't have access to session().defaultEditingContext()).


Except this problem, I can do this: (?)

Number pk = product.primaryKey(); //it's a string.. I'll cast to number
EOEditingContext ec = ERXEC.newEditingContext()
EOEntity entity = EOModelGroup.defaultGroup().entityNamed("Product");
EOGlobalID gid = entity.globalIDForRow(new NSDictionary(pk,"id"));
Product p = (product) ec.faultForGlobalID(gid);


Thanks
Francesco





Hello Francesco;

You can construct an EOGlobalID from the primary key an fault it.  I  
would generally not advocate using the primary key in this manner as  
it may be volatile owing to migration of schema or database product  
migration.  That concern aside, assuming you have a primary key and  
it has an attribute name of "id";


Number pk = ???
EOEditingContext ec = ???
EOEntity entity = EOModelGroup.defaultGroup().entityNamed("FooBar");
EOGlobalID gid = entity.globalIDForRow(new NSDictionary(pk,"id"));
FooBar = (FooBar) ec.faultForGlobalID(gid);

Hope this helps.

cheers.


On 21/lug/09, at 11:24, Christian Trotobas wrote:


Hi Francesco


On 21 juil. 2009, at 09:56, Francesco Romano wrote:


Hi..
This is a simple (and maybe stupid) question.

No question is stupid on this list. Feel free to ask.

I'm doing an application (an e-commerce application.. maybe wo is  
not the best choice, but I know java better than ruby..), and I've  
some pages accessed with directaction.
WebObjects is a pretty good choice for ecommerce; take a look at the  
Apple Store to be sure :)


Maybe I'm wrong, but I can pass values to a page only with the url,  
so.. only strings.
In a page I select an EntityObject and I've to pass to the other  
page.
If I can't pass the whole object, I would like to pass the primary  
key, so fetching should be faster..

But.. I can get the key, but I can't fetch an Object with it's PK.
Now i pass a name (a description string..).. but it's not unique,  
so even with low probability, there can be collisions..
You should use a product ID which would be unique, like a part  
number for example. It will be usefull too for accounting purpose,  
and not only for the app internals. As a unique key, the PK could be  
used, but depending on the nature of your business, you might want  
to avoid exposing PK on the web: they should be considered both  
confidential and subject to changes for technical reasons (though it  
is very unlikely to occur).


In WebObjects, the EOF framework provides a unique identifier for  
EO: it is the EOGlobalID. Basically, it is a compound from the  
EOEntity name and the PK from the table (out of the box, it is how  
it works; for specific reason out of the scope of your question, it  
happens that it is not the PK; again, it is very unlikeky to occur  
for standard/simple uses, so don't bother about this, it was just  
for information purpose). Therefore, in your app, if you are looking  
for a unique identifier for your EO objects, you have to use the  
EOGlobalID and not the PK. Understanding how EOF handles the  
uniquing of objects is one the keys for your successfull development  
with WebObjects.

Take a close look at:
http://developer.apple.com/documentation/Webobjects/Enterprise_Objects/Fetching/Fetching.html#/ 
/apple_ref/doc/uid/TP30001011-CH206-BADHCCEE


Hope that helps.
Christian Trotobas




What can I do?

Thanks

Francesco Romano



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/trotobas%40mac.com

This email sent to troto...@mac.com




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Question about fetching


Hi..
This is a simple (and maybe stupid) question.
I'm doing an application (an e-commerce application.. maybe wo is not  
the best choice, but I know java better than ruby..), and I've some  
pages accessed with directaction.
Maybe I'm wrong, but I can pass values to a page only with the url,  
so.. only strings.

In a page I select an EntityObject and I've to pass to the other page.
If I can't pass the whole object, I would like to pass the primary  
key, so fetching should be faster..

But.. I can get the key, but I can't fetch an Object with it's PK.
Now i pass a name (a description string..).. but it's not unique, so  
even with low probability, there can be collisions..


What can I do?

Thanks

Francesco Romano



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: W3C validation and ERXBatchNavigationBar


Thanks for the reply...
I had an error when I sent my first mail to the lists, so I completely  
forgot the discussion...


I'll have a look a that class.. but.. if I understand correctly I  
should use another framework?



Francesco



On 24/gen/09, at 15:50, Ravi Mendis wrote:



On Friday, January 23, 2009, at 01:31AM,   
wrote:



Sounds like a good idea. One question though: have you considered
contributing back to Wonder the components you've overridden from  
it?



In Ravi's defense, they did completely offer all of their stuff back
to Wonder, actually ... It was some work to integrate into Wonder
because their code was 5.4 only, as I recall, and we needed to
maintain a 5.3/5.4-safe build.


Indeed, when the time is right Diva and all it's components will be  
submitted back to Wonder.


(As with most WebObjects/D2W apps in production/commercial  
environments, we also use Wonder.

So ERDivaLook was developed to be a "good citizen" of Wonder).

And yes, being based on a "table-less" XHTML foundation, it really  
is 5.4-only.
But once we made that transition, we were able to dabble in Web 2.0/ 
Ajax-y stuff (easily).


...to that end it's got some very exciting new features coming soon :)

Thanks,
Ravi
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/fra.makaveli%40gmail.com

This email sent to fra.makav...@gmail.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


W3C validation and ERXBatchNavigationBar

Hi... I've no time to continue developing so I decided to "validate"  
my app...

Now... here is the problem:
ERXBatchNavigatorBar give me 40 errors! Is there a way to change..  
something.. ?


(I'm using XHTML 1.0 Transitional doctype)

Francesco




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


W3C validation: ERXBatchNavigationBar



Hi... I've no time to continue developing so I decided to "validate"  
my app...

Now... here is the problem:
ERXBatchNavigatorBar give me 40 errors! Is there a way to change..  
something.. ?


(I'm using XHTML 1.0 Transitional doctype)

Francesco




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


W3C validation - ERXBatchNavigationBar

Hi... I've no time to continue developing so I decided to "validate"  
my app...

Now... here is the problem:
ERXBatchNavigatorBar give me 40 errors! Is there a way to change..  
something.. ?


(I'm using XHTML 1.0 Transitional doctype)

Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: how to resize an image


Ok...
I've just discovered ssh tunnel..
So.. I deployed the application and it works. Thanks for the help.




On 10/gen/09, at 17:45, Hugi Thordarson wrote:


Try setting the property java.awt.headless=true

Cheers,
- Hugi

// Hugi Thordarson
// http://hugi.karlmenn.is/



On 10.1.2009, at 16:16, Francesco Romano wrote:


Hi...
I'm having some difficults trying to resize an image.


Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: how to resize an image


On my developer machine it seems to work..
Now I have to deploy it and test.

Thanks.

On 10/gen/09, at 17:45, Hugi Thordarson wrote:


Try setting the property java.awt.headless=true

Cheers,
- Hugi

// Hugi Thordarson
// http://hugi.karlmenn.is/



On 10.1.2009, at 16:16, Francesco Romano wrote:


Hi...
I'm having some difficults trying to resize an image.


Francesco



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: WO 5.3 or 5.4



On 23/dic/08, at 17:43, Michael DeMan (WO) wrote:

I have developed WO 5.4 under OSX 10.4, including switching back and  
forth.  If you are just getting started, I would recommend trying to  
get 5.4 running if you can.  Ideally, upgrading your machine to OSX  
10.5 is the way to go, but if that is impossible then...



You want to swap out the WebObjects 5.3 and 5.4 frameworks on your  
local machine - or rather, replace the 5.3 frameworks with the 5.4  
frameworks.


Download the WO 5.4 installer and open it up so you can see the  
frameworks.


More details on what you should see, and where it should go is at:

http://wiki.objectstyle.org/confluence/display/WO/WO+5.4+Getting+Started#WO5.4GettingStarted-DevelopingwithbothWebObjects5.4and5.3

- Mike




So I've to download Xcode 3.0 (the package) to my Tiger machine, open  
the package (not "double click") and searching for the frameworks and  
copying to /System/Library/Frameworks ?

Then I can install Wonder 5.4 in /Libray/Framework ?

Can I simply "copy" the framework from my Leopard Machine?

Francesco



Francesco Romano wrote:



On 23/dic/08, at 17:09, Simon McLean wrote:





On 23 Dec 2008, at 16:03, Francesco Romano wrote:


On 23/dic/08, at 16:55, Pascal Robert wrote:



Le 08-12-23 à 10:50, Francesco Romano a écrit :


Hi... I made a little mistake...
I'm learning WO and developing an application. I use Leopard.
The computer where I'll deploy the app use Tiger... (so I think  
it can't have WO 5.4)


If Java 1.5 is available on the Tiger box, you can use 5.4.  
Embed the WO frameworks in your app, this way you won't have to  
install 5.4 on the Tiger box.




How can I do that?


assuming you are using Wonder, put these in your build.properties

embed.ProjectLocal=true
embed.External=true
embed.Local=true
embed.User=true
embed.System=true
embed.Network=true


I'm using Wonder..
I tried this but it does not work (it continue to read the  
frameworks in /Library/Frameworks on the deployment computer).


I added this in the file Properties in Resources,... is the wrong  
place?



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40deman.com

This email sent to webobje...@deman.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/fra.makaveli%40gmail.com

This email sent to fra.makav...@gmail.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: WO 5.3 or 5.4




On 23/dic/08, at 17:09, Simon McLean wrote:





On 23 Dec 2008, at 16:03, Francesco Romano wrote:


On 23/dic/08, at 16:55, Pascal Robert wrote:



Le 08-12-23 à 10:50, Francesco Romano a écrit :


Hi... I made a little mistake...
I'm learning WO and developing an application. I use Leopard.
The computer where I'll deploy the app use Tiger... (so I think  
it can't have WO 5.4)


If Java 1.5 is available on the Tiger box, you can use 5.4. Embed  
the WO frameworks in your app, this way you won't have to install  
5.4 on the Tiger box.




How can I do that?


assuming you are using Wonder, put these in your build.properties

embed.ProjectLocal=true
embed.External=true
embed.Local=true
embed.User=true
embed.System=true
embed.Network=true


I'm using Wonder..
I tried this but it does not work (it continue to read the frameworks  
in /Library/Frameworks on the deployment computer).


I added this in the file Properties in Resources,... is the wrong place? ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: WO 5.3 or 5.4



On 23/dic/08, at 16:55, Pascal Robert wrote:



Le 08-12-23 à 10:50, Francesco Romano a écrit :


Hi... I made a little mistake...
I'm learning WO and developing an application. I use Leopard.
The computer where I'll deploy the app use Tiger... (so I think it  
can't have WO 5.4)


If Java 1.5 is available on the Tiger box, you can use 5.4. Embed  
the WO frameworks in your app, this way you won't have to install  
5.4 on the Tiger box.




How can I do that?
(btw: is there a "guide" to deploy? I mean.. some setting to  
adjust..like not print a lot of debug information..)




What can I do?
Is there a way to use WO 5.4 on Tiger?
If no.. How can I change my code (and develop for WO 5.3) ?

Francesco


PS:
I can also install Leopard on the iMac.. but.. I don't think this  
can be a good idea.. the Adobe Creative Suite which is in use (the  
one with Photoshop 7) does not work non Leopard..


CS2? I do think it works on Leopard, it's just that it's not Intel  
native.


Not CS2. It's older... The suite before the CS.. the iMac is a G5 
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


WO 5.3 or 5.4


Hi... I made a little mistake...
I'm learning WO and developing an application. I use Leopard.
The computer where I'll deploy the app use Tiger... (so I think it  
can't have WO 5.4)


What can I do?
Is there a way to use WO 5.4 on Tiger?
If no.. How can I change my code (and develop for WO 5.3) ?

Francesco


PS:
I can also install Leopard on the iMac.. but.. I don't think this can  
be a good idea.. the Adobe Creative Suite which is in use (the one  
with Photoshop 7) does not work non Leopard..

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to use WODisplayGroup



On 10/dic/08, at 18:50, David Holt wrote:


Hi Francesco,

On 9-Dec-08, at 11:56 PM, Francesco Romano wrote:


I've some problems with the Insert() method of WODisplayGroup.

It adds another row, but if I edit that row and I don't commit the  
EditingContext, if I insert another row the previous is been cleared.


Another thing...
I inserted a WOBatchNavigationBar.
I use it in this way:




Is this inside a form? What are the bindings you're using?

There are at least four variations of this component to choose from  
if you're using Wonder as well.

WOBatchNavigationBar - needs to be in a form
ERXBatchNavigationBar - needs to be in a form (you may want to try  
this variation)

ERXBatchNavigationBarInForm - self contained in a form (I believe)
ERXFlickrBatchNavigation - I am not sure if it needs a form




This is the whole form:






 Merceologia  Descrizione 
Prezzo
		"$aProdotto">




			"#,##0.00" />
			Mostra Dettagliwo:link>

Elimina





 Aggiungi un 
elemento

 





BatchNavigationBar: ERXBatchNavigationBar {
displayGroup = prodottiDisplayGroup;
objectName = "Prodotto";
pluralName = "Prodotti";
sortKeyList = displaySortKeys;
}

Changing from WOBatchNavigationBar to ERXbatchNavigationBar, now the  
bar is visible also if I don't have more than one pages (and that is  
good), but... there is no pluralName... sigh...


		 Merceologia  Descrizione Prezzotr>
		"$aProdotto">


			"$aMerceologia" selection = "$aProdotto.merceologia" displayString  
= "$merceologiaCompoundString"/>


			"#,##0.00" />
			Mostra Dettagliwo:link>

Elimina




Is this correct? Because when I've more than one batch this  
appeared on the debug:


I've seen this warning but it doesn't seem to have any ill effects  
when I ignore it.


David



Dec 10 08:45:13 iPN[5100] (ERXWOForm.java:435) WARN   
er.extensions.components._private.ERXWOForm  - This form is  
embedded inside another form, so the inner form with these bindings  
is being omitted: name: null id: null action: null actionClass: null  
directActionName: null href: null multipleSubmit:  
value=true> queryDictionary: null otherQueryAssociations: null >
Dec 10 08:45:13 iPN[5100] (ERXWOForm.java:436) WARN   
er.extensions.components._private.ERXWOForm  - page:  
com.ipn.components.EditProduct subcomponents: null >
Dec 10 08:45:13 iPN[5100] (ERXWOForm.java:437) WARN   
er.extensions.components._private.ERXWOForm  - component:  
com.webobjects.woextensions.WOBatchNavigationBar subcomponents:  
null >


Francesco

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com

This email sent to [EMAIL PROTECTED]




 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: many-to-many relationship and qualifiers




On 10/dic/08, at 18:42, David Holt wrote:


Hi Francesco.

On 10-Dec-08, at 8:59 AM, Francesco Romano wrote:

For the second question I solved...
I changed the datasource for the displayGroup: now I user the E12  
instead of Ent2.


By the way... a question regarding WOBatchNavigationBar..
It's very useful, but... it displays the number of objects in the  
entity, not the number of objects matching the qualifier... Is  
there a way to show that number?




Yes. You need to qualify the displayGroup so that when it loads, it  
has the correct number of objects that you wish to display.
One simple way to do this is to use a named fetch specification  
(created inside EntityModeler) associated with the display group in  
the component and make sure "fetches on load" is checked


Another way is to do the fetch and send the resulting array to the  
displayGroup
I sometimes do this in the component constructor (again so that it  
is available when the component loads)


setObjectArray(NSArray array)
  Changes the WODisplayGroup's array of allObjects to array,  
regardless of what its dataSource provides.



If you can't get it to work, post the relevant code from your  
component and the java class.





The qualifier change.. it is based on a item in a PopUpButton..

So.. I don't want to refetch everything... (I use the navigation bar  
to separate the batch... otherwise I'll "make" my own..



On 10/dic/08, at 17:43, Francesco Romano wrote:


Hi...

I read in the list that if I need an attribute in a many-to-many  
relationship I cannot create a "flattern" relationship.

So I created a simple n-to-1 1-to-n.


That sounds right



Now.. I don't understand if I need to do some more "work" in my  
classes...




What do you mean by "work"?


Well.. in the mail I read I saw some methods like  
addToBothSideOfRelation(); (I just invented... I don't remember)..

I was thinking if I need those methods...



David




And... another thing: qualifier.

Let's call Ent1 and Ent2 the 2 entities above and E12 the relation  
entity.




I want to fetch all the records in Ent2 that are linked to a  
particular Ent1.
I can't do it.. because I've an array and I don't know how to  
compare an array with a single value...


I tried something like  
Ent2.E12.eq(Ent1.E12).and(Ent1.attr1.eq(myString)) but it did not  
compile



Francesco


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com

This email sent to [EMAIL PROTECTED]


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: many-to-many relationship and qualifiers


For the second question I solved...
I changed the datasource for the displayGroup: now I user the E12  
instead of Ent2.


By the way... a question regarding WOBatchNavigationBar..
It's very useful, but... it displays the number of objects in the  
entity, not the number of objects matching the qualifier... Is there a  
way to show that number?



On 10/dic/08, at 17:43, Francesco Romano wrote:


Hi...

I read in the list that if I need an attribute in a many-to-many  
relationship I cannot create a "flattern" relationship.

So I created a simple n-to-1 1-to-n.

Now.. I don't understand if I need to do some more "work" in my  
classes...



And... another thing: qualifier.

Let's call Ent1 and Ent2 the 2 entities above and E12 the relation  
entity.


I want to fetch all the records in Ent2 that are linked to a  
particular Ent1.
I can't do it.. because I've an array and I don't know how to  
compare an array with a single value...


I tried something like  
Ent2.E12.eq(Ent1.E12).and(Ent1.attr1.eq(myString)) but it did not  
compile



Francesco


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


many-to-many relationship and qualifiers


Hi...

I read in the list that if I need an attribute in a many-to-many  
relationship I cannot create a "flattern" relationship.

So I created a simple n-to-1 1-to-n.

Now.. I don't understand if I need to do some more "work" in my  
classes...



And... another thing: qualifier.

Let's call Ent1 and Ent2 the 2 entities above and E12 the relation  
entity.


I want to fetch all the records in Ent2 that are linked to a  
particular Ent1.
I can't do it.. because I've an array and I don't know how to compare  
an array with a single value...


I tried something like  
Ent2.E12.eq(Ent1.E12).and(Ent1.attr1.eq(myString)) but it did not  
compile



Francesco
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: How to use WODisplayGroup


I've some problems with the Insert() method of WODisplayGroup.

It adds another row, but if I edit that row and I don't commit the  
EditingContext, if I insert another row the previous is been cleared.


Another thing...
I inserted a WOBatchNavigationBar.
I use it in this way:



 Merceologia  Descrizione 
Prezzo
		"$aProdotto">


			selection = "$aProdotto.merceologia" displayString =  
"$merceologiaCompoundString"/>


			"#,##0.00" />
			Mostra Dettagliwo:link>

Elimina




Is this correct? Because when I've more than one batch this appeared  
on the debug:


Dec 10 08:45:13 iPN[5100] (ERXWOForm.java:435) WARN   
er.extensions.components._private.ERXWOForm  - This form is embedded  
inside another form, so the inner form with these bindings is being  
omitted: null action: null actionClass: null directActionName: null href: null  
multipleSubmit:  
value=true> queryDictionary: null otherQueryAssociations: null >
Dec 10 08:45:13 iPN[5100] (ERXWOForm.java:436) WARN   
er.extensions.components._private.ERXWOForm  - page:  
subcomponents: null >
Dec 10 08:45:13 iPN[5100] (ERXWOForm.java:437) WARN   
er.extensions.components._private.ERXWOForm  - component:  
com.webobjects.woextensions.WOBatchNavigationBar subcomponents: null >


Francesco

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

[Almost SOLVED] Re: One-to-one relationship

I don't know why I remove the "thick" Owns destination and  
propagate key, re-assign it and now it works.


The only thing is I had to "allow null" on the attribute "Qta  
Iniziale" on the entity ProdottoPrivato..


It's not the  "Theorical" way to map a ER to tables... but... I think  
it can be OK..


Thanks to everybody

Francesco.


On 07/dic/08, at 17:36, Francesco Romano wrote:


Maybe I made something wrong...

This is my "last" version of the model:

Entity Prodotto


Entity ProdottoPrivato




Prodotto owns and propagate key to prodottoprivato.

The problem is... Prodotto needs ProdottoPrivato and prodottoPrivato  
needs prodotto..

So I created a "loop"..

ProdottoPrivato and Prodotto have a 1-to-1 relation
I can't create a Prodottoprivato without a Prodotto, but I want to  
do the inverse.

The PK of prodottoPrivato is the PK of Prodotto.

I don't know how to manage this..

Francesco


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: How to use WODisplayGroup



On 07/dic/08, at 16:05, Johann Werner wrote:

If I got your idea right you should look at WOSwitchComponent. The  
problem I mentioned in the last e-mail is if your condition  
evaluates to true (showing your rows) and then you are submitting  
changes where during the takeValues phase the condition changes to  
false the new values are not set as WO thinks that those objects are  
not on that page. This is one of those pitfalls of WO where the  
whole request-response-loop can puzzle quite easily.



jw



From Reference: WOSwitchComponent provides a way to determine at  
runtime which nested component should be displayed. This component is  
useful when you want to decide how to display information based on the  
state of the application.


I don't understand...

I have to create a full wocomponent? (with html, java, api, etc..)
If this.. I can create the component and use the hyperlink in the  
others pages to link to the right component...

Am I wrong?

Francesco ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: How to use WODisplayGroup


I'm very stupid :(

I solved the "in-place modification"... I put a wo:link instead of the  
wo:submit...


A part from that I'll wait for your hints...

Francesco



On 07/dic/08, at 15:24, Johann Werner wrote:


Hi Francesco,

Am 07.12.2008 um 14:54 schrieb Francesco Romano:


I can't modify it..

This is the code: (inside a form)





		"$aLuogo">





 aggiungiElemento
 Applica
Annulla
Salva



If I try to edit the field, and press "Apply" the record is not  
updated...

What is wrong?

(This is the code for applyChanges)

public WOActionResults applyChanges() {
session().defaultEditingContext().saveChanges();
return null;
}



First let me note that using the defaultEditingContext for modifying  
and saving objects is A Bad Thing™. Looking at your page code it  
should work but... the problems that could cause your page not  
function as you expect are:


1. when you submit the changes is it possible that your condition  
isTableLuogo changes during the takeValuesFromRequest phase?


2. what is the editingContext of your ipnDisplayGroup? If it is not  
using the default editing context of course you wont do anything by  
calling saveChanges on the defaultEditingContext.


Another little tip you should return context().page() instead of  
null. What is the difference of your applyChanges() and saveChanges()?


jw



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: How to use WODisplayGroup



On 07/dic/08, at 15:24, Johann Werner wrote:


Hi Francesco,

Am 07.12.2008 um 14:54 schrieb Francesco Romano:


I can't modify it..

This is the code: (inside a form)





		"$aLuogo">





 aggiungiElemento
 Applica
Annulla
Salva



If I try to edit the field, and press "Apply" the record is not  
updated...

What is wrong?

(This is the code for applyChanges)

public WOActionResults applyChanges() {
session().defaultEditingContext().saveChanges();
return null;
}



First let me note that using the defaultEditingContext for modifying  
and saving objects is A Bad Thing™. Looking at your page code it  
should work but... the problems that could cause your page not  
function as you expect are:


1. when you submit the changes is it possible that your condition  
isTableLuogo changes during the takeValuesFromRequest phase?


2. what is the editingContext of your ipnDisplayGroup? If it is not  
using the default editing context of course you wont do anything by  
calling saveChanges on the defaultEditingContext.


Another little tip you should return context().page() instead of  
null. What is the difference of your applyChanges() and saveChanges()?


jw



I'm learning webobject while coding.. So I can do errors and do  
something "very ugly" that (temporary) work.. I'm happy to be  
corrected! (it was the same with Cocoa when I started :) )


So...
The easiest answer:
The difference between Apply and save is that apply commit the  
changes, and save commit changes and change page.


Than... why I use that condition...
Maybe I'm making a "very bad Thing"... There are a lot of  
WOComponent... so.. I created a generic WOComponent to show the  
tables... and with the if I check which table should I show... is this  
a bad thing? (I think yes...)


This is the code when I created the WODisplayGroup:

EODatabaseDataSource ds = new  
EODatabaseDataSource(session().defaultEditingContext(),_table);

ipnDisplayGroup.setDataSource(ds);
ipnDisplayGroup.fetch();

And... if using defaultEditingContext is a bad thing.. what should I  
use??



Francesco ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: How to use WODisplayGroup



On 06/dic/08, at 20:30, Ramsey Lee Gurley wrote:



On Dec 6, 2008, at 9:11 AM, Francesco Romano wrote:


That could be an idea...
But... in this way a displayGroup is very similar to a simple  
array.. What are the advantages?


Display groups have batching, qualifiers, auxiliary qualifiers, sort  
orderings, and datasources.  The display group does all the heavy  
lifting for your view code.  If you were to just use arrays, you'd  
end up reinventing most of the display group.  Combine display  
groups with a batch navigation bar for more awesomeness :-)



By the way... a very simple request...
I want to bind a record attribute with a textfield.
I can do for a "read-only" page.
But is there a way to have a bidirectional bound?
I mean...this is the html

item="$luogo">





If I edit the text in the textfield how can this modify the item in  
the displayGroup (so that the only thing to do is to call  
saveChanges() on the editing context..





Yep.  That's pretty much what it does.  ORM... isn't it great? :-)   
Of course, if you want to modify the object, you'll need to drop  
that text field in a form element at the very least. I really like  
w3schools page of html elements by function.


http://www.w3schools.com/TAGS/ref_byfunc.asp

Since a wo:form maps to the form element, your html should probably  
look something like:




Hi I'm an informative legend!
 
			I'm a textfield label!id="id1"/>


I'm a label too








I can't modify it..

This is the code: (inside a form)










 aggiungiElemento
 Applica
Annulla
Salva



If I try to edit the field, and press "Apply" the record is not  
updated...

What is wrong?

(This is the code for applyChanges)

public WOActionResults applyChanges() {
session().defaultEditingContext().saveChanges();
return null;
}



For other shortcuts... or to create your own, check your eclipse  
preferences:





And, one last shortcut that might not be obvious is command  
clicking.  When you define action="$submitAction" and you get that  
red underline telling you it isn't defined in your java file, just  
command-click it and it will act like a hyperlink that creates the  
method and takes you to it in your java file.  Command clicks work  
in your java source too.


Ramsey



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: How to use WODisplayGroup


That could be an idea...
But... in this way a displayGroup is very similar to a simple array..  
What are the advantages?



By the way... a very simple request...
I want to bind a record attribute with a textfield.
I can do for a "read-only" page.
But is there a way to have a bidirectional bound?
I mean...this is the html






If I edit the text in the textfield how can this modify the item in  
the displayGroup (so that the only thing to do is to call  
saveChanges() on the editing context..


On 06/dic/08, at 14:58, Johann Werner wrote:


Hi Francesco,

you mean to use those functions as deleteSelection() and so on? I  
don't use these as I am using display groups for the sole purpose to  
display batched lists. But I think you should put a link in each row  
of a repetition with an action of displayGroup.selectObject(item)  
and then you can refer to it by displayGroup.sekectedObject() later  
on.


jw

Am 06.12.2008 um 14:42 schrieb Francesco Romano:


Thanks for the reply...
But.. how can the displaygroup manage the selection?

On 06/dic/08, at 13:27, Johann Werner wrote:



Am 06.12.2008 um 11:56 schrieb Francesco Romano:


Hi...

Looking in the API and in various sites I understand that  
WODisplayGroup could be a very useful object for managing a table..


I understand how to create it using WOLips or programmatically (I  
think the following rows are right..)


EODatabaseDataSource ds = new  
EODatabaseDataSource(session().defaultEditingContext(),_table);

displayGroup.setDataSource(ds);
displayGroup.fetch();


But.. I don't understand how to display data managed by my  
WODisplayGroup...


Somebody can explain how to do that?



The primary usage of display groups is in repetitions where you  
would use displayGroup.displayedObjects()
This gives you an NSArray that reflects the sort orderings and  
qualifiers of your display group. Additionally it returns only a  
specific batch of objects if you set  
displayGroup.setNumberOfObjectsPerBatch(int). Of course there is a  
plethora of other features to discover ;-)


jw



Francesco

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/werner%40isd.uni-stuttgart.de

This email sent to [EMAIL PROTECTED]








 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

How to use WODisplayGroup


Hi...

Looking in the API and in various sites I understand that  
WODisplayGroup could be a very useful object for managing a table..


I understand how to create it using WOLips or programmatically (I  
think the following rows are right..)


EODatabaseDataSource ds = new  
EODatabaseDataSource(session().defaultEditingContext(),_table);

displayGroup.setDataSource(ds);
displayGroup.fetch();


But.. I don't understand how to display data managed by my  
WODisplayGroup...


Somebody can explain how to do that?

Francesco

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: DirectActions and URL


ERXRedirect could be the class I was looking for...
Only a ... little... problem.. Why eclipse does not see the class? I  
can't find it.



On 01/dic/08, at 21:35, Chuck Hill wrote:



On Nov 28, 2008, at 11:34 PM, Francesco Romano wrote:


Thanks for the reply...

I tried something like:

reloadPage :WOJavaScript {
scriptString = session.getJSRefresh;
hideInComment = YES;
}

with:

public String getJSRefresh () {
if (_mainPageNeedRefresh) {
_mainPageNeedRefresh = false;
return "window.location.reload()";
}
return "";
}

(_mainPageNeedRefresh) is a boolean set to true in the login.

in the page after the login...

The problem is... it tries to redo the login.. this time without  
passing username and password.. so I'm redirect to the login page..  
(pressing the refresh button without the script is different.. it  
continue to login, with the username and password)... so.. this  
doesn't work...


But... is there a "better" way to set the URL ?


If you are using Project Wonder (and you should be), ERXRedirect may  
be what you want:




PS: I'm new to mailing lists.. I reply to the list too... Is this a  
mistake?


No, you should always reply to the list so that others may share in  
the knowledge.




((Session)session()).setCurrentUser(currentUser);

String pageToRedirect = 
currentUser.group().mainPage();
if (pageToRedirect==null)
;
else {
nextPage = 
pageWithName(pageToRedirect);


ERXRedirect redirect =  
(ERXRedirect)pageWithName(ERXRedirect.class.getName());

redirect.setComponent(nextPage);
nextPage = redirect;


Chuck



On 28/nov/08, at 21:03, Amedeo Mantica wrote:


umh, may be just a work around,..but...

in the final page you can easity trigger a javascript call in the  
page that call a void in the java file... so you got a "refresh"  
with the /wo/ftamst681g4846.../


regards

amedeo

On 27/nov/08, at 16:59, Francesco Romano wrote:


Hi.. I'm new with WebObjects and also in web programming.
I chose WO to develop a Web Application (instead of RoR)..

Now.. I'm doing a login form.. Looking a screencast from David  
LeBer I moved the LoginAction from my Main.java file to  
DirectAction.

Everything works fine.. but ... One thing is annoying.

This is the method (I've to implement the encoding of password  
yet..)



public WOActionResults loginAction() {

WOComponent nextPage = null;

String password = 
request().stringFormValueForKey("password");
String username = 
request().stringFormValueForKey("username");
String errorMessage = null;

			if (StringUtils.isEmpty(username) ||  
StringUtils.isEmpty(password)) {

errorMessage  = "Username o password necessari";
password = null;
}
else

try {
User currentUser;

	EOQualifier qualifier =  
User.USERNAME.eq(username).and(User.PASSWORD.eq(password));
	currentUser =  
User.fetchRequiredUser(ERXEC.newEditingContext(),qualifier);

if (! currentUser.active()) {
		errorMessage = "Utente attualmente disabilitato. Contattare  
l'amministratore";

password = null;
currentUser = null;
nextPage = 
pageWithName(Main.class.getName());
nextPage.takeValueForKey(errorMessage, 
"errorMessage");
nextPage.takeValueForKey(username, 
"username");
return nextPage;
}

((Session)session()).setCurrentUser(currentUser);

String pageToRedirect = 
currentUser.group().mainPage();
if (pageToRedirect==null)
;
else {
nextPage = 
pageWithName(pageToRedirect);
}
   

Re: One-to-one relationship


It's seems that EOM can't model FK with more than one attributes..
So the previous question (if create two-attributes PKs) is answered...  
I'll create very simple PK with one attribute of type id (sigh..)



On 30/nov/08, at 08:56, Francesco Romano wrote:


Ok.. maybe it's a bit better...

this are the two entities:

ProdottoPrivato


Prodotto



Prodotto owns and propagate the PK to ProdottoPrivato...

Now.. I've a doubt...Prodotto has its own PK and the key of the  
entity MERCEOLOGIA. So.. prodotto propagates the key...?? both?
(maybe now I've a problem with the theory... if prodottoID is a  
field ID (a serial) does make sense to have a foreign primary key?  
In my theorical point of view I thought something like:

MERCEOLOGIA PK | Prodotto ID
1  1
1   2
2   1

but I don't think the db do something like that... Am I right? The  
dbms continue to increment the prodotto_id?



Now...  the last two questions...
1) It's better to have a PK with the two fields (strings) OR a PK of  
type id and add a unique index on the 2 attributes? (performance,  
etc..)
2) About inverse relationship... this are saved only in the class  
graph, not in the db ?
I checked a one-to-many relation... even if in the migration the "n"  
entity has a FK to the "1" entity, it doesn't have it in the db.
So.. How does it work? I thought migration was the "interface" to  
the db...



Thanks
Francesco

On 29/nov/08, at 22:15, Miguel Angel Torres Avila wrote:


Hi Francesco

This an example of a mandatory one to one relationship, for any  
prodotto it is obligated to generate a PRODOTTOESTERNO.


First you should select the owner entity, I mean the principal one.  
And I suggest the use of ID's like prodotto_id instead just id.


PRODOTTO
prodotto_id PRIMARY KEY NOT NULL,
descrizione
referenza
prezzo  
foto


PRODOTTOESTERNO
prodotto_id   REFERENCES PRODOTTO ON DELETE CASCADE PRIMARY KEY NOT  
NULL

qtaIniziale
note


In the modeler you should create a relationship from  
PRODOTTOESTERNO to PRODOTTO connecting PRODOTTOESTERNO. prodotto_id  
to PRODOTTO. prodotto_id.

The rules in modeler should look like this:



Now create a new relationship from PRODOTTO to PRODOTTOESTERNO and  
the rules should look like this.





Now create your java Classes and Prodotto will have a  
PRODOTTOESTERNO() function and PRODOTTOESTERNO will have a  
PRODOTTO() function.
This way you will create a new Prodddotto's object and once you  
insert it into an Editing Context the ProdottoEsterno related to it  
will be created automatically.


Hope this helps.




On Nov 29, 2008, at 1:23 PM, Francesco Romano wrote:


Hi...
I'm having some problems passing from the "teorical" ER model , to  
design the real model using EOModeller.


Using the Entity-Relationship model I designed the following tables:

MERCEOLOGIA (nome,marca)
PRODOTTO (id,descrizione, referenza, prezzo, foto )
LUOGO (nome)
PRODOTTOESTERNO (PRODOTTO, qtaIniziale, note)
DISPONIBILITA (PRODOTTO,descrizione)
LUOGO-PRODOTTO (luogo, prodotto, quantita)

Where: the uppercase word is the Entity, between the brackets  
there are the attributes. The underlined words are the Primary Keys.


So..
MERCEOLOGIA has a 1-to-many relation with PRODOTTO, with the PK of  
PRODOTTO is id and the PK of MERCEOLOGIA

LUOGO and PRODOTTO has many-to-many relation (plus an attribute)
PRODOTTOESTERNO has a one - to-one relation with PRODOTTO. The PK  
of PRODOTTOESTERNO is the PK of PRODOTTO

DISPONIBILITA has a one-to-many relation with PRODOTTO.

I've no problem if EOM create a "id" PK for every entity.. I add a  
Unique key on my "teorical" PK and solve this problem...


but...

I don't know how to create one-to-one relations (I can't add them  
using the button..) and how to model the "foreign" PK..


Can somebody please help me solving this?

Thanks
Francesco

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/miguel%40toracom.net

This email sent to [EMAIL PROTECTED]




___
Ing. Miguel Angel Torres Avila








 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

One-to-one relationship


Hi...
I'm having some problems passing from the "teorical" ER model , to  
design the real model using EOModeller.


Using the Entity-Relationship model I designed the following tables:

MERCEOLOGIA (nome,marca)
PRODOTTO (id,descrizione, referenza, prezzo, foto )
LUOGO (nome)
PRODOTTOESTERNO (PRODOTTO, qtaIniziale, note)
DISPONIBILITA (PRODOTTO,descrizione)
LUOGO-PRODOTTO (luogo, prodotto, quantita)

Where: the uppercase word is the Entity, between the brackets there  
are the attributes. The underlined words are the Primary Keys.


So..
MERCEOLOGIA has a 1-to-many relation with PRODOTTO, with the PK of  
PRODOTTO is id and the PK of MERCEOLOGIA

LUOGO and PRODOTTO has many-to-many relation (plus an attribute)
PRODOTTOESTERNO has a one - to-one relation with PRODOTTO. The PK of  
PRODOTTOESTERNO is the PK of PRODOTTO

DISPONIBILITA has a one-to-many relation with PRODOTTO.

I've no problem if EOM create a "id" PK for every entity.. I add a  
Unique key on my "teorical" PK and solve this problem...


but...

I don't know how to create one-to-one relations (I can't add them  
using the button..) and how to model the "foreign" PK..


Can somebody please help me solving this?

Thanks
Francesco

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: DirectActions and URL


Thanks for the reply...

I tried something like:

reloadPage :WOJavaScript {
scriptString = session.getJSRefresh;
hideInComment = YES;
}

with:

public String getJSRefresh () {
if (_mainPageNeedRefresh) {
_mainPageNeedRefresh = false;
return "window.location.reload()";
}
return "";
}

(_mainPageNeedRefresh) is a boolean set to true in the login.

in the page after the login...

The problem is... it tries to redo the login.. this time without  
passing username and password.. so I'm redirect to the login page..  
(pressing the refresh button without the script is different.. it  
continue to login, with the username and password)... so.. this  
doesn't work...


But... is there a "better" way to set the URL ?


PS: I'm new to mailing lists.. I reply to the list too... Is this a  
mistake?



On 28/nov/08, at 21:03, Amedeo Mantica wrote:


umh, may be just a work around,..but...

in the final page you can easity trigger a javascript call in the  
page that call a void in the java file... so you got a "refresh"  
with the /wo/ftamst681g4846.../


regards

amedeo

On 27/nov/08, at 16:59, Francesco Romano wrote:


Hi.. I'm new with WebObjects and also in web programming.
I chose WO to develop a Web Application (instead of RoR)..

Now.. I'm doing a login form.. Looking a screencast from David  
LeBer I moved the LoginAction from my Main.java file to DirectAction.

Everything works fine.. but ... One thing is annoying.

This is the method (I've to implement the encoding of password yet..)


public WOActionResults loginAction() {

WOComponent nextPage = null;

String password = 
request().stringFormValueForKey("password");
String username = 
request().stringFormValueForKey("username");
String errorMessage = null;

			if (StringUtils.isEmpty(username) ||  
StringUtils.isEmpty(password)) {

errorMessage  = "Username o password necessari";
password = null;
}
else

try {
User currentUser;

	EOQualifier qualifier =  
User.USERNAME.eq(username).and(User.PASSWORD.eq(password));
	currentUser =  
User.fetchRequiredUser(ERXEC.newEditingContext(),qualifier);

if (! currentUser.active()) {
		errorMessage = "Utente attualmente disabilitato. Contattare  
l'amministratore";

password = null;
currentUser = null;
nextPage = 
pageWithName(Main.class.getName());
nextPage.takeValueForKey(errorMessage, 
"errorMessage");
nextPage.takeValueForKey(username, 
"username");
return nextPage;
}

((Session)session()).setCurrentUser(currentUser);

String pageToRedirect = 
currentUser.group().mainPage();
if (pageToRedirect==null)
;
else {
nextPage = 
pageWithName(pageToRedirect);
}


}
catch (NoSuchElementException e) {
errorMessage = "Utente non trovato o 
password sbagliata";
}
catch (Exception e) {
NSLog.out.appendln("Some exceptions during 
login");
}

if (! StringUtils.isEmpty(errorMessage)) {
nextPage = 
pageWithName(Main.class.getName());
nextPage.takeValueForKey(errorMessage, 
"errorMessage");
nextPage.takeValueForKey(username, 
"username");
}

return nextPage;
}

Then... this is the URL after the acti

DirectActions and URL


Hi.. I'm new with WebObjects and also in web programming.
I chose WO to develop a Web Application (instead of RoR)..

Now.. I'm doing a login form.. Looking a screencast from David LeBer I  
moved the LoginAction from my Main.java file to DirectAction.

Everything works fine.. but ... One thing is annoying.

This is the method (I've to implement the encoding of password yet..)


public WOActionResults loginAction() {

WOComponent nextPage = null;

String password = 
request().stringFormValueForKey("password");
String username = 
request().stringFormValueForKey("username");
String errorMessage = null;

if (StringUtils.isEmpty(username) || 
StringUtils.isEmpty(password)) {
errorMessage  = "Username o password necessari";
password = null;
}
else

try {
User currentUser;

	EOQualifier qualifier =  
User.USERNAME.eq(username).and(User.PASSWORD.eq(password));
	currentUser =  
User.fetchRequiredUser(ERXEC.newEditingContext(),qualifier);

if (! currentUser.active()) {
		errorMessage = "Utente attualmente disabilitato. Contattare  
l'amministratore";

password = null;
currentUser = null;
nextPage = 
pageWithName(Main.class.getName());
nextPage.takeValueForKey(errorMessage, 
"errorMessage");
nextPage.takeValueForKey(username, 
"username");
return nextPage;
}

((Session)session()).setCurrentUser(currentUser);

String pageToRedirect = 
currentUser.group().mainPage();
if (pageToRedirect==null)
;
else {
nextPage = 
pageWithName(pageToRedirect);
}


}
catch (NoSuchElementException e) {
errorMessage = "Utente non trovato o 
password sbagliata";
}
catch (Exception e) {
NSLog.out.appendln("Some exceptions during 
login");
}

if (! StringUtils.isEmpty(errorMessage)) {
nextPage = 
pageWithName(Main.class.getName());
nextPage.takeValueForKey(errorMessage, 
"errorMessage");
nextPage.takeValueForKey(username, 
"username");
}

return nextPage;
}

Then... this is the URL after the action:
http://192.168.1.2:5100/cgi-bin/WebObjects/iPN.woa/wa/login
even when it's redirect to the WOComponent...
If someone refresh the page, a new login action is done, changing the  
session.

I'd like to have, after the login, the url changed to something like
 
http://192.168.1.2:5100/cgi-bin/WebObjects/iPN.woa/wo/xmxE5KfCss9XG4PiGGzmUg/0.0.5.1
so if someone press refresh the login action is not called...


Any help?

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]