• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Combo box vs "Array is empty"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Combo box vs "Array is empty"


  • Subject: Combo box vs "Array is empty"
  • From: Ian Joyner <email@hidden>
  • Date: Mon, 26 Sep 2005 10:14:54 +1000

Here is a bit of a nasty problem I was having with combo boxes (pop up menus) when editing an existing record. This had previously worked with adding records, but I found the problem was in copying an object into the local editing context. My code was as follows:

    public void edit_thing () {
        ThingInterfaceController asset_controller = new ThingInterfaceController ();
        Group_Thing ga = (Group_Thing)thing_display_group.selectedObject ();

        if (ga != null) {
            Thing edit_thing = (Thing)thing_controller.editingContext ().faultForGlobalID (ga.thing ().editingContext ().globalIDForObject (ga.thing ()), thing_controller.editingContext ());
            thing_controller.displayGroup ().setSelectedObject (edit_thing);

            

            EOFrameController.runControllerInNewFrame (thing_controller, null);
        }
    }

This worked perfectly, except for pop ups associated with the thing object, but resulted in:

apple.awt.EventQueueExceptionHandler Caught Throwable : java.lang.IllegalArgumentException: Array is empty
java.lang.IllegalArgumentException: Array is empty
    at com.webobjects.foundation.NSArray.objectAtIndex(NSArray.java:488)
    at com.webobjects.eointerface.EODisplayGroup._manipulateRelationship(EODisplayGroup.java:3207)
    at com.webobjects.eointerface.EODisplayGroup._addObjectToBothSidesOfRelationshipWithKeyAtIndex(EODisplayGroup.java:3265)
    at com.webobjects.eointerface.EODisplayGroup._addObjectToBothSidesOfSelectedObjectRelationshipWithKey(EODisplayGroup.java:3248)
    at com.webobjects.eointerface.EOAssociation._addObjectToBothSidesOfSelectedObjectRelationshipWithAspect(EOAssociation.java:805)
    at com.webobjects.eointerface.EOValueSelectionAssociation._storeSelectionValue(EOValueSelectionAssociation.java:395)
    at com.webobjects.eointerface.EOValueSelectionAssociation.widgetSelectionDidChange(EOValueSelectionAssociation.java:435)
    at com.webobjects.eointerface.swing.EOSwingComboBoxPlugin.actionPerformed(EOSwingComboBoxPlugin.java:222)
    at com.webobjects.eointerface.swing.EOSwingComboBoxPlugin$_ComboBoxModel.setSelectedItem(EOSwingComboBoxPlugin.java:284)
    at javax.swing.JComboBox.setSelectedItem(JComboBox.java:551)
    at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:597)
    at javax.swing.plaf.basic.BasicComboPopup$ListMouseHandler.mouseReleased(BasicComboPopup.java:749)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:232)
    at java.awt.Component.processMouseEvent(Component.java:5166)
    at javax.swing.plaf.basic.BasicComboPopup$2.processMouseEvent(BasicComboPopup.java:452)
    at java.awt.Component.processEvent(Component.java:4963)


After much pain of scouring the EO model and setup in Interface Builder and thinking there must have been something wrong in this code, I discovered an example with a simpler line to get objects into an editing context and set up the display group:

    public     void edit_thing () {
        ThingInterfaceController asset_controller = new ThingInterfaceController ();
        Group_Thing ga = (Group_Thing)thing_display_group.selectedObject ();

        if (ga != null) {
            thing_controller.setObjectWithGlobalID (ga.thing ().editingContext ().globalIDForObject (ga.thing ()));
            
            EOFrameController.runControllerInNewFrame (thing_controller, null);
        }
    }


and this works, but I'm still not sure as to why 'faultForGlobalID' was not sufficient to make this work and how I could have better tracked down this rather obscure problem. Still, if anyone else stumbles across it in future years, that is a solution that works. Or have I missed something else?

Ian Joyner
Sportstec
 _______________________________________________
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

  • Prev by Date: Re: simple question
  • Next by Date: WO on AMD Linux 64bit
  • Previous by thread: Disabling Client Caching in WO
  • Next by thread: WO on AMD Linux 64bit
  • Index(es):
    • Date
    • Thread