import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart;
/**
- * <p>Abstract AbstractCdmDataViewer class.</p>
- *
* @author n.hoffmann
* @created Feb 9, 2010
* @version 1.0
private final AbstractCdmViewPart viewPart;
- /**
- * <p>Constructor for AbstractCdmDataViewer.</p>
- *
- * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
- * @param viewPart a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart} object.
- */
public AbstractCdmDataViewer(Composite parent, AbstractCdmViewPart viewPart) {
this.viewPart = viewPart;
managedForm = new ManagedForm(parent){
- /* (non-Javadoc)
- * @see org.eclipse.ui.forms.ManagedForm#dirtyStateChanged()
- */
@Override
public void dirtyStateChanged() {
markViewPartDirty();
rootElement = new RootElement(formFactory, body);
}
- /**
- * <p>createFormFactory</p>
- */
protected void createFormFactory() {
if(formFactory != null){
formFactory.dispose();
viewPart.changed(input);
}
-
- /**
- * @return
- */
protected AbstractCdmViewPart getViewPart() {
return viewPart;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.Viewer#getControl()
- */
/** {@inheritDoc} */
@Override
public Control getControl() {
return body;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public void setInput(Object input) {
refresh();
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.Viewer#getInput()
- */
/** {@inheritDoc} */
@Override
public Object getInput() {
return input;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.Viewer#refresh()
- */
/** {@inheritDoc} */
@Override
public void refresh() {
managedForm.reflow(true);
}
-
- /**
- * <p>layout</p>
- */
public void layout(){
body.layout();
}
- /**
- * <p>showParts</p>
- */
protected abstract void showParts();
-
- /**
- * <p>destroySections</p>
- */
protected void destroySections() {
for (IFormPart formPart : managedForm.getParts()){
- removePart((CdmSectionPart) formPart);
+ removePart((CdmSectionPart<?>) formPart);
}
managedForm.setInput(null);
}
}
-
- /**
- * <p>setFocus</p>
- */
public void setFocus(){
// we have to set focus to a control of this viewer
// otherwise, after opening a dialog from the details, the focus will not be
}
}
- /**
- * <p>reflow</p>
- */
public void reflow(){
managedForm.reflow(true);
}
- /**
- * <p>removePart</p>
- *
- * @param sectionPart a {@link eu.etaxonomy.taxeditor.view.detail.CdmSectionPart} object.
- */
- protected void removePart(CdmSectionPart sectionPart){
+ protected void removePart(CdmSectionPart<?> sectionPart){
managedForm.removePart(sectionPart);
formFactory.removePropertyChangeListener(sectionPart);
}
- /**
- * <p>addPart</p>
- *
- * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
- */
- protected void addPart(AbstractFormSection section){
- CdmSectionPart sectionPart = new CdmSectionPart(section);
+ protected void addPart(AbstractFormSection<?> section){
+ CdmSectionPart<?> sectionPart = new CdmSectionPart<>(section);
managedForm.addPart(sectionPart);
formFactory.addPropertyChangeListener(sectionPart);
}
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
@Override
public ConversationHolder getConversationHolder() {
return viewPart.getConversationHolder();
}
- /** {@inheritDoc} */
- @Override
- public void update(CdmDataChangeMap changeEvents) {}
-
}