render: function() { $.getJSON("url/to/aggregated/data", function(data) { var favorites = new Favorites(data.favorites); var feed = new Feed(data.feed); var account = new Account(data.account); new FavoritesView({el: $A.el('#nm'), collection: favorites); new FeedView({el: $A.el('#at_view'), model: feed); new AccountView({model: account}); }); }
/** * Gets a DefaultMutableTreeNode representing the * information in this view instance. * * The default implementation parses the data in the URL, but a subclass may * override this method and provide a different implemenation. For example, * it may create the tree programatically. */ public FavoritesNode getDataAsTree() { HelpSet hs = getHelpSet(); debug("helpSet in "+this+hs.toString()); return (FavoritesNode)parse(hs, hs.getLocale(), new DefaultFavoritesFactory()); }
/** * Saves favorites to the file */ public void saveFavorites(){ FavoritesView view = (FavoritesView)favorites.getNavigatorView(); view.saveFavorites(rootNode); }
/** * Saves favorites file * * @param node The FavoritesNode */ public void saveFavorites(FavoritesNode node){ if(!enabledSave) return; try{ FileOutputStream out; String user_dir = System.getProperty("user.home"); File file = new File(user_dir+File.separator+".JavaHelp"); file.mkdirs(); String userFile = file.getPath()+File.separator+"Favorites.xml"; debug("new file:"+userFile); node.export(out = new FileOutputStream(userFile)); out.close(); }catch(SecurityException se){ enabledSave = false; se.printStackTrace(); }catch(Exception excp){ excp.printStackTrace(); } } /**
favNode = view.getDataAsTree(); rootNode = favNode.getDeepCopy();
/** * Creates an Index navigator with explicit arguments. Note that this should not throw * an InvalidNavigatorViewException since we are implicitly passing the type. * * @param hs HelpSet * @param name The name identifying this HelpSet. * @param label The label to use (for this locale). * @param data The "data" part of the parameters, a URL location of the TOC data. */ public JHelpFavoritesNavigator(HelpSet hs, String name, String label, URL data) throws InvalidNavigatorViewException { super(new FavoritesView(hs, name, label, createParams(data))); }