/**
* @author pplitzner
* @since Jul 12, 2018
- *
*/
public class CategoricalDataHistogram {
*
* @author n.hoffmann
* @date Jan 18, 2012
- *
*/
public class DefaultTermComparator<T extends DefinedTermBase> implements Comparator<T> {
@Override
}
private final TermType termType;
- private final TermVocabulary termVocabulary;
+ @SuppressWarnings("rawtypes")
+ private final TermVocabulary termVocabulary;
private final Class<T> termClass;
private List<T> customPreferredTerms;
public TermComboElement(CdmFormFactory formFactory,
ICdmFormElement parentElement, Class<T> termClass, String labelString, T selection, boolean addEmptyElement,
int style, boolean useAbbrevLabel) {
- this(formFactory, parentElement, termClass, null, null, null,labelString, selection, addEmptyElement, style, useAbbrevLabel, null);
+ this(formFactory, parentElement, termClass, null, null, null, labelString, selection, addEmptyElement, style, useAbbrevLabel, null);
}
public TermComboElement(CdmFormFactory formFactory,
combo.addSelectionListener(this);
combo.addDisposeListener(this);
if (comparator == null){
- setTermComparator(new DefaultTermComparator<T>());
+ setTermComparator(new DefaultTermComparator<>());
}else{
populateTerms();
}
}
protected void addTerms(List<T> preferredTerms) {
- terms = new ArrayList<T>();
+ terms = new ArrayList<>();
Collections.sort(preferredTerms, termComparator);
if(addEmptyElement){
// Add an empty element for when nothing was selected yet
return element;
}
- /**
- * @deprecated Use {@link #createDefinedTermComboElement(TermType, ICdmFormElement, String, DefinedTermBase, int)} instead
- */
- @Deprecated
- public <T extends DefinedTermBase> TermComboElement<T> createTermComboElement(Class<T> termComboType,
- ICdmFormElement parentElement, String labelString, T selection, int style) {
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termComboType, labelString, selection, true, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
TermType termType,
ICdmFormElement parentElement,
Comparator<T> comparator) {
if(termType!=null){
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+ TermComboElement<T> element = new TermComboElement<>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
adapt(element);
parentElement.addElement(element);
return element;
}
else if(termVocabulary!=null){
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termVocabulary, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+ TermComboElement<T> element = new TermComboElement<>(this, parentElement, termVocabulary, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
// if (comparator!= null){
// element.setTermComparator(comparator);
// }
return element;
}else if (terms != null){
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, terms, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+ TermComboElement<T> element = new TermComboElement<>(this, parentElement, terms, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
adapt(element);
parentElement.addElement(element);
int style,
boolean useAbbrevLabel,
Comparator<T> comparator) {
- if(termType!=null){
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+
+ if(termType!=null){
+ TermComboElement<T> element = new TermComboElement<>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
adapt(element);
parentElement.addElement(element);
return element;
}
-
else {
//this should never happen
return null;
/**
* @author pplitzner
* @since Aug 16, 2019
- *
*/
public abstract class AbstractApplicableElement extends AbstractEntityCollectionElement<FeatureState> {
comboState = formFactory.createDefinedTermComboElement(Collections.EMPTY_LIST, element, getComboLabel(), null, style);
comboState.setEnabled(false);
selectFeature.setEnabled(false);
-
+
selectFeature.setEntity(entity.getFeature());
comboState.setSelection(entity.getState());
}
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.FeatureState;
import eu.etaxonomy.cdm.model.description.State;
-import eu.etaxonomy.cdm.model.term.DefinedTerm;
-import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.TermManager;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author pplitzner
* @since Aug 16, 2019
- *
*/
public abstract class AbstractApplicableElementForDto extends AbstractEntityCollectionElement<FeatureStateDto> {
protected TermComboElement<State> comboState;
protected EntitySelectionElement<Feature> selectFeature;
-
public AbstractApplicableElementForDto(CdmFormFactory formFactory, AbstractFormSection section, FeatureStateDto entity,
SelectionListener removeListener, Color backgroundColor, int style) {
super(formFactory, section, entity, removeListener, backgroundColor, style);
-
}
@Override
if (terms.size() == 1){
comboState.setSelection(terms.get(0));
}
-
}
protected abstract String getComboLabel();
@Override
public void handleEvent(Object eventSource) {
}
-
+
@Override
public void setEnabled(boolean enabled){
super.setEnabled(enabled);
this.comboState.setEnabled(false);
this.selectFeature.setEnabled(false);
}
-}
+}
\ No newline at end of file
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureDtoCollectionSection;
/**
- *
* @author pplitzner
* @since Dec 21, 2017
- *
*/
public class CharacterDtoDetailElement extends AbstractCdmDetailElement<CharacterDto> {
import java.util.Map;\r
import java.util.Set;\r
\r
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
import org.eclipse.swt.events.SelectionEvent;\r
import org.eclipse.swt.events.SelectionListener;\r
\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
\r
-\r
/**\r
* The context manager mediates context start/stop and workbench shutdowns to all registered listeners.\r
*\r
* @author a.theys\r
* @created mar 13, 2012\r
- * @version 1.0\r
*/\r
public class UseRecordDetailElement extends\r
AbstractCdmDetailElement<CategoricalData> implements SelectionListener {\r
\r
@SuppressWarnings("unused")\r
- private static final Logger logger = LogManager.getLogger(UseRecordDetailElement.class);\r
+ private static final Logger logger = LogManager.getLogger();\r
\r
private TermComboElement<State> combo_UseCategory;\r
private TermComboElement<State> combo_UseSubCategory;\r
super(formFactory, formElement);\r
}\r
\r
- /** {@inheritDoc} */\r
@Override\r
protected void createControls(ICdmFormElement formElement,\r
CategoricalData entity, int style) {\r
} else {\r
combo_EthnicGroup.setEnabled(false);\r
}\r
-\r
}\r
\r
/**\r
* Returns the select modifier\r
- * @param comboCategory\r
- * @return\r
*/\r
private DefinedTerm modifierSelection(String comboCategory) {\r
if(!getEntity().getModifiers().isEmpty()) {\r
return null;\r
}\r
return null;\r
-\r
}\r
\r
/**\r
* Returns the selected state\r
* @param comboCategory\r
- * @return\r
*/\r
private State stateSelection(String comboCategory) {\r
if (!getEntity().getStateData().isEmpty()) {\r
return null;\r
}\r
return null;\r
-\r
}\r
\r
/**\r
return termsToAdd;\r
}\r
\r
-\r
/**\r
* This function sets the Use Category combo term\r
- * @param listOfTerms\r
- * @return\r
*/\r
private List<State> setUseCategoryComboTerms(List<State> listOfTerms) {\r
List<State> termsToAdd = new ArrayList<State>();\r
}\r
}\r
}\r
-\r
}\r
-\r
else {\r
return null;\r
}\r
if (!getEntity().getStateData().isEmpty()) {\r
Iterator<StateData> itr = getEntity().getStateData().iterator();\r
while(itr.hasNext()) {\r
- StateData stateToRemove = itr.next();\r
+ itr.next();\r
itr.remove();\r
}\r
List<State> termsSubCategory = new ArrayList<State>();\r
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
-import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.State;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
public class StateVocabularyCollectionElement extends AbstractEntityCollectionElement<TermVocabulary<State>> {
private VocabularyComboElement<State, TermVocabulary<State>> comboStateVocabulary;
- /**
- * @param formFactory
- * @param section
- * @param entity
- * @param removeListener
- * @param isChoosableEntity
- * @param backgroundColor
- * @param style
- */
public StateVocabularyCollectionElement(CdmFormFactory formFactory, AbstractFormSection section, TermVocabulary<State> entity,
SelectionListener removeListener, Color backgroundColor, int style) {
super(formFactory, section, entity, removeListener, backgroundColor, style);
-
}
@Override
}
}
}
-
-}
+}
\ No newline at end of file