您可以com.quartetfs.pivot.live.client.drillthrough.impl.DrillthroughExecutor.execute(IPivotDataCell, IMdxSelect, Cube, IMemberHasChildren, IMdxVisitorContext)
用于此任务。这就是 Live 在内部用于钻取的内容。这可以IPivotCellContextHandler
像这样完成:
@Override
public void onPivotCellContext(PivotCellContextEvent event) {
final IPivotCell pivotCell = event.getPivotCell();
if(null != pivotCell && pivotCell instanceof IPivotDataCell) {
//Show the context menu only for pivot-table data
IPivotDataCell pivotDataCell = (IPivotDataCell) pivotCell;
IMdxSelect select = event.getMdxModelPresenter().getMdxModel().getMdxSelect();
Cube cube = event.getMdxModelPresenter().getMdxModel().getCube();
FilterDescription fd = locationExtractor.execute(
pivotDataCell,
select,
cube,
new MdxModelMemberHasChildren(event.getMdxModelPresenter().getMdxModel()),
new DefaultMdxVisitorContext(select, cube)
);
// If filter description is too complicated we do not display the menu
if (fd == null) {
//TODO add entry in menu explaining that mdx is too complext to be converted to a location.
}
if (fd.getLocations().length != 1) {
//TODO handle, this should not happen but should be checked.
}
然后您可以将fd.getLocations[0]
其用于您的目的。