Hi everyone,
I have a Tapestry page that needs to generate a list of warnings (see
Listing 1 below). If the warning is of a certain type (e.g. Duplicate),
then I need to dynamically add in one or more DirectLinks to the warning
text. My question is how do I dynamically generate DirectLink in the
java/class file? I looked and searched everywhere but only found some code
that call the getLink() method from the DirectService class. However, I am
not sure how you can set the various parameters for each DirectLink (e.g.
listener, stateful, etc)?
-- PLEASE NOTE THAT I AM USING TAPESTRY 3.0.3. --
Listing 1:
<ul>
<h1>Warnings</h1>
<span jwcid="qualityCheckWarningsLoop">
<li><span jwcid="qualityCheckWarning">Preliminary Scales</span></li>
<span jwcid="$remove$">
<li>No Report</li>
<li>Below Standard</li>
<li>Invalid ID</li>
<li>Wrong Type</li>
<li>Sample</li>
<li>Duplicate: <a>HDS-2345678</a></li>
</span>
</span>
</ul>
Listing 2 - Here is part of the .page file that corresponding the the jwcid
tags above:
<component id="qualityCheckWarningsLoop" type="Foreach">
<binding name="source"
expression="visit.qualityCheckSession.currentScan.qualityCheckWarnings"/>
<binding name="value" expression="qualityCheckWarning"/>
</component>
<component id="qualityCheckWarning" type="Insert">
<binding name="value" expression="qualityCheckWarningText"/>
</component>
Listing 3 - Here is the getter that returns the warning text for the
qualityCheckWarning component:
public String getQualityCheckWarningText() {
Visit visit = (Visit) getVisit();
Scan currentScan = visit.getQualityCheckSession().getCurrentScan();
StringBuffer qualityCheckWarningText = new
StringBuffer(getQualityCheckWarning());
if
(qualityCheckWarningText.toString().equals(DuplicateScalesScanCheck.DUPLICAT
E_SCALE_WARNING_FLAG)) {
qualityCheckWarningText.append(": ");
int index = 0;
for (Scan duplicateScan: currentScan.getDuplicateScaleScans()) {
if (index != 0) {
qualityCheckWarningText.append(", ");
}
// ===================================================
// NEED TO ADD A DIRECT LINK AROUND THE FOLLOWING TEXT
// ===================================================
qualityCheckWarningText.append(duplicateScan.getStoneId());
index++;
}
}
return qualityCheckWarningText.toString();
}
Thanks for any help in advance,
Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]