Changeset 5604


Ignore:
Timestamp:
Apr 11, 2011, 2:07:57 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1602: The <base:select> taglib should display complete path for directories

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.17-stable/src/clients/web/net/sf/basedb/clients/web/taglib/Select.java

    r5384 r5604  
    3030import net.sf.basedb.clients.web.util.HTML;
    3131import net.sf.basedb.core.BasicItem;
     32import net.sf.basedb.core.Directory;
    3233import net.sf.basedb.core.Nameable;
    3334import net.sf.basedb.core.Removable;
     
    307308  */
    308309  private String unselectedText = "- none -";
     310 
     311  private boolean tryGetDirectoryPath;
     312 
    309313  /*
    310314    Taglib initialization methods
     
    452456//    Page page = (Page)findAncestorWithClass(this, Page.class);
    453457
     458    tryGetDirectoryPath = true;
    454459   
    455460    StringBuilder sb = new StringBuilder();
     
    558563    if (item instanceof Nameable)
    559564    {
    560       name = ((Nameable)item).getName();
     565      if (tryGetDirectoryPath && item instanceof Directory)
     566      {
     567        try
     568        {
     569          name = ((Directory)item).getPath().toString();
     570        }
     571        catch (Exception ex)
     572        {
     573          tryGetDirectoryPath = false;
     574        }
     575      }
     576      if (name == null) name = ((Nameable)item).getName();
    561577    }
    562578    else
Note: See TracChangeset for help on using the changeset viewer.