import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @version 1.0
*/
public class ChecklistEditor extends EditorPart implements ISelectionListener, IPartContentHasFactualData,
- IConversationEnabled, IContextListener, IPartContentHasDetails, IDirtyMarkable {
+ IConversationEnabled, IContextListener, IPartContentHasDetails, IDirtyMarkable, ICdmEntitySessionEnabled {
private static final Logger logger = Logger.getLogger(ChecklistEditor.class);
/**
private Label statusLabel;
+ private final ICdmEntitySession cdmEntitySession;
+
private SortedSet<DefinedTermBase> terms = null;
private ToolItem toolItem;
private ChecklistDropdownSelectionListener dropListener;
* </p>
*/
public ChecklistEditor() {
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
}
/** {@inheritDoc} */
private void createTable() {
Table table = viewer.getTable();//new Table(parent, viewer.getTable().getStyle());
List<String> titles = new ArrayList<String>();
- Collections.addAll(titles, "Taxon", "Author", "Reference", "Rank");
+ Collections.addAll(titles, "Taxon", "Author", "Rank");
List<Integer> bounds = new ArrayList<Integer>();
- Collections.addAll(bounds, 300, 200, 200, 200);
+ Collections.addAll(bounds, 300, 200, 200);
Map<Integer, Boolean> restoreValuesForColumnWidth = restoreValuesForColumnWidth(titles, bounds);
createInitalDistributionColumns(table, titles, bounds, restoreValuesForColumnWidth);
table.setSortDirection(SWT.DOWN);
}
/**
* This method creates initially the distribution columns for a table. It should only be called for creation.<br>
- *<p>
+ *<p>
*
*<b>Notice:</b> If you want to add additional columns later please use <b>addTableViewerColumn()</b>
*
if (columnIndex == 1) {
table.setSortColumn(column.getColumn());
}
- if (columnIndex == 3) {
+ if (columnIndex == 2) {
/** uncommented it for now because no rank editing is wanted **/
// column.setEditingSupport(new RankEditingSupport(viewer, this));
}
/**
* This methods loads the last opened distribution columns for the table viewer from the prefrence store.<br>
- *<p>
+ *<p>
* <b>Notice:</b> It adds also the TitleCache to the titles list for the header of each column.<p>
- *
+ *
* @param titles
* @param bounds
* @return Map<Integer, Boolean>
}
/**
- * This method adds new DistributionColumns to an existing table.
- *
+ * This method adds new DistributionColumns to an existing table.
+ *
* @param title
* @param bound
* @param colNumber
column.setMoveable(true);
return viewerColumn;
}
-
-
-
+
+
+
/**
*
* pull data from database and set input for view
getService().schedule(new ChecklistJob("loading Taxa", selectedTaxonNodes), Job.LONG);
}
if (taxonNode != null) {
- selectedTaxonNodes = taxonNodeService.loadChildNodesOfTaxonNode(taxonNode, NODE_INIT_STRATEGY, true, false);
+ selectedTaxonNodes = taxonNodeService.loadChildNodesOfTaxonNode(taxonNode, NODE_INIT_STRATEGY, true, null);
getService().schedule(new ChecklistJob("loading Taxa", selectedTaxonNodes), Job.LONG);
}
}
/** {@inheritDoc} */
@Override
public void dispose() {
+ cdmEntitySession.dispose();
super.dispose();
}
/** {@inheritDoc} */
@Override
public void setFocus() {
+ cdmEntitySession.bind();
viewer.getControl().setFocus();
}
* It will hide the old distribution column and load the newly added columns.<br>
* <p>
* <b>Notice:</b> for data update please use <b>refresh()</b>
- *
+ *
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void reload(){
}
}
}
-
+
/**
* <p>
* Getter for the field <code>service</code>.
public boolean isDirty() {
return dirty;
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ */
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> getRootEntities() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}