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
11 changes: 6 additions & 5 deletions hdrl/src/org/labkey/hdrl/query/HDRLQuerySchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.view.ActionURL;
import org.labkey.api.view.ViewContext;
import org.labkey.api.writer.HtmlWriter;
import org.labkey.hdrl.HDRLController;
import org.labkey.hdrl.HDRLManager;
import org.labkey.hdrl.HDRLModule;
Expand Down Expand Up @@ -198,7 +199,7 @@ protected void addDetailsAndUpdateColumns(List<DisplayColumn> ret, TableInfo tab
SimpleDisplayColumn actionColumn = new SimpleDisplayColumn()
{
@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, Writer oldWriter, HtmlWriter out) throws IOException
{
Container c = ContainerManager.getForId(ctx.get(FieldKey.fromParts("container")).toString());

Expand All @@ -215,13 +216,13 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
{
FieldKey requestFieldKey = FieldKey.fromParts("RequestId");
ActionURL actionUrl = new ActionURL(HDRLController.EditRequestAction.class, c).addParameter("requestId", (Integer)ctx.get(requestFieldKey));
out.write(PageFlowUtil.link("Edit").href(actionUrl).toString());
oldWriter.write(PageFlowUtil.link("Edit").href(actionUrl).toString());
}
else
{
ActionURL actionUrl = new ActionURL(HDRLController.RequestDetailsAction.class, c);
actionUrl.addParameter("requestId", (Integer) ctx.get("requestId"));
out.write(PageFlowUtil.link("View").href(actionUrl).toString());
oldWriter.write(PageFlowUtil.link("View").href(actionUrl).toString());
}
}
};
Expand All @@ -248,13 +249,13 @@ protected void addDetailsAndUpdateColumns(List<DisplayColumn> ret, TableInfo tab
SimpleDisplayColumn downloadColumn = new SimpleDisplayColumn()
{
@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, Writer oldWriter, HtmlWriter out) throws IOException
{
Integer specimenId = (Integer) ctx.get(FieldKey.fromParts("RowId"));
if (HDRLManager.get().hasClinicalReport(specimenId, getUser(), getContainer()))
{
// download button displayed
out.write(PageFlowUtil.button("Download").href(new ActionURL(HDRLController.DownloadClinicalReportAction.class, getContainer()).addParameter("specimenId", specimenId)).toString());
oldWriter.write(PageFlowUtil.button("Download").href(new ActionURL(HDRLController.DownloadClinicalReportAction.class, getContainer()).addParameter("specimenId", specimenId)).toString());
}
}
};
Expand Down
46 changes: 23 additions & 23 deletions pepdb/src/org/scharp/atlas/pepdb/PepDBBaseController.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.labkey.api.util.HtmlStringBuilder;
import org.labkey.api.util.Link;
import org.labkey.api.view.ActionURL;
import org.labkey.api.writer.HtmlWriter;
import org.scharp.atlas.pepdb.model.PeptideGroup;
import org.scharp.atlas.pepdb.model.PeptidePool;
import org.scharp.atlas.pepdb.model.Peptides;
Expand Down Expand Up @@ -440,7 +441,7 @@ public DCpeptideId(ColumnInfo col)
}

@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, HtmlWriter out)
{
ColumnInfo c = getColumnInfo();
Map rowMap = ctx.getRow();
Expand All @@ -452,17 +453,16 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
try
{
new Link.LinkBuilder("P" + peptideId).clearClasses()
.target("_self")
.href(new ActionURL(PepDBController.DisplayPeptideAction.class, getContainer())
.addParameter(PepDBSchema.COLUMN_PEPTIDE_ID, peptideId))
.build()
.appendTo(out);
.target("_self")
.href(new ActionURL(PepDBController.DisplayPeptideAction.class, getContainer())
.addParameter(PepDBSchema.COLUMN_PEPTIDE_ID, peptideId))
.build()
.appendTo(out);
}
catch (Exception e)
{
e.printStackTrace();
}

}
}

Expand Down Expand Up @@ -497,13 +497,13 @@ public Object getDisplayValue(RenderContext ctx)
}

@Override
public Class getValueClass()
public Class<Integer> getValueClass()
{
return Integer.class;
}

@Override
public Class getDisplayValueClass()
public Class<String> getDisplayValueClass()
{
return String.class;
}
Expand All @@ -517,7 +517,7 @@ public DCpeptidePoolId(ColumnInfo col)
}

@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, HtmlWriter out)
{
ColumnInfo c = getColumnInfo();
Map rowMap = ctx.getRow();
Expand All @@ -529,11 +529,11 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
try
{
new Link.LinkBuilder("PP" + peptidePoolId).clearClasses()
.target("_self")
.href(new ActionURL(PepDBController.DisplayPeptidePoolInformationAction.class, getContainer())
.addParameter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, peptidePoolId))
.build()
.appendTo(out);
.target("_self")
.href(new ActionURL(PepDBController.DisplayPeptidePoolInformationAction.class, getContainer())
.addParameter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, peptidePoolId))
.build()
.appendTo(out);
}
catch (Exception e)
{
Expand Down Expand Up @@ -593,7 +593,7 @@ public DCparentPoolId(ColumnInfo col)
}

@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, HtmlWriter out)
{
ColumnInfo c = getColumnInfo();
Map rowMap = ctx.getRow();
Expand All @@ -607,11 +607,11 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
if(parentPoolId != null)
{
new Link.LinkBuilder("PP" + parentPoolId).clearClasses()
.target("_self")
.href(new ActionURL(PepDBController.DisplayPeptidePoolInformationAction.class, getContainer())
.addParameter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, parentPoolId))
.build()
.appendTo(out);
.target("_self")
.href(new ActionURL(PepDBController.DisplayPeptidePoolInformationAction.class, getContainer())
.addParameter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, parentPoolId))
.build()
.appendTo(out);
}
}
catch (Exception e)
Expand All @@ -634,9 +634,9 @@ public Object getDisplayValue(RenderContext ctx)
try
{
if (parentPoolId != null)
return ("PP" + parentPoolId);
return ("PP" + parentPoolId);
else
return null;
return null;
}
catch (Exception e)
{
Expand Down
10 changes: 5 additions & 5 deletions pepdb/test/src/org/labkey/test/tests/pepdb/PepDBModuleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,21 @@ public void testSteps() throws Exception
// Select a newly uploaded peptide, #3 and edit it to have a storage location of 'Kitchen Sink'
clickAndWait(Locator.linkWithText(pepString(4)));
// Verify the expected record's content
assertTrue(getDriver().findElement(Locator.xpath("//form[@lk-region-form='peptides']/table/tbody")).getText().matches("^[\\s\\S]*Peptide Id:\\s*" + pepString(4) + "\nPeptide Sequence:\\s*REPRGSDIAGTTSTL\nProtein Category:\\s*p24\nSequence Length:\\s*15\nAAStart:\\s*97\nAAEnd:\\s*111\nIs Child:\\s*false\nIs Parent:\\s*false[\\s\\S]*$"));
assertTrue(getDriver().findElement(Locator.xpath("//form[@data-region-form='peptides']/table/tbody")).getText().matches("^[\\s\\S]*Peptide Id:\\s*" + pepString(4) + "\nPeptide Sequence:\\s*REPRGSDIAGTTSTL\nProtein Category:\\s*p24\nSequence Length:\\s*15\nAAStart:\\s*97\nAAEnd:\\s*111\nIs Child:\\s*false\nIs Parent:\\s*false[\\s\\S]*$"));

clickAndWait(Locator.linkWithText("Edit Peptide"));
setFormElement(Locator.name("storage_location"), "Kitchen Sink");
clickAndWait(Locator.xpath("//span[text()='Save Changes']"));

// Assert that the Storage Location now contains "Kitchen Sink"
assertTrue(getDriver().findElement(Locator.xpath("//form[@lk-region-form='peptides']/table/tbody")).getText().matches("^[\\s\\S]*Peptide Id:\\s*" + pepString(4) + "\nPeptide Sequence:\\s*REPRGSDIAGTTSTL\nProtein Category:\\s*p24\nSequence Length:\\s*15\nAAStart:\\s*97\nAAEnd:\\s*111\nIs Child:\\s*false\nIs Parent:\\s*false[\\s\\S]*$"));
assertTrue(getDriver().findElement(Locator.xpath("//form[@data-region-form='peptides']/table/tbody")).getText().matches("^[\\s\\S]*Peptide Id:\\s*" + pepString(4) + "\nPeptide Sequence:\\s*REPRGSDIAGTTSTL\nProtein Category:\\s*p24\nSequence Length:\\s*15\nAAStart:\\s*97\nAAEnd:\\s*111\nIs Child:\\s*false\nIs Parent:\\s*false[\\s\\S]*$"));
clickAndWait(Locator.css("a.labkey-button > span"));

// Search for a single, newly-uploaded peptide and verify it displays as expected.
setFormElement(Locator.name("peptide_id"), Integer.toString(peptideStartIndex + 9));
clickButton("Find");
// Verify the expected record's content
assertTrue(getDriver().findElement(Locator.tagWithAttribute("form", "lk-region-form", "peptides")).getText()
assertTrue(getDriver().findElement(Locator.tagWithAttribute("form", "data-region-form", "peptides")).getText()
.matches("^[\\s\\S]*Peptide Id:\\s*" + pepString(9) + "\nPeptide Sequence:\\s*KCGKEGHQMKDCTER\nProtein Category:\\s*p2p7p1p6\nSequence Length:\\s*15\nAAStart:\\s*52\nAAEnd:\\s*66\nIs Child:\\s*false\nIs Parent:\\s*false\nStorage Location:\\s*\n[\\s\\S]*$"));

clickAndWait(Locator.css("a.labkey-button > span"));
Expand All @@ -199,8 +199,8 @@ public void testSteps() throws Exception
clickAndWait(Locator.name("action_type"));
clickAndWait(Locator.linkWithText(pepString(4)));

checker().verifyEquals("", "Peptide Sequence:", getDriver().findElement(Locator.xpath("//form[@lk-region-form='peptides']/table/tbody/tr[2]/td")).getText());
checker().verifyEquals("", "REPRGSDIAGTTSTL", getDriver().findElement(Locator.xpath("//form[@lk-region-form='peptides']/table/tbody/tr[2]/td[2]")).getText());
checker().verifyEquals("", "Peptide Sequence:", getDriver().findElement(Locator.xpath("//form[@data-region-form='peptides']/table/tbody/tr[2]/td")).getText());
checker().verifyEquals("", "REPRGSDIAGTTSTL", getDriver().findElement(Locator.xpath("//form[@data-region-form='peptides']/table/tbody/tr[2]/td[2]")).getText());
checker().verifyEquals("", "gagptegprac (PEPTIDE NUMBER =GAG1-4)", getDriver().findElement(Locator.css(".lk-body-ct div:nth-of-type(2) > table > tbody > tr > td")).getText());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.labkey.api.study.Study;
import org.labkey.api.study.StudyService;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.writer.HtmlWriter;

import java.io.IOException;
import java.io.Writer;
Expand Down Expand Up @@ -81,35 +82,35 @@ private List<? extends Dataset> getDatasets(RenderContext ctx)
}

@Override
public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException
public void renderGridCellContents(RenderContext ctx, Writer oldWriter, HtmlWriter out) throws IOException
{
// Show an icon for the dataset status (if set) and the dataset name, one per row, in a table
out.write("<table>");
oldWriter.write("<table>");
for (Dataset dataset : getDatasets(ctx))
{
Object status = ReportPropsManager.get().getPropertyValue(dataset.getEntityId(), dataset.getContainer(), DataViewProvider.EditInfo.Property.status.toString());
out.write("<tr><td style=\"width: 16px; border-style: none\">");
oldWriter.write("<tr><td style=\"width: 16px; border-style: none\">");
if (status == null || "None".equalsIgnoreCase(status.toString()))
{
out.write("&nbsp;");
oldWriter.write("&nbsp;");
}
else
{
String iconPath = ICON_PATHS.get(status.toString());
if (iconPath != null)
{
out.write("<img src=\"" + PageFlowUtil.filter(iconPath) + "\" height=\"16px\" width=\"16px\" />");
oldWriter.write("<img src=\"" + PageFlowUtil.filter(iconPath) + "\" height=\"16px\" width=\"16px\" />");
}
else
{
out.write(PageFlowUtil.filter(status));
oldWriter.write(PageFlowUtil.filter(status));
}
}
out.write("</td><td style=\"border-style: none\">");
out.write(PageFlowUtil.filter(dataset.getLabel()));
out.write("</td></tr>\n");
oldWriter.write("</td><td style=\"border-style: none\">");
oldWriter.write(PageFlowUtil.filter(dataset.getLabel()));
oldWriter.write("</td></tr>\n");
}
out.write("</table>");
oldWriter.write("</table>");
}

@Override
Expand Down