mondrian drill through表头的汉化

 

1、找到jpivot-源码   ,修改MondrianDrillThroughTableModel.java类

我用的jpivot-1.8.0-080927

 

路径:com/tonbeller/jpivot/mondrian/MondrianDrillThroughTableModel.java

在175行左右           columnTitles[i] = md.getColumnName(i+1);
                    改为     columnTitles[i] = md.getColumnLabel(i+1);

 

2、将schema里面的level属性 name写成汉字。xml文件保存时,用另存为ansi编码,然后放进solution就可以了。例如schema文件:

<?xml version="1.0" encoding="UTF-8"?>
<Schema name="FinanceInstance">
 <Cube name="FinanceInstances" cache="true" enabled="true">
  <Table name="finance_fact">
  </Table>
  <Dimension foreignKey="ent_id_" name="enterprise" caption="所有企业">
   <Hierarchy  hasAll="true" allMemberName="all enterprise" primaryKey="id_" primaryKeyTable="company_info" allMemberCaption="企业">
    <Table name="company_info">
    </Table>
    <Level name="企业名称" table="company_info" column="COMPANY_NAME_" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="企业名称">
    </Level>
   </Hierarchy>
  </Dimension>
  <Dimension foreignKey="owership_id_" name="ownership" caption="所有制类型">
   <Hierarchy  hasAll="true" allMemberName="ownerships" primaryKey="id_" primaryKeyTable="enterprise_ownership_types" allMemberCaption="所有制">
    <Table name="enterprise_ownership_types">
    </Table>
    <Level name="所有制" table="enterprise_ownership_types" column="name_" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="所有制">
    </Level>
   </Hierarchy>
  </Dimension>
  <Dimension foreignKey="field_id_" name="field" caption="技术领域类型">
   <Hierarchy  hasAll="true" allMemberName="technical fields" primaryKey="id_" primaryKeyTable="enterprise_technical_field_types_" allMemberCaption="技术领域">
    <Table name="enterprise_technical_field_types_">
    </Table>
    <Level name="技术领域" table="enterprise_technical_field_types_" column="name_" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="技术领域">
    </Level>
   </Hierarchy>
  </Dimension>
  <Dimension foreignKey="class_id_" name="class" caption="行业类型">
   <Hierarchy  hasAll="true" allMemberName="classification" primaryKey="id_" primaryKeyTable="industry_classification" allMemberCaption="行业">
    <Table name="industry_classification">
    </Table>
    <Level name="行业" table="industry_classification" column="name_" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never" caption="行业">
    </Level>
   </Hierarchy>
  </Dimension>
  <Dimension type="TimeDimension" foreignKey="TIME_ID_" name="time" caption="时间">
   <Hierarchy hasAll="true" allMemberName="times" primaryKey="ID_" allMemberCaption="年季月">
    <Table name="TIME">
    </Table>
    <Level name="年" column="YEAR_" type="String" uniqueMembers="true" levelType="TimeYears" hideMemberIf="Never" caption="年">
    </Level>
    <Level name="季度" column="season_"  type="String" uniqueMembers="false" levelType="TimeQuarters" hideMemberIf="Never" caption="季">
    </Level>
    <Level name="月" column="MONTH_"  type="String" uniqueMembers="false" levelType="TimeMonths" hideMemberIf="Never" caption="月">
    </Level>
   </Hierarchy>
  </Dimension>
  <Measure name="利润额" column="CASH_FLOW_" formatString="#,###" aggregator="sum" caption="利润额">
  </Measure>
  <Measure name="投资额" column="GROSS_INVEST_" formatString="#,###" aggregator="sum" caption="投资额">
  </Measure>
 </Cube>
</Schema>

你可能感兴趣的:(schema,String,table,hierarchy,classification,Types)