import eu.etaxonomy.taxeditor.store.StoreUtil;
/**
- * @author n.hoffmann
+ * <p>Abstract AbstractEntityCollectionSection class.</p>
*
+ * @author n.hoffmann
+ * @version $Id: $
*/
public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT extends IVersionableEntity> extends AbstractFormSection<ENTITY> implements IExpansionListener{
private String title;
/**
+ * <p>Constructor for AbstractEntityCollectionSection.</p>
+ *
* @param conversation TODO
- * @param parentElement
- * @param style
+ * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
+ * @param style a int.
+ * @param formFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object.
+ * @param title a {@link java.lang.String} object.
+ * @param <ENTITY> a ENTITY object.
+ * @param <ELEMENT> a ELEMENT object.
*/
public AbstractEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String title, int style) {
super(formFactory, conversation, parentElement, Section.CLIENT_INDENT | style);
return toolBarManager.createControl(this);
}
+ /**
+ * <p>setEntity</p>
+ *
+ * @param entity a ENTITY object.
+ */
public void setEntity(ENTITY entity) {
if(entity != null && hasCollectionChanged(entity)){
super.setEntity(entity);
/**
* Sets the title for the section. Adds a "+" sign if the collection is not empty for this section.
* Override in subclasses if you want to have a different behaviour.
- *
*/
protected void setSectionTitle() {
if(getCollection(getEntity()) != null && getCollection(getEntity()).size() > 0){
}
/**
- * Call this method after dynamically changing the client area.
+ * Call this method after dynamically changing the client area.
* If the options changed is set to true, will also fire a state changed
- * event to inform the user of unsaved changes.
- *
- * @param changed
+ * event to inform the user of unsaved changes.
+ *
+ * @param changed a boolean.
*/
protected void internalUpdateSection(boolean changed){
destroyDynamicContent();
reflow();
}
+ /**
+ * <p>createEmptyContent</p>
+ */
protected void createEmptyContent(){
label_empty = formFactory.createLabel(getLayoutComposite(), getEmptyString());
}
/**
* Creates the widgets for the collection
+ *
+ * @param elements a {@link java.util.Collection} object.
*/
protected void createDynamicContents(Collection<ELEMENT> elements)
{
/**
* Create the specific widget for the element
- * @param element
+ *
+ * @param element a ELEMENT object.
+ * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
+ * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
*/
protected void createElementComposite(ELEMENT element, SelectionListener removeListener, Color backgroundColor){
AbstractEntityCollectionElement formElement = formFactory.createEntityCollectionElement(this, element, removeListener, backgroundColor, SWT.NULL);
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.forms.section.AbstractEditorFormSection#setBackground(org.eclipse.swt.graphics.Color)
*/
+ /** {@inheritDoc} */
@Override
public void setBackground(Color color) {
if(label_empty != null && !label_empty.isDisposed()){
}
/**
- *
- * @return
+ * <p>getTitleString</p>
+ *
+ * @return a {@link java.lang.String} object.
*/
public String getTitleString() {
return CdmUtils.Nz(title);
}
+ /**
+ * <p>setTitleString</p>
+ *
+ * @param title a {@link java.lang.String} object.
+ */
public void setTitleString(String title){
this.title = title;
}
+ /** {@inheritDoc} */
public void expansionStateChanging(ExpansionEvent e) {
// logger.warn("Expansion State Changing");
}
+ /** {@inheritDoc} */
public void expansionStateChanged(ExpansionEvent e) {
if(isExpanded()){
renderContent(isExpanded());
/**
* Get the specific collection of this entity
- * @param entity
- * @return
+ *
+ * @param entity a ENTITY object.
+ * @return a {@link java.util.Collection} object.
*/
public abstract Collection<ELEMENT> getCollection(ENTITY entity);
/**
* Create a new Element for this collection
- * @return
+ *
+ * @return a ELEMENT object.
*/
public abstract ELEMENT createNewElement();
/**
* Add an element to the entities collection
- *
- * @param element
+ *
+ * @param element a ELEMENT object.
*/
public abstract void addElement(ELEMENT element);
/**
* Remove an element from the entities collection
- *
- * @param element
+ *
+ * @param element a ELEMENT object.
*/
public abstract void removeElement(ELEMENT element);
/**
* String to display when the collection is empty
- * @return
+ *
+ * @return a {@link java.lang.String} object.
*/
public abstract String getEmptyString();
/**
- *
+ * <p>getTooltipString</p>
+ *
* @return String to display when hovering the add button
*/
protected abstract String getTooltipString();