package com.vci.client.portal.UI.v3; import java.awt.BorderLayout; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import com.vci.client.common.VCIBasePanel; import com.vci.client.framework.rightConfig.object.FunctionObject; import com.vci.client.ui.swing.components.VCIJPanel; import com.vci.client.ui.swing.components.VCIJSplitPane; import com.vci.client.ui.tree.VCIBaseTreeNode; import com.vci.corba.omd.btm.BtmItem; public class UIFManager extends VCIBasePanel { /** * */ private static final long serialVersionUID = -1523364425874164381L; public UIFManager(FunctionObject funcObj) { super(funcObj); init(); } private void init(){ initUI(); } private VCIJSplitPane jspLeftToRight = null; private BtmLinkTypeTreePanel btmLinkTypeTreePanel = null; private UIContextDataPanel uIContextDataPanel = null; private void initUI(){ setLayout(new BorderLayout()); jspLeftToRight = new VCIJSplitPane(VCIJSplitPane.HORIZONTAL_SPLIT); jspLeftToRight.setDividerSize(6); jspLeftToRight.setContinuousLayout(true); jspLeftToRight.setOneTouchExpandable(true); jspLeftToRight.setDividerLocation(250); // 1、实例化 btmLinkTypeTreePanel = new BtmLinkTypeTreePanel(); // 1.1 设置参数(可选) // 显示 业务类型 链接类型 RadioButton,此时可以切换显示业务类型或链接类型的数据 // 如果不设置此参数,则按只显示业务类型,此时没有 RadioButton // btmLinkTypeTreePanel.setShowBtmLinkTypeRadioButton(true); // 只显示链接类型数据,此时也没有RadioButton // btmLinkTypeTreePanel.setOnlyLinkType(true); // 2、构建UI btmLinkTypeTreePanel.buildUI(); // 3、添加树节点选择后的事件处理 btmLinkTypeTreePanel.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { btmLinkTypeTree_valueChange(e); } }); jspLeftToRight.add(btmLinkTypeTreePanel, VCIJSplitPane.LEFT); jspLeftToRight.setRightComponent(new VCIJPanel()); add(jspLeftToRight, BorderLayout.CENTER); } private void btmLinkTypeTree_valueChange(TreeSelectionEvent e){ if(e.getNewLeadSelectionPath() == null) { return; } VCIBaseTreeNode treeNode = (VCIBaseTreeNode) e.getNewLeadSelectionPath().getLastPathComponent();; Object obj = treeNode.getObj(); if(!(obj instanceof BtmItem)){ return; } BtmItem btmItem = (BtmItem)obj; if(uIContextDataPanel == null){ uIContextDataPanel = new UIContextDataPanel(); uIContextDataPanel.setOwnedModulePanel(this); uIContextDataPanel.setBtmItem(btmItem); uIContextDataPanel.buildUI(); } else { uIContextDataPanel.setBtmItem(btmItem); uIContextDataPanel.refreshUI(); } jspLeftToRight.setRightComponent(uIContextDataPanel); int location = jspLeftToRight.getDividerLocation(); jspLeftToRight.setDividerLocation(location); } }