Changeset 4878


Ignore:
Timestamp:
Apr 3, 2009, 9:05:08 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #1271: Add extension points to all toolbars

Added extension point for annotatable items. Added code for displaying extensions to raw bioassay and raw data.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/toolbar/ToolbarUtil.java

    r4872 r4878  
    2525import net.sf.basedb.clients.web.extensions.ExtensionsControl;
    2626import net.sf.basedb.clients.web.extensions.JspContext;
     27import net.sf.basedb.core.Annotatable;
    2728import net.sf.basedb.core.Item;
    2829import net.sf.basedb.core.Ownable;
    2930import net.sf.basedb.core.Removable;
    3031import net.sf.basedb.core.Shareable;
     32import net.sf.basedb.core.data.AnnotatableData;
    3133import net.sf.basedb.core.data.OwnableData;
    3234import net.sf.basedb.core.data.RemovableData;
     
    5557    {
    5658      Item.EXPERIMENT, Item.BIOASSAYSET, Item.BIOASSAY,
    57       Item.TRANSFORMATION, Item.EXTRAVALUE, Item.SPOTDATA
     59      Item.TRANSFORMATION, Item.EXTRAVALUE, Item.SPOTDATA,
     60      Item.RAWBIOASSAY, Item.RAWDATA
    5861    };
    5962
     
    100103  public static String[] EP_REMOVABLE =
    101104    {EP_PREFIX[LIST] + "removeable", EP_PREFIX[ITEM] + "removeable"};
    102  
     105
     106  /**
     107    ID:s for the toolbar extension point that appear on all pages
     108    that displays {@link Annotatable} items.
     109    EP_ANNOTATABLE[0] = list pages; EP_ANNOTATABLE[1] = single-item pages
     110  */
     111  public static String[] EP_ANNOTATABLE =
     112    {EP_PREFIX[LIST] + "annotatable", EP_PREFIX[ITEM] + "annotatable"};
     113
    103114  /**
    104115    Use toolbar extensions for a given gui context. This method
     
    111122  public static ExtensionsInvoker useExtensions(JspContext jspContext)
    112123  {
    113     String[] ep = new String[5]; // 5 is the maximum number of extension points
     124    String[] ep = new String[6]; // 6 is the maximum number of extension points
    114125    int index = 0;
    115126    GuiContext guiContext = jspContext.getGuiContext();
     
    132143        ep[index++] = EP_REMOVABLE[type];
    133144      }
     145      if (AnnotatableData.class.isAssignableFrom(dataClass))
     146      {
     147        ep[index++] = EP_ANNOTATABLE[type];
     148      }
    134149    }
    135150    ep[index++] = EP_PREFIX[type] + itemType.name().toLowerCase();
     
    148163    register(registry, EP_REMOVABLE[LIST], "Toolbar: list pages for items that can be put in the trashcan");
    149164    register(registry, EP_REMOVABLE[ITEM], "Toolbar: single-item pages for items that can be put in the trashcan");
     165    register(registry, EP_ANNOTATABLE[LIST], "Toolbar: list pages for annotatable items");
     166    register(registry, EP_ANNOTATABLE[ITEM], "Toolbar: single-item pages for annotatable items");
    150167   
    151168    for (Item item : TOOLBAR_ITEMS)
  • trunk/www/views/rawbioassays/list_rawbioassays.jsp

    r4711 r4878  
    6666  import="net.sf.basedb.clients.web.PermissionUtil"
    6767  import="net.sf.basedb.clients.web.util.HTML"
    68   import="net.sf.basedb.clients.web.formatter.FormatterFactory"
    6968  import="net.sf.basedb.util.Values"
    7069  import="net.sf.basedb.util.formatter.Formatter"
    7170  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
     71  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
     72  import="net.sf.basedb.clients.web.extensions.JspContext"
     73  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
     74  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
     75  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
    7276  import="java.util.Iterator"
    7377  import="java.util.List"
     
    7781<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    7882<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
     83<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
    7984<%!
    8085  private static final Item itemType = Item.RAWBIOASSAY;
     
    133138  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
    134139  int numListed = 0;
     140  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null);
     141  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
    135142  %>
    136143  <base:page title="<%=title==null ? "Raw bioassays" : title%>" type="<%=mode.getPageType()%>">
    137144  <base:head scripts="menu.js,table.js" styles="menu.css,table.css">
     145    <ext:scripts context="<%=jspContext%>" />
     146    <ext:stylesheets context="<%=jspContext%>" />
    138147    <script language="JavaScript">
    139148    var submitPage = 'index.jsp';
     
    570579          visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
    571580        />
     581        <ext:render extensions="<%=invoker%>" context="<%=jspContext%>"
     582          wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
    572583      </tbl:toolbar>
    573584      <tbl:navigator
  • trunk/www/views/rawbioassays/rawdata/list_rawdata.jsp

    r4866 r4878  
    6565  import="net.sf.basedb.util.formatter.WellCoordinateFormatter"
    6666  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
     67  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
     68  import="net.sf.basedb.clients.web.extensions.JspContext"
     69  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
     70  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
     71  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
    6772  import="java.util.List"
    6873  import="java.util.Map"
     
    7378<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
    7479<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
     80<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
    7581<%!
    7682  private static final Item itemType = Item.RAWDATA;
     
    133139  final boolean writeReporterPermission = sc.hasPermission(Permission.WRITE, Item.REPORTER);
    134140  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
     141  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, rawBioAssay);
     142  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
    135143  %>
    136144  <base:page title="<%=title%>">
    137145  <base:head scripts="table.js,tabcontrol.js" styles="table.css,headertabcontrol.css,path.css">
     146    <ext:scripts context="<%=jspContext%>" />
     147    <ext:stylesheets context="<%=jspContext%>" />
    138148    <script language="JavaScript">
    139149    var submitPage = 'index.jsp';
     
    621631          visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
    622632        />
     633        <ext:render extensions="<%=invoker%>" context="<%=jspContext%>"
     634          wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
    623635      </tbl:toolbar>
    624636      <tbl:navigator
  • trunk/www/views/rawbioassays/view_rawbioassay.jsp

    r4746 r4878  
    6565  import="net.sf.basedb.clients.web.PermissionUtil"
    6666  import="net.sf.basedb.clients.web.util.HTML"
    67   import="net.sf.basedb.clients.web.formatter.FormatterFactory"
    6867  import="net.sf.basedb.util.Values"
    6968  import="net.sf.basedb.util.formatter.Formatter"
    7069  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
     70  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
     71  import="net.sf.basedb.clients.web.extensions.JspContext"
     72  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
     73  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
     74  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
    7175  import="java.util.Collections"
    7276  import="java.util.Date"
     
    8084<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
    8185<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
     86<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
    8287<%!
    8388  private static final Item itemType = Item.RAWBIOASSAY;
     
    127132  final boolean deletePermanentlyPermission = deletePermission && !isUsed;
    128133  final boolean isOwner = rawBioAssay.isOwner();
     134  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, rawBioAssay);
     135  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
    129136  %>
    130 
    131137  <base:page title="<%=title%>">
    132138  <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
     139    <ext:scripts context="<%=jspContext%>" />
     140    <ext:stylesheets context="<%=jspContext%>" />
    133141    <script language="JavaScript">
    134142    function editItem()
     
    270278        visible="<%=writePermission && (rawBioAssay.getSpots() > 0) && rawDataType != null && rawDataType.isStoredInDb()%>"
    271279      />
     280      <ext:render extensions="<%=invoker%>" context="<%=jspContext%>"
     281        wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
    272282      <tbl:button
    273283        image="help.gif"
Note: See TracChangeset for help on using the changeset viewer.