Re: WOPopupButton Confusion...
Re: WOPopupButton Confusion...
- Subject: Re: WOPopupButton Confusion...
- From: James Cicenia <email@hidden>
- Date: Sat, 28 Feb 2004 15:19:30 -0600
my code is as simple as it gets....
my bindings are:
displayString = portfolioCustomerItem.value
item = portfolioCustomerItem
name = "DashboardQ1Popup"
list = aCustomers
noSelectionString = "All Customers"
selection = selectedCustomer
and the code is:
by the way.. dataSetQ1 gets called at least twice upon display?!
Any thoughts... this little bug has been driving me crazy... could it
be the javascript.submit() on the popup?
-James Cicenia
// Generated by the WOLips Core at Fri Feb 27 11:53:17 CST 2004
import org.jfree.data.DefaultPieDataset;
import com.webobjects.appserver.*;
import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSDictionary;
import com.webobjects.foundation.NSMutableArray;
import eo.Portfolio;
import eo.PortfolioCustomer;
import eo.TOSProjectState;
import er.extensions.ERXArrayUtilities;
public class Dashboard extends WOComponent {
PortfolioCustomer portfolioCustomerItem;
PortfolioCustomer selectedCustomer;
PortfolioCustomer aCustomer;
//data object and NSArray to hold data
//protected NSMutableArray dataList;
protected DefaultPieDataset dataSetQ1;
//chart info
protected String chartTypeQ1;
protected String chartTypeQ2;
protected String chartTypeQ3;
protected String chartTypeQ4;
protected String chartNameQ1 = "Status by Customer";
protected static String chartNameQ2 = "Portfolio Thoughput";
protected static String chartNameQ3 = "Portfolio Impact";
protected static String chartNameQ4 = "Financial Impact";
protected static String keyQ1 = "projectState";
protected static String keyQ2 = "";
protected static String keyQ3 = "";
protected static String keyQ4 = "";
protected Number chartWidth = new Integer(300);
protected Number chartHeight = new Integer(300);
/** @TypeInfo PortfolioCustomer */
public Dashboard(WOContext context) {
super(context);
}
public DefaultPieDataset dataSetQ1(){
System.out.println("Selected customer is "+portfolioCustomerItem);
Portfolio portfolio = ((Session) session()).portfolio();
//selectDataSource = new EOArrayDataSource(null,
object.editingContext());
if (portfolio != null) {
if (portfolio.projects() != null) {
dataSetQ1 = new DefaultPieDataset();
NSDictionary result=new NSDictionary();
result =
ERXArrayUtilities.arrayGroupedByKeyPath(portfolio.projects(),keyQ1);
java.util.Enumeration enumerator = result.keyEnumerator();
while (enumerator.hasMoreElements()) {
TOSProjectState myKey = (TOSProjectState)enumerator.nextElement();
System.out.println("**** myCount "+myKey.stateName()+"
-->"+((NSArray)result.objectForKey(myKey)).count());
dataSetQ1.setValue(myKey.stateName(),((NSArray)result.objectForKey(myKey
)).count());
/* code to act on each element */
}
System.out.println("**** made it"+dataSetQ1);
}
}
return dataSetQ1;
}
public NSArray aCustomers() {
NSArray aCustomers = new NSArray();
Portfolio portfolio = ((Session) session()).portfolio();
if (portfolio != null) {
if (portfolio.customers() != null) {
aCustomers = portfolio.customers();
}
}
return aCustomers;
}
public WOComponent submitDashboardQ1() {
return null;
}
}
On Feb 28, 2004, at 1:50 PM, Chuck Hill wrote:
> At 01:34 PM 28/02/2004 -0600, James Cicenia wrote:
>>
>> Now my list is perfect, but I can't seem to get it to "take" the
>> selection. There
>> are so many bindings here that I am confused and don't know if it is
>> my
>> bindings
>> or my code. Also, I have an onChange binding with a
>> javascript.submit()
>> which works.
>>
>> Here is what I have:
>>
>> CustomerArray --> list
>> Customer --> item
>> Customer.custName --> displayString
> Properly styled these names should start with lower case. Upper case
> is
> for class names.
>
>
>> (The above seem to work)
>> now what do I do for the other bindings namely,
>> Selection and selected?
>>
>> Are they set methods? Instance variables? both?
>>
> As you wish (it is just KVC). Selection is what is focused on display
> and
> set on from submission.
>
>
>> No matter what I seem to do it doesn't remember the selection.
>>
> Is it in a form?
>
>
> Chuck
>
>
>
>> -James Cicenia
>>
>> On Feb 28, 2004, at 9:55 AM, David Griffith wrote:
>>
>>> James,
>>>
>>> You need to bind the array to the 'list', an instance of the item in
>>> the
>>> array to 'item' which you have probably done, and then the attribute
>>> from
>>> the item that you want to display should be linked to the
>>> 'displayString'
>>> binding of the WOPopUp.
>>>
>>> I.e.
>>>
>>> CustomerArray -> list
>>> Customer -> item
>>> Customer.custName() -> displayString
>>>
>>> That should sort it...
>>>
>>> Dave.
>>>
>>>> James: I would guess that you have bound your array to both the list
>>>> and item attribute. Make sure you have a single instance variable of
>>>> the type of object in the array -and- bind it to the item attribute.
>>>>
>>>> -George
>>>>
>>>> On Feb 28, 2004, at 10:13 AM, James Cicenia wrote:
>>>>
>>>>> Hello -
>>>>>
>>>>> I think I am brain dead this morning but,
>>>>> When I populate my WOPopupButton with an NSArray, which
>>>>> is an array of my objects, I am seemingly getting a 2-dimensional
>>>>> array view...
>>>>>
>>>>> My popup has the right number of items in it, HOWEVER, each item
>>>>> is an array of my values!!!
>>>>>
>>>>> So instead of getting:
>>>>>
>>>>> Item1
>>>>> Item2
>>>>> Item3
>>>>>
>>>>> I am getting
>>>>>
>>>>> Item1, Item2, Item3
>>>>> Item1, Item2, Item3
>>>>> Item1, Item2, Item3
>>>>>
>>>>> Any help would be appreciated this morning as I am seemingly lost
>>>>> on this simple matter.
>>>>>
>>>>> -James Cicenia
>>>>> _______________________________________________
>>>>> 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.
>>>>
>>>>
>>>
>>
>> _______________________________________________
>> WebObjects-dev mailing list
>> email@hidden
>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>>
>
> --
>
> Chuck Hill email@hidden
> Global Village Consulting Inc.
> http://www.global-village.net
_______________________________________________
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.