function node = getTreeNodeInterface(this)
% GETTREENODEINTERFACE Returns uitreenode associated with this
% object.

if isempty(this.TreeNode )
  this.TreeNode = uitreenode(this,this.Label,this.Icon,~this.AllowsChildren);
  
  % Cache the udd object handle in the user object property
  this.TreeNode.setUserObject(this);
  
  % Add property listeners
  props = findprop(this, 'Label'); 
  L = handle.listener(this, findprop(this, 'Label'), ...
      'PropertyPostSet', @LocalUDDPropertyChange );
  set(L, 'CallbackTarget', this);
  this.TreeListeners = [ this.TreeListeners; L ];
end
node = this.TreeNode;

% ----------------------------------------------------------------------------- %
% % Update UDD object when a property changes on the java side
% function LocalPropertyChange(hSrc, hData, this)
% 
% name  = char( hData.getPropertyName );
% value = hData.getNewValue;
% 
% switch name
% case char( ExplorerTreeNode.LABEL_CHANGED_PROPERTY )
%   this.Label = value;
% case char( ExplorerTreeNode.DESCRIPTION_CHANGED_PROPERTY )
%   this.Description = value;
% end

% ----------------------------------------------------------------------------- %
% Update Java objects when a UDD property changes.
function LocalUDDPropertyChange(this, hData)

name  = hData.Source.Name;
value = hData.NewValue;
Node  = this.TreeNode;

%% Fire event only if Java label has really changed.
if ~strcmp(Node.getName, this.Label)
Node.setName( this.Label );

%% Refresh the tree to accomodate any chnage in label size
awtinvoke(this.getRoot.TsViewer.TreeManager.Tree.getModel,...
    'nodeChanged(Ljavax/swing/tree/TreeNode;)',Node)

% Get top node and fire event.
%     newData = { Node };
%     wksp = handle( Node.getRoot.getObject );
%     wksp.firePropertyChange('NODE_CHANGED', [], newData);
end
  
