// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.ui.forms;
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>Abstract AbstractCdmEntityWizardPage class.</p>
- *
+ * <p>
+ * Abstract AbstractCdmEntityWizardPage class.
+ * </p>
+ *
* @author n.hoffmann
* @created Jun 1, 2010
* @version 1.0
*/
-public abstract class AbstractCdmEntityWizardPage<T> extends WizardPage implements IConversationEnabled {
+public abstract class AbstractCdmEntityWizardPage<T> extends WizardPage
+ implements IConversationEnabled, IPropertyChangeListener {
protected CdmFormFactory formFactory;
protected T entity;
AbstractCdmDetailElement<T> detailElement;
- private ConversationHolder conversation;
-
+ private final ConversationHolder conversation;
+
/**
- * <p>Constructor for AbstractCdmEntityWizardPage.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a T object.
- * @param <T> a T object.
+ * <p>
+ * Constructor for AbstractCdmEntityWizardPage.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
+ * object.
+ * @param conversation
+ * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
+ * @param entity
+ * a T object.
+ * @param <T>
+ * a T object.
*/
- protected AbstractCdmEntityWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, T entity) {
+ protected AbstractCdmEntityWizardPage(CdmFormFactory formFactory,
+ ConversationHolder conversation, T entity) {
super("page");
this.formFactory = formFactory;
this.entity = entity;
this.conversation = conversation;
setDescription(getEntityTitle());
+
+ formFactory.addPropertyChangeListener(this);
+ setPageComplete(false);
}
-
+
/**
* @return
*/
private String getEntityTitle() {
- if(entity instanceof IIdentifiableEntity){
+ if (entity instanceof IIdentifiableEntity) {
((IIdentifiableEntity) entity).getTitleCache();
}
return "";
/*
* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ *
+ * @see
+ * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+ * .Composite)
*/
/** {@inheritDoc} */
+ @Override
public void createControl(Composite parent) {
- ScrolledForm scrolledForm = formFactory.createScrolledForm(parent);
+ ScrolledForm scrolledForm = formFactory.createScrolledForm(parent);
scrolledForm.getBody().setLayout(CdmFormFactory.LAYOUT());
-
+
Composite control = formFactory.createComposite(scrolledForm.getBody());
control.setLayoutData(CdmFormFactory.FILL());
-
+
control.setLayout(CdmFormFactory.LAYOUT(2, false));
- WizardPageRootElement rootElement = new WizardPageRootElement(formFactory, control, getConversationHolder());
-
+ WizardPageRootElement rootElement = new WizardPageRootElement(
+ formFactory, control, getConversationHolder());
+
Color bgColor = getShell().getBackground();
-
+
detailElement = createElement(rootElement);
-
+
rootElement.setBackground(bgColor);
control.setBackground(bgColor);
scrolledForm.setBackground(bgColor);
-
+
setControl(scrolledForm);
}
-
+
/**
- * <p>Getter for the field <code>entity</code>.</p>
- *
+ * <p>
+ * Getter for the field <code>entity</code>.
+ * </p>
+ *
* @return a T object.
*/
public T getEntity() {
return entity;
}
-
+
/**
* Creates the detail element for this wizard page
- *
- * @param rootElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement} object.
+ *
+ * @param rootElement
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
+ * object.
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
+ * object.
*/
- public abstract AbstractCdmDetailElement<T> createElement(ICdmFormElement rootElement);
-
- protected class WizardPageRootElement extends RootElement implements IConversationEnabled{
+ public abstract AbstractCdmDetailElement<T> createElement(
+ ICdmFormElement rootElement);
+
+ protected class WizardPageRootElement extends RootElement implements
+ IConversationEnabled {
+
+ private final ConversationHolder conversation;
- private ConversationHolder conversation;
-
- public WizardPageRootElement(CdmFormFactory formFactory,
+ public WizardPageRootElement(CdmFormFactory formFactory,
Composite layoutComposite, ConversationHolder conversation) {
super(formFactory, layoutComposite);
this.conversation = conversation;
}
-
+
@Override
public void refresh() {
super.refresh();
detailElement = createElement(this);
((Composite) getControl()).layout();
}
-
+
+ @Override
public ConversationHolder getConversationHolder() {
return conversation;
}
-
- public void update(CdmDataChangeMap changeEvents) {}
+
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
+ }
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getSource() == getDetailElement()) {
+ checkComplete();
+ }
}
-
+
/**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ * Should check whether the wizard is complete in a sense that it contains
+ * sane data. Should setPageComplete to true if that is the case.
*/
+ protected void checkComplete() {
+ setPageComplete(titleCacheIsNotEmpty());
+ }
+
+ private boolean titleCacheIsNotEmpty() {
+ if (getEntity() instanceof IIdentifiableEntity) {
+ IIdentifiableEntity entity = (IIdentifiableEntity) getEntity();
+ return !StringUtils.isEmpty(entity.getTitleCache());
+ }
+ return true;
+ }
+
+ /**
+ * <p>
+ * getConversationHolder
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
+ */
+ @Override
public ConversationHolder getConversationHolder() {
return conversation;
}
-
+
/** {@inheritDoc} */
@Override
public void dispose() {
- if(detailElement != null){
+ if (detailElement != null) {
detailElement.removeElements();
}
+ formFactory.removePropertyChangeListener(this);
super.dispose();
}
-
+
/**
- * <p>Getter for the field <code>detailElement</code>.</p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement} object.
+ * <p>
+ * Getter for the field <code>detailElement</code>.
+ * </p>
+ *
+ * @return a
+ * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
+ * object.
*/
public AbstractCdmDetailElement<T> getDetailElement() {
return detailElement;
}
-
+
/** {@inheritDoc} */
- public void update(CdmDataChangeMap changeEvents) {}
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
+ }
}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.ui.section.agent;
import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
* @created Dec 15, 2010
* @version 1.0
*/
-public class InstitutionWizardPage extends AbstractCdmEntityWizardPage<Institution> {
+public class InstitutionWizardPage extends
+ AbstractCdmEntityWizardPage<Institution> {
/**
* @param formFactory
super(formFactory, conversation, entity);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement
+ * (eu.etaxonomy.taxeditor.forms.ICdmFormElement)
*/
@Override
public AbstractCdmDetailElement createElement(ICdmFormElement rootElement) {
- InstitutionDetailElement detailElement = (InstitutionDetailElement) formFactory.createCdmDetailElement(DetailType.INSTITUTION, rootElement, SWT.NULL);
+ InstitutionDetailElement detailElement = (InstitutionDetailElement) formFactory
+ .createCdmDetailElement(DetailType.INSTITUTION, rootElement,
+ SWT.NULL);
detailElement.setEntity(entity);
return detailElement;
}
-
}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.ui.section.agent;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmPropertyChangeEvent;
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>PersonDetailElement class.</p>
- *
+ * <p>
+ * PersonDetailElement class.
+ * </p>
+ *
* @author n.hoffmann
* @created Mar 8, 2010
* @version 1.0
private TextWithLabelElement text_lastname;
private TextWithLabelElement text_prefix;
private TextWithLabelElement text_suffix;
-
+
private Collection<Object> excludeFromIrrelevantToggleableObjects;
-
+
/**
- * <p>Constructor for PersonDetailElement.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
- * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
- * @param style a int.
+ * <p>
+ * Constructor for PersonDetailElement.
+ * </p>
+ *
+ * @param cdmFormFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
+ * object.
+ * @param formElement
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
+ * object.
+ * @param style
+ * a int.
*/
- public PersonDetailElement(CdmFormFactory cdmFormFactory, ICdmFormElement formElement,
- int style) {
+ public PersonDetailElement(CdmFormFactory cdmFormFactory,
+ ICdmFormElement formElement, int style) {
super(cdmFormFactory, formElement);
}
-
+
/** {@inheritDoc} */
@Override
- protected void createControls(ICdmFormElement formElement, Person entity, int style) {
- toggleable_cache = formFactory.createToggleableTextField(formElement, "Title Cache", entity.getTitleCache(), entity.isProtectedTitleCache(), SWT.NULL);
-
- text_nomenclaturalTitle = formFactory.createTextWithLabelElement(formElement, "Nom. Title", entity.getNomenclaturalTitle(), SWT.NULL);
+ protected void createControls(ICdmFormElement formElement, Person entity,
+ int style) {
+ toggleable_cache = formFactory.createToggleableTextField(formElement,
+ "Title Cache", entity.getTitleCache(),
+ entity.isProtectedTitleCache(), SWT.NULL);
+
+ text_nomenclaturalTitle = formFactory.createTextWithLabelElement(
+ formElement, "Nom. Title", entity.getNomenclaturalTitle(),
+ SWT.NULL);
-
- text_firstname = formFactory.createTextWithLabelElement(formElement, "Firstname", entity.getFirstname(), SWT.NULL);
- text_lastname = formFactory.createTextWithLabelElement(formElement, "Lastname", entity.getLastname(), SWT.NULL);
+ text_firstname = formFactory.createTextWithLabelElement(formElement,
+ "Firstname", entity.getFirstname(), SWT.NULL);
+ text_lastname = formFactory.createTextWithLabelElement(formElement,
+ "Lastname", entity.getLastname(), SWT.NULL);
- text_prefix = formFactory.createTextWithLabelElement(formElement, "Prefix", entity.getPrefix(), SWT.NULL);
- text_suffix = formFactory.createTextWithLabelElement(formElement, "Suffix", entity.getSuffix(), SWT.NULL);
+ text_prefix = formFactory.createTextWithLabelElement(formElement,
+ "Prefix", entity.getPrefix(), SWT.NULL);
+ text_suffix = formFactory.createTextWithLabelElement(formElement,
+ "Suffix", entity.getSuffix(), SWT.NULL);
}
-
+
/** {@inheritDoc} */
@Override
protected void updateContent() {
super.updateContent();
-
- excludeFromIrrelevantToggleableObjects = Arrays.asList(new Object[]{toggleable_cache, text_nomenclaturalTitle});
-
+
+ excludeFromIrrelevantToggleableObjects = Arrays.asList(new Object[] {
+ toggleable_cache, text_nomenclaturalTitle });
+
toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
- setIrrelevant(toggleable_cache.getState(), excludeFromIrrelevantToggleableObjects);
+ setIrrelevant(toggleable_cache.getState(),
+ excludeFromIrrelevantToggleableObjects);
}
-
-
+
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
- if(eventSource == toggleable_cache){
- getEntity().setTitleCache(toggleable_cache.getText(), toggleable_cache.getState());
- setIrrelevant(toggleable_cache.getState(), excludeFromIrrelevantToggleableObjects);
- }
- else if(eventSource == text_nomenclaturalTitle){
- getEntity().setNomenclaturalTitle(text_nomenclaturalTitle.getText());
- }
- else if(eventSource == text_firstname){
+ if (eventSource == toggleable_cache) {
+ getEntity().setTitleCache(toggleable_cache.getText(),
+ toggleable_cache.getState());
+ setIrrelevant(toggleable_cache.getState(),
+ excludeFromIrrelevantToggleableObjects);
+ } else if (eventSource == text_nomenclaturalTitle) {
+ getEntity()
+ .setNomenclaturalTitle(text_nomenclaturalTitle.getText());
+ } else if (eventSource == text_firstname) {
getEntity().setFirstname(text_firstname.getText());
- }
- else if(eventSource == text_lastname){
+ } else if (eventSource == text_lastname) {
getEntity().setLastname(text_lastname.getText());
- }
- else if(eventSource == text_prefix){
+ } else if (eventSource == text_prefix) {
getEntity().setPrefix(text_prefix.getText());
- }
- else if(eventSource == text_suffix){
+ } else if (eventSource == text_suffix) {
getEntity().setSuffix(text_suffix.getText());
}
-
- if(eventSource != toggleable_cache){
+
+ if (eventSource != toggleable_cache) {
toggleable_cache.setText(getEntity().getTitleCache());
}
+
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.ui.section.agent;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType;
+import eu.etaxonomy.taxeditor.ui.forms.CdmPropertyChangeEvent;
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>TeamDetailElement class.</p>
- *
+ * <p>
+ * TeamDetailElement class.
+ * </p>
+ *
* @author n.hoffmann
* @created Apr 26, 2010
* @version 1.0
private ToggleableTextElement toggleable_nomenclaturalTitleCache;
private TeamMemberSection section_teamMembers;
-
+
/**
- * <p>Constructor for TeamDetailElement.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
- * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
- * @param style a int.
+ * <p>
+ * Constructor for TeamDetailElement.
+ * </p>
+ *
+ * @param cdmFormFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
+ * object.
+ * @param formElement
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
+ * object.
+ * @param style
+ * a int.
*/
public TeamDetailElement(CdmFormFactory cdmFormFactory,
ICdmFormElement formElement, int style) {
super(cdmFormFactory, formElement);
}
-
/** {@inheritDoc} */
@Override
- protected void createControls(
- ICdmFormElement formElement,
- Team entity, int style) {
-
- toggleable_cache = formFactory.createToggleableTextField(formElement, "Title Cache", entity.getTitleCache(), entity.isProtectedTitleCache(), style);
- toggleable_nomenclaturalTitleCache = formFactory.createToggleableTextField(formElement, "Nom. Title", entity.getNomenclaturalTitle(), entity.isProtectedNomenclaturalTitleCache(), style);
- section_teamMembers = (TeamMemberSection) formFactory.createEntityDetailSection(EntityDetailType.TEAMMEMBER, getConversationHolder(), formElement, Section.EXPANDED);
- section_teamMembers.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(2, 1));
+ protected void createControls(ICdmFormElement formElement, Team entity,
+ int style) {
+
+ toggleable_cache = formFactory.createToggleableTextField(formElement,
+ "Title Cache", entity.getTitleCache(),
+ entity.isProtectedTitleCache(), style);
+ toggleable_nomenclaturalTitleCache = formFactory
+ .createToggleableTextField(formElement, "Nom. Title",
+ entity.getNomenclaturalTitle(),
+ entity.isProtectedNomenclaturalTitleCache(), style);
+ section_teamMembers = (TeamMemberSection) formFactory
+ .createEntityDetailSection(EntityDetailType.TEAMMEMBER,
+ getConversationHolder(), formElement, Section.EXPANDED);
+ section_teamMembers.setLayoutData(CdmFormFactory
+ .FILL_HORIZONTALLY(2, 1));
}
-
+
/** {@inheritDoc} */
@Override
protected void updateContent() {
super.updateContent();
-
+
toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
- toggleable_nomenclaturalTitleCache.setEnabled(getEntity().isProtectedNomenclaturalTitleCache());
- setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache, toggleable_nomenclaturalTitleCache}));
-
+ toggleable_nomenclaturalTitleCache.setEnabled(getEntity()
+ .isProtectedNomenclaturalTitleCache());
+ setIrrelevant(
+ toggleable_cache.getState(),
+ Arrays.asList(new Object[] { toggleable_cache,
+ toggleable_nomenclaturalTitleCache }));
+
section_teamMembers.setEntity(getEntity());
-
+
}
-
+
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
- if(eventSource == toggleable_cache){
- getEntity().setTitleCache(toggleable_cache.getText(), toggleable_cache.getState());
-// setEnabled(! toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache}));
- setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache}));
- }else if(eventSource == toggleable_nomenclaturalTitleCache){
- getEntity().setNomenclaturalTitle(toggleable_nomenclaturalTitleCache.getText(), toggleable_nomenclaturalTitleCache.getState());
-// setEnabled(! toggleable_nomenclaturalTitleCache.getState(), Arrays.asList(new Object[]{toggleable_nomenclaturalTitleCache}));
- setIrrelevant(toggleable_nomenclaturalTitleCache.getState(), Arrays.asList(new Object[]{toggleable_nomenclaturalTitleCache}));
- }else if(eventSource == section_teamMembers){
+ if (eventSource == toggleable_cache) {
+ getEntity().setTitleCache(toggleable_cache.getText(),
+ toggleable_cache.getState());
+ // setEnabled(! toggleable_cache.getState(), Arrays.asList(new
+ // Object[]{toggleable_cache}));
+ setIrrelevant(toggleable_cache.getState(),
+ Arrays.asList(new Object[] { toggleable_cache }));
+ } else if (eventSource == toggleable_nomenclaturalTitleCache) {
+ getEntity().setNomenclaturalTitle(
+ toggleable_nomenclaturalTitleCache.getText(),
+ toggleable_nomenclaturalTitleCache.getState());
+ // setEnabled(! toggleable_nomenclaturalTitleCache.getState(),
+ // Arrays.asList(new Object[]{toggleable_nomenclaturalTitleCache}));
+ setIrrelevant(
+ toggleable_nomenclaturalTitleCache.getState(),
+ Arrays.asList(new Object[] { toggleable_nomenclaturalTitleCache }));
+ } else if (eventSource == section_teamMembers) {
toggleable_cache.setText(getEntity().getTitleCache());
- toggleable_nomenclaturalTitleCache.setText(getEntity().getNomenclaturalTitle());
+ toggleable_nomenclaturalTitleCache.setText(getEntity()
+ .getNomenclaturalTitle());
}
+
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
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.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
} else if (eventSource == text_microReference) {
getEntity().setMicroReference(text_microReference.getText());
}
+
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.ui.section.classification;
-
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
/**
- * <p>ClassificationWizardPage class.</p>
- *
+ * <p>
+ * ClassificationWizardPage class.
+ * </p>
+ *
* @author n.hoffmann
* @created 23.06.2009
* @version 1.0
*/
-public class ClassificationWizardPage extends AbstractCdmEntityWizardPage<Classification>{
-
+public class ClassificationWizardPage extends
+ AbstractCdmEntityWizardPage<Classification> {
+
/**
- * <p>Constructor for ClassificationWizardPage.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
+ * <p>
+ * Constructor for ClassificationWizardPage.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
+ * object.
+ * @param conversation
+ * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
+ * @param entity
+ * a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
*/
- public ClassificationWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, Classification entity){
+ public ClassificationWizardPage(CdmFormFactory formFactory,
+ ConversationHolder conversation, Classification entity) {
super(formFactory, conversation, entity);
setTitle("Classification");
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement
+ * (eu.etaxonomy.taxeditor.forms.ICdmFormElement)
*/
/** {@inheritDoc} */
@Override
public ClassificationDetailElement createElement(ICdmFormElement rootElement) {
- ClassificationDetailElement detailElement = (ClassificationDetailElement) formFactory.createCdmDetailElement(DetailType.CLASSIFICATION, rootElement, SWT.NULL);
+ ClassificationDetailElement detailElement = (ClassificationDetailElement) formFactory
+ .createCdmDetailElement(DetailType.CLASSIFICATION, rootElement,
+ SWT.NULL);
detailElement.setEntity(getEntity());
-
+
return detailElement;
}
}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.ui.section.classification;
-
-import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
/**
- * <p>TaxonNodeWizardPage class.</p>
- *
+ * <p>
+ * TaxonNodeWizardPage class.
+ * </p>
+ *
* @author n.hoffmann
* @created Sep 15, 2009
* @version 1.0
*/
-public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage<ITreeNode> implements IPropertyChangeListener{
+public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage<ITreeNode> {
/**
- * <p>Constructor for TaxonNodeWizardPage.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.taxon.ITreeNode} object.
+ * <p>
+ * Constructor for TaxonNodeWizardPage.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
+ * object.
+ * @param conversation
+ * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
+ * @param entity
+ * a {@link eu.etaxonomy.cdm.model.taxon.ITreeNode} object.
*/
public TaxonNodeWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, ITreeNode entity) {
setTitle("Create a new Taxon");
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement
+ * (eu.etaxonomy.taxeditor.forms.ICdmFormElement)
*/
/** {@inheritDoc} */
@Override
public TaxonNodeDetailElement createElement(ICdmFormElement rootElement) {
-
- TaxonNodeDetailElement detailElement = (TaxonNodeDetailElement) formFactory.createCdmDetailElement(DetailType.TAXON_NODE, rootElement, SWT.NULL);
+
+ TaxonNodeDetailElement detailElement = (TaxonNodeDetailElement) formFactory
+ .createCdmDetailElement(DetailType.TAXON_NODE, rootElement,
+ SWT.NULL);
detailElement.setEntity(entity);
formFactory.addPropertyChangeListener(this);
return detailElement;
}
/**
- * <p>openInEditor</p>
- *
+ * <p>
+ * openInEditor
+ * </p>
+ *
* @return a boolean.
*/
- public boolean openInEditor(){
+ public boolean openInEditor() {
return ((TaxonNodeDetailElement) getDetailElement()).isOpenInEditor();
- }
-
+ }
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse
+ * .jface.util.PropertyChangeEvent)
*/
/** {@inheritDoc} */
@Override
public void propertyChange(PropertyChangeEvent event) {
- if(event.getSource() == getDetailElement()){
- setPageComplete(checkComplete());
+ if (event.getSource() == getDetailElement()) {
+ checkComplete();
}
}
/**
*
*/
- private boolean checkComplete() {
+ @Override
+ protected void checkComplete() {
TaxonNodeDetailElement detailElement = (TaxonNodeDetailElement) getDetailElement();
-
- if(detailElement.getClassification() == null){
+
+ if (detailElement.getClassification() == null) {
setMessage("No classification", WARNING);
- }else{
+ } else {
setMessage(null);
- return true;
+ setPageComplete(true);
+ return;
}
-
- return false;
+
+ setPageComplete(false);
}
-
+
/**
- * <p>Getter for the field <code>parentTreeNode</code>.</p>
- *
+ * <p>
+ * Getter for the field <code>parentTreeNode</code>.
+ * </p>
+ *
* @return a {@link eu.etaxonomy.cdm.model.taxon.ITreeNode} object.
*/
public ITreeNode getParentTreeNode() {
- return ((TaxonNodeDetailElement) getDetailElement()).getParentTreeNode();
+ return ((TaxonNodeDetailElement) getDetailElement())
+ .getParentTreeNode();
}
-
- public Taxon getTaxon(){
+
+ public Taxon getTaxon() {
return ((TaxonNodeDetailElement) getDetailElement()).getTaxon();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#dispose()
*/
/** {@inheritDoc} */
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.ui.section.name;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType;
+import eu.etaxonomy.taxeditor.ui.forms.CdmPropertyChangeEvent;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.term.NomenclaturalCodeComboElement;
/**
- * <p>NonViralNameDetailElement class.</p>
- *
+ * <p>
+ * NonViralNameDetailElement class.
+ * </p>
+ *
* @author n.hoffmann
* @created May 20, 2010
* @version 1.0
*/
-public class NonViralNameDetailElement extends AbstractCdmDetailElement<NonViralName> {
+public class NonViralNameDetailElement extends
+ AbstractCdmDetailElement<NonViralName> {
private NameDetailSection section_name;
private AuthorshipDetailSection section_author;
private NomenclaturalCodeComboElement combo_nomenclaturalCode;
/**
- * <p>Constructor for NonViralNameDetailElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
- * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
+ * <p>
+ * Constructor for NonViralNameDetailElement.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
+ * object.
+ * @param formElement
+ * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
+ * object.
*/
public NonViralNameDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement, eu.etaxonomy.cdm.model.common.AnnotatableEntity, int)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
+ * (eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement,
+ * eu.etaxonomy.cdm.model.common.AnnotatableEntity, int)
*/
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement,
final NonViralName entity, int style) {
-
- toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
-
- combo_nomenclaturalCode = (NomenclaturalCodeComboElement) formFactory.createEnumComboElement(EnumComboType.NOMENCLATURALCODE, formElement, style);
+
+ toggleable_cache = formFactory.createToggleableTextField(formElement,
+ "Cache", entity.getTitleCache(), entity.isProtectedTitleCache()
+ || entity.isProtectedFullTitleCache(), style);
+
+ combo_nomenclaturalCode = (NomenclaturalCodeComboElement) formFactory
+ .createEnumComboElement(EnumComboType.NOMENCLATURALCODE,
+ formElement, style);
combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
-
- section_name = (NameDetailSection) formFactory.createCdmDetailSection(DetailType.SCIENTIFICNAME, getConversationHolder(), formElement, null, Section.TWISTIE | Section.EXPANDED);
+
+ section_name = (NameDetailSection) formFactory.createCdmDetailSection(
+ DetailType.SCIENTIFICNAME, getConversationHolder(),
+ formElement, null, Section.TWISTIE | Section.EXPANDED);
section_name.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(2, 1));
addControl(section_name);
addElement(section_name);
- section_author = (AuthorshipDetailSection) formFactory.createCdmDetailSection(DetailType.AUTHORSHIP, getConversationHolder(), formElement, null, Section.TWISTIE | Section.EXPANDED);
+ section_author = (AuthorshipDetailSection) formFactory
+ .createCdmDetailSection(DetailType.AUTHORSHIP,
+ getConversationHolder(), formElement, null,
+ Section.TWISTIE | Section.EXPANDED);
section_author.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(2, 1));
addControl(section_author);
addElement(section_author);
}
-
/** {@inheritDoc} */
@Override
protected void updateContent() {
super.updateContent();
-
- // disable nomenclatural code, because changing of nom.code is not implemented on library side
+
+ // disable nomenclatural code, because changing of nom.code is not
+ // implemented on library side
combo_nomenclaturalCode.setEnabled(false);
-
- setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache}));
+
+ setIrrelevant(toggleable_cache.getState(),
+ Arrays.asList(new Object[] { toggleable_cache }));
}
-
+
/** {@inheritDoc} */
@Override
public void setEntity(NonViralName entity) {
section_name.setEntity(entity);
section_author.setEntity(entity);
}
-
+
/** {@inheritDoc} */
@Override
public void removeElements() {
super.removeElements();
- if(section_name != null){
+ if (section_name != null) {
section_name.removeElements();
removeControl(section_name);
section_name.dispose();
section_name = null;
}
- if(section_author != null){
+ if (section_author != null) {
section_author.removeElements();
removeControl(section_author);
section_author.dispose();
section_author = null;
}
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
+ * .lang.Object)
*/
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
- if(eventSource == toggleable_cache){
- getEntity().setTitleCache(toggleable_cache.getText(), toggleable_cache.getState());
- // we never want the fullTitleCache to be protected since we only use it for
+ if (eventSource == toggleable_cache) {
+ getEntity().setTitleCache(toggleable_cache.getText(),
+ toggleable_cache.getState());
+ // we never want the fullTitleCache to be protected since we only
+ // use it for
// initiating the free text name editor
getEntity().setProtectedFullTitleCache(false);
boolean irrelevant = toggleable_cache.getState();
- List<Object> except = Arrays.asList(new Object[]{toggleable_cache});
+ List<Object> except = Arrays
+ .asList(new Object[] { toggleable_cache });
setIrrelevant(irrelevant, except);
- }
- else if(eventSource == section_name || eventSource == section_author){
- if(getParentElement() instanceof AbstractCdmDetailSection)
+ } else if (eventSource == section_name || eventSource == section_author) {
+ if (getParentElement() instanceof AbstractCdmDetailSection)
((AbstractCdmDetailSection) getParentElement()).updateTitle();
- if(! toggleable_cache.getState()){
+ if (!toggleable_cache.getState()) {
toggleable_cache.setText(getEntity().getTitleCache());
}
}
- if(eventSource == section_name){
+ if (eventSource == section_name) {
section_name.setEntity(getEntity());
getLayoutComposite().layout();
}
+
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
}
else if (eventSource != toggleable_cache) {
toggleable_cache.setText(getEntity().getTitleCache());
}
+
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
/*