void init() { this.setTitle("经济科目"); try { cbxLvl = new FComboBox(); cbxLvl.setTitle("级次选择"); cbxLvl.setRefModel(REF_LEVEL); cbxLvl.setValue(IFilterProvider.LVL_1); cbxLvl.setPreferredSize(new Dimension(100, 20)); cbxLvl.addValueChangeListener( new ValueChangeListener() { public void valueChanged(ValueChangeEvent arg0) { setTypeChange(IFilterProvider.TYPE_ACCT_JJ, "" + arg0.getNewValue()); } }); cbxLvl.setEnabled(false); cbxLvl.getEditor().addMouseListener(comCick); chkGroupUp = new FCheckBox(); chkGroupUp.setTitle(" 按级次汇总"); chkGroupUp.setTitlePosition("right"); chkGroupUp.setEnabled(false); DataSet ds = AbastractFilterPanel.getSelectDs(IFilterProvider.TYPE_ACCT_JJ, IFilterProvider.LVL_1); treAcctJJ = new CustomTree( "经济科目", ds, IPubInterface.BSI_ID, IPubInterface.ACCT_FNAME, IPubInterface.BSI_PARENT_ID, null, IPubInterface.ACCT_CODE_JJ, true); treAcctJJ.setIsCheckBoxEnabled(false); if (ds.getRecordCount() < 200) treAcctJJ.expandAll(); spnlTree = new FScrollPane(treAcctJJ); getBodyPanel().add(cbxLvl, BorderLayout.NORTH); FPanel pnl = new FPanel(); pnl.setLayout(new BorderLayout()); pnl.add(chkGroupUp, BorderLayout.NORTH); pnl.add(spnlTree, BorderLayout.CENTER); getBodyPanel().add(pnl, BorderLayout.CENTER); cbxLvl.addMouseListener(comCick); chkGroupUp.addMouseListener(comCick); spnlTree.addMouseListener(comCick); treAcctJJ.addMouseListener(comCick); } catch (Exception e) { new MessageBox("初始化经济科目选择失败!", e.getMessage(), MessageBox.ERROR, MessageBox.BUTTON_OK).show(); e.printStackTrace(); } reset(); }
public void setTypeChange(String type, String lvl) { try { spnlTree.remove(treAcctJJ); DataSet ds = AbastractFilterPanel.getSelectDs(type, lvl); treAcctJJ = new CustomTree( "经济科目", ds, IPubInterface.BSI_ID, IPubInterface.ACCT_FNAME, IPubInterface.BSI_PARENT_ID, null, IPubInterface.ACCT_CODE_JJ, true); treAcctJJ.setIsCheckBoxEnabled(true); spnlTree.getViewport().add(treAcctJJ); if (ds.getRecordCount() < 200) treAcctJJ.expandAll(); } catch (Exception e) { new MessageBox("刷新数据失败!", e.getMessage(), MessageBox.ERROR, MessageBox.BUTTON_OK).show(); e.printStackTrace(); } }