import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.TableWrapData;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
protected void createControls(ICdmFormElement formElement,
TaxonNode entity, int style) {
// taxon = entity.getTaxon();
+
Label taxonTitle = new Label(getLayoutComposite(), SWT.NULL);
- taxonTitle.setText(Messages.TaxonNodeWizardPage_TAXON_INFORMATION);
- TableWrapData tableWrap = LayoutConstants.FILL_HORIZONTALLY(2, 2);
- tableWrap.valign = SWT.TOP;
- taxonTitle.setLayoutData(tableWrap);
- taxonTitle.setFont(FONT_BOLD);
+ taxonTitle.setText(Messages.TaxonNodeWizardPage_TAXON_INFORMATION);
+ taxonTitle.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ taxonTitle.setFont(FONT_BOLD);
+
+
if (isCreateNew()){
textNewTaxonName = formFactory.createTextWithLabelElement(formElement,
Messages.TaxonNodeWizardPage_TAXON_IS_PUBLISH, true, style);
checkbox_publish.setEnabled(isCreateNew());
-
+ Label spacer = new Label(getLayoutComposite(), SWT.NULL);
+ spacer.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 2));
Label nodeTitle = new Label(getLayoutComposite(), SWT.NULL);
- nodeTitle.setText(Messages.TaxonNodeWizardPage_TAXON_NODE);
+ nodeTitle.setText("Taxon Node");
nodeTitle.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
nodeTitle.setFont(FONT_BOLD);
+// LabelElement nodeTitle = formFactory.createLabel(formElement, Messages.TaxonNodeWizardPage_TAXON_INFORMATION);
+// nodeTitle.setLayout(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+// nodeTitle.setBackground(getPersistentBackground());
+// nodeTitle.setBold();
+
selection_parentTaxonNode = formFactory
.createTaxonNodeSelectionElement(getConversationHolder(), formElement, Messages.TaxonNodeWizardPage_PARENT, parentNode,
EntitySelectionElement.DELETABLE, style, 100);
}
textTaxonSec.setEnabled(false);
microReference.setEnabled(false);
+ Label spacer = new Label(getLayoutComposite(), SWT.NULL);
+ spacer.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 2));
Label nodeTitle = new Label(getLayoutComposite(), SWT.NULL);
nodeTitle.setText("Taxon Node");
nodeTitle.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
nodeTitle.setFont(FONT_BOLD);
+// LabelElement nodeTitle = formFactory.createLabel(formElement, "Taxon Node");
+// nodeTitle.setLayout(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+// nodeTitle.setBackground(getPersistentBackground());
+// nodeTitle.setBold();
+
+
if (entity.getParent().getTaxon() == null){
TextWithLabelElement textParent = formFactory.createTextWithLabelElement(
formElement,CLASSIFICATION_STR, entity.getClassification().getTitleCache(), style);
textParent.setEnabled(false);
}
}
- Label spacer = new Label(getLayoutComposite(), SWT.NULL);
- spacer.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+
+
combo_status = formFactory.createEnumComboElement(TaxonNodeStatus.class, formElement, style, true);
if (!isCreateNew()){
combo_status.setSelection(entity.getStatus());
multiLanguageTextStatusNotes.setEnabled(entity.getStatus() != null);
}
- if (!isCreateNew()){
- selectionNodeAgentRelation = formFactory.createTaxonNodeAgentRelationCollectionSection(formElement, getConversationHolder(), StoreUtil.getSectionStyle(TaxonNodeAgentRelationCollectionSection.class, entity.getClass().getCanonicalName()));
- selectionNodeAgentRelation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- selectionNodeAgentRelation.setEntity(entity);
- }
sourceSection = formFactory.createOriginalSourceElement(formElement, entity);
- if (isCreateNew()){
- sourceSection.setEntity(null);
+ if (isCreateNew() || entity.getSource() == null){
+ DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
+ entity.setSource(source);
+ sourceSection.setEntity(source);
}else{
sourceSection.setEntity(entity.getSource());
+
}
+ selectionNodeAgentRelation = formFactory.createTaxonNodeAgentRelationCollectionSection(formElement, getConversationHolder(), StoreUtil.getSectionStyle(TaxonNodeAgentRelationCollectionSection.class, entity.getClass().getCanonicalName()));
+ selectionNodeAgentRelation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ selectionNodeAgentRelation.setEntity(entity);
+ setBackground(getPersistentBackground());
}
}
if (eventSource == sourceSection) {
- if(!isCreateNew()){
- getEntity().setSource((DescriptionElementSource)sourceSection.getEntity());
- }
+// getEntity().setSource((DescriptionElementSource)sourceSection.getEntity());
+
}else if (eventSource == selection_SecRef) {
if (taxon != null){
taxon.setSec(selection_SecRef.getEntity());
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
}
selection_Ref.setBackground(this.getPersistentBackground());
microReference = formFactory.createTextWithLabelElement(formElement, "Details", entity != null? entity.getCitationMicroReference(): "", style);
+
+
for (ICdmFormElement element: selection_Ref.getElements()){
element.setBackground(getPersistentBackground());
}
advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
-
+ layoutData.indent = 10;
advancedSection.setLayoutData(layoutData);
addElement(advancedSection);
advancedSection.setBackground(this.getPersistentBackground());
advancedSection.setEntity(entity);
+ if (!((DescriptionElementSource)entity).checkEmpty()){
+ advancedSection.setExpanded(true);
+ }else{
+ advancedSection.setExpanded(false);
+ }
}
@Override
public void handleEvent(Object eventSource) {
if (eventSource.equals(selection_Ref)){
-
- if (getEntity() == null){
- Reference ref = selection_Ref.getEntity();
- DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
- setEntity(source);
- selection_Ref.setEntity(ref);
- if (cdmEntity != null && cdmEntity instanceof TaxonNode){
- ((TaxonNode)cdmEntity).setSource(source);
- }
- }
- //TODO: why is this null????ß
getEntity().setCitation(selection_Ref.getEntity());
-
}else if (eventSource.equals(microReference)){
-
- if (getEntity() == null){
- DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
- setEntity(source);
- if (cdmEntity != null && cdmEntity instanceof TaxonNode){
- ((TaxonNode)cdmEntity).setSource(source);
- }
- }
- //TODO: why is this null????ß
getEntity().setCitationMicroReference(microReference.getText());
}