让我们说用户双击或右键单击透视单元格。如何确定已选择的位置?
例如,用户可能想要选择一个位置来重新评估其位置。因此,根据位置,我需要将相应的书籍/区域发送到网格。
答案 0 :(得分:1)
您可以使用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]
用于您的目的。