Changeset 3558


Ignore:
Timestamp:
Jul 16, 2007, 9:44:02 AM (14 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #669

Location:
trunk
Files:
10 edited

Legend:

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

    r3556 r3558  
    487487      is typically used to create a root bioassay set from raw data.
    488488    */
    489     INTENSITY_EXPRESSION(1, "Intensity expression", false)
     489    INTENSITY_EXPRESSION(1, "Intensity expression", false, false)
    490490    {
    491491      /**
     
    519519      bioassay set into a child bioassay set.
    520520    */
    521     INTENSITY_TRANSFORMATION(2, "Intensity transformation", false)   
     521    INTENSITY_TRANSFORMATION(2, "Intensity transformation", false, false)   
    522522    {
    523523      /**
     
    561561      The formula can also be used to calculate extra values for a bioassay set.
    562562    */
    563     COLUMN_EXPRESSION(3, "Column expression", true)
     563    COLUMN_EXPRESSION(3, "Column expression", true, true)
    564564    {
    565565      /**
     
    584584      to create a filtered bioassay set.
    585585    */
    586     COLUMN_RESTRICTION(4, "Column restriction", false)
     586    COLUMN_RESTRICTION(4, "Column restriction", false, false)
    587587    {
    588588      /**
     
    631631    private final String displayValue;
    632632    private final boolean canUseColoring;
    633    
    634     private Type(int value, String displayValue, boolean canUseColoring)
     633    private final boolean supportsAverage;
     634   
     635    private Type(int value, String displayValue, boolean canUseColoring, boolean supportsAverage)
    635636    {
    636637      this.value = value;
    637638      this.displayValue = displayValue;
    638639      this.canUseColoring = canUseColoring;
     640      this.supportsAverage = supportsAverage;
    639641    }
    640642   
     
    661663    {
    662664      return canUseColoring;
     665    }
     666   
     667    /**
     668      If a formula of this type can be used in an average expression or not.
     669      This is only possible for formulas which create one value.
     670      @since 2.4
     671    */
     672    public boolean supportsAverage()
     673    {
     674      return supportsAverage;
    663675    }
    664676   
  • trunk/www/admin/extravaluetypes/edit_extravaluetype.jsp

    r2978 r3558  
    3434  import="net.sf.basedb.core.Permission"
    3535  import="net.sf.basedb.core.ExtraValueType"
     36  import="net.sf.basedb.core.Formula"
    3637  import="net.sf.basedb.core.Coloring"
    3738  import="net.sf.basedb.core.PermissionDeniedException"
     
    5556  ExtraValueType extraValueType = null;
    5657  Coloring coloring = null;
     58  Formula.AverageMethod currentAverageMethod = null;
    5759
    5860  if (itemId == 0)
     
    6062    title = "Create extra value type";
    6163    cc.removeObject("item");
     64    currentAverageMethod = Formula.AverageMethod.fromValue(Values.getInt(cc.getPropertyValue("averageMethod"),
     65      Formula.AverageMethod.ARITHMETIC_MEAN.getValue()));
    6266    coloring = new Coloring();
    6367    coloring.setUsingColors(Values.getBoolean(cc.getPropertyValue("coloring.usingColors")));
     
    7074  {
    7175    extraValueType = ExtraValueType.getById(dc, itemId);
     76    currentAverageMethod = extraValueType.getAverageMethod();
    7277    coloring = extraValueType.getColoring();
    7378    cc.setObject("item", extraValueType);
     
    199204
    200205    <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3>
    201     <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*200)+"px;"%>"
     206    <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*240)+"px;"%>"
    202207      position="bottom" remember="<%=extraValueType != null%>">
    203208    <t:tab id="info" title="Extra value type" validate="validateExtraValueType()"
     
    242247          }
    243248          %>
     249        </td>
     250      </tr>
     251      <tr>
     252        <td class="prompt">Avg. method</td>
     253        <td>
     254          <select name="averageMethod" class="required">
     255          <%
     256          for (Formula.AverageMethod method : Formula.AverageMethod.values())
     257          {
     258            String selected = method == currentAverageMethod ? "selected" : "";
     259            %>
     260            <option value="<%=method.name()%>" <%=selected%>><%=HTML.encodeTags(method.toString())%>
     261            <%
     262          }
     263          %>
     264          </select>
    244265        </td>
    245266      </tr>
  • trunk/www/admin/extravaluetypes/index.jsp

    r2978 r3558  
    3232  import="net.sf.basedb.core.Include"
    3333  import="net.sf.basedb.core.ExtraValueType"
     34  import="net.sf.basedb.core.Formula"
    3435  import="net.sf.basedb.core.Coloring"
    3536  import="net.sf.basedb.core.ItemQuery"
     
    143144    extraValueType.setDescription(Values.getStringOrNull(request.getParameter("description")));
    144145    extraValueType.setExternalId(externalId);
     146    extraValueType.setAverageMethod(Formula.AverageMethod.valueOf(request.getParameter("averageMethod")));
    145147    Coloring coloring = extraValueType.getColoring();
    146148    coloring.setUsingColors(Values.getBoolean(request.getParameter("use_colors")));
  • trunk/www/admin/extravaluetypes/list_extravaluetypes.jsp

    r3190 r3558  
    3131  import="net.sf.basedb.core.Item"
    3232  import="net.sf.basedb.core.ExtraValueType"
     33  import="net.sf.basedb.core.Formula"
    3334  import="net.sf.basedb.core.ItemQuery"
    3435  import="net.sf.basedb.core.Include"
     
    5859
    5960  private static final Enumeration<String, String> valueTypes = new Enumeration<String, String>();
     61  private static final Enumeration<String, String> avgMethods = new Enumeration<String, String>();
    6062  static
    6163  {
     
    6365    valueTypes.add(Integer.toString(Type.FLOAT.getValue()), Type.FLOAT.toString());
    6466    valueTypes.add(Integer.toString(Type.STRING.getValue()), Type.STRING.toString());
     67    for (Formula.AverageMethod m : Formula.AverageMethod.values())
     68    {
     69      avgMethods.add(Integer.toString(m.getValue()), HTML.encodeTags(m.toString()));
     70    }
    6571  }
    6672
     
    213219        title="Value type"
    214220        enumeration="<%=valueTypes%>"
     221        sortable="true"
     222        filterable="true"
     223        exportable="true"
     224      />
     225      <tbl:columndef
     226        id="averageMethod"
     227        property="averageMethod"
     228        datatype="int"
     229        enumeration="<%=avgMethods%>"
     230        title="Avg. method"
    215231        sortable="true"
    216232        filterable="true"
     
    414430                <tbl:cell column="externalId"><%=HTML.encodeTags(item.getExternalId())%></tbl:cell>
    415431                <tbl:cell column="valueType"><%=item.getValueType()%></tbl:cell>
     432                <tbl:cell column="averageMethod"><%=item.getAverageMethod().toString()%></tbl:cell>
    416433                <tbl:cell column="useColors"><%=item.getColoring().isUsingColors() ? "yes" : "no"%></tbl:cell>
    417434                <tbl:cell column="logarithmic"><%=item.getColoring().isLogarithmic() ? "yes" : "no"%></tbl:cell>
  • trunk/www/admin/extravaluetypes/view_extravaluetype.jsp

    r2978 r3558  
    182182      </tr>
    183183      <tr>
     184        <td class="prompt">Avg. method</td>
     185        <td><%=extraValueType.getAverageMethod().toString()%></td>
     186      </tr>
     187      <tr>
    184188        <td class="prompt">Use coloring</td>
    185189        <td>
  • trunk/www/include/scripts/main.js

    r3518 r3558  
    366366    this.controllers['TRANSFORMATION'] = { url:'views/experiments/transformations/index.jsp', width:500, height:300 };
    367367    this.controllers['JOB'] = { url:'views/jobs/index.jsp', width:600, height:440, popup:true, edit:false };
    368     this.controllers['FORMULA'] = { url:'views/formulas/index.jsp', width:700, height:460 };
     368    this.controllers['FORMULA'] = { url:'views/formulas/index.jsp', width:740, height:500 };
    369369    this.controllers['HYBRIDIZATION'] = { url:'views/hybridizations/index.jsp', width:800, height:500 };
    370370    this.controllers['RAWBIOASSAY'] = { url:'views/rawbioassays/index.jsp', width:800, height:500 };
     
    421421    this.controllers['USER'] = { url:'admin/users/index.jsp', width:600, height:440 };
    422422    this.controllers['ANYTOANY'] = { url:'common/anytoany/index.jsp', width:500, height:340, popup:true };
    423     this.controllers['EXTRAVALUETYPE'] = { url:'admin/extravaluetypes/index.jsp', width:500, height:340 };
     423    this.controllers['EXTRAVALUETYPE'] = { url:'admin/extravaluetypes/index.jsp', width:500, height:360 };
    424424    this.controllers['EXTRAVALUE'] = { url:'views/experiments/extravalues/index.jsp', width:500, height:340, edit:false };
    425425  }
  • trunk/www/views/formulas/edit_formula.jsp

    r2978 r3558  
    6060  Formula.Type currentType = null;
    6161  Formula.Parser currentParser = null;
     62  Formula.AverageMethod currentAverageMethod = null;
    6263  RawDataType currentRawDataType = null;
    6364  RawDataType defaultRawDataType = null;
     
    8283    currentParser = Formula.Parser.fromValue(Values.getInt(cc.getPropertyValue("parser"),
    8384      Formula.Parser.JEP.getValue()));
     85    currentAverageMethod = Formula.AverageMethod.fromValue(Values.getInt(cc.getPropertyValue("averageMethod"),
     86      Formula.AverageMethod.ARITHMETIC_MEAN.getValue()));
    8487    currentRawDataType = RawDataTypes.getRawDataType(cc.getPropertyValue("rawDataType"));
    8588    if (currentRawDataType == null)
     
    100103    formula = Formula.getById(dc, itemId);
    101104    currentParser = formula.getParser();
     105    currentAverageMethod = formula.getAverageMethod();
    102106    currentType = formula.getFormulaType();
    103107    currentRawDataType = formula.getRawDataType();
     
    301305 
    302306    var useColors = new Array();
     307    var supportsAverage = new Array();
    303308    <%
    304309    for (Formula.Type ft : Formula.Type.values())
     
    306311      %>
    307312      useColors['<%=ft.name()%>'] = <%=ft.canUseColoring()%>;
     313      supportsAverage['<%=ft.name()%>'] = <%=ft.supportsAverage()%>;
    308314      <%
    309315    }
     
    339345      frm.use_colors.disabled = !use;
    340346      useColorsOnClick();
     347      var supportsAvg = supportsAverage[formulaType];
     348      frm.averageMethod.disabled = !supportsAvg;
     349      if (!supportsAvg) frm.averageMethod.selectedIndex = 0;
    341350    }
    342351    </script>
     
    348357
    349358    <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3>
    350     <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*340)+"px;"%>"
     359    <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*380)+"px;"%>"
    351360      position="bottom"  remember="<%=formula != null%>">
    352361    <t:tab id="info" title="Formula" validate="validateFormula()" helpid="formula.edit">
     
    454463        </td>
    455464      </tr>
     465      <tr>
     466        <td class="prompt">Avg. method</td>
     467        <td>
     468          <select name="averageMethod" class="required">
     469          <%
     470          for (Formula.AverageMethod method : Formula.AverageMethod.values())
     471          {
     472            String selected = method == currentAverageMethod ? "selected" : "";
     473            %>
     474            <option value="<%=method.name()%>" <%=selected%>><%=HTML.encodeTags(method.toString())%>
     475            <%
     476          }
     477          %>
     478          </select>
     479        </td>
     480      </tr>
    456481     
    457482      <tr>
  • trunk/www/views/formulas/index.jsp

    r2978 r3558  
    147147    formula.setDescription(Values.getStringOrNull(request.getParameter("description")));
    148148    formula.setParser(Formula.Parser.valueOf(request.getParameter("parser")));
     149    formula.setAverageMethod(Formula.AverageMethod.valueOf(request.getParameter("averageMethod")));
    149150    Formula.Type formulaType = Formula.Type.valueOf(request.getParameter("type"));
    150151    formula.setFormulaType(formulaType);
  • trunk/www/views/formulas/list_formulas.jsp

    r3552 r3558  
    5959  private static final Enumeration<String, String> types = new Enumeration<String, String>();
    6060  private static final Enumeration<String, String> parsers = new Enumeration<String, String>();
     61  private static final Enumeration<String, String> avgMethods = new Enumeration<String, String>();
    6162  private static final Enumeration<String, String> rawEnumeration = new Enumeration<String, String>();
    6263  static
     
    6970    {
    7071      parsers.add(Integer.toString(p.getValue()), HTML.encodeTags(p.toString()));
     72    }
     73    for (Formula.AverageMethod m : Formula.AverageMethod.values())
     74    {
     75      avgMethods.add(Integer.toString(m.getValue()), HTML.encodeTags(m.toString()));
    7176    }
    7277    for (RawDataType rdt : RawDataTypes.getRawDataTypes())
     
    245250        enumeration="<%=parsers%>"
    246251        title="Parser"
     252        sortable="true"
     253        filterable="true"
     254        exportable="true"
     255      />
     256      <tbl:columndef
     257        id="averageMethod"
     258        property="averageMethod"
     259        datatype="int"
     260        enumeration="<%=avgMethods%>"
     261        title="Avg. method"
    247262        sortable="true"
    248263        filterable="true"
     
    511526                <tbl:cell column="type"><%=item.getFormulaType().toString()%></tbl:cell>
    512527                <tbl:cell column="parser"><%=item.getParser().toString()%></tbl:cell>
     528                <tbl:cell column="averageMethod"><%=item.getAverageMethod().toString()%></tbl:cell>
    513529                <tbl:cell column="rawDataType"><%=rawDataType == null ? "<i>- none -</i>" : HTML.encodeTags(rawDataType.getName())%></tbl:cell>
    514530                <tbl:cell column="channels"><%=item.getChannels()%></tbl:cell>
  • trunk/www/views/formulas/view_formula.jsp

    r3547 r3558  
    242242          %>
    243243        </td>
     244      </tr>
     245      <tr>
     246        <td class="prompt">Avg. method</td>
     247        <td><%=formula.getAverageMethod().toString()%></td>
    244248      </tr>
    245249      <tr>
Note: See TracChangeset for help on using the changeset viewer.