view m-toolbox/m/gui/ltpdv/callbacks/ltpdv_properties_build_props.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents f0afece42f48
children
line wrap: on
line source

function ltpdv_properties_build_props(obj, mainfig)

  % Object class
  cl = class(obj);

  % Get setter methods
  ms = methods(cl);
  setters = ms(strmatch('set', ms));

  % Draw properties panel
  panh = findobj(mainfig, 'Tag', 'LTPDVobjectProperties');
  delete(get(panh, 'Children'))

  pmarg = 0.025;
  keyl = pmarg;
  keyh = 0.055;
  keyw = 0.3;
  keyb = 1-pmarg-keyh;
  vall = pmarg*2 + keyw;
  valw = 0.5;
  oldVals = {};
  for kk=1:numel(setters)

    sfcn = setters{kk};
    prop = lower(strrep(sfcn, 'set', ''));
    val = [];
    try
      val  = obj.(prop);
    end
    if isa(val, 'ltpda_obj')
      val = char(val);
    end
    if isa(val, 'sym')
      val = char(val);
    end
    if ~isnumeric(val)
      oldVals = [oldVals {val}];
      % Draw label
      sth = uicontrol(panh,'Style','text',...
        'String', sfcn,...
        'Units', 'normalized', ...
        'BackgroundColor', 'w', ...
        'Fontsize', 12, ...
        'Position',[keyl keyb keyw keyh]);

      % Draw edit box
      eh = uicontrol(panh,'Style','edit',...
        'String', val,...
        'units', 'normalized', ...
        'BackgroundColor', 'w', ...
        'Fontsize', 12, ...
        'Enable', 'on', ...
        'Position',[vall keyb valw keyh]);

      keyb = keyb - pmarg - keyh;
    end
  end
  % Draw apply button
  pbh = uicontrol(panh,'Style','pushbutton',...
    'String','Apply',...
    'Callback', {@ltpdv_properties_apply, oldVals, obj, mainfig}, ...
    'Units', 'normalized', ...
    'Fontsize', 12, ...
    'Position',[pmarg pmarg 0.15 0.05]);

end