view m-toolbox/classes/@repogui/buildSubmitPanel.m @ 25:79dc7091dbbc database-connection-manager

Update tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% BUILDSUBMITPANEL build the submit panel.
%
% M Hewitson 22-09-08
%
% $Id: buildSubmitPanel.m,v 1.7 2011/04/08 08:56:25 hewitson Exp $
%
function buildSubmitPanel(mainfig)
  
  import utils.const.*
  utils.helper.msg(msg.PROC1, 'building Submit Panel');
  
  htab = mainfig.panels(2);
  
  Gproperties = mainfig.Gproperties;
  pmarg = 0.025;
  
  CommonHeight = 0.06;
  
  % header
  bw = 0.3;
  bl = pmarg;
  
  bh = CommonHeight;
  bb = 1-2*pmarg-bh-0.6;
  uicontrol(htab, 'Style','pushbutton',...
     'String', 'Refresh',...
     'Units', 'normalized', ...
     'Fontsize', Gproperties.fontsize+2, ...
     'Position',[bl bb .14 bh], ...
     'Callback',@refreshBtnCallback);
 
  uicontrol(htab, 'Style','pushbutton',...
     'String', 'Select',...
     'Units', 'normalized', ...
     'Fontsize', Gproperties.fontsize+2, ...
     'Position',[pmarg+.16 bb .14 bh], ...
     'Callback',@okBtnCallback);
 

  % list box objects to submit
  
  bh = CommonHeight;
  bb = bb - bh - .02;
  uicontrol(htab, 'Style','text',...
    'String', 'Objects to submit:',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'ForegroundColor', 'k', ...
    'Fontsize', Gproperties.fontsize+1, ...
    'Userdata',[], ...
    'Tag', 'treeHandle', ...
    'Position',[bl bb bw bh]);

  bh = 0.18;
  bb = bb - bh;
  uicontrol(htab,'Style','edit',...
    'String',{' '},...
    'Min',1,...
    'Max',10,...
    'BackgroundColor', 'w',...
    'Fontsize', Gproperties.fontsize,...
    'Units', 'normalized', ...
    'Position',[bl bb bw bh],...
    'TooltipString','Here you can also type in the name of the variables to submit',...
    'Tag', 'RepoguiObjs2SubmitList');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  

  % Submission details
  
  EditWidth = 0.42;
  
  % Experiment title
  bl = bl + pmarg + bw;
  BL = bl;
  bw = 0.2;
  bh = CommonHeight;
  bb = 1-2*pmarg-bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Experiment Title',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'ForegroundColor', 'r', ...
    'FontWeight','Bold',...
    'Fontsize', Gproperties.fontsize+1, ...
    'Position',[bl bb bw bh]);
  
  bl = bl + pmarg + bw;
  bw = EditWidth;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'Fontsize', Gproperties.fontsize, ...
    'String', '', ...
    'Position', [bl bb bw bh],...
    'HorizontalAlignment', 'left', ...
    'Tag', 'RepoguiExperimentTitleEdit');
  
  % Experiment description
  bl = BL;
  bw = 0.2;
  bh = 3*CommonHeight;
  bb = bb - pmarg - bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Experiment Description',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'ForegroundColor', 'r', ...
    'FontWeight','Bold',...
    'Fontsize', Gproperties.fontsize+1, ...
    'Position',[bl bb bw bh]);
  
  bl = bl + pmarg + bw;
  bw = EditWidth;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'Fontsize', Gproperties.fontsize, ...
    'HorizontalAlignment', 'left', ...
    'String', '', ...
    'Max', 1000, ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiExperimentDescriptionEdit');
  
  % Analysis description
  bl = BL;
  bw = 0.2;
  bh = 2*CommonHeight;
  bb = bb - pmarg - bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Analysis Description',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'ForegroundColor', 'r', ...
    'FontWeight','Bold',...
    'Fontsize', Gproperties.fontsize+1, ...
    'Position',[bl bb bw bh]);
  
  bl = bl + pmarg + bw;
  bw = EditWidth;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'HorizontalAlignment', 'left', ...
    'Fontsize', Gproperties.fontsize, ...
    'String', '', ...
    'Max', 1000, ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiAnalysisDescriptionEdit');
  
  % Quantity
  bl = BL;
  bw = 0.2;
  bh = CommonHeight;
  bb = bb - pmarg - bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Quantity',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'ForegroundColor', 'k', ...
    'Fontsize', Gproperties.fontsize+1, ...
    'Position',[bl bb bw bh]);
  
  bl = bl + pmarg + bw;
  bw = EditWidth;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'HorizontalAlignment', 'left', ...
    'Fontsize', Gproperties.fontsize, ...
    'String', '', ...
    'Max', 1000, ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiQuantityEdit');
  
  % Keywords
  bl = BL;
  bw = 0.2;
  bh = CommonHeight;
  bb = bb - pmarg - bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Keywords',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'ForegroundColor', 'k', ...
    'Fontsize', Gproperties.fontsize+1, ...
    'Position',[bl bb bw bh]);
  
  bl = bl + pmarg + bw;
  bw = EditWidth;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'HorizontalAlignment', 'left', ...
    'Fontsize', Gproperties.fontsize, ...
    'String', '', ...
    'Max', 1000, ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiKeywordsEdit');
  
  % Reference IDs
  bl = BL;
  bw = 0.2;
  bh = CommonHeight;
  bb = bb - pmarg - bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Reference IDs',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'ForegroundColor', 'k', ...
    'Fontsize', Gproperties.fontsize+1, ...
    'Position',[bl bb bw bh]);
  
  bl = bl + pmarg + bw;
  bw = EditWidth;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'HorizontalAlignment', 'left', ...
    'Fontsize', Gproperties.fontsize, ...
    'String', '', ...
    'Max', 1000, ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiReferenceIDsEdit');
  
  % Additional comments
  bl = BL;
  bw = 0.2;
  bh = CommonHeight;
  bb = bb - pmarg - bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Additional Comments',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'ForegroundColor', 'k', ...
    'Fontsize', Gproperties.fontsize+1, ...
    'Position',[bl bb bw bh]);
  
  bl = bl + pmarg + bw;
  bw = EditWidth;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'HorizontalAlignment', 'left', ...
    'Fontsize', Gproperties.fontsize, ...
    'String', '', ...
    'Max', 1000, ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiAdditonalCommentsEdit');
  
  
  % Additional authors
  bl = BL;
  bw = 0.2;
  bh = CommonHeight;
  bb = bb - pmarg - bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Additional Authors',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'ForegroundColor', 'k', ...
    'Fontsize', Gproperties.fontsize+1, ...
    'Position',[bl bb bw bh]);
  
  bl = bl + pmarg + bw;
  bw = EditWidth;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'HorizontalAlignment', 'left', ...
    'Fontsize', Gproperties.fontsize, ...
    'String', '', ...
    'Max', 1000, ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiAdditionalAuthorsEdit');
  
  % Submit button
  
%   bb = bb - pmarg - bh;
  bb = .02;
  bl = bl + bw - 0.2;
  bw = 0.2;
  pbh = uicontrol(htab,'Style','pushbutton',...
    'String','Submit',...
    'Callback', {'repogui.cb_submit', mainfig}, ...
    'Units', 'normalized', ...
    'Fontsize', Gproperties.fontsize, ...
    'Position',[bl bb bw bh], ...
    'Tag','repoguiSubmitButton');
  
end

function okBtnCallback(varargin)
   
   tree = get(findobj(gcf,'Tag','treeHandle'),'UserData');
   objNames = {};
   xx = get(tree,'SelectedNodes');
   
   for j=1:numel(xx)
      yy{j} = getPath(xx(j));
      
      cName = '';
      for i = 2:numel(yy{j})
         cName = [cName '.' char(getName(yy{j}(i)))];
      end;
      
      if ~isempty(cName)
         cName(1) = [];
         objNames = [objNames cName];
      end
   end
      
   objNames = objNames';
   
   set(findobj('Tag','RepoguiObjs2SubmitList'),'String',objNames);
   
end


function refreshBtnCallback(varargin)
   
   tree = get(findobj(gcf,'Tag','treeHandle'),'UserData');
   delete(tree)
   tree = repogui.cb_treegui();
   set(findobj(gcf,'Tag','treeHandle'),'UserData',tree);
   
end