0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % SUBMITDIALOG Creates a connection and the sinfo structure depending of the input variables.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: SUBMITDIALOG Creates a connection and the sinfo structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % depending of the input variables.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % CALL: sinfo = submitDialog(sinfo_in, pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % VERSION: $Id: submitDialog.m,v 1.19 2011/11/10 09:47:47 mauro Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 function sinfo = submitDialog(pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % Copy input plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 pl = copy(pl, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 %%% Show dialog or not
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 noDialog = pl.find('no dialog');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 %%% Create/fill sinfo from the plist.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 sinfo = getDefaultStruct();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 %%% Check If we should the sinfo from a file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 if ~isempty(pl.find('sinfo filename'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 pl.combine(utils.xml.read_sinfo_xml(pl.find('sinfo filename')));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 %%% Set the fields from the plist to the struct
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 sinfo = setField(sinfo, pl, 'experiment title');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 sinfo = setField(sinfo, pl, 'experiment description');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 sinfo = setField(sinfo, pl, 'analysis description');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 sinfo = setField(sinfo, pl, 'quantity');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 sinfo = setField(sinfo, pl, 'keywords');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 sinfo = setField(sinfo, pl, 'reference ids');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 sinfo = setField(sinfo, pl, 'additional comments');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 sinfo = setField(sinfo, pl, 'additional authors');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 %%% Create connection if the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 if (allFieldsFilled(sinfo)) || ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 (allMandatoryFieldsFilled(sinfo) && noDialog)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 %%% Return because we have all sinfo information
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 jsinfo = awtcreate('mpipeline.repository.SubmissionInfo', 'Lmpipeline.main.MainWindow;', []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 if ~isempty(sinfo.experiment_title), jsinfo.setExperimentTitle(sinfo.experiment_title);end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 if ~isempty(sinfo.experiment_description), jsinfo.setExperimentDescription(sinfo.experiment_description); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 if ~isempty(sinfo.analysis_description), jsinfo.setAnalysisDescription(sinfo.analysis_description); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 if ~isempty(sinfo.quantity), jsinfo.setQuantity(sinfo.quantity); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 if ~isempty(sinfo.keywords), jsinfo.setKeywords(sinfo.keywords); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 if ~isempty(sinfo.reference_ids), jsinfo.setReferenceIDs(sinfo.reference_ids); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 if ~isempty(sinfo.additional_comments), jsinfo.setAdditionalComments(sinfo.additional_comments); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 if ~isempty(sinfo.additional_authors), jsinfo.setAdditionalAuthors(sinfo.additional_authors); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % sid = awtcreate('mpipeline.repository.SubmitInfoDialog', 'Lmpipeline.main.MainWindow;Lmpipeline.repository.SubmissionInfo;', [], jsinfo);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 sid = javaObjectEDT('mpipeline.repository.SubmitInfoDialog', [], jsinfo);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 h1 = handle(sid.getLoadBtn,'callbackproperties');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 h1.ActionPerformedCallback = @cb_loadSinfoFromFile;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 h2 = handle(sid.getSaveBtn,'callbackproperties');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 h2.ActionPerformedCallback = @cb_saveSinfoToFile;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 h3 = handle(sid, 'callbackproperties');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 h3.WindowClosedCallback = @cb_guiClosed;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 sid.setVisible(true)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 if sid.isCancelled
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 sinfo = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 %%% Store the 'sinfo' of the GUI to the output sinfo
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 jsinfo = sid.getSubmissionInfo;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 sinfo.experiment_title = char(jsinfo.getExperimentTitle);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 sinfo.experiment_description = char(jsinfo.getExperimentDescription);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 sinfo.analysis_description = char(jsinfo.getAnalysisDescription);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 sinfo.quantity = char(jsinfo.getQuantity);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 sinfo.keywords = char(jsinfo.getKeywords);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 sinfo.reference_ids = char(jsinfo.getReferenceIDs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 sinfo.additional_comments = char(jsinfo.getAdditionalComments);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 sinfo.additional_authors = char(jsinfo.getAdditionalAuthors);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 jsinfo = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 sid = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 pl = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 prefs = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 java.lang.System.gc();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 % nested callback Function: cb_loadSinfoFromFile()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 function cb_loadSinfoFromFile(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 [FileName, PathName, FilterIndex] = uigetfile('*.xml', 'XML File');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 if (FileName)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 sinfoPl = utils.xml.read_sinfo_xml(fullfile(PathName, FileName));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 % Set the values from the PLIST to the dialog.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 if ~isempty(sinfoPl.find('experiment title'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 sid.setExperimentTitleTxtField(sinfoPl.find('experiment title')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 if ~isempty(sinfoPl.find('experiment_title'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 sid.setExperimentTitleTxtField(sinfoPl.find('experiment_title')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 if ~isempty(sinfoPl.find('experiment description'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 sid.setExperimentDescriptionTxtField(sinfoPl.find('experiment description')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 if ~isempty(sinfoPl.find('experiment_description'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 sid.setExperimentDescriptionTxtField(sinfoPl.find('experiment_description')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 if ~isempty(sinfoPl.find('analysis description'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 sid.setAnalysisDescriptionTxtField(sinfoPl.find('analysis description')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 if ~isempty(sinfoPl.find('analysis_description'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 sid.setAnalysisDescriptionTxtField(sinfoPl.find('analysis_description')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 if ~isempty(sinfoPl.find('quantity'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 sid.setquantityTxtField(sinfoPl.find('quantity')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 if ~isempty(sinfoPl.find('keywords'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 sid.setKeywordsTxtField(sinfoPl.find('keywords')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 if ~isempty(sinfoPl.find('reference ids'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 sid.setReferenceIDsTxtField(sinfoPl.find('reference ids')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 if ~isempty(sinfoPl.find('reference_ids'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 sid.setReferenceIDsTxtField(sinfoPl.find('reference_ids')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 if ~isempty(sinfoPl.find('additional comments'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 sid.setAdditionalCommentsTxtField(sinfoPl.find('additional comments')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 if ~isempty(sinfoPl.find('additional_comments'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 sid.setAdditionalCommentsTxtField(sinfoPl.find('additional_comments')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 if ~isempty(sinfoPl.find('additional authors'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 sid.setAdditionalAuthorsTxtField(sinfoPl.find('additional authors')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 if ~isempty(sinfoPl.find('additional_authors'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 sid.setAdditionalAuthorsTxtField(sinfoPl.find('additional_authors')); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 utils.helper.err(['### This file doesn''t contain any submission information.' err.message])
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 % nested callback Function: cb_saveSinfoToFile()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 function cb_saveSinfoToFile(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 saveBtn = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 jsinfo = saveBtn.rootPane.getParent().getSubmissionInfo();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 sinfo.experiment_title = char(jsinfo.getExperimentTitle());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 sinfo.experiment_description = char(jsinfo.getExperimentDescription());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 sinfo.analysis_description = char(jsinfo.getAnalysisDescription());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 sinfo.quantity = char(jsinfo.getQuantity());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 sinfo.keywords = char(jsinfo.getKeywords());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 sinfo.reference_ids = char(jsinfo.getReferenceIDs());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 sinfo.additional_comments = char(jsinfo.getAdditionalComments());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 sinfo.additional_authors = char(jsinfo.getAdditionalAuthors());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 [FileName, PathName, FilterIndex] = uiputfile('*.xml', 'XML File');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 if (FileName)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 utils.xml.save_sinfo_xml(fullfile(PathName, FileName), sinfo);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 % nested callback Function: cb_guiClosed()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 function cb_guiClosed(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 if ishandle(h1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 delete(h1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 if ishandle(h2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 delete(h2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 if ishandle(h3)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 delete(h3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 % Local Functions %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 % FUNCTION: getDefaultStruct
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 % DESCRIPTION: Creates default structure for 'sinfo'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 function sinfo = getDefaultStruct()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 sinfo = struct(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 'experiment_title', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 'experiment_description', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 'analysis_description', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 'quantity', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 'keywords', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 'reference_ids', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 'additional_comments', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 'additional_authors', '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 % FUNCTION: allMandatoryFieldsFilled
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 % DESCRIPTION: Check if all mandatory fields are filled in 'sinfo'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 function res = allMandatoryFieldsFilled(sinfo)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 res = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 if isstruct(sinfo)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 if isfield(sinfo, 'experiment_title') && ~isempty(sinfo.experiment_title) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 isfield(sinfo, 'experiment_description') && ~isempty(sinfo.experiment_description) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 isfield(sinfo, 'analysis_description') && ~isempty(sinfo.analysis_description)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 res = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 function res = allFieldsFilled(sinfo)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 res = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 if isstruct(sinfo)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 if isfield(sinfo, 'experiment_title') && ~isempty(sinfo.experiment_title) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 isfield(sinfo, 'experiment_description') && ~isempty(sinfo.experiment_description) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 isfield(sinfo, 'analysis_description') && ~isempty(sinfo.analysis_description) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 isfield(sinfo, 'quantity') && ~isempty(sinfo.quantity) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 isfield(sinfo, 'keywords') && ~isempty(sinfo.keywords) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 isfield(sinfo, 'reference_ids') && ~isempty(sinfo.reference_ids) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 isfield(sinfo, 'additional_comments') && ~isempty(sinfo.additional_comments) && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 isfield(sinfo, 'additional_authors') && ~isempty(sinfo.additional_authors)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 res = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 % FUNCTION: setField
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 % DESCRIPTION:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 function sinfo = setField(sinfo, pl, field)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 struct_field = strrep(field, ' ', '_');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 % if the fiels doesn't exist in the struct then create this field
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 if ~isfield(sinfo, struct_field)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 sinfo.(struct_field) = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 if ~isempty(pl.find(field))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 sinfo.(struct_field) = pl.find(field);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 if ~isempty(pl.find(strrep(field, ' ', '_')))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 sinfo.(struct_field) = pl.find(strrep(field, ' ', '_'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284
|