ComboTreeDetailListUI左树右表必须实现的方法事件
//增加下拉列表选择改变事件处理(会重新生成树)
protected void cbxMain_itemStateChanged(java.awt.event.ItemEvent e) throws Exception
{
super.cbxMain_itemStateChanged(e);// 本超类事件重新生成树
if (treeMain.getRowCount() > 1)
nodeselector treeMain.setSelectionRow(1);// 有数据选择第一个节点
else
treeMain.setSelectionRow(0);// 无数据选择根节点
}
//给左树传查询过滤条件(如果需要传参数给左树,需要实现ILNTreeNodeCtrl接口)
protected ILNTreeNodeCtrl getLNTreeNodeCtrl() throws Exception
{
if (ItemCount() > 0) tateChanged(e);//本超类函数重新生成树
if (treeMain.getRowCount() > 1)
treeMain.setSe
{
return new LNCsAccountTypeTreeNodeCtrl(getTreeInterface(), (CsAccountTableInfo) SelectedItem(), "acccountTable");
} else
{
return new LNCsAccountTypeTreeNodeCtrl(getTreeInterface(), new CsAccountTableInfo(), "acccountTable");
}
}
class LNCsAccountTypeTreeNodeCtrl implements ILNTreeNodeCtrl
{
private ICsAccountType iAccountType = null;
private CsAccountTableInfo accoutTableInfo = null;
private String filterField = null;// 查询过滤字段名
public LNCsAccountTypeTreeNodeCtrl(ITreeBase treeCtrl, IObjectValue accoutTableInfo, String filterField)
{
this.iAccountType = (ICsAccountType) treeCtrl;
this.accoutTableInfo = (CsAccountTableInfo) accoutTableInfo;
this.filterField = filterField;
}
// 获取指定结点的指定级次的子孙结点, 若parent==null,则获取从1到指定级次的结点
public AbstractObjectCollection getChildren(TreeBaseInfo parentNodeInfo, int level) throws Exception
{
String tableID = null;
if (this.accoutTableInfo != null && Id() != null)
{
tableID = Id().toString();
}
EntityViewInfo viewInfo = new EntityViewInfo();
viewInfo.setFilter(new FilterInfo());
if (parentNodeInfo != null)
{
Filter().getFilterItems().add(new FilterItemInfo("longNumber", LongNumber() + "!%", CompareType.LIKE));
Filter().getFilterItems().add(new FilterItemInfo("level", new Level()), CompareType.GREATER));
Filter().getFilterItems().add(new FilterItemInfo("level", new Level() + level), CompareType.LESS_EQUALS));
Filter().getFilterItems().add(new FilterItemInfo(filterField, tableID, CompareType.EQUALS));
} else
{
Filter().getFilterItems().add(new FilterItemInfo("level", new Integer(level), CompareType.LESS_EQUALS));
Filter().getFilterItems().add(new FilterItemInfo(filterField, tableID, CompareType.EQUALS));
}
Selector().add(new SelectorItemInfo("*"));
Sorter().add(new SorterItemInfo("longNumber"));
AbstractObjectCollection result = TreeBaseCollection(viewInfo);
return result;
}
// 指定过滤条件。如组织类型 获取指定结点的指定级次的子孙结点, 若parent==null,则获取从1到指定级次的结点
public AbstractObjectCollection getChildren(TreeBaseInfo parentNodeInfo, int level, FilterInfo info) throws Exception
{
String tableID = null;
if (this.accoutTableInfo != null && Id() != null)
{
tableID = Id().toString();
}
EntityViewInfo viewInfo = new EntityViewInfo();
viewInfo.setFilter(new FilterInfo());
if (parentNodeInfo != null)
{
Filter().getFilterItems().add(new FilterItemInfo("longNumber", LongNumber() + "!%", CompareType.LIKE));
Filter().getFilterItems().add(new FilterItemInfo("level", new Level()), CompareType.GREATER));
Filter().getFilterItems().add(new FilterItemInfo("level", new Level() + level), CompareType.LESS_EQUALS));
Filter().getFilterItems().add(new FilterItemInfo(filterField, tableID, CompareType.EQUALS));
} else
{
Filter().getFilterItems().add(new FilterItemInfo("level", new Integer(level), CompareType.LESS_EQUALS));
Filter().getFilterItems().add(new FilterItemInfo(filterField, tableID, CompareType.EQUALS));
}
Selector().add(new SelectorItemInfo("*"));
Sorter().add(new SorterItemInfo("longNumber"));
AbstractObjectCollection result = TreeBaseCollection(viewInfo);
return result;
}
// 指定过滤条件。如组织类型 获取指定结点的指定级次的子孙结点, 若parent==null,则获取从1到指定级次的结点
public AbstractObjectCollection getChildren(TreeBaseInfo parentNodeInfo, int level, FilterInfo filter, SelectorItemCollection selector) throws Exception
{
return getChildren(parentNodeInfo, level, filter);
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论