Home > m > gui > ltpdaRepoGUI > repogui.m

repogui

PURPOSE ^

REPOGUI a GUI to interact with an LTPDA Repository.

SYNOPSIS ^

function varargout = repogui(varargin)

DESCRIPTION ^

 REPOGUI a GUI to interact with an LTPDA Repository.
 
 M Hewitson

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = repogui(varargin)
0002 
0003 % REPOGUI a GUI to interact with an LTPDA Repository.
0004 %
0005 % M Hewitson
0006 %
0007 
0008 addpath('callbacks');
0009 
0010 %% Check if I exist already
0011 id = findobj('Tag', 'LTPDARepomainfig');
0012 if ~isempty(id)
0013   figure(id)
0014   return
0015 end
0016 
0017 %% Some initial setup
0018 
0019 
0020 
0021 Gproperties.Gcol    = [240 240 240]/255;
0022 Gproperties.Gwidth  = 800;
0023 Gproperties.Gheight = 600;
0024 Gproperties.Gborder = 10;
0025 
0026 Gproperties.Screen   = get(0,'screensize');
0027 Gproperties.Gposition = [Gproperties.Screen(3)/2-Gproperties.Gwidth/2 ...
0028                          Gproperties.Screen(4)/2-Gproperties.Gheight/2 ...
0029                          Gproperties.Gwidth...
0030                          Gproperties.Gheight];
0031 
0032 %  Initialize and hide the GUI as it is being constructed.
0033 mainfig = figure('Name', 'LTPDA Repository GUI',...
0034                  'NumberTitle', 'off',...
0035                  'Visible','off',...
0036                  'Position',Gproperties.Gposition,...
0037                  'Color', Gproperties.Gcol,...
0038                  'Toolbar', 'none',...
0039                  'MenuBar', 'none',...
0040                  'Resize', 'off',...
0041                  'Tag', 'LTPDARepomainfig');
0042 
0043 % Set mainfig callbacks
0044 set(mainfig, 'CloseRequestFcn', {'cb_mainfigClose', mainfig});
0045 
0046 % Set Application data
0047 setappdata(mainfig, 'Gproperties', Gproperties);
0048 setappdata(mainfig, 'connection', []);
0049 setappdata(mainfig, 'Nconditions', 0);
0050 setappdata(mainfig, 'tableSelected', 1);
0051 
0052 %% Add components
0053 
0054 Tleft   = Gproperties.Gborder/Gproperties.Gwidth;
0055 Theight = 1-2*Gproperties.Gborder/Gproperties.Gheight;
0056 Tbottom = (1 - Gproperties.Gborder/Gproperties.Gheight - Theight);
0057 Twidth  = 1-2*Gproperties.Gborder/Gproperties.Gwidth;
0058 
0059 htab = uitabpanel(...
0060   'Parent',mainfig,...
0061   'Style','lefttop',...
0062   'Units','normalized',...
0063   'Position',[Tleft Tbottom Twidth Theight],...
0064   'Fontsize', 14,...
0065   'FrameBackgroundColor',Gproperties.Gcol,...
0066   'FrameBorderType','etchedout',...
0067   'Title',{'Connection','Submit','Query', 'Retrieve'},...
0068   'HorizontalAlignment','left',...
0069   'FontWeight','bold',...
0070   'TitleBackgroundColor',Gproperties.Gcol,...
0071   'TitleForegroundColor','k',...
0072   'TitleHighlightColor', [1 0 0],...
0073   'PanelBackgroundColor',Gproperties.Gcol,...
0074   'PanelBorderType','line');
0075 
0076 hpanel = getappdata(htab,'panels');
0077 setappdata(mainfig, 'panels', hpanel);
0078 
0079 %-------- Connection Panel -------------
0080 cp = create_connection_panel(hpanel(1), Gproperties);
0081 %-------- Submit Panel -------------
0082 sp = create_submit_panel(hpanel(2), Gproperties);
0083 %-------- Query Panel -------------
0084 qp = create_query_panel(hpanel(3), Gproperties);
0085 %-------- Query Panel -------------
0086 rp = create_retrieve_panel(hpanel(4), Gproperties);
0087 
0088 
0089 %% Start the GUI
0090 
0091 % Make the GUI visible.
0092 set(mainfig,'Visible','on')
0093 
0094 
0095 h = findobj(mainfig, 'Tag', 'statusTxt');
0096 get(h, 'String')
0097 
0098 end
0099 
0100 %--------------------------------------------------------------------------
0101 % Create the retrieve panel
0102 %
0103 function panel = create_retrieve_panel(panel, Gproperties)
0104 
0105 Ppos    = get(panel, 'Position');
0106 mainfig = findobj('Tag', 'LTPDARepomainfig');
0107 
0108 %-- Text string
0109 Sleft   = 10;
0110 Sheight = 20;
0111 Sbottom = Ppos(2) + Ppos(4) - 20 - Gproperties.Gborder - Sheight;
0112 Swidth  = 300;
0113 Osth = uicontrol(panel,'Style','text',...
0114                 'String','Retrieve object IDs',...
0115                 'Fontsize', 14,...
0116                 'BackgroundColor', Gproperties.Gcol,...
0117                 'HorizontalAlignment', 'left',...
0118                 'Position',[Sleft Sbottom Swidth Sheight]);
0119               
0120 %-- ID entry
0121 pos     = get(Osth, 'Position');
0122 Sleft   = 10;
0123 Sheight = 250;
0124 Swidth  = 250;
0125 Sbottom = pos(2) - 20 - Sheight;
0126 
0127 sth = uicontrol(panel,'Style','edit',...
0128                 'String','',...
0129                 'Fontsize', 14,...
0130                 'BackgroundColor', 'w',...
0131                 'Max', 10,...
0132                 'HorizontalAlignment', 'left',...
0133                 'Position',[Sleft Sbottom Swidth Sheight],...
0134                 'Tag', 'retrieveIDsTxt');
0135 
0136 %-- Prefix entry
0137 pos     = get(sth, 'Position');
0138 Sleft   = 10;
0139 Sheight = 20;
0140 Sbottom = pos(2) - 20 - Sheight;
0141 Swidth  = 50;
0142 sth = uicontrol(panel,'Style','text',...
0143                 'String','Prefix',...
0144                 'Fontsize', 14,...
0145                 'BackgroundColor', Gproperties.Gcol,...
0146                 'HorizontalAlignment', 'left',...
0147                 'Position',[Sleft Sbottom Swidth Sheight]);
0148               
0149 
0150 Sleft   = Sleft + Swidth + 20;             
0151 Sheight = 20;
0152 Swidth  = 150;
0153 sth = uicontrol(panel,'Style','edit',...
0154                 'String','obj',...
0155                 'Fontsize', 14,...
0156                 'BackgroundColor', 'w',...
0157                 'HorizontalAlignment', 'left',...
0158                 'Position',[Sleft Sbottom Swidth Sheight],...
0159                 'Tag', 'objPrefixTxt');
0160 
0161 %-- Append obj type
0162 pos = get(sth, 'Position');
0163 Sleft   = 10;
0164 Swidth  = 150;
0165 Sheight = 20;
0166 Sbottom = pos(2) - 20 - Sheight;
0167 cbh = uicontrol(panel,'Style','checkbox',...
0168                 'String','Append object type',...
0169                 'Fontsize', 14,...
0170                 'BackgroundColor', Gproperties.Gcol,...
0171                 'Value',1,'Position',[Sleft Sbottom Swidth Sheight],...
0172                 'Tag', 'appendObjTypeChk');
0173 
0174 %-- Retrieve Btn
0175 
0176 Bleft   = 10;
0177 Bheight = 20;
0178 Bwidth  = 100;
0179 Bbottom = Ppos(2) + 10;
0180 pbh = uicontrol(panel,'Style','pushbutton','String','Retrieve',...
0181                 'Position',[Bleft Bbottom Bwidth Bheight ],...
0182                 'Fontsize', 14,...
0183                 'Fontweight', 'bold',...
0184                 'Tag', 'retrieveBtn');
0185 set(pbh, 'Callback', {'cb_retrieveBtn', pbh, mainfig});
0186 
0187 
0188 
0189 end
0190 
0191 %--------------------------------------------------------------------------
0192 % Create the Query panel
0193 %
0194 function panel = create_query_panel(panel, Gproperties)
0195 
0196 Ppos    = get(panel, 'Position');
0197 mainfig = findobj('Tag', 'LTPDARepomainfig');
0198 
0199 %-- Build conditions
0200 buildConditions(panel);
0201 
0202 end
0203 
0204 %--------------------------------------------------------------------------
0205 % Create the submit panel
0206 %
0207 function panel = create_submit_panel(panel, Gproperties)
0208 
0209 Ppos    = get(panel, 'Position');
0210 mainfig = findobj('Tag', 'LTPDARepomainfig');
0211 
0212 %-- Text string
0213 Sleft   = 10;
0214 Sheight = 20;
0215 Sbottom = Ppos(2) + Ppos(4) - 20 - Gproperties.Gborder - Sheight;
0216 Swidth  = 300;
0217 sth = uicontrol(panel,'Style','text',...
0218                 'String','LTPDA Objects',...
0219                 'Fontsize', 14,...
0220                 'BackgroundColor', Gproperties.Gcol,...
0221                 'HorizontalAlignment', 'center',...
0222                 'Position',[Sleft Sbottom Swidth Sheight]);
0223 
0224 %-- Workspace list of LTPDA objects
0225 Lleft   = 10;
0226 Lheight = 350;
0227 Lbottom = Ppos(2) + Ppos(4) - 40 - Gproperties.Gborder - Lheight;
0228 Lwidth  = Swidth;
0229 
0230 lbh = uicontrol(panel,'Style','listbox',...
0231                 'String',{' '},...
0232                 'Value',1,...
0233                 'BackgroundColor', 'w',...
0234                 'Fontsize', 14,...
0235                 'Max', 1000,...
0236                 'Position',[Lleft Lbottom Lwidth Lheight],...
0237                 'Tag', 'workspaceObjsList');
0238 
0239 % Set callback
0240 set(lbh, 'Callback', {'cb_workspaceObjsList', lbh, mainfig});
0241 
0242 % fill list
0243 objs = getWorkspaceObjs();
0244 setWorkspaceObjsList(objs);
0245 
0246 %-- Refresh button
0247 pos     = get(lbh, 'Position');
0248 Bleft   = Lleft;
0249 Bheight = 20;
0250 Bwidth  = 100;
0251 Bbottom = pos(2) - Bheight - 10;
0252 pbh = uicontrol(panel,'Style','pushbutton','String','Refresh list',...
0253                 'Position',[Bleft Bbottom Bwidth Bheight ],...
0254                 'Tag', 'refreshListBtn');
0255 set(pbh, 'Callback', {'cb_refreshObjsList', pbh, mainfig});
0256 
0257 
0258 %-- Info panel
0259 pos = get(lbh, 'Position');
0260 Sleft   = 10 + pos(1) + pos(3);
0261 Sheight = 150;
0262 Sbottom = Ppos(2) + Ppos(4) - 40 - Gproperties.Gborder - Sheight;
0263 Swidth  = 440;
0264 sth = uicontrol(panel,'Style','text',...
0265                 'String','',...
0266                 'Fontsize', 12,...
0267                 'BackgroundColor', 'w',...
0268                 'ForegroundColor', 'b',...
0269                 'HorizontalAlignment', 'left',...
0270                 'Position',[Sleft Sbottom Swidth Sheight],...
0271                 'Tag', 'ltpdaObjInfo');
0272 
0273 
0274 %-- experiment title
0275 pos     = get(sth, 'Position');
0276 Sheight = 20;
0277 Swidth  = 150;
0278 Sbottom = pos(2) - 20 - Sheight;
0279 
0280 sth = uicontrol(panel,'Style','text',...
0281                 'String','Experiment Title',...
0282                 'Fontsize', 14,...
0283                 'BackgroundColor', Gproperties.Gcol,...
0284                 'HorizontalAlignment', 'left',...
0285                 'Position',[Sleft Sbottom Swidth Sheight]);
0286 
0287 Tleft   = Sleft + Swidth + 20;              
0288 Theight = 20;
0289 Twidth  = 270;
0290 Tbottom = Sbottom;
0291               
0292 sth = uicontrol(panel,'Style','edit',...
0293                 'String','',...
0294                 'Fontsize', 14,...
0295                 'BackgroundColor', 'w',...
0296                 'HorizontalAlignment', 'left',...
0297                 'Position',[Tleft Tbottom Twidth Theight],...
0298                 'Tag', 'experimentTitle');
0299 
0300 %-- experiment description
0301 Sbottom = Sbottom - 20 - Theight;
0302 
0303 sth = uicontrol(panel,'Style','text',...
0304                 'String','Experiment description',...
0305                 'Fontsize', 14,...
0306                 'BackgroundColor', Gproperties.Gcol,...
0307                 'HorizontalAlignment', 'left',...
0308                 'Position',[Sleft Sbottom Swidth Sheight]);
0309 
0310 Extra = 60;
0311 Tbottom = Sbottom + 20 - Theight - Extra;
0312 Theight = Theight + Extra;              
0313 sth = uicontrol(panel,'Style','edit',...
0314                 'String','',...
0315                 'Fontsize', 14,...
0316                 'BackgroundColor', 'w',...
0317                 'Max', 100,...
0318                 'HorizontalAlignment', 'left',...
0319                 'Position',[Tleft Tbottom Twidth Theight],...
0320                 'Tag', 'experimentDescription');
0321 
0322 %-- reference ids
0323 Sbottom = Sbottom - 20 - Theight;
0324 
0325 sth = uicontrol(panel,'Style','text',...
0326                 'String','Reference IDs',...
0327                 'Fontsize', 14,...
0328                 'BackgroundColor', Gproperties.Gcol,...
0329                 'HorizontalAlignment', 'left',...
0330                 'Position',[Sleft Sbottom Swidth Sheight]);
0331 
0332 Theight = 20;              
0333 Tbottom = Sbottom + 20 - Theight;
0334 sth = uicontrol(panel,'Style','edit',...
0335                 'String','',...
0336                 'Fontsize', 14,...
0337                 'BackgroundColor', 'w',...
0338                 'Max', 1,...
0339                 'HorizontalAlignment', 'left',...
0340                 'Position',[Tleft Tbottom Twidth Theight],...
0341                 'Tag', 'referenceIDs');
0342               
0343 %-- additional comments
0344 Sbottom = Sbottom - 20 - Theight;
0345 
0346 sth = uicontrol(panel,'Style','text',...
0347                 'String','Additional Comments',...
0348                 'Fontsize', 14,...
0349                 'BackgroundColor', Gproperties.Gcol,...
0350                 'HorizontalAlignment', 'left',...
0351                 'Position',[Sleft Sbottom Swidth Sheight]);
0352 
0353 Extra = 30;
0354 Tbottom = Sbottom + 20 - Theight - Extra;
0355 Theight = Theight + Extra;              
0356 sth = uicontrol(panel,'Style','edit',...
0357                 'String','',...
0358                 'Fontsize', 14,...
0359                 'BackgroundColor', 'w',...
0360                 'Max', 100,...
0361                 'HorizontalAlignment', 'left',...
0362                 'Position',[Tleft Tbottom Twidth Theight],...
0363                 'Tag', 'additionalComments');
0364               
0365 %-- additional authors
0366 Sbottom = Sbottom - 20 - Theight;
0367 
0368 sth = uicontrol(panel,'Style','text',...
0369                 'String','Additional Authors',...
0370                 'Fontsize', 14,...
0371                 'BackgroundColor', Gproperties.Gcol,...
0372                 'HorizontalAlignment', 'left',...
0373                 'Position',[Sleft Sbottom Swidth Sheight]);
0374 
0375 Extra = 0;
0376 Tbottom = Sbottom + 20 - Theight - Extra;
0377 Theight = Theight + Extra;              
0378 sth = uicontrol(panel,'Style','edit',...
0379                 'String','',...
0380                 'Fontsize', 14,...
0381                 'BackgroundColor', 'w',...
0382                 'Max', 100,...
0383                 'HorizontalAlignment', 'left',...
0384                 'Position',[Tleft Tbottom Twidth Theight],...
0385                 'Tag', 'additionalAuthors');
0386 
0387 
0388 %-- Submit Btn
0389 
0390 pos     = get(lbh, 'Position');
0391 Bleft   = Lleft;
0392 Bheight = 20;
0393 Bwidth  = 100;
0394 Bbottom = Ppos(2) + 10;
0395 pbh = uicontrol(panel,'Style','pushbutton','String','Submit',...
0396                 'Position',[Bleft Bbottom Bwidth Bheight ],...
0397                 'Fontsize', 14,...
0398                 'Fontweight', 'bold',...
0399                 'Tag', 'submitBtn');
0400 set(pbh, 'Callback', {'cb_submitBtn', pbh, mainfig});
0401 
0402 
0403 
0404 end
0405 
0406 
0407 %--------------------------------------------------------------------------
0408 % Create the server connection panel
0409 %
0410 function panel = create_connection_panel(panel, Gproperties)
0411 
0412 
0413 % %-- Panel
0414 % Pleft   = Gproperties.Gborder/Gproperties.Gheight;
0415 % Pbottom = Gproperties.Gborder/Gproperties.Gheight;
0416 % Pwidth  = 1-2*Gproperties.Gborder/Gproperties.Gwidth;
0417 % Pheight = 0.4;
0418 %
0419 % hp = uipanel('Parent', mainfig,...
0420 %              'Title', 'Server Connection',...
0421 %              'FontSize', 14,...
0422 %              'BackgroundColor', Gproperties.Gcol,...
0423 %              'Position', [Pleft Pbottom Pwidth Pheight],...
0424 %              'BorderType', 'etchedout', ...
0425 %              'HighlightColor', [0.1 0.9 0.1]);
0426 
0427 Ppos    = get(panel, 'Position');
0428 mainfig = findobj('Tag', 'LTPDARepomainfig');
0429 
0430 %-- Server selection
0431 Sleft   = 10;
0432 Sbottom = Ppos(2) + Ppos(4) - 40-Gproperties.Gborder;
0433 Swidth  = 150;
0434 Sheight = 20;
0435 
0436 pmh = uicontrol(panel,'Style','popupmenu',...
0437                 'String',{'localhost','130.75.117.56'},...
0438                 'Fontsize', 14,...
0439                 'BackgroundColor', Gproperties.Gcol,...
0440                 'Value',1,'Position',[Sleft Sbottom Swidth Sheight],...
0441                 'Tag', 'serverSelect');
0442 
0443 %-- Server Txt entry
0444 Tleft   = Sleft + Swidth + 10;
0445 Tbottom = Sbottom;
0446 Twidth  = 200;
0447 Theight = 20;
0448 
0449 eth = uicontrol(panel,'Style','edit',...
0450                 'String','localhost',...
0451                 'Fontsize', 14,...
0452                 'BackgroundColor', 'w',...
0453                 'Position',[Tleft Tbottom Twidth Theight],...
0454                 'Tag', 'serverTxt');
0455 
0456 %-- Text string
0457 sth = uicontrol(panel,'Style','text',...
0458                 'String','Server hostname',...
0459                 'Fontsize', 14,...
0460                 'BackgroundColor', Gproperties.Gcol,...
0461                 'HorizontalAlignment', 'left',...
0462                 'Position',[Tleft+Twidth+10 Tbottom 120 Theight]);
0463 
0464 %-- Database selection
0465 pmh = uicontrol(panel,'Style','popupmenu',...
0466                 'String',{'ltpda','utp','test'},...
0467                 'Fontsize', 14,...
0468                 'BackgroundColor', Gproperties.Gcol,...
0469                 'Value',1,'Position',[Sleft Sbottom-Sheight-10 Swidth Sheight],...
0470                 'Tag', 'dbSelect');
0471 set(pmh, 'Callback', {'cb_dbSelect', pmh, mainfig});
0472 
0473 %-- Database Txt entry
0474 eth = uicontrol(panel,'Style','edit',...
0475                 'String','ltpda',...
0476                 'Fontsize', 14,...
0477                 'BackgroundColor', 'w',...
0478                 'Position',[Tleft Tbottom-Theight-10 Twidth Theight],...
0479                 'Tag', 'databaseTxt');
0480               
0481 %-- Text string
0482 sth = uicontrol(panel,'Style','text',...
0483                 'String','Database',...
0484                 'Fontsize', 14,...
0485                 'BackgroundColor', Gproperties.Gcol,...
0486                 'HorizontalAlignment', 'left',...
0487                 'Position',[Tleft+Twidth+10 Tbottom-Theight-10 120 Theight]);
0488               
0489 %-- Available DBs button
0490 pos     = get(sth, 'Position');
0491 Bleft   = pos(1) + pos(3) + 20;
0492 Bbottom = pos(2);
0493 Bwidth  = 100;
0494 Bheight = 20;
0495 pbh = uicontrol(panel,'Style','pushbutton','String','Get DBs',...
0496                 'Position',[Bleft Bbottom Bwidth Bheight ],...
0497                 'Tag', 'getDbsBtn');
0498 set(pbh, 'Callback', {'cb_getDBs', pbh, mainfig});
0499 
0500 %-- Login Btn
0501 pos     = get(pmh, 'Position');
0502 Bleft   = pos(1);
0503 Bbottom = pos(2) - pos(4) - 20;
0504 Bwidth  = 100;
0505 Bheight = 20;
0506 
0507 pbh = uicontrol(panel,'Style','pushbutton','String','Connect',...
0508                 'Position',[Bleft Bbottom Bwidth Bheight ],...
0509                 'Tag', 'connectBtn');
0510 set(pbh, 'Callback', {'cb_connectBtn', pbh, mainfig});
0511 
0512 %-- Status Txt
0513 Sleft   = Bleft;
0514 Sbottom = Ppos(2)+40;
0515 Swidth  = 60;
0516 Sheight = 20;
0517 
0518 sth = uicontrol(panel,'Style','text',...
0519                 'String','Status:',...
0520                 'Fontsize', 14,...
0521                 'BackgroundColor', Gproperties.Gcol,...
0522                 'HorizontalAlignment', 'left',...
0523                 'Position',[Sleft Sbottom Swidth Sheight]);
0524 
0525 pos = get(sth, 'Position');
0526 Sleft   = Sleft + Swidth + 20;
0527 Swidth  = Ppos(3) - pos(2) - pos(3) - Gproperties.Gborder;
0528 Sheight = 60;
0529 Sbottom = Ppos(2) + 10;
0530 sth = uicontrol(panel,'Style','text',...
0531                 'String','not connected',...
0532                 'Fontsize', 14,...
0533                 'BackgroundColor', 'w',...
0534                 'HorizontalAlignment', 'left',...
0535                 'Max', 100,...
0536                 'Position',[Sleft Sbottom Swidth Sheight],...
0537                 'Tag', 'statusTxt');
0538 
0539 
0540 end
0541

Generated on Thu 01-Nov-2007 09:42:34 by m2html © 2003