Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.1
-
Fix Version/s: None
-
Component/s: Export
-
Labels:None
-
Application server:Websphere Application Server 6.0.2
Description
Whe generating export link in HTMLTableWriter (method writeExportLinks) I would setting a new parameter target for link generated.
Actually is not possible set it (for example _blank).
Actually is not possible set it (for example _blank).
Maybe someone who has set up the CVS project is willing to create a patch.
After the change it is possible to specify the export target by adding the following tag inside the table tag:
<display:setProperty name="export.target" value="_blank" />
Here is what I did:
class org.displaytag.properties.TableProperties
added:
/**
* Property <code>export.target.value</code>. Name of the target frame used in exportLinks
*/
public static final String PROPERTY_STRING_EXPORT_TARGET_VALUE = "export.target";
/**
*
* @return the target frame used for construction the exportLinks
*/
public String getExportTargetValue()
{
String result = getProperty(PROPERTY_STRING_EXPORT_TARGET_VALUE);
return result;
}
********************************************************
class org.displaytag.util.Anchor
added:
private String target;
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
/**
* Creates a new Anchor whith the supplied Href and body text.
* @param linkHref baseHref
* @param linkBody String link body
* @param target target frame for the link
*/
public Anchor(Href linkHref, String linkBody, String target)
{
this.href = linkHref;
this.linkText = linkBody;
this.target = target;
}
private String getTargetString()
{
if (this.target == null)
{
return TagConstants.EMPTY_STRING;
}
return " target=\"" + this.target.toString() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
}
changed
line 116
return TagConstants.TAG_OPEN + TagConstants.TAGNAME_ANCHOR + getHrefString() + TagConstants.TAG_CLOSE;
to
return TagConstants.TAG_OPEN + TagConstants.TAGNAME_ANCHOR + getHrefString() + getTargetString() + TagConstants.TAG_CLOSE;
********************************************************
org.displaytag.render.HtmlTableWriter
Method writeExportLinks()
added in line 580
if(this.properties.getExportTargetValue()!=null){
anchor.setTarget(this.properties.getExportTargetValue());
}