$1 | $2 | $3 | $4 |
$1 | $2 |
' strrep(err.message, char(10), '
')];
+ catch
+ % forget it...
+ end
+ end
+ end
+
+ % Restore warnings
+ try warning(oldWarn); catch, end
+
+ % Set the object tooltip
+ if ~isempty(dataFieldsStr)
+ toolTipStr = [' ' char(toolTipStr) '' hgStr ': ' dataFieldsStr ''];
+ end
+ uiObject.setToolTipText(toolTipStr);
+ end
+
+ %% Expand tree node
+ function nodeExpanded(src, evd, tree) %#ok
+ % tree = handle(src);
+ % evdsrc = evd.getSource;
+ evdnode = evd.getCurrentNode;
+
+ if ~tree.isLoaded(evdnode)
+
+ % Get the list of children TreeNodes
+ childnodes = getChildrenNodes(tree, evdnode);
+
+ % Add the HG sub-tree (unless already included in the first tree)
+ childHandle = getappdata(evdnode.handle,'childHandle'); %=evdnode.getUserObject
+ if evdnode.isRoot && ~isempty(hg_handles) && ~isequal(hg_handles(1).java, childHandle)
+ childnodes = [childnodes, getChildrenNodes(tree, evdnode, true)];
+ end
+
+ % If we have a single child handle, wrap it within a javaArray for tree.add() to "swallow"
+ if (length(childnodes) == 1)
+ chnodes = childnodes;
+ childnodes = javaArray('com.mathworks.hg.peer.UITreeNode', 1);
+ childnodes(1) = java(chnodes);
+ end
+
+ % Add child nodes to the current node
+ tree.add(evdnode, childnodes);
+ tree.setLoaded(evdnode, true);
+ end
+ end
+
+ %% Get an icon image no larger than 16x16 pixels
+ function iconImage = setIconSize(iconImage)
+ try
+ iconWidth = iconImage.getWidth;
+ iconHeight = iconImage.getHeight;
+ if iconWidth > 16
+ newHeight = fix(iconHeight * 16 / iconWidth);
+ iconImage = iconImage.getScaledInstance(16,newHeight,iconImage.SCALE_SMOOTH);
+ elseif iconHeight > 16
+ newWidth = fix(iconWidth * 16 / iconHeight);
+ iconImage = iconImage.getScaledInstance(newWidth,16,iconImage.SCALE_SMOOTH);
+ end
+ catch
+ % never mind... - return original icon
+ end
+ end % setIconSize
+
+ %% Get list of children nodes
+ function nodes = getChildrenNodes(tree, parentNode, isRootHGNode)
+ try
+ iconpath = [matlabroot, '/toolbox/matlab/icons/'];
+ nodes = handle([]);
+ try
+ userdata = get(tree,'userdata');
+ catch
+ userdata = getappdata(handle(tree),'userdata');
+ end
+ hdls = userdata.handles;
+ nodedata = get(parentNode,'userdata');
+ if nargin < 3
+ %isJavaNode = ~ishghandle(parentNode.getUserObject);
+ isJavaNode = ~ishghandle(nodedata.obj);
+ isRootHGNode = false;
+ else
+ isJavaNode = ~isRootHGNode;
+ end
+
+ % Search for this parent node in the list of all nodes
+ parents = userdata.parents;
+ nodeIdx = nodedata.idx;
+
+ if isJavaNode && isempty(nodeIdx) % Failback, in case userdata doesn't work for some reason...
+ for hIdx = 1 : length(hdls)
+ %if isequal(handle(parentNode.getUserObject), hdls(hIdx))
+ if isequal(handle(nodedata.obj), hdls(hIdx))
+ nodeIdx = hIdx;
+ break;
+ end
+ end
+ end
+ if ~isJavaNode
+ if isRootHGNode % =root HG node
+ thisChildHandle = userdata.hg_handles(1);
+ childName = getNodeName(thisChildHandle);
+ hasGrandChildren = any(parents==1);
+ icon = [];
+ if hasGrandChildren && length(hg_handles)>1
+ childName = childName.concat(' - HG root container');
+ icon = [iconpath 'figureicon.gif'];
+ end
+ try
+ nodes = uitreenode('v0', thisChildHandle, childName, icon, ~hasGrandChildren);
+ catch % old matlab version don't have the 'v0' option
+ try
+ nodes = uitreenode(thisChildHandle, childName, icon, ~hasGrandChildren);
+ catch
+ % probably an invalid handle - ignore...
+ end
+ end
+
+ % Add the handler to the node's internal data
+ % Note: could also use 'userdata', but setUserObject() is recommended for TreeNodes
+ % Note2: however, setUserObject() sets a java *BeenAdapter object for HG handles instead of the required original class, so use setappdata
+ %nodes.setUserObject(thisChildHandle);
+ setappdata(nodes,'childHandle',thisChildHandle);
+ nodedata.idx = 1;
+ nodedata.obj = thisChildHandle;
+ set(nodes,'userdata',nodedata);
+ return;
+ else % non-root HG node
+ parents = userdata.hg_parents;
+ hdls = userdata.hg_handles;
+ end % if isRootHGNode
+ end % if ~isJavaNode
+
+ % If this node was found, get the list of its children
+ if ~isempty(nodeIdx)
+ %childIdx = setdiff(find(parents==nodeIdx),nodeIdx);
+ childIdx = find(parents==nodeIdx);
+ childIdx(childIdx==nodeIdx) = []; % faster...
+ numChildren = length(childIdx);
+ for cIdx = 1 : numChildren
+ thisChildIdx = childIdx(cIdx);
+ try thisChildHandle = hdls(thisChildIdx); catch, continue, end
+ childName = getNodeName(thisChildHandle);
+ try
+ visible = thisChildHandle.Visible;
+ if visible
+ try visible = thisChildHandle.Width > 0; catch, end %#ok
+ end
+ if ~visible
+ childName = ['' char(childName) '']; %#ok grow
+ end
+ catch
+ % never mind...
+ end
+ hasGrandChildren = any(parents==thisChildIdx);
+ try
+ isaLabel = isa(thisChildHandle.java,'javax.swing.JLabel');
+ catch
+ isaLabel = 0;
+ end
+ if hasGrandChildren && ~any(strcmp(class(thisChildHandle),{'axes'}))
+ icon = [iconpath 'foldericon.gif'];
+ elseif isaLabel
+ icon = [iconpath 'tool_text.gif'];
+ else
+ icon = [];
+ end
+ try
+ nodes(cIdx) = uitreenode('v0', thisChildHandle, childName, icon, ~hasGrandChildren);
+ catch % old matlab version don't have the 'v0' option
+ try
+ nodes(cIdx) = uitreenode(thisChildHandle, childName, icon, ~hasGrandChildren);
+ catch
+ % probably an invalid handle - ignore...
+ end
+ end
+
+ % Use existing object icon, if available
+ try
+ setTreeNodeIcon(nodes(cIdx),thisChildHandle);
+ catch
+ % probably an invalid handle - ignore...
+ end
+
+ % Pre-select the node based upon the user's FINDJOBJ filters
+ try
+ if isJavaNode && ~userdata.userSelected && any(userdata.initialIdx == thisChildIdx)
+ pause(0.0002); % as short as possible...
+ drawnow;
+ if isempty(tree.getSelectedNodes)
+ tree.setSelectedNode(nodes(cIdx));
+ else
+ newSelectedNodes = [tree.getSelectedNodes, nodes(cIdx).java];
+ tree.setSelectedNodes(newSelectedNodes);
+ end
+ end
+ catch
+ % never mind...
+ end
+
+ % Add the handler to the node's internal data
+ % Note: could also use 'userdata', but setUserObject() is recommended for TreeNodes
+ % Note2: however, setUserObject() sets a java *BeenAdapter object for HG handles instead of the required original class, so use setappdata
+ % Note3: the following will error if invalid handle - ignore
+ try
+ if isJavaNode
+ thisChildHandle = thisChildHandle.java;
+ end
+ %nodes(cIdx).setUserObject(thisChildHandle);
+ setappdata(nodes(cIdx),'childHandle',thisChildHandle);
+ nodedata.idx = thisChildIdx;
+ nodedata.obj = thisChildHandle;
+ set(nodes(cIdx),'userdata',nodedata);
+ catch
+ % never mind (probably an invalid handle) - leave unchanged (like a leaf)
+ end
+ end
+ end
+ catch
+ % Never mind - leave unchanged (like a leaf)
+ %error('YMA:findjobj:UnknownNodeType', 'Error expanding component tree node');
+ dispError
+ end
+ end
+
+ %% Get a node's name
+ function [nodeName, nodeTitle] = getNodeName(hndl,charsLimit)
+ try
+ % Initialize (just in case one of the succeding lines croaks)
+ nodeName = '';
+ nodeTitle = '';
+ if ~ismethod(hndl,'getClass')
+ try
+ nodeName = class(hndl);
+ catch
+ nodeName = hndl.type; % last-ditch try...
+ end
+ else
+ nodeName = hndl.getClass.getSimpleName;
+ end
+
+ % Strip away the package name, leaving only the regular classname
+ if ~isempty(nodeName) && ischar(nodeName)
+ nodeName = java.lang.String(nodeName);
+ nodeName = nodeName.substring(nodeName.lastIndexOf('.')+1);
+ end
+ if (nodeName.length == 0)
+ % fix case of anonymous internal classes, that do not have SimpleNames
+ try
+ nodeName = hndl.getClass.getName;
+ nodeName = nodeName.substring(nodeName.lastIndexOf('.')+1);
+ catch
+ % never mind - leave unchanged...
+ end
+ end
+
+ % Get any unique identifying string (if available in one of several fields)
+ labelsToCheck = {'label','title','text','string','displayname','toolTipText','TooltipString','actionCommand','name','Tag','style'}; %,'UIClassID'};
+ nodeTitle = '';
+ strField = ''; %#ok - used for debugging
+ while ((~isa(nodeTitle,'java.lang.String') && ~ischar(nodeTitle)) || isempty(nodeTitle)) && ~isempty(labelsToCheck)
+ try
+ nodeTitle = get(hndl,labelsToCheck{1});
+ strField = labelsToCheck{1}; %#ok - used for debugging
+ catch
+ % never mind - probably missing prop, so skip to next one
+ end
+ labelsToCheck(1) = [];
+ end
+ if length(nodeTitle) ~= numel(nodeTitle)
+ % Multi-line - convert to a long single line
+ nodeTitle = nodeTitle';
+ nodeTitle = nodeTitle(:)';
+ end
+ if isempty(char(nodeTitle))
+ % No title - check whether this is an HG label whose text is gettable
+ try
+ location = hndl.getLocationOnScreen;
+ pos = [location.getX, location.getY, hndl.getWidth, hndl.getHeight];
+ %dist = sum((labelPositions-repmat(pos,size(labelPositions,1),[1,1,1,1])).^2, 2);
+ dist = sum((labelPositions-repmat(pos,[size(labelPositions,1),1])).^2, 2);
+ [minVal,minIdx] = min(dist);
+ % Allow max distance of 8 = 2^2+2^2 (i.e. X&Y off by up to 2 pixels, W&H exact)
+ if minVal <= 8 % 8=2^2+2^2
+ nodeTitle = get(hg_labels(minIdx),'string');
+ % Preserve the label handles & position for the tooltip & context-menu
+ %hg_labels(minIdx) = [];
+ %labelPositions(minIdx,:) = [];
+ end
+ catch
+ % never mind...
+ end
+ end
+ if nargin<2, charsLimit = 25; end
+ extraStr = regexprep(nodeTitle,{sprintf('(.{%d,%d}).*',charsLimit,min(charsLimit,length(nodeTitle)-1)),' +'},{'$1...',' '},'once');
+ if ~isempty(extraStr)
+ if ischar(extraStr)
+ nodeName = nodeName.concat(' (''').concat(extraStr).concat(''')');
+ else
+ nodeName = nodeName.concat(' (').concat(num2str(extraStr)).concat(')');
+ end
+ %nodeName = nodeName.concat(strField);
+ end
+ catch
+ % Never mind - use whatever we have so far
+ %dispError
+ end
+ end
+
+ %% Strip standard Swing callbacks from a list of events
+ function evNames = stripStdCbs(evNames)
+ try
+ stdEvents = {'AncestorAdded', 'AncestorMoved', 'AncestorRemoved', 'AncestorResized', ...
+ 'ComponentAdded', 'ComponentRemoved', 'ComponentHidden', ...
+ 'ComponentMoved', 'ComponentResized', 'ComponentShown', ...
+ 'FocusGained', 'FocusLost', 'HierarchyChanged', ...
+ 'KeyPressed', 'KeyReleased', 'KeyTyped', ...
+ 'MouseClicked', 'MouseDragged', 'MouseEntered', 'MouseExited', ...
+ 'MouseMoved', 'MousePressed', 'MouseReleased', 'MouseWheelMoved', ...
+ 'PropertyChange', 'VetoableChange', ...
+ 'CaretPositionChanged', 'InputMethodTextChanged', ...
+ 'ButtonDown', 'Create', 'Delete'};
+ stdEvents = [stdEvents, strcat(stdEvents,'Callback'), strcat(stdEvents,'Fcn')];
+ evNames = setdiff(evNames,stdEvents)';
+ catch
+ % Never mind...
+ dispError
+ end
+ end
+
+ %% Callback function for ');
+ descEndIdx = startIdx + strfind(webPage(startIdx:startIdx+999),' ');
+ descStr = webPage(descStartIdx(1)+3 : descEndIdx(1)-2);
+ descStr = regexprep(descStr,'?[pP]>','');
+ catch
+ descStr = '';
+ end
+
+ % Get this file's latest date
+ thisFileName = which(mfilename); %#ok
+ try
+ thisFileData = dir(thisFileName);
+ try
+ thisFileDatenum = thisFileData.datenum;
+ catch % old ML versions...
+ thisFileDatenum = datenum(thisFileData.date);
+ end
+ catch
+ thisFileText = evalc('type(thisFileName)');
+ thisFileLatestDate = regexprep(thisFileText,'.*Change log:[\s%]+([\d-]+).*','$1');
+ thisFileDatenum = datenum(thisFileLatestDate,'yyyy-mm-dd');
+ end
+
+ % If there's a newer version on the File Exchange webpage (allow 2 days grace period)
+ if (thisFileDatenum < datenum(latestDate,'dd mmm yyyy')-2)
+
+ % Ask the user whether to download the newer version (YES, no, no & don't ask again)
+ msg = {['A newer version (' latestDate ') of FindJObj is available on the MathWorks File Exchange:'], '', ...
+ ['\color{blue}' descStr '\color{black}'], '', ...
+ 'Download & install the new version?'};
+ createStruct.Interpreter = 'tex';
+ createStruct.Default = 'Yes';
+ answer = questdlg(msg,'FindJObj','Yes','No','No & never ask again',createStruct);
+ switch answer
+ case 'Yes' % => Yes: download & install newer file
+ try
+ %fileUrl = [baseUrl '/download.do?objectId=14317&fn=findjobj&fe=.m'];
+ fileUrl = [baseUrl '/14317?controller=file_infos&download=true'];
+ %file = urlread(fileUrl);
+ %file = regexprep(file,[char(13),char(10)],'\n'); %convert to OS-dependent EOL
+ %fid = fopen(thisFileName,'wt');
+ %fprintf(fid,'%s',file);
+ %fclose(fid);
+ [fpath,fname,fext] = fileparts(thisFileName);
+ zipFileName = fullfile(fpath,[fname '.zip']);
+ urlwrite(fileUrl,zipFileName);
+ unzip(zipFileName,fpath);
+ rehash;
+ catch
+ % Error downloading: inform the user
+ msgbox(['Error in downloading: ' lasterr], 'FindJObj', 'warn'); %#ok
+ web(webUrl);
+ end
+ case 'No & never ask again' % => No & don't ask again
+ setpref('FindJObj','dontCheckNewerVersion',1);
+ otherwise
+ % forget it...
+ end
+ end
+ end
+ else
+ % Maybe webpage not fully loaded or changed format - bail out...
+ end
+ end
+ catch
+ % Never mind...
+ end
+ end
+
+ %% Get the first selected object (might not be the top one - depends on selection order)
+ function object = getTopSelectedObject(jTree, root)
+ try
+ object = [];
+ numSelections = jTree.getSelectionCount;
+ if numSelections > 0
+ % Get the first object specified
+ %object = jTree.getSelectionPath.getLastPathComponent.getUserObject;
+ nodedata = get(jTree.getSelectionPath.getLastPathComponent,'userdata');
+ else
+ % Get the root object (container)
+ %object = root.getUserObject;
+ nodedata = get(root,'userdata');
+ end
+ object = nodedata.obj;
+ catch
+ % Never mind...
+ dispError
+ end
+ end
+
+ %% Update component callback upon callbacksTable data change
+ function tbCallbacksChanged(src, evd, object, table)
+ persistent hash
+ try
+ % exit if invalid handle or already in Callback
+ %if ~ishandle(src) || ~isempty(getappdata(src,'inCallback')) % || length(dbstack)>1 %exit also if not called from user action
+ if isempty(hash), hash = java.util.Hashtable; end
+ if ~ishandle(src) || ~isempty(hash.get(src)) % || length(dbstack)>1 %exit also if not called from user action
+ return;
+ end
+ %setappdata(src,'inCallback',1); % used to prevent endless recursion % can't use getappdata(src,...) because it fails on R2010b!!!
+ hash.put(src,1);
+
+ % Update the object's callback with the modified value
+ modifiedColIdx = evd.getColumn;
+ modifiedRowIdx = evd.getFirstRow;
+ if modifiedRowIdx>=0 %&& modifiedColIdx==1 %sanity check - should always be true
+ %table = evd.getSource;
+ %object = get(src,'userdata');
+ modifiedRowIdx = table.getSelectedRow; % overcome issues with hierarchical table
+ cbName = strtrim(table.getValueAt(modifiedRowIdx,0));
+ try
+ cbValue = strtrim(char(table.getValueAt(modifiedRowIdx,1)));
+ if ~isempty(cbValue) && ismember(cbValue(1),'{[@''')
+ cbValue = eval(cbValue);
+ end
+ if (~ischar(cbValue) && ~isa(cbValue, 'function_handle') && (~iscell(cbValue) || iscom(object(1))))
+ revertCbTableModification(table, modifiedRowIdx, modifiedColIdx, cbName, object, '');
+ else
+ for objIdx = 1 : length(object)
+ obj = object(objIdx);
+ if ~iscom(obj)
+ try
+ try
+ if isjava(obj)
+ obj = handle(obj,'CallbackProperties');
+ end
+ catch
+ % never mind...
+ end
+ set(obj, cbName, cbValue);
+ catch
+ try
+ set(handle(obj,'CallbackProperties'), cbName, cbValue);
+ catch
+ % never mind - probably a callback-group header
+ end
+ end
+ else
+ cbs = obj.eventlisteners;
+ if ~isempty(cbs)
+ cbs = cbs(strcmpi(cbs(:,1),cbName),:);
+ obj.unregisterevent(cbs);
+ end
+ if ~isempty(cbValue) && ~strcmp(cbName,'-')
+ obj.registerevent({cbName, cbValue});
+ end
+ end
+ end
+ end
+ catch
+ revertCbTableModification(table, modifiedRowIdx, modifiedColIdx, cbName, object, lasterr) %#ok
+ end
+ end
+ catch
+ % never mind...
+ end
+ %setappdata(src,'inCallback',[]); % used to prevent endless recursion % can't use setappdata(src,...) because it fails on R2010b!!!
+ hash.remove(src);
+ end
+
+ %% Revert Callback table modification
+ function revertCbTableModification(table, modifiedRowIdx, modifiedColIdx, cbName, object, errMsg) %#ok
+ try
+ % Display a notification MsgBox
+ msg = 'Callbacks must be a ''string'', or a @function handle';
+ if ~iscom(object(1)), msg = [msg ' or a {@func,args...} construct']; end
+ if ~isempty(errMsg), msg = {errMsg, '', msg}; end
+ msgbox(msg, ['Error setting ' cbName ' value'], 'warn');
+
+ % Revert to the current value
+ curValue = '';
+ try
+ if ~iscom(object(1))
+ curValue = charizeData(get(object(1),cbName));
+ else
+ cbs = object(1).eventlisteners;
+ if ~isempty(cbs)
+ cbs = cbs(strcmpi(cbs(:,1),cbName),:);
+ curValue = charizeData(cbs(1,2));
+ end
+ end
+ catch
+ % never mind... - clear the current value
+ end
+ table.setValueAt(curValue, modifiedRowIdx, modifiedColIdx);
+ catch
+ % never mind...
+ end
+ end % revertCbTableModification
+
+ %% Get the Java positions of all HG text labels
+ function labelPositions = getLabelsJavaPos(container)
+ try
+ labelPositions = [];
+
+ % Ensure we have a figure handle
+ try
+ h = hFig; %#ok unused
+ catch
+ hFig = getCurrentFigure;
+ end
+
+ % Get the figure's margins from the Matlab properties
+ hg_labels = findall(hFig, 'Style','text');
+ units = get(hFig,'units');
+ set(hFig,'units','pixels');
+ outerPos = get(hFig,'OuterPosition');
+ innerPos = get(hFig,'Position');
+ set(hFig,'units',units);
+ margins = abs(innerPos-outerPos);
+
+ figX = container.getX; % =outerPos(1)
+ figY = container.getY; % =outerPos(2)
+ %figW = container.getWidth; % =outerPos(3)
+ figH = container.getHeight; % =outerPos(4)
+
+ % Get the relevant screen pixel size
+ %monitorPositions = get(0,'MonitorPositions');
+ %for monitorIdx = size(monitorPositions,1) : -1 : 1
+ % screenSize = monitorPositions(monitorIdx,:);
+ % if (outerPos(1) >= screenSize(1)) % && (outerPos(1)+outerPos(3) <= screenSize(3))
+ % break;
+ % end
+ %end
+ %monitorBaseY = screenSize(4) - monitorPositions(1,4);
+
+ % Compute the labels' screen pixel position in Java units ([0,0] = top left)
+ for idx = 1 : length(hg_labels)
+ matlabPos = getpixelposition(hg_labels(idx),1);
+ javaX = figX + matlabPos(1) + margins(1);
+ javaY = figY + figH - matlabPos(2) - matlabPos(4) - margins(2);
+ labelPositions(idx,:) = [javaX, javaY, matlabPos(3:4)]; %#ok grow
+ end
+ catch
+ % never mind...
+ err = lasterror; %#ok debug point
+ end
+ end
+
+ %% Traverse an HG container hierarchy and extract the HG elements within
+ function traverseHGContainer(hcontainer,level,parent)
+ try
+ % Record the data for this node
+ thisIdx = length(hg_levels) + 1;
+ hg_levels(thisIdx) = level;
+ hg_parentIdx(thisIdx) = parent;
+ try
+ hg_handles(thisIdx) = handle(hcontainer);
+ catch
+ hg_handles = handle(hcontainer);
+ end
+ parentId = length(hg_parentIdx);
+
+ % Now recursively process all this node's children (if any)
+ %if ishghandle(hcontainer)
+ try % try-catch is faster than checking ishghandle(hcontainer)...
+ allChildren = allchild(handle(hcontainer));
+ for childIdx = 1 : length(allChildren)
+ traverseHGContainer(allChildren(childIdx),level+1,parentId);
+ end
+ catch
+ % do nothing - probably not a container
+ %dispError
+ end
+
+ % TODO: Add axis (plot) component handles
+ catch
+ % forget it...
+ end
+ end
+
+ %% Debuggable "quiet" error-handling
+ function dispError
+ err = lasterror; %#ok
+ msg = err.message;
+ for idx = 1 : length(err.stack)
+ filename = err.stack(idx).file;
+ if ~isempty(regexpi(filename,mfilename))
+ funcname = err.stack(idx).name;
+ line = num2str(err.stack(idx).line);
+ msg = [msg ' at ' funcname ' line #' line '']; %#ok grow
+ break;
+ end
+ end
+ disp(msg);
+ return; % debug point
+ end
+
+ %% ML 7.0 - compatible ischar() function
+ function flag = ischar(data)
+ try
+ flag = builtin('ischar',data);
+ catch
+ flag = isa(data,'char');
+ end
+ end
+
+ %% Set up the uitree context (right-click) menu
+ function jmenu = setTreeContextMenu(obj,node,tree_h)
+ % Prepare the context menu (note the use of HTML labels)
+ import javax.swing.*
+ titleStr = getNodeTitleStr(obj,node);
+ titleStr = regexprep(titleStr,'
.*','');
+ menuItem0 = JMenuItem(titleStr);
+ menuItem0.setEnabled(false);
+ menuItem0.setArmed(false);
+ %menuItem1 = JMenuItem('Export handle to findjobj_hdls');
+ if isjava(obj), prefix = 'j'; else, prefix = 'h'; end %#ok
Text/title: %s',objClass,objName);
+
+ % If the component is invisible, state this in the tooltip
+ if ~isempty(strfind(nodeName,'color="gray"'))
+ nodeTitleStr = [nodeTitleStr '
*** Invisible ***'];
+ end
+ nodeTitleStr = [nodeTitleStr '
Right-click for context-menu'];
+ catch
+ % Possible not a Java object - try treating as an HG handle
+ try
+ handleValueStr = sprintf('#: %.99g',double(obj));
+ try
+ type = '';
+ type = get(obj,'type');
+ type(1) = upper(type(1));
+ catch
+ if ~ishandle(obj)
+ type = ['Invalid ' char(node.getName) ''];
+ handleValueStr = '!!!
Perhaps this handle was deleted after this UIInspect tree was
already drawn. Try to refresh by selecting any valid node handle';
+ end
+ end
+ nodeTitleStr = sprintf('%s handle %s',type,handleValueStr);
+ try
+ % If the component is invisible, state this in the tooltip
+ if strcmp(get(obj,'Visible'),'off')
+ nodeTitleStr = [nodeTitleStr '