import org.eclipse.swt.SWT;
+import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
import eu.etaxonomy.cdm.model.reference.ReferenceType;
import eu.etaxonomy.taxeditor.model.AuthorHelper;
import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
-import eu.etaxonomy.taxeditor.ui.forms.CdmPropertyChangeEvent;
-import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.forms.IErrorIntolerableElement;
-import eu.etaxonomy.taxeditor.ui.forms.IExceptionHandler;
-import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement;
-import eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement;
-import eu.etaxonomy.taxeditor.ui.forms.UriWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IErrorIntolerableElement;
+import eu.etaxonomy.taxeditor.ui.element.IExceptionHandler;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
+import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
-import eu.etaxonomy.taxeditor.ui.selection.AgentSelectionElement;
-import eu.etaxonomy.taxeditor.ui.selection.InstitutionSelectionElement;
-import eu.etaxonomy.taxeditor.ui.selection.ReferenceSelectionElement;
-import eu.etaxonomy.taxeditor.ui.term.ReferenceTypeComboElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
* <p>
private TextWithLabelElement text_title;
private TextWithLabelElement text_volume;
private UriWithLabelElement text_uri;
- private AgentSelectionElement selection_authorTeam;
+ private EntitySelectionElement<AgentBase> selection_authorTeam;
private TimePeriodElement element_timePeriod;
- private ReferenceSelectionElement selection_inReference;
- private InstitutionSelectionElement selection_institution;
- private ReferenceTypeComboElement combo_referenceType;
+ private EntitySelectionElement<Reference> selection_inReference;
+ private EntitySelectionElement<Institution> selection_institution;
+ private EnumComboElement<ReferenceType> combo_referenceType;
- private ReferenceSelectionElement selection_inSeries;
+ private EntitySelectionElement<Reference> selection_inSeries;
/**
* <p>
* </p>
*
* @param cdmFormFactory
- * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
+ * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
* object.
* @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* @param style
* a int.
"Reference Cache", entity.getTitleCache(),
entity.isProtectedTitleCache(), style);
- combo_referenceType = (ReferenceTypeComboElement) formFactory
- .createEnumComboElement(EnumComboType.REFERENCETYPE,
+ combo_referenceType = formFactory.createEnumComboElement(ReferenceType.class,
formElement, style);
combo_referenceType.setSelection(entity.getType());
"Title", entity.getTitle(), style);
// author team
- selection_authorTeam = (AgentSelectionElement) formFactory
- .createSelectionElement(SelectionType.AGENT,
+ selection_authorTeam = formFactory
+ .createSelectionElement(AgentBase.class,
getConversationHolder(), formElement, "Author",
AuthorHelper.getAuthor(entity.getAuthorTeam()),
- AgentSelectionElement.DEFAULT, style);
+ EntitySelectionElement.ALL, style);
ReferenceType referenceType = entity.getType();
}
if (createInReferenceWidget) {
- selection_inReference = (ReferenceSelectionElement) formFactory
- .createSelectionElement(SelectionType.REFERENCE,
+ selection_inReference = formFactory
+ .createSelectionElement(Reference.class,
getConversationHolder(), element, label,
reference.getInReference(),
- ReferenceSelectionElement.DEFAULT, style);
+ EntitySelectionElement.ALL, style);
}
}
if (referenceType.equals(ReferenceType.Report)) {
// institution
- selection_institution = (InstitutionSelectionElement) formFactory
- .createSelectionElement(SelectionType.INSTITUTION,
+ selection_institution = formFactory
+ .createSelectionElement(Institution.class,
getConversationHolder(), element, "Institution",
reference.getInstitution(),
- InstitutionSelectionElement.DEFAULT, style);
+ EntitySelectionElement.ALL, style);
}
if (referenceType.equals(ReferenceType.Thesis)) {
// school
- selection_institution = (InstitutionSelectionElement) formFactory
- .createSelectionElement(SelectionType.INSTITUTION,
+ selection_institution = formFactory
+ .createSelectionElement(Institution.class,
getConversationHolder(), element, "School",
reference.getSchool(),
- InstitutionSelectionElement.DEFAULT, style);
+ EntitySelectionElement.ALL, style);
}
if (referenceType.equals(ReferenceType.Proceedings)) {
private void createPrintedUnitControls(ICdmFormElement element,
ReferenceType referenceType, Reference reference, int style) {
// in series
- selection_inSeries = (ReferenceSelectionElement) formFactory
- .createSelectionElement(SelectionType.REFERENCE,
+ selection_inSeries = formFactory
+ .createSelectionElement(Reference.class,
getConversationHolder(), element, "In Series",
- reference.getInSeries(),
- ReferenceSelectionElement.DEFAULT, style);
+ (Reference) reference.getInSeries(),
+ EntitySelectionElement.ALL, style);
// editor
text_editor = formFactory.createTextWithLabelElement(element, "Editor",
public void handleEvent(Object eventSource) {
if (eventSource == combo_referenceType) {
getEntity().setType(combo_referenceType.getSelection());
- getParentElement().refresh();
+ updateContent();
} else if (eventSource == element_timePeriod) {
getEntity().setDatePublished(element_timePeriod.getTimePeriod());
clearException();