Changeset 7779


Ignore:
Timestamp:
Feb 28, 2020, 12:36:48 PM (22 months ago)
Author:
Nicklas Nordborg
Message:

References #2202: Include information from parent items in list pages

Added support for other static properties than "Name".

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/list/ParentItemColumn.java

    r7773 r7779  
    7878          col.setFilterProperty("/"+tmp[1]+"/"+tmp[2]+"/name");
    7979        }
    80         col.setValueType(Type.STRING);
    8180        col.setClazz("parentitemcol");
    8281        if (property == null || property.getHibernateType().isEntityType())
    8382        {
    8483          col.setExportFormatter(new NameableFormatter());
     84          col.setFilterProperty(col.getProperty()+".name");
     85          col.setValueType(Type.STRING);
    8586          if (!helper.lazy) col.setFormatter(new CollectionFormatter(new LinkedItemFormatter()));
    8687        }
    8788        else
    8889        {
    89           col.setExportFormatter(new ToStringFormatter<>());
     90          Type colType = Type.fromHibernateType(property.getHibernateType());
     91          if (colType != null)
     92          {
     93            col.setValueType(colType);
     94            col.setExportFormatter(FormatterFactory.getTypeFormatter(dc.getSessionControl(), colType));
     95          }
     96          else
     97          {
     98            // Last fallback -- if we get here the Type.fromHibernateType() should be update with special cases
     99            col.setValueType(Type.STRING);
     100            col.setExportFormatter(new ToStringFormatter<>());
     101          }
    90102          if (!helper.lazy) col.setFormatter(new CollectionFormatter(col.getExportFormatter()));
    91103        }
  • trunk/www/common/columns/add_parent_column.js

    r7777 r7779  
    3131  var currentAnnotationTypesAll;
    3232  var currentAnnotationTypesCategory;
     33 
     34  var nameCol = {'id': '.', 'text': 'Name'};
     35  var externalIdCol = {'id': 'externalId', 'text': 'External ID'};
     36  var bioPlateCol = {'id': 'bioWell.bioPlate', 'text': 'Bioplate'};
     37  var entryDateCol = {'id': 'entryDate', 'text': 'Registered'};
     38  var remainingQCol = {'id': 'remainingQuantity', 'text': 'Remaining quantity'};
     39 
     40  var creationRegistredCol = {'id': 'creationEvent.entryDate', 'text': 'Registered'};
     41  var creationProtocolCol = {'id': 'creationEvent.protocol', 'text': 'Protocol'};
     42  var creationHardwareCol = {'id': 'creationEvent.hardware', 'text': 'Hardware'};
     43
     44  var protocolCol = {'id': 'protocol', 'text': 'Protocol'};
     45  var hardwareCol = {'id': 'hardware', 'text': 'Hardware'};
     46  var softwareCol = {'id': 'software', 'text': 'Software'};
     47
     48  var staticColumns = {
     49    'BIOSOURCE': [nameCol, externalIdCol, entryDateCol],
     50    'SAMPLE': [nameCol, externalIdCol, bioPlateCol, creationRegistredCol, creationProtocolCol, remainingQCol],
     51    'EXTRACT': [nameCol, externalIdCol, bioPlateCol, creationRegistredCol, creationProtocolCol, remainingQCol],
     52    'PHYSICALBIOASSAY': [nameCol, creationRegistredCol, creationProtocolCol, creationHardwareCol],
     53    'DERIVEDBIOASSAY': [nameCol, entryDateCol, protocolCol, softwareCol, hardwareCol]
     54  }
    3355 
    3456  /**
     
    82104  configure.typeInfoLoaded = function(request)
    83105  {
    84     App.debug(request.responseText);
    85106    var response = JSON.parse(request.responseText);
    86107    if (response.status != 'ok')
     
    122143    var annotationTypes = frm.showAllAnnotationTypes.checked ? currentAnnotationTypesAll : currentAnnotationTypesCategory;
    123144    frm.column.length = 0;
    124     frm.column[frm.column.length] = new Option('Name', '.');
     145   
     146    // Add static property columns depending on itemtype
     147    var cols = staticColumns[parentType] || [];
     148    for (var i = 0; i < cols.length; i++)
     149    {
     150      var c = cols[i];
     151      frm.column[frm.column.length] = new Option(c.text, c.id);
     152    }
     153   
     154    // Add annotation columns
    125155    for (var i = 0; i < annotationTypes.length; i++)
    126156    {
Note: See TracChangeset for help on using the changeset viewer.