Home > m > gui > gltpda > pan5output.m

pan5output

PURPOSE ^

========================================================================

SYNOPSIS ^

function varargout = pan5output(varargin)

DESCRIPTION ^

 ========================================================================
 ====================== Panel for the outputs ===========================
 ========================================================================
 This is the GUI m-file to show that the panel relative to the outputs

  $Id: pan5output.m,v 1.3 2008/03/04 05:00:52 nicola Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = pan5output(varargin)
0002 
0003 % ========================================================================
0004 % ====================== Panel for the outputs ===========================
0005 % ========================================================================
0006 % This is the GUI m-file to show that the panel relative to the outputs
0007 %
0008 %  $Id: pan5output.m,v 1.3 2008/03/04 05:00:52 nicola Exp $
0009 
0010 global LTPDAoutvar
0011 
0012 InputObjList=''; OutputObjList='';
0013 UpdateListbox();
0014 
0015 currPanel   = varargin{1};
0016 panelDimens = get(currPanel, 'Position');
0017 backColor   = get(currPanel, 'BackgroundColor');
0018 
0019     DataPanPos   = [20 panelDimens(4)-320 panelDimens(3)-40 285];
0020   hDataPanel    =  uipanel(...
0021                       'Title','Data Control Panel',...
0022                       'BackgroundColor',[1,1,1],...
0023                       'FontSize',7,...
0024                       'Units','pixels',...
0025                       'Position',DataPanPos);
0026     nbuttons    = 6;
0027     buttonWidth = (DataPanPos(3)-10*(nbuttons+1))/nbuttons;
0028     buttonPos   = [10 DataPanPos(4)-45 buttonWidth 25];
0029   hPlotButton   =   uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Plot','FontSize',8,'Visible','on','Callback',@hLoadDataButtonCallback,'Style','pushbutton','enable','off');
0030     buttonPos(1) = buttonPos(1)+buttonWidth+10;
0031   hRemoveButton =   uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Remove','FontSize',8,'Visible','on','Callback',@hRemoveButtonCallback,'Style','pushbutton','enable','off');
0032     buttonPos(1) = buttonPos(1)+buttonWidth+10;
0033   hRepoButton   =   uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Send to repository','FontSize',8,'Visible','on','Callback',@hClearButtonCallback,'Style','pushbutton','enable','off');
0034     buttonPos(1) = buttonPos(1)+buttonWidth+10;
0035   hExploreButton =  uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Explore','FontSize',8,'Visible','on','UserData',InputObjList,'Callback',@hExploreButtonCallback,'Style','pushbutton','enable','off');
0036     buttonPos(1) = buttonPos(1)+buttonWidth+10;
0037   hSaveOutButton =  uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Save workspace','FontSize',8,'Visible','on','Enable','on','Callback',@SaveOutputCallback,'Style','pushbutton');
0038     buttonPos(1) = buttonPos(1)+buttonWidth+10;
0039   hClearButton  =   uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Clear output','FontSize',8,'Visible','on','Enable','on','Callback',@hClearButtonCallback,'Style','pushbutton');
0040     clear nbuttons buttonWidth buttonPos
0041 
0042 
0043     ntexts    = 2;
0044     textWidth = (DataPanPos(3)-10*(ntexts+1))/ntexts;
0045     textPos   = [10 DataPanPos(4)-80 textWidth 25];
0046   % hListAOText   =   uicontrol('Parent',hDataPanel,'BackgroundColor',get(hDataPanel,'BackgroundColor'),'HorizontalAlignment','center','Position',textPos,'String','Input:','FontName','Times New Roman','FontSize',8,'FontWeight','normal','Visible','on','Style','text');
0047     textPos(1) = textPos(1)+textWidth+10;
0048   hResultAOText   =   uicontrol('Parent',hDataPanel,'BackgroundColor',get(hDataPanel,'BackgroundColor'),'HorizontalAlignment','center','Position',textPos,'String','Output:','FontName','Times New Roman','FontSize',8,'FontWeight','normal','Visible','on','Style','text');
0049     clear ntexts textWidth textPos
0050 
0051 
0052     nlists    = 2;
0053     listWidth = (DataPanPos(3)-10*(nlists+1))/nlists;
0054     listPos   = [10 DataPanPos(4)-275 listWidth 200];
0055   % Info panel:
0056   uicontrol('Parent',hDataPanel,'BackgroundColor',[0.94,0.94,1],'Style','text','HorizontalAlignment', 'left','Fontsize', 7,'Units','pixels','Position',listPos,'Tag','infoPanel');
0057     listPos(1) = listPos(1)+listWidth+10;
0058   OutputObjList   =   uicontrol('Parent',hDataPanel,'BackgroundColor',[0.95,0.95,0.95],'HorizontalAlignment','center','Position',listPos,'String',listResAOs,'Value',[],'Max',10,'Min',1,'FontSize',8,'FontWeight','normal','Visible','on','Callback',@hResultListCallback,'Style','listbox');
0059     hResultListCallback(OutputObjList,1)
0060     clear DataPanPos nlists listWidth listPos
0061     
0062     
0063 %%
0064     %----------------------------------------------------------------------
0065     function UpdateListbox(varargin)
0066     % Updates the LTPDAoutvar listbox
0067 
0068          %==================================
0069          % Update the list of results AOs
0070          [anobX,anobY]=size(LTPDAoutvar);
0071          listResAOs=cell(anobX,anobY);
0072          if anobX>0
0073              for j=1:anobX
0074                  if ltpda_isuserobject(LTPDAoutvar{j,1})
0075                      anobject=LTPDAoutvar{j};
0076                      aonumber=sprintf('%g',j);
0077                      aoname={anobject.name};
0078                      aocreated=get(get(anobject.provenance, 'created'),'time_str');
0079                      if strcmp (aoname,'None')
0080                          listResAOs(j,1)=strcat(aonumber,'.---------------- None ----------------');
0081                      else
0082                          listResAOs(j,1)=strcat(aonumber,' ._',aoname,'__',aocreated);
0083                      end
0084                  end
0085              end
0086          else
0087              listResAOs{1,1}='The memory is empty';
0088          end
0089          if ~isempty(OutputObjList)
0090              set(OutputObjList,'Value',1)
0091              set(OutputObjList,'String',listResAOs)
0092          end
0093          %==================================
0094 
0095     end
0096     %----------------------------------------------------------------------
0097 
0098 %%
0099     %----------------------------------------------------------------------
0100     function hResultListCallback(hObject, varargin)
0101     % This callback is called whenever the user double click upon one of
0102     % the AOs in use.
0103         if ~isempty(varargin{1}) && varargin{1}==1 && size(LTPDAoutvar,1)>0
0104                 val = get(hObject, 'Value');
0105                 if length(val) == 1
0106                     lines = get(hObject, 'String');
0107                     objnumb = str2double(deblank(strtok(lines{val})));
0108                     objtxt = display(LTPDAoutvar{objnumb});
0109                 else
0110                     objtxt = '';
0111                 end
0112                 set(findobj('Tag', 'infoPanel'), 'String', objtxt)
0113         elseif size(LTPDAoutvar,1)>0
0114             if strcmp(get(gcf,'SelectionType'),'normal')
0115                 val = get(hObject, 'Value');
0116                 if length(val) == 1
0117                     lines = get(hObject, 'String');
0118                     objnumb = str2double(deblank(strtok(lines{val})));
0119                     objtxt = display(LTPDAoutvar{objnumb});
0120                 else
0121                     objtxt = '';
0122                 end
0123                 set(findobj('Tag', 'infoPanel'), 'String', objtxt)
0124             end
0125             if strcmp(get(gcf,'SelectionType'),'open')
0126                 currAO=get(hObject,'Value');
0127                 figure
0128                 plot(LTPDAoutvar{currAO,1});
0129             end
0130         end
0131          
0132     end
0133     %----------------------------------------------------------------------
0134 
0135     %----------------------------------------------------------------------
0136     function SaveOutputCallback(varargin)
0137     % Callback function: run when the user click the "Clear all data"
0138     % button
0139 
0140          try
0141              [FileName,PathName,FilterIndex] = uiputfile('*.mat','Save Workspace As');
0142              save(strcat(PathName,FileName),'LTPDAoutvar');
0143              disp('Output saved')
0144          catch
0145          end
0146     end
0147     %----------------------------------------------------------------------
0148 
0149     %----------------------------------------------------------------------
0150     function hClearButtonCallback(varargin)
0151     % Callback function: run when the user click the "Clear all data"
0152     % button
0153 
0154          LTPDAoutvar={};
0155          set(OutputObjList,'Value',1)
0156          set(findobj('Tag', 'infoPanel'), 'String', '')
0157          UpdateListbox();
0158 
0159     end
0160     %----------------------------------------------------------------------
0161 
0162 
0163 %%
0164 end

Generated on Fri 07-Mar-2008 15:46:43 by m2html © 2003