Opened 12 years ago

Closed 12 years ago

#741 closed (fixed)

Update and deletion of annotations

Reported by: Fredrik Levander Owned by: olle
Milestone: Proteios SE 2.15.0 Keywords:
Cc:

Description

It should be possible to delete annotations for a specific object. Furthermore it should be possible to update values.

Change History (19)

comment:1 Changed 12 years ago by Fredrik Levander

(In [4127]) Refs #741. Added functionality for updating values by clicking on them in the annotation table. Deletion is performed by checking checkboxes and clicking delete. Currently only implemented for files.

comment:2 Changed 12 years ago by Fredrik Levander

Owner: changed from Fredrik Levander to olle

comment:3 Changed 12 years ago by Fredrik Levander

Probably the createAnnotationTable function from ViewActiveFile should be moved and be the basis of something more generic, so that the same function is used also for biomaterials. Currently similar code can be found for samples and extracts etcetera. Possibly TableFactory2 should be used instead for annotations.

Last edited 12 years ago by olle (previous) (diff)

comment:4 Changed 12 years ago by olle

Status: newassigned

Ticket accepted.

comment:5 Changed 12 years ago by olle

Design note.

  • A previous action class/file managing annotations is action/write/AddAnnotation.java in client/servlet/. The latest ticket directly related to this class/file is Ticket #339 (Enable annotations for extracts).

comment:6 Changed 12 years ago by olle

(In [4128]) Refs #741. Class/file action/annotation/DeleteAnnotations.java in client/servlet/ updated to check that at least one annotation item has been selected:

  1. Public method void runMe() updated to check that at least one annotation item has been selected, and if not to return to the previous action with an error message.

comment:7 Changed 12 years ago by olle

Design discussion of functionality of previously existing GUI for annotation management.

  • The "Annotations" tab in the file properties form managed by ViewActiveFile contains an "Annotation" box, that allows new annotations to be created, either using an existing AnnotationType, or a new one, together with an annotation value string. A pop-up menu exists for selecting an existing AnnotationType, while a text field allows entry of a new AnnotationType name.

    a. If an existing annotation type is selected in the pop-up menu, the text entry field for the annotation type name is disabled. If no previous annotation for the annotation type exists, a new annotation is created with the entered value. If an annotation for the selected annotation type already exists, its value will be overwritten with the new value.
    b. If the name of a an annotation type is explicitly entered in the text field, while the annotation type pop-up menu having been left with the default option "-- New --", a new annotation is created with the entered annotation type and value.

    However, when an annotation type name is explicitly entered (case b above), no check is made if the entered annotation type already exists, making it possible to create several annotation type items with the same name. After creation, each of these items will be represented with an option in the pop-up menu for annotation type, but as the options have identical names, the user cannot know what annotation values the different equally-named options represent.

Suggested design update:

  • Allowing creation of several annotation types having the same name is clearly undesirable, and the code should therefore be updated to check if an entered annotation type exists, in which case an error message should be displayed, instead of a new annotation type with the same name being created.
  • The method to change the value of an existing annotation value via the "Annotation" box, described in case a above, will be kept for the moment, but the new functionality added in this ticket in changeset [4127] is preferable, since it is more clear what annotation value is edited.

comment:8 Changed 12 years ago by olle

(In [4129]) Refs #741. Class/file action/write/AddAnnotation.java in client/servlet/ updated to check if an annotation type exists before creating a new one:

  1. Public method void runMe() updated to call new private convenience method boolean isAnnotationTypeExisiting(DbControl dc, Annotator annotator, Annotatable item, String annotationTypeName) to check if an annotation type name already exists, in which case an error message is displayed, instead of a new annotation type with the same name being created.
  1. New private convenience method boolean isAnnotationTypeExisiting(DbControl dc, Annotator annotator, Annotatable item, String annotationTypeName) added. It checks if an annotation type with a given name already exists for a specific item type. If the item type is null, the check will include all item types.

comment:9 Changed 12 years ago by olle

Traceability note:

  • Ticket #742 (Multiple annotation types with same name should not be allowed) updates the design for making sure that multiple annotation types with the same name are not created.
Last edited 12 years ago by olle (previous) (diff)

comment:10 Changed 12 years ago by olle

Design update:

  • The ability to delete an existing annotation should be extended to biomaterials, i.e. samples, extracts, and labeled extracts.
  • View action for an annotation should be added for biomaterials, i.e. samples, extracts, and labeled extracts. As for file annotations, the view action should be set to class ViewAnnotation, that allows an annotation value to be edited.
  • Currently, classes ViewActiveFile and ViewActiveSample use a separate private method Table createAnnotationsTable(TableFactory tableFactory, ItemQuery<Annotation> annotationQuery) to create the annotations table, while classes ViewActiveExtract and ViewActiveLabeledExtract do not. In order to simplify future refactoring, the latter two classes should also use a separate private method Table createAnnotationsTable(TableFactory tableFactory, ItemQuery<Annotation> annotationQuery) to create the annotations table.
  • Currently, class SaveAnnotation for saving an edited annotation value forwards action to action ViewActiveFile, which will not work when the annotation is for a biomaterial (it is also pointed out in the source code of SaveAnnotation, that this part should be made generic). In order to make the code generic, class SaveAnnotation should obtain an action link id from valid parameter VString ForwardField.VPARAM, and forward action to this.

comment:11 Changed 12 years ago by olle

(In [4158]) Refs #741. Refs #339. Annotation management for biomaterials, i.e. samples, extracts, and labeled extracts, updated with view action for an annotation, that allows the value to be edited, and support for deleting an annotation:

  1. Class/file action/annotation/SaveAnnotation.java in client/servlet/ updated to obtain an action link id from valid parameter VString ForwardField.VPARAM, and forward action to this when it is finished.
  1. Class/file action/annotation/ViewAnnotation.java in client/servlet/ updated to obtain an action link id from valid parameter VString ForwardField.VPARAM, and transfer the value to SaveAnnotation, if the latter action is called.
  1. Class/file action/file/ViewActiveFile.java in client/servlet/ updated to set value of valid parameter VString ForwardField.VPARAM to that of the class itself (in this case ViewActiveFile), when action ViewAction is called.
  1. Class/file action/sample/ViewActiveSample.java in client/servlet/ updated in private method Table createAnnotationsTable(TableFactory tableFactory, ItemQuery<Annotation> annotationQuery) to set view action for annotation value to ViewAnnotation and add tool bar with button coupled to action link to DeleteAnnotations.
  1. Class/file action/extract/ViewActiveExtract.java in client/servlet/ updated to create annotation table using same private method Table createAnnotationsTable(TableFactory tableFactory, ItemQuery<Annotation> annotationQuery) as was used for ViewActiveSample.
  1. Class/file action/extract/ViewActiveLabeledExtract.java in client/servlet/ updated to create annotation table using same private method Table createAnnotationsTable(TableFactory tableFactory, ItemQuery<Annotation> annotationQuery) as was used for ViewActiveSample.

comment:12 Changed 12 years ago by olle

Design update:

  • Information on properties for biomaterial items can now be obtained in analogous ways for samples, extracts, and labeled extracts. However, view action for items when listing samples, extracts, and labeled extracts for a project is only defined for the first two, but not for labeled extracts, for which one have to navigate via the creation event for the parent extract to obtain the properties form for a labeled extract. In order to make the GUI consistent for all biomaterial items, view action should be added when listing labeled extracts, and set to action ViewLabeledExtract.

comment:13 Changed 12 years ago by olle

(In [4159]) Refs #741. Refs #339. View action defined for items when listing labeled extracts:

  1. Class/file action/ActionFactory.java in client/servlet/ updated in public synchronized method ActionLink getViewActionLink(AttributeDefinition ad) to set view action for labeled extract items to ViewLabeledExtract.

comment:14 Changed 12 years ago by olle

Design update:

Currently the annotation tab in the file properties form has the layout

Annotations (name and value of annotations) Annotated biomaterials
Annotation (select annotation type or create new)

while for samples, extracts, and labeled extracts it has the layout

Annotation (select annotation type or create new) Annotations (name and value of annotations)
Associated Files
  • In order to increase consistency, the annotation tab in the file properties form should have a layout that resembles the one for the biomaterial items:
Annotation (select annotation type or create new) Annotations (name and value of annotations)
Annotated biomaterials

This choice has the following benefits:

  1. The two components related to annotations are now found at same locations in all of the forms.
  2. The two components related to annotations are at the top of the form tab entitled "Annotations".
  3. The components for associated items are found at same locations in all of the forms.
  4. The layout has a row-based structure, with the first row related to annotations and the second to associated items. New items will be added at the bottom, which is natural for a web form.

comment:15 Changed 12 years ago by olle

(In [4160]) Refs #741. Class/file action/file/ViewActiveFile.java in client/servlet/ updated in annotation tab to have a layout similar to that for the annotation tab for the properties form for samples, extracts, and labeled extracts:

  1. Public method void runMe() updated to place the form for new annotations to the upper left, the one for annotation names and values to the upper right, and the one for annotated biomaterials to the lower left.

comment:16 Changed 12 years ago by olle

Design update:

  • Just as the annotation tab in the file properties form has links for annotated biomaterial, that leads to the properties form for the biomaterial in question, the annotation tab in the properties form for samples, extracts, and labeled extracts should have links for associated file items, that leads to the properties form for the file.

comment:17 Changed 12 years ago by olle

(In [4161]) Refs #741. Refs #339. Annotation management for biomaterials, i.e. samples, extracts, and labeled extracts, updated with links for associated file items, that leads to the properties form for the file:

  1. Class/file action/sample/ViewActiveSample.java in client/servlet/ updated in private method Table createFileTable(Sample sample) with action link for associated file items. The action link is coupled to action ViewFile, and the file id value is added to valid parameter VInteger FormFactory.VID.
  1. Class/file action/extract/ViewActiveExtract.java in client/servlet/ updated in protected method void runMe() with action link for associated file items. The action link is coupled to action ViewFile, and the file id value is added to valid parameter VInteger FormFactory.VID.
  1. Class/file action/extract/ViewActiveLabeledExtract.java in client/servlet/ updated in protected method void runMe() with action link for associated file items. The action link is coupled to action ViewFile, and the file id value is added to valid parameter VInteger FormFactory.VID.

comment:18 Changed 12 years ago by olle

Design update summary.

  • Annotation management for files and biomaterials (samples, extracts, and labeled extracts) has been updated to support editing and deletion of annotations. The functionality related to annotations and associated items is now similar for files and biomaterial items. while some differences in the code still exists. Refactoring of the code to make it more generic will be left for future updates.

comment:19 Changed 12 years ago by olle

Resolution: fixed
Status: assignedclosed

Ticket closed as annotation management for files and biomaterials has been updated to support editing and deletion of annotations, and the user interface has been updated to increase similarity between the different item types.

Note: See TracTickets for help on using tickets.