@@ -139,7 +139,7 @@ private void createBody() {
139
139
analysisTypeCombo .addItem (new ComboItem <>(Method .Generic , Method .Generic .getLabel ()));
140
140
analysisTypeCombo .addItem (new ComboItem <>(Method .Specialized , Method .Specialized .getLabel ()));
141
141
analysisTypeCombo .addActionListener (e -> {
142
- analysisTypeChanged ();
142
+ updateLabels ();
143
143
firePropertyChange (PROP_NAME , null , getDisplayName ());
144
144
});
145
145
makeSmall (analysisLabel , analysisTypeCombo );
@@ -150,7 +150,10 @@ private void createBody() {
150
150
expressionsText = pathTextFactory .create ("Expressions:" , FileBrowser .Filter .EXPRESSION );
151
151
ranksText = pathTextFactory .create ("Ranks:" , FileBrowser .Filter .RANK );
152
152
classesText = pathTextFactory .create ("Classes:" , FileBrowser .Filter .CLASS );
153
+
153
154
classesText .getTextField ().getDocument ().addDocumentListener (SwingUtil .simpleDocumentListener (this ::preFillPhenotypes ));
155
+ enrichments1Text .getTextField ().getDocument ().addDocumentListener (SwingUtil .simpleDocumentListener (this ::updateLabels ));
156
+ gmtText .getTextField ().getDocument ().addDocumentListener (SwingUtil .simpleDocumentListener (this ::updateLabels ));
154
157
155
158
enrichments2Text .getLabel ().setVisible (false );
156
159
enrichments2Text .getTextField ().setVisible (false );
@@ -262,13 +265,21 @@ private void createBody() {
262
265
}
263
266
264
267
265
- private void analysisTypeChanged () {
268
+ private void updateLabels () {
266
269
switch (getMethod ()) {
267
270
case Generic :
268
271
case Specialized :
269
- enrichments1Text .getLabel ().setText ("* Enrichments:" );
270
272
enrichments2Text .setVisible (false );
271
- gmtText .getLabel ().setText ("GMT:" );
273
+ if (enrichments1Text .isEmpty () == gmtText .isEmpty ()) {
274
+ enrichments1Text .getLabel ().setText ("* Enrichments:" );
275
+ gmtText .getLabel ().setText ("* GMT:" );
276
+ } else if (enrichments1Text .isEmpty ()) {
277
+ enrichments1Text .getLabel ().setText ("Enrichments:" );
278
+ gmtText .getLabel ().setText ("* GMT:" );
279
+ } else if (gmtText .isEmpty ()) {
280
+ enrichments1Text .getLabel ().setText ("* Enrichments:" );
281
+ gmtText .getLabel ().setText ("GMT:" );
282
+ }
272
283
break ;
273
284
case GSEA :
274
285
enrichments1Text .getLabel ().setText ("* Enrichments Pos:" );
@@ -298,8 +309,8 @@ public List<Message> validateInput(MasterDetailDialogPage parent) {
298
309
List <Message > messages = new ArrayList <>();
299
310
if (nameText .isEmpty ())
300
311
messages .add (Message .error ("Name field is empty." ));
301
- if (enrichments1Text .isEmpty ())
302
- messages .add (Message .error ("Enrichments file path is empty ." ));
312
+ if (enrichments1Text .isEmpty () && gmtText . isEmpty () )
313
+ messages .add (Message .error ("Enrichments file or GMT file is required ." ));
303
314
if (!enrichments1Text .emptyOrReadable () && getMethod () == Method .GSEA )
304
315
messages .add (Message .error ("Enrichments Pos file path is not valid." ));
305
316
if (!enrichments1Text .emptyOrReadable () && getMethod () != Method .GSEA )
0 commit comments