It is not quite clear from your code what the difference between currentLinkId en activeId is and where currentId comes from. I'm almost assuming you have some sort of Loop setup you are not sharing here. But given you can obtain these variables from the enclosing component, you are pretty much there in your commented out code, you just need to remove the argument from your getMyDynCss()
method. Like so:
Java:
public class TestLink {
@Property
@Parameter(required=true)
private int activeId;
@Property
@Parameter(required=true)
private int currentId;
public String getMyDynCss() {
if (currentId == activeId) {
return "active";
}
else {
return "xxx";
}
}
}
Your tml:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<t:pagelink page="mytest" t:id="myLink" class="${myDynCss}">
</html>
Your enclosing component:
<html t:type="layout" title="Test" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter">
<p:app_navigation>
<t:testLink activeId="1000" currentId="somePropertyFromSomewhere"/>
</p:app_navigation>
</html>