Birt报告,带动作的动态标签

时间:2014-05-20 12:59:56

标签: eclipse label report action birt

我创建了一个Birt处理程序类,它可以动态地在报表中创建标签。

当我创建标签时,我想创建一个动作DrillThrough,以此方式链接与标签关联的其他报告。

LabelHandle label = elementFactory.newLabel("name label");
label.setText("text label");


//ACTION DRILLTHROUGHACTION
DrillThroughAction drillThroughAction = new DrillThroughAction();
drillThroughAction.setReportName("report linked name");
drillThroughAction.setTargetFileType("report-design");
drillThroughAction.setTargetWindow("_blank");
Action action = new Action((IHyperlinkAction) drillThroughAction)

label.setAction(action);

但是通过这种方式,该操作不适用于标签中的主题setAction。

如何为标签构建DrillThroughAction?

由于

1 个答案:

答案 0 :(得分:2)

试试这样:

LabelHandle label = elementFactory.newLabel("name label");
label.setText("text label");

// instantiate an action and link it to the element
Action action = StructureFactory.createAction();    
ActionHandle actionHandle = label.setAction( action  ); 

// Define drillthrough target    
actionHandle.setLinkType(DesignChoiceConstants.ACTION_LINK_TYPE_DRILL_THROUGH);
actionHandle.setReportName("report linked name");
actionHandle.setTargetFileType("report-design");
actionHandle.setTargetWindow("_blank");