Cocoa Bindings don't update UI when Model changes?

Has anyone found a solution to this problem? I read all the Troubleshooting info at Apple and just about wore out the KVC/KVO and Cocoa Bindings documentation.
I've got one TableView that updates fine, and two others that don't when the Model is modified.
The Model: class VoterController, the variable is an NSMutableArray "playerArray" that contains 7 NSMutableDictionaries, read in from an XML plist. I set the @property and the @synthesize for it. You can't bind a Model, so no bindings for the array.
The View: an NSTableView with one column. The column is bound to the voterController listed below.
Column Binding:
Bind To: voterController
Controller Key: arrangedObjects
Model Key Path: playerName (a key in each dictionary)
The Controller: an NSTableViewController, class NSTableViewController.
Bindings for this controller:
Bind To: mainController
Model Key Path: playerArray (the NSMutableArray)
Controller "mainController":
A simple NSObject (not an Object Controller despite the name) that has its class set as "VoterController", which is the class of the Model object (the array of dictionaries).
Now the thing that has me stumped is that this NSTableView reads the Model data fine but does not respond to changes in it. In other words, if I delete one of the array elements, it does not show up in the View until I re-launch the app and it reads the changed XML from disk.
Even more strange, I have another tableView that DOES dynamically change as I change values for any of the keys in the dictionaries that are the elements of the array. This working tableView has the bindings for each of its 5 columns as follows:
Bind To:voterController
Controller Key: arrangedObjects
Model Key Path: playerName, voteCount, role, etc. for each column. Each of these is a key in the dictionaries. If I change programmatically any of the values of these keys, they are immediately changed in the View.
Apple says the most common reason for Views not updating is non-KVO compliance in the model property. I have the array @property and @synthesize compiler directives, and one View updates and another does not, on the same controller.
I dunno - I don't expect a solution but any tips I will rush off and try. Thanks in advance.

"Is this because VIs which use ConfigData_v1.ctl were not loaded into memory at the time when I made the change to the typedef?"
In short: Yes. Only the callers in memory are updated.
=====================================================
Fading out. " ... J. Arthur Rank on gong."

Similar Messages

  • Update JTree when model changes

    Hello!
    I'am doing a webbrowser that stores the history in a JTree that is visible in EAST in the browserFrame.
    The history is updated when a link is clicked or it is typed in the addressbar. Everything works for the moment but it's quite ugly i guess...
    For now i do tree.updateUI(); in the view everytime I have added a node, but I want to remove tree.updateUI() and update the view automaticly whenever the model has changed.
    Is nodesWereInserted() the right function to use?
    I have tried to use this listener in the HistoryModel(after removing tree.updateUI()) but the JTree acts very strange then...
    thanks for any help :)
    Fredrik
    ////////////THE LISTENER THAT I HAVE TRIED TO USE IN THE HistoryModel
        class MyTreeModelListener implements TreeModelListener {
            public void treeNodesChanged(TreeModelEvent e) {
                DefaultMutableTreeNode node;
                node = (DefaultMutableTreeNode)
                         (e.getTreePath().getLastPathComponent());
                 * If the event lists children, then the changed
                 * node is the child of the node we've already
                 * gotten.  Otherwise, the changed node and the
                 * specified node are the same.
                try {
                    int index = e.getChildIndices()[0];
                    node = (DefaultMutableTreeNode)
                           (node.getChildAt(index));
                } catch (NullPointerException exc) {}
                System.out.println("The user has finished editing the node.");
                System.out.println("New value: " + node.getUserObject());
            public void treeNodesInserted(TreeModelEvent e) {
                DefaultMutableTreeNode node;
                node = (DefaultMutableTreeNode)
                         (e.getTreePath().getLastPathComponent());           
                int index = treeModel.getIndexOfChild(node.getParent(), node);
                treeModel.nodesWereInserted(node.getParent(), new int[] {index});
            public void treeNodesRemoved(TreeModelEvent e) {
            public void treeStructureChanged(TreeModelEvent e) {
            }////////////////THIS IS THE VIEW CLASS
    package freebrowser.gui;
    import java.net.URL;
    import java.util.ArrayList;
    import java.util.Iterator;
    import javax.swing.JTree;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.TreeSelectionModel;
    import freebrowser.model.HistoryModel;
    import freebrowser.model.LinkInfo;
    import freebrowser.types.Browser;
    * This class represents a JTree with a domainname as children and url:s in its leafs.
    * @author dalen
    public class HistoryTree implements TreeSelectionListener {
        private JTree tree;
        private Browser browser;
        private ArrayList currentPageLinkInfo;
        private URL browserCurrentUrl;
        private HistoryModel historyModel;
        public HistoryTree(Browser browser, HistoryModel historyModel){
            this.browser = browser;
            this.historyModel = historyModel;
            //Create a tree that allows one selection at a time.
            tree = historyModel.createJtree();
            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            //Listen for when the selection changes.
            tree.addTreeSelectionListener(this);
         * This function is called when a link has been clicked.
         * @param url - The <code>url</code> that has been clicked
        public void newPageClicked(URL url){
            Iterator it = currentPageLinkInfo.iterator();
            while(it.hasNext()){
                LinkInfo info = (LinkInfo)it.next();
                if(info.getUrl().equals(url)){
                    historyModel.addNode(info, browserCurrentUrl);
                    tree.updateUI(); /// this is what I want to remove!
                    break;
         * Adds a node to the tree if a url has been entered in the addresfield
         * @param url
         * @param title
        public void addressBarPageEntered(URL url, String title) {
            LinkInfo info = new LinkInfo(url, title);
            browserCurrentUrl = url;
            historyModel.addNode(info, browserCurrentUrl);
            tree.updateUI();/// this is what I want to remove!
         * Helps the <code>HistoryBar</code> to be updated with the current url.
         * @param url - The curren <code>url</code> in the browser
        public void setHistoryCurrentPage(URL url){
            LinkInfo info = new LinkInfo(url, null);
            currentPageLinkInfo = info.getLinkInfos();
            browserCurrentUrl = url;
         * Invoked by TreeSelectionListener when a node has been clicked
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
            if (node == null) return;
            Object nodeInfo = node.getUserObject();
            if (node.isLeaf()) {
                LinkInfo linkInfo = (LinkInfo)nodeInfo;
                System.out.println(linkInfo.getUrl());
                browser.setURL(linkInfo.getUrl());
         * Function to recieve the JTree
         * @return The <code>tree</code>
        public JTree getTree() {
            return this.tree;
    }/////////////THIS IS THE MODEL CLASS
    package freebrowser.model;
    import java.net.URL;
    import java.util.Enumeration;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeModel;
    * This class holds the infomation of the historytree. It is stored in an array containing <code>Nodes</code>.
    * @author dalen
    public class HistoryModel {
        private DefaultTreeModel treeModel;
        private DefaultMutableTreeNode rootNode;
        public HistoryModel() {
            rootNode =  new DefaultMutableTreeNode("L�nkHistorik");
            treeModel = new DefaultTreeModel(rootNode);
         * Adds a node in the right place in the model
         * @param info - The <code>info</code> to be added.
        public void addNode(LinkInfo info, URL browserCurrentUrl) {
            //l�gg till noden p� r�tt plats i modellen
            Enumeration e = rootNode.children();
            DefaultMutableTreeNode category = null;
            DefaultMutableTreeNode urlLeaf = null;
            boolean newNodeSet = false;
            while(e.hasMoreElements()) {
                DefaultMutableTreeNode childToCheck = (DefaultMutableTreeNode)e.nextElement();
                //check if the domainname already is in the tree
                if(childToCheck.toString().equals( browserCurrentUrl.getHost()) ){
                    urlLeaf = new DefaultMutableTreeNode(info);
                    treeModel.insertNodeInto(urlLeaf, childToCheck, childToCheck.getChildCount());
                    newNodeSet = true;
                    break;
            if(!newNodeSet) {
                category = new DefaultMutableTreeNode(new LinkInfo(null,browserCurrentUrl.getHost()));
                DefaultMutableTreeNode parent = (DefaultMutableTreeNode)treeModel.getRoot();
                treeModel.insertNodeInto(category, parent, parent.getChildCount());
                urlLeaf = new DefaultMutableTreeNode(info);
                treeModel.insertNodeInto(urlLeaf, category, category.getChildCount());
            ((DefaultMutableTreeNode)treeModel.getRoot()).setUserObject("L�nkhistorik (dom�ner: " + rootNode.getChildCount() + "  l�nkar: " + rootNode.getLeafCount() +")");
         * Creates and returns a JTree built on the model from createJTreeModel()
         * @return The new JTree
        public JTree createJtree() {
            return new JTree(treeModel);
    }

    Nevermind, I solved it by my self :)
    added treeModel.nodeChanged(node); after insertNodeInto()

  • ADFf 11g, view does not refresh when model changes

    Hi,
    I am really missing something about adf faces (jdev 11.1.1.3.0).
    I have a web app, with jspx, tabpanels and pojo data controls.
    Since there is a complex logic to open new pages/tabs, sometimes I have to open new pages/tabs programmatically, and also sometimes I have
    to refresh the model behind pages/tabs programmatically.
    When I say "programmatically" I mean that the model refresh is not started by an user action on the webpage, but is started by logic in the model layer
    (say, for example, you receive a JMS message and you want to reload the content of an entire page).
    I can succesfully update the model, using debug println I can see the model is updated, but there is no way I can update the view.
    I tryed with the "addPartialTarget" code and so on, but it does not work.
    I've also bought and read "Oracle JDeveloper 11g Handbook" and "Oracle Fusion Developer Guide", but I can't find anything that can help me.
    Can someone explain me: what am I missing? I am sure there is some concept in ADF Faces I missed: this framework is too
    big not to offer what I need, so I miss something for sure.
    I hope to get an answer, I hope Shay reads this too.
    Thanks all.

    Hi,
    Active Data Services (chapter 20 in the book) is what would allow you to synchronize the screen with the model changes. The problem you face is because the data you see is what is stored in the iterators of the binding layer. An alternative solution to using ADS is to use an af:poll component that refreshes the display component when the model has changed. For this your model exposes a method that returns a time stamp that changes whenever the data has changed. Upon af:poll expiring, it calls a managed bean method, which - through the ADF binding layer - checks for the time stamp and compares it with a local saved copy (whenever the time stamp has changed, the client side will e.g. write it to the viewScope or pageFlowScope). If the time stamp has changed, the managed bean re-executes the method populating the iterator for the UI components and then issues a partial refresh of the component(s). Instead of PPR'ing each component in turn, you can try setting the ChangeEventPolicy property of the iterators to ppr"
    This should solve the problem. The latter example is also explained in chapter 20, but for ADF BC
    Frank

  • Why do screen updates fail when MacOSX changes location?

    With Firefox 4.0, when I change MacOSX system location (host name and IP), the Firefox screen no longer updates. It does appear that link selections are followed. My current work-around is to quit and restart Firefox losing all session state. Changing MacOSX location did not appear to effect Firefox 3.

    The issue appears to have been resolved in the production release. Perhaps it was in some way related to the beta feedback plugin.

  • What happens if I don't update iTunes when prompted and stay with an old version?

    I ask because I hear about so many problems people have when they do apply updates.
    Basically, what am I missing if I don't?

    The new features included with the updates, which include the ability to sync recent devices.
    (113418)

  • Typedef updates don't update callers when using save as

    I have a typedef that holds configuration data for my system...this typedef is used by many VIs in my application.
    This typedef will change over time as I add/delete configuration parameters, but I would also like to retain old versions of the typedef so that I can retrieve old configuration information.
    I accomplish this by always using "Save As" whenever I update the typedef, and saving new versions with a different name. For example:
    ConfigData_v1.ctl
    ConfigData_v2.ctl
    ConfigData_v3.ctl
    What I expect to happen is that I can open up a current version of the typedef (let's say ConfigData_v1.ctl), make changes, then select "Save As"...I do *not* check the "Save a copy without updating callers" checkbox because I *do* want all callers to now point to the new typedef that I will be saving as ConfigData_v2.ctl.
    I've noticed, however, that if I start LabVIEW and first open up ConfigData_v1.ctl, make the changes, select "Save As" (not checking "...updating callers..."), and then close ConfigData_v2.ctl (which was opened as ConfigData_v1.ctl)...when I open any of the VIs that use(d) the ConfigData_v1.ctl typedef, they have not been updated to point to ConfigData_v2.ctl.
    Is this because VIs which use ConfigData_v1.ctl were not loaded into memory at the time when I made the change to the typedef? Strange.
    Thanks!
    BTW, if you're curious about how the data is managed, I have written a VI that pulls in data that conforms to an old version of the typedef and extracts the data into a new version of the typedef. This allows me to update my configuration typedef and propagate any saved values from old to new.

    "Is this because VIs which use ConfigData_v1.ctl were not loaded into memory at the time when I made the change to the typedef?"
    In short: Yes. Only the callers in memory are updated.
    =====================================================
    Fading out. " ... J. Arthur Rank on gong."

  • Sometimes the url's don't update so when you press the "back button" it sends you to the home page instead of the last page visited

    A friend of mine has this webblog and I have never had problems viewing it before I downloaded the new version of firefox. However, once I downloaded the new version, I noticed that every time I press the "back button" after viewing a picture, it sends me back to the blog home page instead of the last page I was on or that I viewed. This also happens with some of the standard websites I visit not just the blogs.

    Right click the Back button and select the page you want to go back to.

  • My TOC does not update automatically when I change the header text of a chapter

    Some chapters do; others don't. Anybody?
    Thanks

    The current version is 10.2.2, and that's why your iTunes hasn't automatically updated. Any currently available version of iCloud is a beta only, and so iTunes will not automatically update via Software Update
    When you do update, you won't lose any of your current iTunes Library. If you want to be sure, back up the library which, by default is in <your user name>/Music. If you copy the whole /Music folder, you'll be absolutely sure.

  • How to update collection when checkbox changed in report

    I have a report based on a collection:
    select seq_id
           ,c001
           ,c002
           ,apex_item.checkbox(1,seq_id,decode(c003,'J','CHECKED','UNCHECKED')) selected
    from apex_collections
    where collection_name='CONCOLLECTION'When the checkbox changes I want to store the new checked/unchecked status in the collection.
    Steps towards a solution I've come up with:
    1 Create a dynamic action: Change, jquery selector : input[name="f01"]
    2 Create javascript to store value (=seq_id) of changed item into a hidden page item.
    3 plsql code to update collection member with seq_id that is now in hidden item.
    Is this the way to do it?
    If so, it's the javascript of step 2 that I can't figure out.
    thanks, René

    thanks this works.
    Using javascript I store the seq_id and the checked value in 2 page items
    $s('P70_SEQ_ID', $(this.triggeringElement).val() );
    $s('P70_CHECKED', $(this.triggeringElement.checked).val() );The checked value I get is <empty> when checked and 'undefined' when unchecked. Based on this I can now update the collection.
    declare
      l_selectie varchar2(1);
    begin
      if v('P70_CHECKED')='undefined'
      then
        l_selectie := 'N';
      else
        l_selectie := 'J';
      end if;
      apex_collection.update_member_attribute(p_collection_name => 'CONCOLLECTION'
                                                 ,p_seq             => v('P70_SEQ_ID')
                                                 ,p_attr_number     => 3
                                                 ,p_attr_value      => l_selectie);
    end;

  • Chrome favourites, added to safari, don't update automatically

    Recently Safari allowed me to add Chrome favourites to Safari's, however they don't update automatically when I change them in Chrome. How do I fix the problem? Thanks

    Your issue peaked my curiosity, so a ran a small experiment with some routers which I had handy ... a 802.11n AirPort Extreme Base Station (AEBSn), a Linksys BEFSR81, and a Netgear WGR614.
    I rotated them, in turn, to a Motorola SB5101 cable modem provided by my ISP -- Cox Communications. For each case, I left the default settings on the routers which, in all cases, they were set as DHCP clients. For each case, the DNS IP information, provided by the ISP, was NOT visible on the Basic Settings page for any of these routers. However, they were ALL visible when viewing the equivalent router's status pages. For the AEBSn, that would be the Internet > Internet Connection tab in the AirPort Utility; For the Linksys, that would be the Status > Router tab; For the Netgear, that would be the Maintenance > Router Status.
    In addition, I confirmed that each of the routers "passed thru" the ISP DNS server information to their LAN clients (wired or wireless) that were set up as DHCP client (& for WinXP or Vista clients to receive DNS info automatically.) (Note: I used the ipconfig utility for both Windows & OS X clients.)
    So, this leads me to believe that what you are seeing is normal behavior of the router. If your ISP changes their DNS server(s), this should also "pass thru" to your LAN clients. If this is not happening then either the router is set for a static DNS IP address or the client is. I'm not sure what else it would be.

  • MIRO, automatic update Amount when quantity was changed

    Deal all,
    How to make automatic update in line item MIRO, when i change the Quantity then the Amount must update by automaticly, in current system i always change by manualy
    thanks
    imron

    Dear Krishna
    I know that the price may change and hence the amount field is kept open for changes, but i want the amount can update automaticlly when i change qty because when we create invoice (MIRO) the quantity not always same with total PO qty (partial invoice), maybe you can look this my illustration :
    1 . PO number = 4500000001
         Qty            = 5
         Price         = 10
         Net Price   = 50
    2.  GR number = 5000000001
         Qty       = 2
         Amount in local currency = 20
    3.  GR number = 5000000002
         Qty       = 3
         Amount in local currency = 30
    4.  create Invoice (MIRO)
          Qty =5 -->this default by system, (now we want to change to 2, for invoicing PO number one)
          Amount = 50 --> this default by system (we want this amount automatclly to become 20)
    5. create second invoice 
    Regrads
    imron
    Edited by: Muhammad Nur Imron on Jan 24, 2008 3:17 AM

  • When I download firefox, using recommended setting, or my own, all the sub files/folders like plugins, modules, updater end up on the desktop as well as in the file location. And when I try to put them into the file location, they don't. And when I delete

    When I download firefox, using recommended setting, or my own, all the sub files/folders like plugins, modules, updater end up on the desktop as well as in the file location. And when I try to put them into the file location, they don't. And when I delete them, FireFox won't open. I tried deleting FireFox and reinstalling it multiple times, and a message pops up sometimes that says FireFox may not have installed correctly, so I follow the steps, but all the extra icons on my desktop don't go away. This has happened every time I have downloaded FireFox. The browser itself works, but I need to know how to get rid of these icons, but still be able to use FireFox. This is on a new computer, with Windows 7.
    == I downloaded FireFox. ==
    == User Agent ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6

    Managed to solve this myself. Just went to properties > hidden.

  • Old project with entity 4.0 breaks when adding new model or updating an existing model.

    i have an old 4.0 project that was using entity 4.0
    in VS2013 if I try to update an existing model or add a new one, it will forcefully install the entity framework 5.0 even though the selection in the box was to use 4.0
    it goes out to nuget to do this and then it will forever add 5.0 even if I uninstall it.
    5.0 getting installed completely breaks my application. References to tables disappear and cross reference for NO reason at all with another model.
    How can i get it to just let me use 4.0 so I can move on OR how can i upgrade my old model into 5.0?
    I'd rather not got tthe 5.0 route because that changes a lot of the ways things were done and would break even more code.

    Hello,
    >>in VS2013 if I try to update an existing model or add a new one, it will forcefully install the entity framework 5.0 even though the selection in the box was to use 4.0
    It is not very clear how you install the Entity Framework, as far as I know, the EF version 4.0 is available with .NET 3.5, from .NET 4.0, it will use the 5.0 by default, if you want to use the EF 4.0, you could change the target to .NET 3.5.
    >>How can i get it to just let me use 4.0 so I can move on OR how can i upgrade my old model into 5.0?
    If it is EF 5.0, as far as I know, it uses the DbContext API instead of the original ObjectContext API(the EF 4.0 uses this API) which provides a better performance, if you want to keep to use ObjectContext API, you could follow this article:
    Reverting Back to ObjectContext Code Generation
    The article shows the configuration for VS2012, for VS2013, you could change the Code Generation Strategy from T4 to Legacy ObjectContext.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • TS3694 Why can't I update my iPhone 4 to iOS 5.1? Every time I try it gets all the way done downloading it; however when it's processing the file the page tells me "There is a problem downloading the software for the iPhone. Network connection timed out.

    Why can't I update my iPhone 4 to iOS 5.1? Every time I try it gets all the way done downloading it; however when it's processing the file the page tells me "There is a problem downloading the software for the iPhone. Network connection timed out. Make sure your network settings are correct and your network connection is active. or try again later." and next to the file it has err = -3259. I have tried this 17 times and it won't work. My iTunes is completely up to date. I have made sure that my connection is fine and I have tried turning my firewall off with no avail. This has happened to me before but usually the update will go through after 2-3 tries, never to this extent. I don't know what to do. Help!

    Error -3259 is a network timeout error, usually. This article might help:
    http://support.apple.com/kb/TS2799

  • I have a Mac leopard.  Did a recent recommended update.  When it finished,I restarted then a window came up to enter Master Password.  I don't know what it is  and when I try to enter one, the window shakes and I am unable to use computer at all

    I have a Mac leopard.  Did a recent recommended update.  When it finished,I restarted then a window came up to enter Master Password.  I don't know what it is  and when I try to enter one, the window shakes so I am unable to use computer at all.

    Please confirm exactly what Mac this is, and what 'recent update' you installed.

Maybe you are looking for

  • Should I place a weblogic server outside my firewall?

    I am looking at setting up an app server running an HR application. I want employees to be able to access it from home and internally at work. One option is to set up two app servers one internally and one externally outside the firewall. Another opt

  • No DHCP on Intel iMac

    I'm setting up our new Intel iMac, and on first attempt to get online I found I was not connected to the internet. Ethernet is connected and on, the Network system pref confirms, but it is self-assigning its IP. Local networking (via Bonjour) works f

  • Page Properties not working

    When I try to change the link colors in page properties, it doesn't work, it keeps going back to default. I'm using Dreamweaver CS5.5 for Mac Any help would be appreciated. Thank you Judy

  • E72 - removing e-mail accounts

    Hi! I got my E72 today and of course started fiddling with it. Somehow I messed up my e-mail accounts, so I want to start over by deleting them. When I try to delete the accounts, I get the following error message 'you have to be connected to remove

  • Saving to and retrieving from database

    Hi, How can I save my program's data in a database and how can I view the data? S.A.T