import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.CreateElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.CreateSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionElement;
adapt(section);
return section;
}
+
+ public CreateSection createCreateSection(ICdmFormElement parentElement, int style) {
+ CreateSection section = new CreateSection(this, parentElement, style);
+ parentElement.addElement(section);
+ adapt(section);
+ return section;
+ }
/**
* @param parent
return section;
}
- public SecundumSourceSection createSecundumDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- SecundumSourceSection section = new SecundumSourceSection(this, conversation, parentElement, selectionProvider, style);
- addAndAdaptSection(parentElement, section);
- return section;
- }
+// public SecundumSourceSection createSecundumDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+// SecundumSourceSection section = new SecundumSourceSection(this, conversation, parentElement, selectionProvider, style);
+// addAndAdaptSection(parentElement, section);
+// return section;
+// }
public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
return element;
}
- public SecundumSourceDetailElement createSecundumSourceDetailElement(ICdmFormElement parentElement){
- SecundumSourceDetailElement element = new SecundumSourceDetailElement(this, parentElement);
- addAndAdaptElement(parentElement, element);
- return element;
- }
+// public SecundumSourceDetailElement createSecundumSourceDetailElement(ICdmFormElement parentElement){
+// SecundumSourceDetailElement element = new SecundumSourceDetailElement(this, parentElement);
+// addAndAdaptElement(parentElement, element);
+// return element;
+// }
public SecundumSourceElement createSecundumSourceElement(ICdmFormElement parentElement, CdmBase cdmEntity, String label){
SecundumSourceElement element = new SecundumSourceElement(this, parentElement, cdmEntity, label);
return section;
}
+ public CreateElement createCreateElement(ICdmFormElement parentElement, VersionableEntity entity, int style) {
+ CreateElement element = new CreateElement(this, parentElement, entity, style);
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
private TextWithLabelElement text_uuid;\r
private TextWithLabelElement text_objectId;\r
\r
- private Label label_created;\r
- \r
- \r
private CdmBase entity;\r
/**\r
* @param formFactory\r
ICdmFormElement formElement, CdmBase entity, int style) {\r
\r
super(formFactory, formElement);\r
- label_created = formFactory.createLabel(getLayoutComposite(), null, style);\r
- label_created.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());\r
-\r
text_uuid = formFactory.createTextWithLabelElement(formElement, "UUID", null, style);\r
text_uuid.setEditable(false);\r
text_objectId = formFactory.createTextWithLabelElement(formElement, "Object ID", null, style);\r
public void setEntity(CdmBase entity) {\r
\r
this.entity = entity;\r
- String createdString = "";\r
- String updatedString = "";\r
- \r
- if(entity != null){\r
- createdString = "Created "\r
- + dateFormat(entity.getCreated())\r
- + " by " + userFormat(entity.getCreatedBy()); \r
- \r
- }\r
- \r
- label_created.setText(createdString);\r
+ \r
text_uuid.setText(entity != null ? entity.getUuid().toString() : "");\r
text_objectId.setText(entity != null ? entity.getId()+"" : "");\r
}\r
--- /dev/null
+/**
+* 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.supplemental;
+
+import org.eclipse.swt.widgets.Label;
+import org.joda.time.DateTime;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.model.permission.User;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.VersionableEntity;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+
+/**
+ * <p>VersionElement class.</p>
+ *
+ * @author n.hoffmann
+ * @created Nov 5, 2009
+ * @version 1.0
+ */
+public class CreateElement extends AbstractCdmFormElement implements IEntityElement<CdmBase> {
+
+ private Label label_created;
+
+ private CdmBase entity;
+
+ /**
+ * <p>Constructor for VersionElement.</p>
+ *
+ * @param style a int.
+ * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+ * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
+ * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
+ */
+ public CreateElement(CdmFormFactory formFactory, ICdmFormElement parentElement, CdmBase entity, int style) {
+ super(formFactory, parentElement);
+
+ label_created = formFactory.createLabel(getLayoutComposite(), null, style);
+ label_created.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+
+ setEntity(entity);
+ }
+
+ /**
+ * <p>Setter for the field <code>entity</code>.</p>
+ *
+ * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
+ */
+ public void setEntity(CdmBase entity){
+
+ this.entity = entity;
+
+ String createdString = "";
+ String updatedString = "";
+
+ if(entity != null){
+ createdString = "Created "
+ + dateFormat(entity.getCreated())
+ + " by " + userFormat(entity.getCreatedBy());
+ }
+
+ label_created.setText(createdString);
+
+ }
+
+
+
+ /**
+ * <p>Getter for the field <code>entity</code>.</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
+ */
+ public CdmBase getEntity() {
+ return entity;
+ }
+
+ @Override
+ public void setSelected(boolean selected) {
+ // this entity element is not likely to get selected
+ }
+}
--- /dev/null
+/**
+* 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.supplemental;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.VersionableEntity;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+
+/**
+ * <p>VersionSection class.</p>
+ *
+ * @author n.hoffmann
+ * @created Mar 2, 2010
+ * @version 1.0
+ */
+public class CreateSection extends AbstractFormSection<CdmBase>{
+
+ private CreateElement createElement;
+
+
+ /**
+ * <p>Constructor for VersionSection.</p>
+ *
+ * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+ * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
+ * @param style a int.
+ */
+ public CreateSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
+ int style) {
+ super(cdmFormFactory, parentElement, style);
+ createElement = cdmFormFactory.createCreateElement(this, null, style);
+ }
+
+
+ /** {@inheritDoc} */
+ @Override
+ public void setEntity(CdmBase entity) {
+ super.setEntity(entity);
+ createElement.setEntity(entity);
+ }
+}
*/
public class VersionElement extends AbstractCdmFormElement implements IEntityElement<VersionableEntity> {
- private Label label_created;
+// private Label label_created;
private Label label_updated;
public VersionElement(CdmFormFactory formFactory, ICdmFormElement parentElement, VersionableEntity entity, int style) {
super(formFactory, parentElement);
- label_created = formFactory.createLabel(getLayoutComposite(), null, style);
- label_created.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+// label_created = formFactory.createLabel(getLayoutComposite(), null, style);
+// label_created.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
label_updated = formFactory.createLabel(getLayoutComposite(), null, style);
label_updated.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+ " by " + userFormat(entity.getUpdatedBy());
}
- label_created.setText(createdString);
+// label_created.setText(createdString);
label_updated.setText(updatedString);
}
import eu.etaxonomy.taxeditor.ui.section.media.MediaSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.CreateSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection;
if(input instanceof IdentifiableMediaEntity){
createIdentifiableMediaSections(rootElement);
}
+ createCreateSection(rootElement);
//5. Versionable
if(input instanceof VersionableEntity){
createVersionSection(rootElement);
addPart(mediaSection);
}
+ private void createCreateSection(RootElement parent){
+ CreateSection createSection = formFactory.createCreateSection(parent, ExpandableComposite.NO_TITLE);
+ addPart(createSection);
+ }
+
private void createVersionSection(RootElement parent){
VersionSection versionSection = formFactory.createVersionSection(parent, ExpandableComposite.NO_TITLE);
addPart(versionSection);