((DefaultTreeModel) tree.getModel()).setRoot(AssetManager.getRootFolderNode());
if (((DefaultTreeModel) tree.getModel()).getRoot() != AssetManager.getRootFolderNode()) { ((DefaultTreeModel) tree.getModel()).setRoot(AssetManager.getRootFolderNode()); }
	public void loadChildAssets(final String[] assetids, final String[] sort_orders, final boolean selectAll, final boolean teleport) {		MatrixStatusBar.setStatus(Matrix.translate("asset_map_status_bar_requesting"));		Runnable runner = new Runnable() {			public void run() {				// if we have a different root and not the actual root then this will not work				// or should it?				tree.setRootVisible(false);				((DefaultTreeModel) tree.getModel()).setRoot(AssetManager.getRootFolderNode());				MatrixTreeNode parent = AssetManager.getRootFolderNode();				int numAssets = assetids.length;				int level = 0;				int loadedNodes = 0;				boolean found = false;				TreePath path = null;				try {					// clear all other selections					tree.clearSelection();					int sort_order = 0;					int totalKids = 0;					if (parent.getChildCount() > 0) {						// get the first asset in our lineage list						sort_order = Integer.parseInt(sort_orders[level]);						parent = (MatrixTreeNode)parent.getChildAt(sort_order);						if (parent.getAsset().getId().equals(assetids[level])) {							found = true;							path = getPathToRoot(parent);							if (isExpanded(path)) {								// we want treeWillExpand action to fire later on								tree.collapsePath(path);							}							level++;						}					}					if (found) {						TreePath[] paths = new TreePath[numAssets+1];						paths[0] = path;						while (level < numAssets) {							found = false;							Asset asset = parent.getAsset();							totalKids = asset.getTotalKidsLoaded();							sort_order = Integer.parseInt(sort_orders[level]);							if (!sort_orders[level].equals("-1")) {								int modifier = (int)(sort_order/AssetManager.getLimit());								int loc = 0;								if (parent.getChildCount() == 0 || (AssetManager.getLimit()*modifier != totalKids)) {									// load another set of assets									removeChildNodes(parent);									AssetManager.refreshAsset(parent, "", AssetManager.getLimit()*modifier, -1);									loadedNodes += parent.getChildCount();								}								if (parent.getChildCount() > 0) {									loc += (sort_order%AssetManager.getLimit());									if (loc > parent.getChildCount()) {										loc = parent.getChildCount()-1;									} else if (loc < 0) {										loc = 0;									}									MatrixTreeNode foundChild = null;									foundChild = (MatrixTreeNode)parent.getChildAt(loc);									if (foundChild.getAsset().getId().equals(assetids[level])) {										found = true;										parent = foundChild;									} else {										// we will check assets around us due to notice links having sort_order										if (((AssetManager.getLimit()*modifier) + loc) < foundChild.getSortOrder()) {											while (loc >= 0 && !found) {												foundChild = (MatrixTreeNode)parent.getChildAt(loc);												if (foundChild.getAsset().getId().equals(assetids[level])) {													found = true;													parent = foundChild;												}												loc--;											}										} else if (((AssetManager.getLimit()*modifier) + loc) > foundChild.getSortOrder()) {											while ((loc <  parent.getChildCount()) && !found) {												foundChild = (MatrixTreeNode)parent.getChildAt(loc);												if (foundChild.getAsset().getId().equals(assetids[level])) {													found = true;													parent = foundChild;												}												loc++;											}										} else {											loc = 0;											while ((loc <  parent.getChildCount()) && !found) {												foundChild = (MatrixTreeNode)parent.getChildAt(loc);												if (foundChild.getAsset().getId().equals(assetids[level])) {													found = true;													parent = foundChild;												}												loc++;											}										}									}								}							} else {								parent = findAssetUnderParent(parent, assetids[level], false);								if (parent != null) {									found = true;								}							}							if (!found) {								break;							} else {								path = getPathToRoot(parent);								paths[level] = path;								level++;							}						}						// scroll to the last selected node						if (selectAll) {							tree.addSelectionPaths(paths);						} else {							tree.addSelectionPath(path);						}						if (teleport) {							teleportToRoot((MatrixTreeNode)path.getLastPathComponent());						}						scrollPathToVisible(path);					}					if (!found) {						// asset not found						MatrixStatusBar.setStatusAndClear(Matrix.translate("asset_map_status_bar_requesting"), 1000);						Object[] transArgs = {							assetids[level]						};						String message = Matrix.translate("asset_map_error_locate_asset", transArgs);						GUIUtilities.error(message, Matrix.translate("asset_map_dialog_title_error"));						return;					}				} catch (Exception ioe) {					MatrixStatusBar.setStatusAndClear(Matrix.translate("asset_map_status_bar_requesting"), 1000);					Object[] transArgs = {						ioe.getMessage()					};					String message = Matrix.translate("asset_map_error_loading_children", transArgs);					GUIUtilities.error(message, Matrix.translate("asset_map_dialog_title_error"));					Log.log(message, MatrixTree.class, ioe);					return;				}				if (loadedNodes == 1) {					MatrixStatusBar.setStatusAndClear(Matrix.translate("asset_map_status_bar_loaded_child"), 3000);				} else {					Object[] transArgs = {						new Integer(loadedNodes)					};					MatrixStatusBar.setStatusAndClear(Matrix.translate("asset_map_status_bar_loaded_children", transArgs), 3000);				}			}		};		SwingUtilities.invokeLater(runner);	}