% BUILDSUBMITPANEL build the submit panel.
%
% M Hewitson 22-09-08
%
% $Id: buildSubmitPanel.m,v 1.3 2011/04/08 08:56:36 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;
  
  % Workspace object list
  
  % header
  bw = 0.17;
  bl = pmarg;
  bh = CommonHeight;
  bb = 1-2*pmarg-bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'LTPDA Objects in Workspace',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'Fontsize', Gproperties.fontsize+2, ...
    'Position',[bl bb bw bh]);
  
  % list box
  bh = 0.7;
  bb = bb - pmarg - bh;
  lbh = uicontrol(htab,'Style','listbox',...
    'String',{' '},...
    'Value',1,...
    'BackgroundColor', 'w',...
    'Fontsize', Gproperties.fontsize,...
    'Units', 'normalized', ...
    'Max', 1000,...
    'Position',[bl bb bw bh],...
    'Tag', 'RepoguiWorkspaceObjsList', ...
    'Callback', {'repogui2.cb_workspaceObjsList', mainfig});
  
  
  % fill list
  objs = repogui2.getWorkspaceObjs();
  setWorkspaceObjsList(mainfig, objs);
  
  % refresh button
  bh = CommonHeight;
  bb = bb - pmarg - bh;
  pbh = uicontrol(htab,'Style','pushbutton',...
    'String','Refresh',...
    'Callback', {'repogui2.cb_refreshObjsList', mainfig}, ...
    'Units', 'normalized', ...
    'Fontsize', Gproperties.fontsize, ...
    'Position',[bl bb bw bh]);
  
  
  
  % Submission details
  
  EditWidth = 0.54;
  
  % 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', ...
    'Fontsize', Gproperties.fontsize, ...
    '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', ...
    'Fontsize', Gproperties.fontsize, ...
    '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', ...
    'Fontsize', Gproperties.fontsize, ...
    '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, ...
    '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, ...
    '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, ...
    '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, ...
    '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, ...
    '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;
  bl = bl + bw - 0.2;
  bw = 0.2;
  pbh = uicontrol(htab,'Style','pushbutton',...
    'String','Submit',...
    'Callback', {'repogui2.cb_submit', mainfig}, ...
    'Units', 'normalized', ...
    'Fontsize', Gproperties.fontsize, ...
    'Position',[bl bb bw bh]);
  
end
