Re: EO Model problem
Re: EO Model problem
- Subject: Re: EO Model problem
- From: Marek Wawrzyczny <email@hidden>
- Date: Fri, 4 Jun 2004 16:02:21 +1000
Sure, here's a sample, we had a reason to hide access to the variables
but you don't have to do that.
public class SomeObjectSelection extends WOComponent
{
private SomeObject _someObject;
private boolean _bgToggle;
public SomeObjectSelection(WOContext context)
{
super(context);
_bgToggle = true;
}
public boolean synchronizesVariablesWithBindings()
{
return false;
}
public boolean isStateless()
{
return true;
}
<...>
public SomeObject someObjectItem()
{
return _someObject;
}
public void setSomeObject(SomeObject pSomeObject)
{
_bgToggle = !_bgToggle;
_someObject = pSomeObject;
}
public boolean toggleBg()
{
return _bgToggle;
}
public void reset()
{
_someObject = null;
_bgToggle = true;
}
}
On 03/06/2004, at 13:13, Tanmoy Roy wrote:
Hi Marek,
Can you please describe the steps what exactly you did and if possible
can you give me the code for the same. Code snippets will also do. I
am currently woking with Art's solution.
But your code snippet will be great help. One of project mate is
currently facing the same problem and he needs to work with the
Conditionals.
Thanks in anticipation.
Thanks and Regards
Tanmoy Roy
----------
From: email@hidden on behalf of Marek
Wawrzyczny
Sent: Friday, June 4, 2004 5:07 AM
To: WO DEV LIST (E-mail)
Subject: Re: EO Model problem
I tend to use a 'toggle' boolean for the page and two conditionals,
though you could also use Art's solution to return true and false. I
prefer the conditional approach as we tend to rely more heavily on
CSS (for background, highlights, etc) and as such the alternating rows
are profoundly different.
On 30/05/2004, at 19:16, Art Isbell wrote:
On May 29, 2004, at 7:35 PM, Tanmoy Roy wrote:
am currently working with a EOModel which is fetching some rows from
DB and then using WORepetition I am showing it in the HTML page. But
what I want say for 5 rows I want to shade the alternate rows in
some
colour and leave the rest intact. But whenever I am trying to do it
by WOConditional either all the rows are getting shaded or none at
all. I am using two WOConditional first one for nth row and the next
one for (2n+1)th row.
You're working too hard. Get rid of the WOConditionals and bind the
WORepetition's "index" key to a component instance variable, say
"rowIndex". Then make your row dynamic, add a "bgColor" key, and
bind
it to a method like
public String bgColor() {
return rowIndex % 2 == 0 ? evenRowColor : oddRowColor;
}
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
Marek Wawrzyczny
software engineer
-------------------------->
ish group pty ltd
http://www.ish.com.au
7 Darghan St Glebe 2037 Australia
phone +61 2 9660 1400 fax +61 2 9660 7400
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
Marek Wawrzyczny
software engineer
-------------------------->
ish group pty ltd
http://www.ish.com.au
7 Darghan St Glebe 2037 Australia
phone +61 2 9660 1400 fax +61 2 9660 7400
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.