view m-toolbox/classes/@repogui2/buildConnectPanel.m @ 2:18e956c96a1b database-connection-manager

Add LTPDADatabaseConnectionManager implementation. Matlab code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Sun, 04 Dec 2011 21:23:09 +0100
parents f0afece42f48
children
line wrap: on
line source

% BUILDCONNECTPANEL build the connection panel
% 
% M Hewitson 22-09-08
% 
% $Id: buildConnectPanel.m,v 1.4 2011/04/08 08:56:36 hewitson Exp $
% 

function buildConnectPanel( mainfig)

  import utils.const.*
  prefs = getappdata(0, 'LTPDApreferences');
  utils.helper.msg(msg.PROC1, 'building Connect Panel');
  
  htab = mainfig.panels(1);
  
  Gproperties = mainfig.Gproperties;
  pmarg = 0.025;

  % Get list of default servers set by ltpda_startup
  servers = prefs.repository.servers;
  
  CommonHeight = 0.06;
  UseWidth     = 0.8;
  
  % text description field
  bw = UseWidth;
  bl = 0.5-bw/2;
  bh = CommonHeight;
  bb = 1-2*pmarg-bh;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Select Repository',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'Fontsize', Gproperties.fontsize+2, ...
    'Position',[bl bb bw bh]);
  
  % Add hostname drop-down box  
  bw = 0.5-bl-pmarg;
  bh = CommonHeight;
  bb = bb - pmarg - bh;
  
  clsh = uicontrol(htab, ...
    'Style', 'popupmenu', ...
    'Units', 'normalized',...
    'Fontsize', Gproperties.fontsize, ...
    'BackgroundColor', 'w', ...
    'String', servers, ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiServerList', ...
    'Callback', {'repogui2.cb_select_repo', mainfig});
  
  % Hostname edit box
  bl = bl + bw + 2*pmarg;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'Fontsize', Gproperties.fontsize, ...
    'String', '', ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiServerEdit');

  
  % text description field
  bw = UseWidth;
  bl = 0.5-bw/2;
  bb = bb - 6*pmarg;
  sth = uicontrol(htab, 'Style','text',...
    'String', 'Select Database',...
    'Units', 'normalized', ...
    'BackgroundColor', 'w', ...
    'Fontsize', Gproperties.fontsize+2, ...
    'Position',[bl bb bw bh]);
  
  % db drop-down box
  bw = (UseWidth-2*pmarg)/3;
  bh = CommonHeight;
  bb = bb - pmarg - bh;
  
  clsh = uicontrol(htab, ...
    'Style', 'popupmenu', ...
    'Units', 'normalized',...
    'Fontsize', Gproperties.fontsize, ...
    'BackgroundColor', 'w', ...
    'String', {'ltpda_test'}, ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiDatabaseList', ...
    'Callback', {'repogui2.cb_select_db', mainfig});
  
  % get DBs button
  bl = bl + pmarg + bw;  
  pbh = uicontrol(htab,'Style','pushbutton',...
    'String','Get DBs',...
    'Callback', {'repogui2.cb_get_dbs', mainfig}, ...
    'Units', 'normalized', ...
    'Fontsize', Gproperties.fontsize, ...
    'Position',[bl bb bw bh]);
  
  
  % db edit field
  bl = bl + pmarg + bw;
  th = uicontrol(htab, ...
    'Style', 'edit', ...
    'Units', 'normalized',...
    'BackgroundColor', 'w', ...
    'Fontsize', Gproperties.fontsize, ...
    'String', '', ...
    'Position', [bl bb bw bh],...
    'Tag', 'RepoguiDatabaseEdit');
    
  % Connect button
  bb = bb - 10*pmarg;
  bl = 0.5-UseWidth/2;
  bw = UseWidth;
  pbh = uicontrol(htab,'Style','pushbutton',...
    'String','Connect',...
    'Callback', {'repogui2.cb_connect', mainfig}, ...
    'Units', 'normalized', ...
    'Fontsize', Gproperties.fontsize, ...
    'Position',[bl bb bw 2*bh]);
  

end