Changeset 6334


Ignore:
Timestamp:
Oct 16, 2013, 4:39:55 PM (9 years ago)
Author:
olle
Message:

Refs #1772. Support for annotatable Software items added.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/DerivedBioAssay.java

    r6328 r6334  
    368368      if (getData().getExtract() != null) annotatable.add(getExtract());
    369369      if (getData().getHardware() != null) annotatable.add(getHardware());
     370      if (getData().getSoftware() != null) annotatable.add(getSoftware());
    370371    }
    371372    catch (PermissionDeniedException ex)
  • trunk/src/core/net/sf/basedb/core/RawBioAssay.java

    r6127 r6334  
    244244      if (getData().getParentBioAssay() != null) annotatable.add(getParentBioAssay());
    245245      if (getData().getParentExtract() != null) annotatable.add(getParentExtract());
     246      if (getData().getSoftware() != null) annotatable.add(getSoftware());
    246247    }
    247248    catch (PermissionDeniedException ex)
  • trunk/src/core/net/sf/basedb/core/Software.java

    r6127 r6334  
    3838*/
    3939public class Software
    40   extends CommonItem<SoftwareData>
     40  extends AnnotatedItem<SoftwareData>
    4141  implements Registered, Subtypable
    4242{
     
    171171  {
    172172    return DateUtil.copy(getData().getEntryDate());
     173  }
     174  // -------------------------------------------
     175  /*
     176    From the Annotatable interface
     177    -------------------------------------------
     178  */
     179  /**
     180    @return Always null
     181    @since 3.3
     182  */
     183  @Override
     184  public Set<Annotatable> getAnnotatableParents()
     185  {
     186    return null;
    173187  }
    174188  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/SoftwareData.java

    r6127 r6334  
    3636*/
    3737public class SoftwareData
    38   extends CommonData
     38  extends AnnotatedData
    3939  implements RegisteredData, SubtypableData
    4040{
  • trunk/src/core/net/sf/basedb/util/overview/loader/SoftwareLoader.java

    r5685 r6334  
    8484    }
    8585    Node softwareNode = createItemNode(nf, software, software, denied,
    86         parentNode, ChildNodeDirection.NONE);
     86        parentNode, ChildNodeDirection.PROPERTY);
    8787    return softwareNode;
    8888  }
    8989  // -----------------------------------
    90  
     90  /*
     91    From the AbstractNodeLoader class
     92    ----------------------------------
     93  */
     94  /**
     95    Loads annotations and software parameters for the given software node.
     96    @see RawBioAssayLoader#createForwardNode(DbControl, OverviewContext, Node)
     97  */
     98  @Override
     99  protected void loadPropertyChildNodes(DbControl dc, OverviewContext context, Node softwareNode)
     100  {
     101    getNodeLoader(context, Item.ANNOTATION).createPropertyNode(dc, context, softwareNode);
     102  }
     103  // ------------------------------------- 
    91104}
  • trunk/www/admin/software/edit_software.jsp

    r6222 r6334  
    2626--%>
    2727<%@ page pageEncoding="UTF-8" session="false"
     28  import="net.sf.basedb.core.AnnotationType"
    2829  import="net.sf.basedb.core.SessionControl"
    2930  import="net.sf.basedb.core.DbControl"
     
    197198      </table>
    198199    </t:tab>
     200    <t:tab id="annotations" title="Annotations" helpid="annotations.edit">
     201      <jsp:include page="../../common/annotations/annotate_frameset.jsp">
     202        <jsp:param name="item_type" value="<%=itemType.name()%>" />
     203        <jsp:param name="item_id" value="<%=itemId%>" />
     204        <jsp:param name="ID" value="<%=ID%>" />
     205      </jsp:include>
     206    </t:tab>
    199207    </t:tabcontrol>
    200208    </form>
  • trunk/www/admin/software/index.jsp

    r6192 r6334  
    179179      }
    180180     
     181      Base.updateAnnotations(dc, software, software, request);
    181182      // OnSave extensions
    182183      invoker.render(OnSaveRenderer.ON_SAVE);
     
    215216      message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission";
    216217    }
    217     redirect = listPage;
     218    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
    218219  }
    219220  else if ("RestoreItem".equals(cmd))
     
    238239      message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission";
    239240    }
    240     redirect = listPage;
     241    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
    241242  }
    242243  else if ("ShareItem".equals(cmd))
  • trunk/www/admin/software/list_software.jsp

    r6222 r6334  
    3030  import="net.sf.basedb.core.Software"
    3131  import="net.sf.basedb.core.ItemSubtype"
     32  import="net.sf.basedb.core.Annotation"
     33  import="net.sf.basedb.core.AnnotationType"
     34  import="net.sf.basedb.core.AnnotationSet"
    3235  import="net.sf.basedb.core.ItemQuery"
    3336  import="net.sf.basedb.core.Include"
     
    8083final DbControl dc = sc.newDbControl();
    8184ItemResultIterator<Software> software = null;
     85ItemResultList<AnnotationType> annotationTypes = null;
    8286try
    8387{
    8488  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
    8589  final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType);
     90  final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType);
     91  annotationTypes = annotationTypeQuery.list(dc);
    8692
    8793  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
     
    197203        exportable="true"
    198204      />
     205      <%
     206      for (AnnotationType at : annotationTypes)
     207      {
     208        Enumeration<String, String> annotationEnum = null;
     209        Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType());
     210        if (at.isEnumeration())
     211        {
     212          annotationEnum = new Enumeration<String, String>();
     213          List<?> values = at.getValues();
     214          for (Object value : values)
     215          {
     216            String encoded = formatter.format(value);
     217            annotationEnum.add(encoded, encoded);
     218          }
     219        }
     220        %>
     221        <tbl:columndef
     222          id="<%="at"+at.getId()%>"
     223          title="<%=HTML.encodeTags(at.getName())+" [A]"%>"
     224          property="<%="#"+at.getId()%>"
     225          annotation="true"
     226          datatype="<%=at.getValueType().getStringValue()%>"
     227          enumeration="<%=annotationEnum%>"
     228          smartenum="<%=at.getDisplayAsList() %>"
     229          sortable="<%=at.getMultiplicity() == 1%>"
     230          filterable="true"
     231          exportable="true"
     232          formatter="<%=formatter%>"
     233          unit="<%=at.getDefaultUnit()%>"
     234        />
     235        <%
     236      }
     237      %> 
    199238      <tbl:columndef
    200239        id="permission"
     
    416455                  /></tbl:cell>
    417456                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
     457                <%
     458                AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null;
     459                if (as != null)
     460                {
     461                  for (AnnotationType at : annotationTypes)
     462                  {
     463                    if (as.hasAnnotation(at))
     464                    {
     465                      Annotation a = as.getAnnotation(at);
     466                      String suffix = a.getUnitSymbol(null);
     467                      if (suffix != null) suffix = "&nbsp;" + suffix;
     468                      %>
     469                      <tbl:cell
     470                        column="<%="at"+at.getId()%>"
     471                        ><tbl:cellvalue
     472                          list="<%=a.getValues(null)%>"
     473                          suffix="<%=suffix%>"
     474                      /></tbl:cell>
     475                      <%
     476                    }
     477                  }
     478                }
     479                %>
    418480                <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell>
    419481                <tbl:cell column="sharedTo">
  • trunk/www/admin/software/software.js

    r6297 r6334  
    4444     
    4545      // Tab validation
     46      TabControl.addTabActivateListener('settings.annotations', software.loadAnnotationsFrame);
    4647      TabControl.addTabValidator('settings.info', software.validateSoftware);
    4748    }
     
    6162      Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes);
    6263      Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes);
     64
     65      TabControl.addTabActivateListener('main.annotations', AnnotationsList.loadOnce);
    6366    }
    6467    else if (pageId == 'list-page')
     
    99102    if (TabControl.validateActiveTab('settings'))
    100103    {
     104      Annotations.saveModifiedAnnotationsToForm(frm);
    101105      frm.submit();
    102106    }
     107  }
     108
     109  software.loadAnnotationsFrame = function()
     110  {
     111    Annotations.autoLoadEditFrame(null, ItemSubtype.getSubtypeId('subtype_id'));
    103112  }
    104113
  • trunk/www/admin/software/view_software.jsp

    r6322 r6334  
    252252      </jsp:include>
    253253    </t:tab>
     254    <t:tab id="annotations" title="Annotations"
     255      tooltip="View annotation values" clazz="white">
     256      <jsp:include page="../../common/annotations/list_frameset.jsp">
     257        <jsp:param name="item_type" value="<%=itemType.name()%>" />
     258        <jsp:param name="item_id" value="<%=itemId%>" />
     259        <jsp:param name="ID" value="<%=ID%>" />
     260      </jsp:include>
     261    </t:tab>
    254262    </t:tabcontrol>
    255263  </base:body>
  • trunk/www/include/scripts/main.js

    r6328 r6334  
    548548    this.controllers['SAMPLE'] = { url:'biomaterials/samples/index.jsp', width:750, height:500 };
    549549    this.controllers['SESSION'] = { url:'views/sessions/index.jsp', width:450, height:300, popup:true, edit:false, noAnyToAny:true };
    550     this.controllers['SOFTWARE'] = { url:'admin/software/index.jsp', width:450, height:300 };
     550    this.controllers['SOFTWARE'] = { url:'admin/software/index.jsp', width:800, height:500 };
    551551    this.controllers['TAG'] = { url:'biomaterials/tags/index.jsp', width:450, height:300 };
    552552    this.controllers['TRANSFORMATION'] = { url:'views/experiments/transformations/index.jsp', width:450, height:300, noAnyToAny:true };
  • trunk/www/views/derivedbioassays/bioassays.js

    r6328 r6334  
    240240    var hardwareId = Math.abs(parseInt(frm.hardware_id.value));
    241241    if (hardwareId > 0) parents[parents.length] = 'HARDWARE:'+hardwareId;
     242    var softwareId = Math.abs(parseInt(frm.software_id.value));
     243    if (softwareId > 0) parents[parents.length] = 'SOFTWARE:'+softwareId;
    242244    return parents;
    243245  }
  • trunk/www/views/rawbioassays/bioassays.js

    r6314 r6334  
    199199    var extractId = Math.abs(parseInt(frm.extract_id.value));
    200200    if (extractId > 0) parents[parents.length] = 'EXTRACT:'+extractId;
     201    var softwareId = Math.abs(parseInt(frm.software_id.value));
     202    if (softwareId > 0) parents[parents.length] = 'SOFTWARE:'+softwareId;
    201203    if (frm.arraydesign_id)
    202204    {
Note: See TracChangeset for help on using the changeset viewer.