% REPOGUI is a graphical interface for interacting with an LTPDA
% repository.
%
% CALL: repogui
%       repogui(h) % to draw the gui in another figure pointed to by
%                  % handle, h
%
% M Hewitson 22-09-08
%
% $Id: repogui.m,v 1.4 2011/04/08 08:56:25 hewitson Exp $
%
classdef repogui < handle

  properties (SetAccess=private, GetAccess=private)
    handle        = [];
    panels        = [];
    connection    = [];
    username      = '';
    dbuser        = '';
    dbpass        = '';
    Gproperties   = [];
    Nconditions   = 0;
    tableSelected = 1;
  end
  
  methods
    function mainfig = repogui(varargin)

      % Build the main figure
      mainfig = buildMainfig(mainfig, varargin{:});
      
      % Build panels
      buildConnectPanel(mainfig);
      buildSubmitPanel(mainfig);
      buildQueryPanel(mainfig);
      buildRetrievePanel(mainfig);
      buildHLQPanel(mainfig);
      
      % Make the GUI visible.
      set(mainfig.handle,'Visible','on')
    end
  end % End public methods

  methods (Static=true)
    % General
    objs = getWorkspaceObjs(varargin);
    
    % Main figure
    varargout = cb_mainfigClose(varargin);
    varargout = cb_tabChanged(varargin);
    
    % Connect panel
    varargout = cb_select_repo(varargin);
    varargout = cb_select_db(varargin);
    varargout = cb_get_dbs(varargin);
    varargout = cb_connect(varargin);
    
    % Submit panel
    varargout = cb_workspaceObjsList(varargin);
    varargout = cb_refreshObjsList(varargin);
    varargout = cb_submit(varargin);
    varargout = cb_treegui(varargin);
    
    % Query panel
    varargout = getFields(varargin);
    varargout = getTables(varargin);
    varargout = buildquery(varargin);
    varargout = sqlResultsGUI(varargin);
    varargout = cb_fieldSelect(varargin);
    varargout = cb_tableSelect(varargin);
    varargout = cb_condPlusBtn(varargin);
    varargout = cb_condSubtractBtn(varargin);
    varargout = cb_executeQuery(varargin);
    
    varargout = createTable(varargin)
    
    % Retrieve panel
    varargout = cb_importBtn(varargin);
    varargout = cb_saveBtn(varargin);
    
  end
  
  methods (Access = private)
    
    varargout = buildMainfig(varargin);
    varargout = buildConnectPanel(varargin);
    varargout = buildSubmitPanel(varargin);
    varargout = buildQueryPanel(varargin);
    varargout = buildConditions(varargin);
    varargout = buildRetrievePanel(varargin);
    varargout = buildHLQPanel(varargin);
    
  end
  
  methods (Access = public)
    
    % Callbacks
    
    % Connect panel
    
    % Submit panel
    varargout = setWorkspaceObjsList(varargin);
  end
  
end

% END
