Changeset 8088 for branches/3.19-stable


Ignore:
Timestamp:
Oct 31, 2022, 9:57:24 AM (7 months ago)
Author:
Nicklas Nordborg
Message:

References #2286: Improve performance for multi-hop child->parent->child kolumns

Implemented functionality for allowing/not allowing doubling back when creating a related item column that has a child->parent->child specification. The default is to not allow doubling back.

Location:
branches/3.19-stable
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/3.19-stable/src/clients/web/net/sf/basedb/clients/web/extensions/list/RelatedItemColumn.java

    r8086 r8088  
    189189 
    190190  /**
     191    Get the specification for this column.
     192    @since 3.19.5
     193  */
     194  protected Specification getSpecification()
     195  {
     196    return spec;
     197  }
     198 
     199  /**
    191200    We finalize this implementation to make sure that the helper
    192201    implementation always get a chance to re-cycle transactions.
     
    261270  {
    262271    Set<Integer> sourceIds = Collections.singleton(item.getId());
     272    helper.transformContext.resetCollected();
    263273    if (preTransform != null)
    264274    {
     275      if (!spec.allowDoublingBack) helper.transformContext.setCollecting();
    265276      sourceIds = preTransform.transform(helper.transformContext, sourceIds);
     277      if (!spec.allowDoublingBack) helper.transformContext.setAvoiding();
    266278    }
    267279    Set<Integer> relatedIds = transformer.transform(helper.transformContext, sourceIds);
     
    309321        baseIndex = 2;
    310322        spec.directionRaw = tmp[1];
    311         if ("CHILD".equals(spec.directionRaw)) spec.direction = SourceItemTransform.PARENT_TO_CHILD;
     323        if (spec.directionRaw.endsWith("+")) spec.allowDoublingBack = true;
     324        if (spec.directionRaw.startsWith("CHILD")) spec.direction = SourceItemTransform.PARENT_TO_CHILD;
    312325      }
    313326      spec.targetType = Item.valueOf(tmp[baseIndex]);
     
    353366    String directionRaw;
    354367    SourceItemTransform direction;
     368    boolean allowDoublingBack;
    355369    Item sourceType;
    356370    Item targetType;
     
    388402
    389403    /**
     404      Enabled on a multi-hop path if the path down to the related child from the
     405      parent item is allowed to traverse the same items as the path up from
     406      the source child item to the parent.
     407    */
     408    public boolean isDoublingBackAllowed()
     409    {
     410      return allowDoublingBack;
     411    }
     412   
     413    /**
    390414      Get the source item type. This is not part of the expression, but
    391415      is taken from the current list.
     
    474498      result += direction == SourceItemTransform.CHILD_TO_PARENT ? "parentitem" : "childitem";
    475499      if (multiHop) result += " multihop";
     500      if (allowDoublingBack) result += " doublingback";
    476501      result += "\">";
    477502      result += StringUtil.coalesce(subtypeName, targetType.name());
  • branches/3.19-stable/src/clients/web/net/sf/basedb/clients/web/extensions/list/RelatedItemMultiHopColumn.java

    r8067 r8088  
    1818
    1919  private final RelatedItemColumn nextHop;
     20  private final Specification nextSpec;
     21 
    2022  RelatedItemMultiHopColumn(DbControl dc, int index, Specification spec, RelatedItemHelper helper, RelatedItemColumn nextHop)
    2123  {
    2224    super(dc, index, spec, helper);
    2325    this.nextHop = nextHop;
     26    this.nextSpec = nextHop.getSpecification();
    2427   
    2528    setValueType(nextHop.getValueType());
     
    4346    setTitle(spec.generateTitle(nextHop.getTitle()));
    4447    setSubtitle(nextHop.getSubtitle());
    45     setTooltip(spec.generateTooltip(StringUtil.coalesce(nextHop.getTooltip(), nextHop.getTitle())));
     48    setTooltip(spec.generateTooltip(StringUtil.coalesce(nextHop.getTooltip(), nextHop.getTitle())+
     49      (nextSpec.allowDoublingBack ? " (doubling back allowed)" : " (no doubling back)")));
    4650  }
    4751
  • branches/3.19-stable/www/common/columns/add_relateditem_column.js

    r8074 r8088  
    109109    configure.clearList('childItemType');
    110110    configure.clearList('childSubtype');
     111    Doc.element('allowDoublingBack').disabled = true;
    111112   
    112113    var frm = document.forms['relatedItems'];
     
    200201    configure.clearColumns();
    201202    configure.clearList('childSubtype');
     203    Doc.element('allowDoublingBack').disabled = true;
    202204   
    203205    var frm = document.forms['relatedItems'];
     
    267269      frm.childSubtype.selectedIndex = 0;
    268270      frm.childSubtype.disabled = currentChildSubtypes.length == 0;
     271      frm.allowDoublingBack.disabled = currentChildSubtypes.length == 0;
    269272    }
    270273   
     
    371374    data.childItemType = frm.childItemType.value;
    372375    data.childSubtype = frm.childSubtype.value;
     376    data.allowDoublingBack = frm.allowDoublingBack.checked?1:0;
    373377
    374378    if (!data.targetItemType)
     
    396400    {
    397401      data.childSubtypeName = frm.childSubtype[frm.childSubtype.selectedIndex].text;
    398       propertyPrefix += '/CHILD/'+data.childItemType+'/'+data.childSubtype+'/';
     402      propertyPrefix += (data.allowDoublingBack?'/CHILD+/':'/CHILD/')+data.childItemType+'/'+data.childSubtype+'/';
    399403      titlePrefix += '.'+data.childSubtypeName;
    400404    }
  • branches/3.19-stable/www/common/columns/add_relateditem_column.jsp

    r8075 r8088  
    5858{
    5959  width: 100%;
     60  position: absolute;
     61  border-collapse: separate;
     62}
     63
     64.columnstable thead
     65{
     66  position: sticky;
     67  top: 0;
    6068}
    6169
     
    6371{
    6472  vertical-align: top;
     73}
     74
     75.columnstable tr.bottomborder th
     76{
     77  border-bottom-width: 1px;
     78}
     79
     80.columnstable tr.topborder th
     81{
     82  border-top-width: 1px;
    6583}
    6684
     
    170188      </td>
    171189    </tr>
     190    <tr>
     191      <th class="subprompt"></th>
     192      <td>
     193        <label><input type="checkbox" id="showAllAnnotationTypes"
     194          name="showAllAnnotationTypes">Show annotations for all subtypes</label>
     195      </td>
     196      <td></td>
     197      <td>
     198        <label title="Normally, child items that was passed when going up to the parent are ignored when going down. Enable this option to include all child items."
     199          ><input type="checkbox" id="allowDoublingBack" name="allowDoublingBack" disabled
     200          >Allow doubling back</label>
     201      </td>
     202    </tr>
    172203    <tr class="dynamic">
    173204      <th></th>
    174       <td></td>
    175       <td></td>
    176       <td></td>
     205      <td colspan="3" class="columnsFrom" style="padding-top: 2px;">
     206        <span id="targetPath"></span><span id="childPath" class="childitem" style="display: none;"></span>
     207      </td>
    177208    </tr>
    178209    </table>
    179210    </div>
    180211   
    181     <div class="absolutefull" style="top: 4em; left: 10em;">
    182       <div class="columnsFrom" style="height: 1.5em; white-space: nowrap; overflow: hidden;">
    183         <span id="targetPath"></span><span id="childPath" class="childitem" style="display: none;"></span>
    184         <label style="font-weight: normal;"><input type="checkbox" id="showAllAnnotationTypes"
    185           name="showAllAnnotationTypes">Show annotations for all subtypes</label>
    186       </div>
     212    <div class="absolutefull" style="top: 6.75em; left: 10em;">   
    187213      <table id="columnstable" class="columnstable" style="width: 100%;">
    188       <thead class="bg-filled-100 topborder bottomborder">
    189         <tr>
     214      <thead class="">
     215        <tr class="bg-filled-100 topborder bottomborder">
    190216          <th style="width: 33%;">Columns</th>
    191217          <th style="width: 33%;">Annotations</th>
  • branches/3.19-stable/www/include/styles/table.css

    r8072 r8088  
    253253}
    254254
    255 /* A column header defining a parent/child item value */
    256 .itemlist div.data th.relateditemcol::before
    257 {
    258   margin-right: 2px;
    259   float: left;
    260 }
    261 
    262255.itemlist div.data th.relateditemcol span.parentitem::before
    263256{
     
    274267}
    275268
    276 
    277 /* This will make room for the '›' without causing the header to wrap */
    278 .itemlist div.data th.relateditemcol > span
    279 {
    280   display: inline-block;
    281   max-width: calc(100% - 16px);
    282   overflow: hidden;
    283 }
     269.itemlist div.data th.relateditemcol span.childitem.doublingback::before
     270{
     271  content: url('../../images/child-item-doubleback.png');
     272}
     273
    284274
    285275/* A column header defining a linked item value */
Note: See TracChangeset for help on using the changeset viewer.