Revision 3be6ef3e
Added by Niels Hoffmann over 13 years ago
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodePropertyTester.java | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
5 |
|
|
6 |
import org.eclipse.core.expressions.PropertyTester; |
|
7 |
|
|
8 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
9 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
10 |
import eu.etaxonomy.cdm.model.taxon.TaxonomicTree; |
|
11 |
|
|
12 |
public class TaxonNodePropertyTester extends PropertyTester { |
|
13 |
|
|
14 |
private static final Object HAS_SYNONYMS = "hasSynonyms"; |
|
15 |
private static final Object HAS_TAXA = "hasTaxa"; |
|
16 |
|
|
17 |
public boolean test(Object receiver, String property, Object[] args, |
|
18 |
Object expectedValue) { |
|
19 |
if (receiver instanceof TaxonNode && HAS_SYNONYMS.equals(property)) { |
|
20 |
Taxon taxon = ((TaxonNode) receiver).getTaxon(); |
|
21 |
if(taxon != null){ |
|
22 |
return taxon.hasSynonyms(); |
|
23 |
} |
|
24 |
} |
|
25 |
|
|
26 |
if (receiver instanceof TaxonomicTree && HAS_TAXA.equals(property)) { |
|
27 |
TaxonomicTree taxononomicTree = (TaxonomicTree) receiver; |
|
28 |
return taxononomicTree.getChildNodes().size() > 0; |
|
29 |
} |
|
30 |
|
|
31 |
return false; |
|
32 |
} |
|
33 |
} |
|
1 |
|
|
2 |
/** |
|
3 |
* <p>TaxonNodePropertyTester class.</p> |
|
4 |
* |
|
5 |
* @author n.hoffmann |
|
6 |
* @version $Id: $ |
|
7 |
*/ |
|
8 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
9 |
|
|
10 |
import org.eclipse.core.expressions.PropertyTester; |
|
11 |
|
|
12 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
13 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
14 |
import eu.etaxonomy.cdm.model.taxon.TaxonomicTree; |
|
15 |
public class TaxonNodePropertyTester extends PropertyTester { |
|
16 |
|
|
17 |
private static final Object HAS_SYNONYMS = "hasSynonyms"; |
|
18 |
private static final Object HAS_TAXA = "hasTaxa"; |
|
19 |
|
|
20 |
/** {@inheritDoc} */ |
|
21 |
public boolean test(Object receiver, String property, Object[] args, |
|
22 |
Object expectedValue) { |
|
23 |
if (receiver instanceof TaxonNode && HAS_SYNONYMS.equals(property)) { |
|
24 |
Taxon taxon = ((TaxonNode) receiver).getTaxon(); |
|
25 |
if(taxon != null){ |
|
26 |
return taxon.hasSynonyms(); |
|
27 |
} |
|
28 |
} |
|
29 |
|
|
30 |
if (receiver instanceof TaxonomicTree && HAS_TAXA.equals(property)) { |
|
31 |
TaxonomicTree taxononomicTree = (TaxonomicTree) receiver; |
|
32 |
return taxononomicTree.getChildNodes().size() > 0; |
|
33 |
} |
|
34 |
|
|
35 |
return false; |
|
36 |
} |
|
37 |
} |
Also available in: Unified diff
performed javacscript:fix and worked on documentation