Changeset 2484


Ignore:
Timestamp:
Aug 3, 2006, 8:41:17 AM (17 years ago)
Author:
Martin Svensson
Message:

Refrences #173 A hardware can now be attach to a Hybridization in the GUI.

Location:
trunk
Files:
7 edited

Legend:

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

    r2474 r2484  
    6262  */
    6363  public static final String PRINT_ROBOT = "net.sf.basedb.core.HardwareType.PRINT_ROBOT";
     64 
     65  /**
     66    The id for the <code>HardwareType</code> object representing a
     67    hybridization station.
     68  */
     69  public static final String HYBRIDIZATION_STATION = "net.sf.basedb.core.HarwareType.HYBRIDIZATION_STATION";
     70 
     71  /**
     72    Create a new <code>HardwareType</code> item.
     73 
     74    @param dc The <code>DbControl</code> which will be used for
     75      permission checking and database access
     76    @return The new <code>HardwareType</code> item
     77    @throws BaseException If there is an error
     78  */
     79  public static HardwareType getNew(DbControl dc)
     80    throws BaseException
     81  {
     82    HardwareType hwt = dc.newItem(HardwareType.class);
     83    hwt.setName("New hardware type");
     84    return hwt;
     85  }
    6486 
    6587  /**
  • trunk/src/core/net/sf/basedb/core/Install.java

    r2480 r2484  
    382382      HardwareTypeData scanner = createHardwareType(HardwareType.SCANNER, "Scanner", "Scans the microarray images.");
    383383      HardwareTypeData robot = createHardwareType(HardwareType.PRINT_ROBOT, "Print robot", "Spot the probe on the array.");
    384      
     384      HardwareTypeData hybStation = createHardwareType(HardwareType.HYBRIDIZATION_STATION, "Hybridization station", "Automate the hybridization of microarrays on slides.");
    385385
    386386      // Hardware
  • trunk/src/core/net/sf/basedb/core/Item.java

    r2382 r2484  
    160160    The item is a {@link HardwareType}.
    161161  */
    162   HARDWARETYPE(122, "Hardware type", "htp", HardwareType.class, HardwareTypeData.class, DefinedPermissions.write),
     162  HARDWARETYPE(122, "Hardware type", "htp", HardwareType.class, HardwareTypeData.class, DefinedPermissions.basic),
    163163  /**
    164164    The item is a {@link Software}.
  • trunk/www/views/hybridizations/edit_hybridization.jsp

    r2465 r2484  
    3434  import="net.sf.basedb.core.Permission"
    3535  import="net.sf.basedb.core.Include"
     36  import="net.sf.basedb.core.Hardware"
     37  import="net.sf.basedb.core.HardwareType"
    3638  import="net.sf.basedb.core.Hybridization"
    3739  import="net.sf.basedb.core.BioMaterialEvent"
     
    7880  boolean readCurrentProtocol = true;
    7981  Protocol currentProtocol = null;
     82 
     83  boolean readCurrentHybStation = true;
     84  Hardware currentHybStation = null;
    8085
    8186  if (itemId == 0)
     
    8691    {
    8792      currentProtocol = Base.getFirstMatching(dc, Protocol.getQuery(), "name", cc.getPropertyFilter("creationEvent.protocol.name"));
     93    }
     94    if (cc.getPropertyFilter("creationEvent.hardware.name") != null)
     95    {
     96      currentHybStation = Base.getFirstMatching(dc, Hardware.getQuery(), "name", cc.getPropertyFilter("creationEvent.hardware.name"));
    8897    }
    8998    if (cc.getPropertyFilter("arraySlide.name") != null)
     
    124133    {
    125134      readCurrentProtocol = false;
     135    }
     136    try
     137    {
     138      currentHybStation = creationEvent.getHardware();
     139    }
     140    catch (PermissionDeniedException ex)
     141    {
     142      readCurrentHybStation = false;
    126143    }
    127144   
     
    217234      frm.protocol_id[1].text = name;
    218235      frm.protocol_id.selectedIndex = 1;
     236    }
     237   
     238   
     239   
     240    function selectHybStationOnClick()
     241    {
     242      var frm = document.forms['hybridization'];
     243      var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setHybStationCallback';
     244      if (frm.hardware_id.length > 1)
     245      {
     246        var id = Math.abs(parseInt(frm.hardware_id[1].value));       
     247        url += '&item_id='+id;
     248      }
     249      url += '&filter:INT:hardwareType=<%=SystemItems.getId(HardwareType.HYBRIDIZATION_STATION)%>';
     250      Main.openPopup(url, 'SelectHybStation', 1000, 700);
     251    }
     252    function setHybStationCallback(hybStationId, name)
     253    {
     254      var frm = document.forms['hybridization'];
     255      if (frm.hardware_id.length < 2) // >
     256      {
     257        frm.hardware_id[frm.hardware_id.length] = new Option();
     258      }
     259      frm.hardware_id[1].value = hybStationId;
     260      frm.hardware_id[1].text = name;
     261      frm.hardware_id.selectedIndex = 1;
    219262    }
    220263   
     
    414457      </tr>
    415458      <tr>
     459        <td class="prompt">Hardware</td>
     460        <td>
     461          <table border="0" cellspacing="0" cellpadding="0">
     462          <tr>
     463          <td>
     464            <select name="hardware_id" size="1"
     465              <%=!readCurrentHybStation ? "disabled readonly class=\"disabled\"" : ""%>
     466              style="width: 20em;">
     467            <%
     468            if (!readCurrentHybStation)
     469            {
     470              %>
     471              <option value="-1">- denied -
     472              <%
     473            }
     474            else
     475            {
     476              %>
     477              <option value="0">- none -
     478              <%
     479              if (currentHybStation != null)
     480              {
     481                %>
     482                <option value="<%=hyb == null ? currentHybStation.getId() : -currentHybStation.getId()%>"
     483                  selected><%=HTML.encodeTags(currentHybStation.getName())%>
     484                <%
     485              }
     486            }
     487            %>
     488            </select>
     489            &nbsp;
     490          </td>
     491          <td><base:button onclick="selectHybStationOnClick()"
     492            title="Select&hellip;" disabled="<%=!readCurrentHybStation%>" /></td>
     493          </tr>
     494          </table>
     495        </td>
     496      </tr>
     497      <tr>
    416498        <td class="prompt">Array slide</td>
    417499        <td>
  • trunk/www/views/hybridizations/index.jsp

    r2465 r2484  
    3535  import="net.sf.basedb.core.LabeledExtract"
    3636  import="net.sf.basedb.core.Protocol"
     37  import="net.sf.basedb.core.Hardware"
    3738  import="net.sf.basedb.core.ItemQuery"
    3839  import="net.sf.basedb.core.ItemResultIterator"
     
    163164    }
    164165   
     166    //Hybridization station
     167    int hybStationId = Values.getInt(request.getParameter("hardware_id"), -1);
     168    if (hybStationId >= 0) // < 0 denied or unchanged
     169    {
     170      Hardware hw = hybStationId == 0 ? null : Hardware.getById(dc, hybStationId);
     171      creationEvent.setHardware(hw);
     172    }
     173   
    165174    // Labeled extracts
    166175    String[] modifiedLabeledExtracts = Values.getString(request.getParameter("modifiedLabeledExtracts")).split(",");
  • trunk/www/views/hybridizations/list_hybridizations.jsp

    r2437 r2484  
    256256        exportable="true"
    257257        show="<%=mode.isCompact() ? "never" : "auto"%>"
     258      />
     259      <tbl:columndef
     260        id="hybStation"
     261        property="creationEvent.hardware"
     262        datatype="string"
     263        title="Hardware"
     264        sortable="true"
     265        filterable="true"
     266        exportable="true"
     267        show="<%=mode.isCompact() ? "never" : "auto"%>"       
    258268      />
    259269      <tbl:columndef
     
    569579                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
    570580                  /></tbl:cell>
     581                <tbl:cell column="hybStation"
     582                  ><base:propertyvalue
     583                    item="<%=creationEvent%>"
     584                    property="hardware"
     585                    enableEditLink="<%=mode.hasEditLink()%>"
     586                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
     587                  /></tbl:cell>
    571588                <tbl:cell column="eventDate"><%=Values.formatDate(creationEvent.getEventDate())%></tbl:cell>
    572589                <tbl:cell column="entryDate"><%=Values.formatDate(creationEvent.getEntryDate())%></tbl:cell>
  • trunk/www/views/hybridizations/view_hybridization.jsp

    r2478 r2484  
    235235      </tr>
    236236      <tr>
     237        <td class="prompt">Hardware</td>
     238        <td><base:propertyvalue item="<%=creationEvent%>" property="hardware" /></td>
     239      </tr>
     240      <tr>
    237241        <td class="prompt">Owner</td>
    238242        <td><base:propertyvalue item="<%=hyb%>" property="owner" /></td>
Note: See TracChangeset for help on using the changeset viewer.