-// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.
*/
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
-import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.VersionableEntity;
import eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.IElementHasDetails;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.RootElement;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;
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.RightsSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.SourceSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.IdentifierSection;
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
import eu.etaxonomy.taxeditor.view.detail.DetailsViewer;
private boolean showDebug;
-
+
/**
* <p>Constructor for SupplementalDataViewer.</p>
*
super(parent, viewPart);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.Viewer#getSelection()
- */
/** {@inheritDoc} */
@Override
public ISelection getSelection() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers.ISelection, boolean)
- */
/** {@inheritDoc} */
@Override
public void setSelection(ISelection selection, boolean reveal) {
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.view.AbstractDetailsViewer#showParts(eu.etaxonomy.cdm.model.common.AnnotatableEntity)
- */
/** {@inheritDoc} */
@Override
protected void showParts() {
-
- showDebug = PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.SHOW_DEBUG_INFORMATION);
-
+
+ showDebug = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_DEBUG_INFORMATION);
+
Object input;
-
+
if(getInput() instanceof IElementHasDetails){
input = ((IElementHasDetails) getInput()).getData();
}else{
input = getInput();
}
-
+
destroySections();
//1. Headline
createHeadlineSection(rootElement);
//2. Annotatable entitiy
- if(input instanceof AnnotatableEntity){
+ if(input instanceof AnnotatableEntity){
createAnnotationSections(rootElement);
}
//3. Identifiable entity
}
//4. Identifiable media entity
if(input instanceof IdentifiableMediaEntity){
- createIdentifiableMediaSections(rootElement);
+ createIdentifiableMediaSections(rootElement);
}
//5. Versionable
if(input instanceof VersionableEntity){
createVersionSection(rootElement);
- }
+ }
//6. CdmBase
if(showDebug){
createCdmBaseSection(rootElement);
}
-
+
layout();
}
HeadlineSection headlineSection = formFactory.createHeadlineSection(parent);
addPart(headlineSection);
}
-
- private void createAnnotationSections(RootElement parent){
- AnnotationSection annotationSection = (AnnotationSection)
- formFactory.createEntityDetailSection(EntityDetailType.ANNOTATION, getConversationHolder(), parent, Section.TWISTIE);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- MarkerSection markerSection = (MarkerSection)
- formFactory.createEntityDetailSection(EntityDetailType.MARKER, getConversationHolder(), parent, Section.TWISTIE);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- addPart(annotationSection);
- addPart(markerSection);
- }
- private void createIdentifiableSections(RootElement parent){
- CreditSection creditSection = (CreditSection)
- formFactory.createEntityDetailSection(EntityDetailType.CREDIT, getConversationHolder(), parent, Section.TWISTIE);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- ExtensionSection extensionSection = (ExtensionSection)
- formFactory.createEntityDetailSection(EntityDetailType.EXTENSION, getConversationHolder(), parent, Section.TWISTIE);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- RightsSection rightsSection = (RightsSection)
- formFactory.createEntityDetailSection(EntityDetailType.RIGHTS, getConversationHolder(), parent, Section.TWISTIE);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- SourceSection sourceSection = (SourceSection)
- formFactory.createEntityDetailSection(EntityDetailType.SOURCE, getConversationHolder(), parent, Section.TWISTIE);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- addPart(creditSection);
- addPart(extensionSection);
- addPart(rightsSection);
- addPart(sourceSection);
-
- }
-
- private void createIdentifiableMediaSections(RootElement parent){
- MediaSection mediaSection = (MediaSection)
- formFactory.createEntityDetailSection(EntityDetailType.MEDIA, getConversationHolder(), parent, Section.TWISTIE);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- addPart(mediaSection);
+ private void createAnnotationSections(RootElement parent) {
+ AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ MarkerSection markerSection = formFactory.createMarkerSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ addPart(annotationSection);
+ addPart(markerSection);
+ }
+
+ private void createIdentifiableSections(RootElement parent) {
+
+ ExtensionSection extensionSection = formFactory.createExtensionSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ SourceSection sourceSection = formFactory.createSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ IdentifierSection identifierSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ CreditSection creditSection = formFactory.createCreditSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ addPart(sourceSection);
+ addPart(identifierSection);
+ addPart(extensionSection);
+ addPart(creditSection);
+ addPart(rightsSection);
+
}
-
- private void createVersionSection(RootElement parent){
- VersionSection versionSection = formFactory.createVersionSection(parent, Section.NO_TITLE | Section.EXPANDED);
+
+ private void createIdentifiableMediaSections(RootElement parent) {
+ MediaSection mediaSection = formFactory.createMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ addPart(mediaSection);
+ }
+
+ private void createVersionSection(RootElement parent){
+ VersionSection versionSection = formFactory.createVersionSection(parent, ExpandableComposite.NO_TITLE | ExpandableComposite.EXPANDED);
addPart(versionSection);
}
-
+
/**
* @param rootElement
*/
private void createCdmBaseSection(RootElement parent) {
-
- CdmBaseSection cdmBaseSection = formFactory.createCdmBaseSection(parent, Section.NO_TITLE | Section.EXPANDED);
+
+ CdmBaseSection cdmBaseSection = formFactory.createCdmBaseSection(parent, ExpandableComposite.NO_TITLE | ExpandableComposite.EXPANDED);
addPart(cdmBaseSection);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
*/
/** {@inheritDoc} */
- public void selectionChanged(SelectionChangedEvent event) {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
if(event.getSource() instanceof DetailsViewer){
if(event.getSelection() == CdmFormFactory.EMPTY_SELECTION){
setInput(null);
return;
}
-
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
setInput(selection.getFirstElement());
}
}
+
+ @Override
+ public void update(CdmDataChangeMap arg0) {
+ }
}