Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.labkey.flow.data.FlowWell;

import java.io.File;
import java.io.IOException;
import java.util.List;

import static org.labkey.api.util.DOM.Attribute.colspan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.util.SimpleNamedObject;
import org.labkey.api.util.StringExpression;
import org.labkey.api.util.element.Input;
import org.labkey.api.util.element.Input.InputBuilder;
import org.labkey.api.view.GridView;
import org.labkey.api.writer.HtmlWriter;
import org.labkey.flow.analysis.model.ISampleInfo;
Expand Down Expand Up @@ -335,7 +335,7 @@ protected void renderExtraRecordSelectorContent(RenderContext ctx, HtmlWriter ou
{
// Add a hidden input for spring form binding -- if this value is posted, the row was unchecked.
out.write(
new Input.InputBuilder()
new InputBuilder<>()
.type("hidden")
.name(SpringActionController.FIELD_MARKER + getRecordSelectorName(ctx))
.value(0)
Expand Down Expand Up @@ -369,23 +369,23 @@ public MatchedFlagDisplayColumn()
}

@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, Writer oldWriter, HtmlWriter out) throws IOException
{
Boolean match = ctx.get(MATCHED_FLAG_FIELD_KEY, Boolean.class);
if (match != null)
{
out.write("<img src=\"");
out.write(AppProps.getInstance().getContextPath());
oldWriter.write("<img src=\"");
oldWriter.write(AppProps.getInstance().getContextPath());
if (match)
{
out.write("/_images/check.png\" />");
oldWriter.write("/_images/check.png\" />");
String fileName = ctx.get(SAMPLE_NAME_FIELD_KEY, String.class);
PageFlowUtil.popupHelp(HtmlString.of("Matched the previously imported FCS file '" + fileName + "'"), "Matched").appendTo(out);
PageFlowUtil.popupHelp(HtmlString.of("Matched the previously imported FCS file '" + fileName + "'"), "Matched").appendTo(oldWriter);
}
else
{
out.write("/_images/cancel.png\" />");
PageFlowUtil.popupHelp(HtmlString.of("Failed to match a previously imported FCS file. Please manually select a matching FCS file or skip importing this row."), "Not matched").appendTo(out);
oldWriter.write("/_images/cancel.png\" />");
PageFlowUtil.popupHelp(HtmlString.of("Failed to match a previously imported FCS file. Please manually select a matching FCS file or skip importing this row."), "Not matched").appendTo(oldWriter);
}
}
}
Expand Down Expand Up @@ -504,7 +504,7 @@ protected String getSelectInputDisplayValue(NamedObject entry)
}

@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, HtmlWriter out)
{
super.renderGridCellContents(ctx, out);

Expand All @@ -515,7 +515,8 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
String sampleId = ctx.get(SAMPLE_ID_FIELD_KEY, String.class);
for (FlowFCSFile candidate : candidates)
{
out.write("<input type='hidden' name='selectedSamples.rows[" + sampleId + "].candidateFile' value='" + candidate.getRowId() + "'>\n");
out.write(new InputBuilder<>().type("hidden").name("selectedSamples.rows[" + sampleId + "].candidateFile").value(candidate.getRowId()));
out.write("\n");
}
}
}
Expand Down
17 changes: 9 additions & 8 deletions flow/src/org/labkey/flow/query/FlowSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import org.labkey.api.util.StringExpressionFactory;
import org.labkey.api.view.ActionURL;
import org.labkey.api.view.ViewContext;
import org.labkey.api.writer.HtmlWriter;
import org.labkey.flow.analysis.web.FCSAnalyzer;
import org.labkey.flow.analysis.web.StatisticSpec;
import org.labkey.flow.controllers.FlowController;
Expand Down Expand Up @@ -454,7 +455,7 @@ public DisplayColumn createRenderer(ColumnInfo colInfo)
return new DataColumn(colInfo)
{
@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, Writer oldWriter, HtmlWriter out) throws IOException
{
String targetStudyId = (String)getBoundColumn().getValue(ctx);
if (targetStudyId != null && targetStudyId.length() > 0)
Expand All @@ -467,11 +468,11 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
var urlProvider = PageFlowUtil.urlProvider(ProjectUrls.class);
if (study != null && urlProvider != null)
{
out.write("<a href=\"");
out.write(PageFlowUtil.filter(urlProvider.getBeginURL(c)));
out.write("\">");
out.write(study.getLabel().replaceAll(" ", "&nbsp;"));
out.write("</a>");
oldWriter.write("<a href=\"");
oldWriter.write(PageFlowUtil.filter(urlProvider.getBeginURL(c)));
oldWriter.write("\">");
oldWriter.write(study.getLabel().replaceAll(" ", "&nbsp;"));
oldWriter.write("</a>");
}
}
}
Expand Down Expand Up @@ -881,12 +882,12 @@ public String renderURL(RenderContext ctx)
}

@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, Writer oldWriter, HtmlWriter out) throws IOException
{
String url = renderURL(ctx);
if (url != null)
{
out.write(PageFlowUtil.iconLink("fa fa-download", null).href(url).toString());
oldWriter.write(PageFlowUtil.iconLink("fa fa-download", null).href(url).toString());
}
}
};
Expand Down
6 changes: 2 additions & 4 deletions flow/src/org/labkey/flow/view/GraphColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import org.labkey.flow.controllers.well.WellController;
import org.labkey.flow.query.FlowQuerySettings;

import java.io.Writer;

import static org.labkey.api.util.DOM.Attribute.alt;
import static org.labkey.api.util.DOM.Attribute.height;
import static org.labkey.api.util.DOM.Attribute.src;
Expand Down Expand Up @@ -125,9 +123,9 @@ protected FlowQuerySettings.ShowGraphs showGraphs(RenderContext ctx)
}

@Override
public void renderGridCellContents(RenderContext ctx, Writer out)
public void renderGridCellContents(RenderContext ctx, HtmlWriter out)
{
renderGraph(ctx, HtmlWriter.of(out));
renderGraph(ctx, out);
}

public void renderGraph(RenderContext ctx, HtmlWriter out)
Expand Down
11 changes: 6 additions & 5 deletions flow/src/org/labkey/flow/webparts/AnalysisScriptsWebPart.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.labkey.api.view.Portal;
import org.labkey.api.view.SimpleWebPartFactory;
import org.labkey.api.view.ViewContext;
import org.labkey.api.writer.HtmlWriter;
import org.labkey.flow.controllers.editscript.ScriptController;
import org.labkey.flow.controllers.executescript.AnalysisScriptController;
import org.labkey.flow.data.FlowProtocolStep;
Expand Down Expand Up @@ -151,7 +152,7 @@ public FlowScript getScript(RenderContext ctx)
}

@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, Writer oldWriter, HtmlWriter out) throws IOException
{
FlowScript script = getScript(ctx);
if (script != null)
Expand All @@ -161,21 +162,21 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
if (script.hasStep(FlowProtocolStep.calculateCompensation))
{
ActionURL url = script.urlFor(AnalysisScriptController.ChooseRunsToAnalyzeAction.class, FlowProtocolStep.calculateCompensation);
out.write("<a href='" + PageFlowUtil.filter(url) + "'>Compensation</a>");
oldWriter.write("<a href='" + PageFlowUtil.filter(url) + "'>Compensation</a>");
and = "<br>";
}

if (script.hasStep(FlowProtocolStep.analysis))
{
ActionURL url = script.urlFor(AnalysisScriptController.ChooseRunsToAnalyzeAction.class, FlowProtocolStep.analysis);
out.write(and);
out.write("<a href='" + PageFlowUtil.filter(url) + "'>Statistics and Graphs</a>");
oldWriter.write(and);
oldWriter.write("<a href='" + PageFlowUtil.filter(url) + "'>Statistics and Graphs</a>");
}

}
else
{
out.write("&nbsp;");
oldWriter.write("&nbsp;");
}
}
}
Expand Down
47 changes: 34 additions & 13 deletions luminex/src/org/labkey/luminex/LuminexUploadWizardAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import jakarta.servlet.ServletException;
import org.apache.commons.collections4.keyvalue.MultiKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.action.LabKeyError;
import org.labkey.api.action.SpringActionController;
Expand Down Expand Up @@ -53,11 +54,13 @@
import org.labkey.api.study.assay.ParticipantVisitResolverType;
import org.labkey.api.util.HtmlString;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.util.element.Input;
import org.labkey.api.view.HttpView;
import org.labkey.api.view.InsertView;
import org.labkey.api.view.JspView;
import org.labkey.api.view.VBox;
import org.labkey.api.view.ViewServlet;
import org.labkey.api.writer.HtmlWriter;
import org.labkey.luminex.model.Analyte;
import org.labkey.luminex.model.SinglePointControl;
import org.labkey.luminex.model.Titration;
Expand Down Expand Up @@ -85,6 +88,10 @@
import java.util.Set;
import java.util.TreeSet;

import static org.labkey.api.util.DOM.Attribute.style;
import static org.labkey.api.util.DOM.TD;
import static org.labkey.api.util.DOM.at;

/**
* Adds Analyte Properties as third wizard step, handles analyte and titration definition input view UI and post, saves
* last entered default values for analyte domain and standard properties
Expand Down Expand Up @@ -421,21 +428,26 @@ else if (titrationEntry.getValue().isStandard())
view.getDataRegion().addGroup(new DisplayColumnGroup(cols, titrationEntry.getKey(), true)
{
@Override
public void writeSameCheckboxCell(RenderContext ctx, Writer out) throws IOException
public void writeSameCheckboxCell(RenderContext ctx, HtmlWriter out)
{
String titrationCellName = PageFlowUtil.filter(getTitrationColumnCellName(titrationEntry.getValue().getName()));
String groupName = ColumnInfo.propNameFromName(getColumns().get(0).getFormFieldName(ctx));
String id = groupName + "CheckBox";
out.write("<td name='" + titrationCellName + "' style='display:" + (hideCell ? "none" : "table-cell") + "' >");
out.write("<input type=checkbox name='" + id + "' id='" + id + "'>");

TD(
at(style, "display:" + (hideCell ? "none" : "table-cell")).
name(titrationCellName),
new Input.InputBuilder<>().type("checkbox").name(id).id(id)

).appendTo(out);

StringBuilder onchange = new StringBuilder("b = this.checked;");
for (DisplayColumn col : getColumns())
{
onchange.append("document.getElementsByName('").append(col.getFormFieldName(ctx)).append("')[0].style.display = b ? 'none' : 'block';\n");
}
onchange.append("if (b) { ").append(groupName).append("Updated(); }");
HttpView.currentPageConfig().addHandler(id, "change", onchange.toString());
out.write("</td>");
}

@Override
Expand Down Expand Up @@ -548,7 +560,7 @@ private boolean toShowStandardCheckboxColumn(boolean errorReshow, Set<Titration>
return (errorReshow && requestParamValue.equals("true")) || (!errorReshow && standardTitrations.contains(standard));
}

private DisplayColumnFactory createAnalytePropertyDisplayColumnFactory(final String inputName, final String displayName)
private DisplayColumnFactory createAnalytePropertyDisplayColumnFactory(final String inputName, final @NotNull String displayName)
{
return colInfo -> new DataColumn(colInfo)
{
Expand All @@ -559,21 +571,30 @@ public String getFormFieldName(RenderContext ctx)
}

@Override
public void renderTitle(RenderContext ctx, Writer out) throws IOException
public HtmlString getTitle(RenderContext ctx)
{
out.write(displayName);
return HtmlString.of(displayName);
}

@Override
public void renderDetailsCaptionCell(RenderContext ctx, Writer out, @Nullable String cls) throws IOException
public void renderDetailsCaptionCell(RenderContext ctx, HtmlWriter out, @Nullable String cls)
{
out.write("<td class=\"control-header-label\">");
Writer oldWriter = out.unwrap();

renderTitle(ctx, out);
String sb = "Type: " + getBoundColumn().getFriendlyTypeName() + "\n";
PageFlowUtil.popupHelp(HtmlString.of(sb), displayName).appendTo(out);
try
{
oldWriter.write("<td class=\"control-header-label\">");

out.write("</td>");
oldWriter.write(getTitle(ctx).toString());
String sb = "Type: " + getBoundColumn().getFriendlyTypeName() + "\n";
PageFlowUtil.popupHelp(HtmlString.of(sb), displayName).appendTo(oldWriter);

oldWriter.write("</td>");
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
};
}
Expand Down
Loading