org.hy.common.xml.XJava Java Examples

The following examples show how to use org.hy.common.xml.XJava. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JU_Sheets.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void test_Sheets() throws Exception
{
    List<JUBase<?>> v_Junits          = (List<JUBase<?>>)XJava.getObject("Junits");
    List<RTemplate> v_ReportTemplates = (List<RTemplate>)XJava.getObject("ReportTemplates");
    RWorkbook       v_RWorkbook       = null;
    RTemplate       v_RTemplate       = null;
    
    for (int i_Index=0; i_Index<v_ReportTemplates.size(); i_Index++)
    {
        v_RTemplate = v_ReportTemplates.get(i_Index);
        v_RWorkbook = ReportHelp.toExcel(v_RWorkbook ,v_Junits.get(i_Index).getDatas(10) ,v_RTemplate);
    }
    
    ExcelHelp.save(v_RWorkbook.getWorkbook() ,"/Users/hy/Downloads/Sheets");
}
 
Example #2
Source File: CopyActionListener.java    From HBaseClient with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onClick(ActionEvent i_Event)
{
    if ( JavaHelp.isNull(this.getAppFrame().getTableName()) )
    {
        this.getAppFrame().showHintInfo("请先选择要清空的表" ,Color.BLUE);
        return;
    }
    
    if ( this.getAppFrame().getSelectColCount() <= 1 )
    {
        this.getAppFrame().showHintInfo("请选择查询结果列表中的多行数据" ,Color.BLUE);
        return;
    }
    
    
    JTable v_JTable      = (JTable)XJava.getObject("xtDataList");
    int [] v_RowIndexArr = v_JTable.getSelectedRows();
    
    String v_CMDPuts = this.writeContents(v_JTable ,v_RowIndexArr);
    
    ((JTextArea)XJava.getObject("xtPutsInfo")).setText(v_CMDPuts);
    
    super.onClick(i_Event);
}
 
Example #3
Source File: EditSubmitActionListener.java    From HBaseClient with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void transactionAfter(ActionEvent i_ActionEvent)
{
    // 所有编码控件及按钮本身都有效
    this.setEditDatasEnabled(true);
    
    this.getAppFrame().setTables_Tools_Edit_Enabled(true);
    
    if ( this.getHPage().getRowKey() == null )
    {
        ((JButton) XJava.getObject("xbNextPage")).setEnabled(false);
        ((JButton) XJava.getObject("xbLastPage")).setEnabled(false);
    }
    
    ((JComponent)XJava.getObject("xpResultInfo")).setEnabled(true);
}
 
Example #4
Source File: JU_PageTitle.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
@Test
public void test_PageTitle() throws RTemplateException
{
    RTemplate v_RTemplate = (RTemplate)XJava.getObject("ReportPageTitle");
    RTemplate v_Clone     = new RTemplate(v_RTemplate);
    
    // 分页页眉、分页页脚的演示
    ExcelHelp.save(ReportHelp.toExcel(getDatas(10) ,v_RTemplate).getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ReportPageTitle.Page.xlsx");
    
    // 仅分页页眉的演示
    v_RTemplate.setTitlePageFooterBeginRow(null);
    ExcelHelp.save(ReportHelp.toExcel(getDatas(10) ,v_RTemplate).getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ReportPageTitle.Header.xlsx");
    
    // 仅分页页脚的演示
    v_RTemplate.init(v_Clone);
    v_RTemplate.setTitlePageHeaderBeginRow(null);
    ExcelHelp.save(ReportHelp.toExcel(getDatas(10) ,v_RTemplate).getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ReportPageTitle.Footer.xlsx");
    
    // 无分页的演示
    v_RTemplate.setTitlePageHeaderBeginRow(null);
    v_RTemplate.setTitlePageFooterBeginRow(null);
    ExcelHelp.save(ReportHelp.toExcel(getDatas(10) ,v_RTemplate).getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ReportPageTitle.Normal.xlsx");
}
 
Example #5
Source File: MenuEditFamilyNamesAction.java    From HBaseClient with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onClick(ActionEvent i_Event)
{
    if ( JavaHelp.isNull(this.getTableName()) )
    {
        this.getAppFrame().showHintInfo("请先选择要编辑的表" ,Color.BLUE);
        return;
    }
    
    
    List<String>  v_FamilyNames = this.getHBase().getTableFamilyNames(this.getTableName());
    StringBuilder v_Buffer      = new StringBuilder();
    
    for (String v_FamilyName : v_FamilyNames)
    {
        v_Buffer.append(",").append(v_FamilyName);
    }
    
    ((JTextField)XJava.getObject("xtEditFamilysTableName")).setText(this.getTableName());
    ((JTextField)XJava.getObject("xtEditFamilyNames"))     .setText(v_Buffer.toString().substring(1));
    
    super.onClick(i_Event);
}
 
Example #6
Source File: JU_Total03.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
@Test
public void test_Subtotal() throws RTemplateException
{
    RTemplate v_RTemplate01 = (RTemplate)XJava.getObject("PartSprayRecordStatistics");
    RTemplate v_RTemplate02 = (RTemplate)XJava.getObject("PartSprayRecordStatistics_t");
    
    
    List<PartSprayRecordGroup> v_Datas = getDatas(10);
    
    Date v_BeginTime = new Date();
    RWorkbook v_RWorkbook = null;
    
    v_RWorkbook = ReportHelp.toExcel(v_RWorkbook ,v_Datas ,v_RTemplate01);
    v_RWorkbook = ReportHelp.toExcel(v_RWorkbook ,v_Datas ,v_RTemplate02);
    
    ExcelHelp.save(v_RWorkbook.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\PartSprayRecordStatistics");
    Date v_EndTime  = new Date();
    
    System.out.println(v_EndTime.getTime() - v_BeginTime.getTime());
}
 
Example #7
Source File: ExecutePutAction.java    From HBaseClient with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onClick(ActionEvent i_Event)
{
    String v_CMD = ((JTextArea)XJava.getObject("xtPutsInfo")).getText();
    
    if ( JavaHelp.isNull(v_CMD) )
    {
        this.getAppFrame().showHintInfo("请输入要执行的命令" ,Color.BLUE);
        return;
    }
    
    
    try
    {
        AppMain.executes(v_CMD);
        super.onClick(i_Event);
        
        this.getAppFrame().showHintInfo("执行完成,请查看控制台日志" ,Color.BLUE);
    }
    catch (Exception exce)
    {
        this.getAppFrame().showHintInfo("执行命令异常:" + exce.getMessage() ,Color.RED);
    }
}
 
Example #8
Source File: DatasMaker.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
public List<AppendComplex03> makeAppendComplex03()
{
    List<AppendComplex03> v_Datas = new ArrayList<AppendComplex03>();
    
    for (int i=1; i<=3; i++)
    {
        String          v_No   = StringHelp.lpad(i ,3 ,"0");
        AppendComplex03 v_Data = new AppendComplex03();
        
        v_Data.setQty(     "Q" + v_No);
        v_Data.setTypeName("T" + v_No);
        v_Data.setRemark(  "R" + v_No);
        v_Data.setLength(  i);
        v_Data.setWidth(   Help.multiply(i ,100));
        v_Data.setHeight(  Help.multiply(i ,60));
        v_Data.setNet(     Help.multiply(i ,10));
        v_Data.setRt(      Help.multiply(i ,30));
        v_Data.setGross(   Help.multiply(i ,Math.PI));  // 在模板上可设置显示的小数位数
        v_Data.setQcode(XJava.getParam("QCodeImagePath").getValue() + i + ".png");
        
        v_Datas.add(v_Data);
    }
    
    return v_Datas;
}
 
Example #9
Source File: SelectColumnNameListener.java    From HBaseClient with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent e)
{
    boolean v_Enable = false;
    
    try
    {
        String v_FileName   = ((JComboBox)XJava.getObject("FamilyName")).getSelectedItem().toString();
        String v_ColumnName = ((JComboBox)XJava.getObject("ColumnName")).getSelectedItem().toString();
        
        
        if ( !JavaHelp.isNull(v_FileName) && !JavaHelp.isNull(v_ColumnName) )
        {
            v_Enable = true;
        }
    }
    catch (Exception exce)
    {
        // Nothing.
    }
    
    ((JComponent)XJava.getObject("xbSubmitFilter")).setEnabled(v_Enable);
}
 
Example #10
Source File: SelectFamilyNameListener.java    From HBaseClient with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent e)
{
    JComboBox v_FamilyNameObj = (JComboBox)e.getSource();
    JComboBox v_ColumnNameObj = null;
    
    if ( v_FamilyNameObj.getName().equals("Edit_FamilyName") )
    {
        v_ColumnNameObj = (JComboBox)XJava.getObject("Edit_ColumnName");
    }
    else
    {
        v_ColumnNameObj = (JComboBox)XJava.getObject("ColumnName");
        ((JComponent)XJava.getObject("xbSubmitFilter")).setEnabled(false);
    }
    
    this.getAppFrame().initColumnNames(e.getItem().toString() ,v_ColumnNameObj);
}
 
Example #11
Source File: JU_AppendComplex.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void test_01() throws RTemplateException
{
    List<RTemplate>    v_Reports     = (List<RTemplate>)   XJava.getObject("ReportAppendComplexs");
    List<List<Object>> v_ReportDatas = (List<List<Object>>)XJava.getObject("ReportDatas");
    RWorkbook          v_RWorkbook   = null;
    
    for (int v_RIndex=0; v_RIndex<v_Reports.size(); v_RIndex++)
    {
        RTemplate    v_RTemplate = v_Reports    .get(v_RIndex);
        List<Object> v_RData     = v_ReportDatas.get(v_RIndex);
        
        // 最后一个参数为true时,即追加模式
        v_RWorkbook = ReportHelp.toExcel(v_RWorkbook ,"工作表的标题" ,v_RData ,v_RTemplate ,true);
    }
    
    ExcelHelp.save(v_RWorkbook ,"C:\\Users\\ZhengWei\\Desktop\\追加模式的复合报表.xlsx");
}
 
Example #12
Source File: AppFrame.java    From HBaseClient with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 初始化主窗口信息
 */
public void init()
{
    this.setJMenuBar((JMenuBar)XJava.getObject("xmMainMenuBar"));
    this.getContentPane().setLayout(new BorderLayout());
    this.getContentPane().add((Component)XJava.getObject("xpMain") ,BorderLayout.CENTER);
    this.setEnabled(false);
    
    JComponent v_JC = ((JComponent)XJava.getObject("xlTables"));
    v_JC.setSize(50 ,v_JC.getHeight());
    
    this.showHintInfo("请稍后,正在访问数据库..." ,Color.BLUE);
    
    this.initListModel();
    this.initTableModel();
    this.initTablesInfo();
    
    this.setEnabled(true);
    this.showHintInfo("欢迎使用!");
}
 
Example #13
Source File: InitConfig.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private synchronized void init()
{
    if ( !$Init )
    {
        $Init = true;
        
        try
        {
            this.init("startup.Config.xml");
            this.init((List<Param>)XJava.getObject("StartupConfig") ,Help.getClassPath(this));
        }
        catch (Exception exce)
        {
            System.out.println(exce.getMessage());
            exce.printStackTrace();
        }
    }
}
 
Example #14
Source File: JU_ReadHorizontal.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public JU_ReadHorizontal() throws Exception
{
    if ( !$isInit )
    {
        $isInit = true;
        XJava.parserAnnotation(this.getClass().getName());
    }
}
 
Example #15
Source File: JU_FontReport.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Font() throws RTemplateException
{
    RTemplate      v_RTemplate = (RTemplate)XJava.getObject("Report_Font_xlsx");
    List<FontTest> v_Datas     = this.getDatas(1);
    
    RWorkbook v_RWorkbook02 = ReportHelp.toExcel(v_Datas ,v_RTemplate);
    
    ExcelHelp.save(v_RWorkbook02.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\FontReport_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #16
Source File: JU_ImageReport.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Image() throws RTemplateException
{
    //RTemplate             v_RTemplate01 = (RTemplate)XJava.getObject("Report_Image_xls");
    RTemplate             v_RTemplate02 = (RTemplate)XJava.getObject("Report_Image_xlsx");
    List<ImageReportBean> v_Datas       = this.getDatas(118);
    
    //RWorkbook v_RWorkbook01 = ReportHelp.toExcel(v_Datas ,v_RTemplate01);
    RWorkbook v_RWorkbook02 = ReportHelp.toExcel(v_Datas ,v_RTemplate02);
    
    //ExcelHelp.save(v_RWorkbook01.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ImageReport_" + Date.getNowTime().getFull_ID() + ".xls");
    ExcelHelp.save(v_RWorkbook02.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ImageReport_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #17
Source File: JU_ImageReport.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public JU_ImageReport() throws Exception
{
    if ( !$isInit )
    {
        $isInit = true;
        XJava.parserAnnotation(this.getClass().getName());
    }
}
 
Example #18
Source File: JU_Brace.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public JU_Brace() throws Exception
{
    if ( !$isInit )
    {
        $isInit = true;
        XJava.parserAnnotation(this.getClass().getName());
    }
}
 
Example #19
Source File: JU_Total_Subtotal.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public JU_Total_Subtotal() throws Exception
{
    if ( !$isInit )
    {
        $isInit = true;
        XJava.parserAnnotation(this.getClass().getName());
    }
}
 
Example #20
Source File: JU_ImageReport02.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Image05() throws RTemplateException
{
    RTemplate             v_RTemplate = (RTemplate)XJava.getObject("Report_Image05_xlsx");
    List<ImageReportBean> v_Datas     = this.getDatas(3);
    
    RWorkbook v_RWorkbook05 = ReportHelp.toExcel(v_Datas ,v_RTemplate);
    v_RWorkbook05 = ReportHelp.toExcel(v_RWorkbook05 ,v_Datas ,v_RTemplate ,true);
    v_RWorkbook05 = ReportHelp.toExcel(v_RWorkbook05 ,v_Datas ,v_RTemplate ,true);
    
    ExcelHelp.save(v_RWorkbook05.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ImageReport_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #21
Source File: JU_Formula.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
/**
 * 测试:带公式的报表生成
 * 
 * @author      ZhengWei(HY)
 * @createDate  2020-05-21
 * @version     v1.0
 *
 * @throws RTemplateException
 */
@Test
public void test_Formula() throws RTemplateException
{
    RTemplate             v_RTemplate = (RTemplate)XJava.getObject("Report_Formula_xlsx");
    List<ImageReportBean> v_Datas     = this.getDatas(3);
    
    RWorkbook v_RWorkbook = ReportHelp.toExcel(v_Datas ,v_RTemplate);
    
    ExcelHelp.save(v_RWorkbook.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\Formula_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #22
Source File: JU_ImageReport02.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public JU_ImageReport02() throws Exception
{
    if ( !$isInit )
    {
        $isInit = true;
        XJava.parserAnnotation(this.getClass().getName());
    }
}
 
Example #23
Source File: JU_Formula.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public JU_Formula() throws Exception
{
    if ( !$isInit )
    {
        $isInit = true;
        XJava.parserAnnotation(this.getClass().getName());
    }
}
 
Example #24
Source File: JU_Total02.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Subtotal() throws RTemplateException
{
    RTemplate v_RTemplate = (RTemplate)XJava.getObject("ReportTotalSubtotal");
    
    
    List<ProductPressureTestStatisticsGroup> v_Datas = getDatas(100);
    
    Date v_BeginTime = new Date();
    ExcelHelp.save(ReportHelp.toExcel("小计、分组数据的报表演示" ,v_Datas ,v_RTemplate).getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\TotalSubtotal");
    Date v_EndTime  = new Date();
    
    System.out.println(v_EndTime.getTime() - v_BeginTime.getTime());
}
 
Example #25
Source File: JU_Total02.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public JU_Total02() throws Exception
{
    if ( !$isInit )
    {
        $isInit = true;
        XJava.parserAnnotation(this.getClass().getName());
    }
}
 
Example #26
Source File: JU_ReadHorizontal.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_ReadHorizontal()
{
    RTemplate v_RTemplate = (RTemplate)XJava.getObject("ReadHorizontal");
    List<?>   v_Datas     = ReportHelp.toJava(v_RTemplate ,JU_ReadHorizontal.class.getResource("JU_ReadHorizontal_Datas.xlsx").toString());
    
    Help.print(v_Datas);
}
 
Example #27
Source File: JU_ReadVertical.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public JU_ReadVertical() throws Exception
{
    if ( !$isInit )
    {
        $isInit = true;
        XJava.parserAnnotation(this.getClass().getName());
    }
}
 
Example #28
Source File: JU_ReadVertical.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_ReadHorizontal()
{
    RTemplate v_RTemplate = (RTemplate)XJava.getObject("ReadVertical");
    List<?>   v_Datas     = ReportHelp.toJava(v_RTemplate ,JU_ReadVertical.class.getResource("JU_ReadVertical_Datas.xlsx").toString());
    
    Help.print(v_Datas);
}
 
Example #29
Source File: JU_AppendPage.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public JU_AppendPage() throws Exception
{
    if ( !$isInit )
    {
        $isInit = true;
        XJava.parserAnnotation(this.getClass().getName());
    }
}
 
Example #30
Source File: JU_AppendPage.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_AppendPage() throws RTemplateException
{
    RTemplate             v_RTemplate01 = (RTemplate)XJava.getObject("Report_AppendPage_1_xlsx");
    RTemplate             v_RTemplate02 = (RTemplate)XJava.getObject("Report_AppendPage_2_xlsx");
    List<ImageReportBean> v_Datas       = this.getDatas(2);
    
    RWorkbook v_RWorkbook = ReportHelp.toExcel(v_Datas ,v_RTemplate01); // 按第一个模板生成数据
    
    ReportHelp.toExcel(v_RWorkbook ,v_Datas ,v_RTemplate02 ,true);      // 追加第二个模板的数据
    
    ExcelHelp.save(v_RWorkbook.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\AppendPage_" + Date.getNowTime().getFull_ID() + ".xlsx");
}