ERD2WCustomQueryBoolean uiStyle
ERD2WCustomQueryBoolean uiStyle
- Subject: ERD2WCustomQueryBoolean uiStyle
- From: Theodore Petrosky <email@hidden>
- Date: Sat, 18 Feb 2012 08:01:43 -0800 (PST)
Based on what you suggested and the fact that my EO is using the integer booleans in the database here is what I came up with:
public void setValue(String newValue) throws Exception {
int returnValue = 0;
propertyKey =(String) valueForBinding("propertyKey");
displayGroup = (WODisplayGroup)valueForBinding("displayGroup");
if(newValue == null || newValue == "don't care" || newValue == "-- Select --") {
displayGroup.queryMatch().takeValueForKey(null, propertyKey);
displayGroup.queryOperator().takeValueForKey(null, propertyKey);
} else {
if (newValue.equalsIgnoreCase("true")) {
returnValue = 1;
} else if (newValue.equalsIgnoreCase("false")){
returnValue = 0;
}
displayGroup.queryMatch().takeValueForKey(returnValue, propertyKey);
displayGroup.queryOperator().takeValueForKey("=", propertyKey);
}
}
public EOEnterpriseObject object;
public String propertyKey;
public Object item;
public WODisplayGroup displayGroup;
private static NSArray<String> list = new NSArray<String>(new String[] {"true", "false"});
//NSLog.out.appendln("setValue in the boolean popup " + returnValue );
}
It works. Is there a better way? I guess if I were to do this 'correctly' I would figure out whether the incoming value is a string or int. In this case I guess I should rename my method:
TPSD2WQueryBooleanIntComponent
Ted
>
> Message: 2
> Date: Fri, 17 Feb 2012 12:35:31 -0800 (PST)
> From: Theodore Petrosky <email@hidden>
> To: email@hidden
> Cc: email@hidden
> Subject: Re: ERD2WCustomQueryBoolean uiStyle
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset=iso-8859-1
>
> Oh now the error message makes sense. you use 'true' for
> true. I am using 1 and 0 (int booleans). I will have to
> adjust this.
>
> Ted
>
> > >>
> > >> Message: 7
> > >> Date: Sun, 12 Feb 2012 08:09:00 -0600
> > >> From: James Cicenia <email@hidden>
> > >> To: WebObjects-Dev Mailing List List <email@hidden>
> > >> Subject: Re: ERD2WCustomQueryBoolean uiStyle
> > >> Message-ID: <email@hidden>
> > >> Content-Type: text/plain; charset="utf-8"
> > >>
> > >> Good question. A long time ago I couldn't find
> one,
> > so I
> > >> created my own and never looked again.
> > >>
> > >> HTH
> > >> James
> > >>
> > >>
> > >> binding:
> > >>
> > >> PopUpBoolean: WOPopUpButton {
> > >> list = list;
> > >> selection = value;
> > >> noSelectionString = "--
> > Select --";
> > >> item = item;
> > >> }
> > >>
> > >>
> > >> code:
> > >>
> > >>
> > >>
> > >> public class TOSD2WQueryBooleanComponent
> extends
> > >> ERDCustomQueryComponent
> > >> {
> > >>
> > >> public
> > TOSD2WQueryBooleanComponent(WOContext
> > >> context)
> > >> {
> > >>
> > super(context);
> > >> }
> > >>
> > >> public NSArray list()
> > >> {
> > >> return list;
> > >> }
> > >>
> > >> public Object value()
> > >> {
> > >>
> > if(displayGroup != null
> > >> && displayGroup.queryMatch() != null)
> > >>
> > return
> > >>
> > displayGroup.queryMatch().objectForKey(propertyKey);
> > >> else
> > >>
> > return null;
> > >> }
> > >>
> > >> public void setValue(String
> > newValue)
> > >> throws
> > Exception
> > >> {
> > >> if(newValue
> > == "don't care")
> > >> {
> > >>
> > >>
> displayGroup.queryMatch().takeValueForKey(null,
> > >> propertyKey);
> > >>
> > >>
> displayGroup.queryOperator().takeValueForKey(null,
> > >> propertyKey);
> > >> } else
> > >> {
> > >>
> > >>
> > displayGroup.queryMatch().takeValueForKey(newValue,
> > >> propertyKey);
> > >>
> > >>
> displayGroup.queryOperator().takeValueForKey("=",
> > >> propertyKey);
> > >> }
> > >> }
> > >>
> > >> public EOEnterpriseObject
> > object;
> > >> public String propertyKey;
> > >> public Object item;
> > >> public WODisplayGroup
> > displayGroup;
> > >> private static NSArray list
> > = new NSArray(new
> > >> String[] {
> > >> "true",
> > "false"
> > >> });
> > >>
> > >> }
> > >>
> > >>
> > >> On Feb 11, 2012, at 11:40 PM, Theodore
> Petrosky
> > wrote:
> > >>
> > >>> Finally I got the query page rules
> working. It
> > seems
> > >> that I misspelled a propertyKey name.
> > >>> So, I can not figure out how to control
> the UI
> > style
> > >> of:
> > >>> ERD2WCustomQueryBoolean
> > >>>
> > >>> The default is radio buttons but I would
> love
> > to see a
> > >> popup.
> > >>>
> > >>> Ted
> > >>>
> > _______________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden