添加按钮 三种 方式
自己建的xml一定要要和系统的xml放到相同路径下,不然 不会显示
1.首先在功能注册找到要扩展的功能节点对应的XXXconfig.xml
2.自己新建一个xml
xml version="1.0" encoding="UTF-8"?>
<beans></beans>
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo"></bean>
<property name="actionContainer" <="" span="">ref="container" /></property>
<property name="actionType" value="</span>notedit<span style=" font-size:="" 13px;text-decoration:="" underline;"=""></property>" />
<property name="target" <="" span="">ref="printMenuAction" /></property>
<property name="</span>pos<span style=" font-size:="" 13px;text-decoration:="" underline;"=""></property>" value="after" />
<property name="action" <="" span="">ref="purchZanguAction" /></property>
<bean id="purchZanguAction" class="nc.ui.jtekt_ext.extpu.m45.action.PurchZanguAction"></bean>
<property name="model" <="" span="">ref="ManageAppModel" /></property>
3.自己创建action类 在类里面isActionEnable实现按钮的控制和doaction业务的逻辑处理
package nc.ui.jtekt_ext.extpu.m45.action;
import java.awt.event.ActionEvent;
import nc.ui.pubapp.uif2app.view.BillForm;
import nc.ui.uif2.NCAction;
import nc.ui.uif2.UIState;
import nc.ui.uif2.model.AbstractAppModel;
import nc.ui.uif2.model.BillManageModel;
@SuppressWarnings("serial")
public class PurchZanguAction extends NCAction {
private BillManageModel model;
private BillForm editor;
public PurchZanguAction() {
//按钮名称
super.setBtnName("模具费用分摊");
}
@Override
public void doAction(ActionEvent arg0) throws Exception {
if (null != this.model.getSelectedData()) {
// TODO 实现你的业务逻辑。
}
}
// 在isActionEnable实现对按钮使能控制 控制按钮是否可编辑
@Override
protected boolean isActionEnable() {
// 获取界面选择的所有单据
Object[] objs = this.model.getSelectedOperaDatas();
// 按钮默认不可编辑
boolean isActionEnable = false;
// 选中行显示
if (objs != null && objs.length > 0) {
isActionEnable = true;
}
return isActionEnable;
}
public BillManageModel getModel() {
return model;
}
public void setModel(BillManageModel model) {
// 加入AbstractAppModel监听(陷阱,一定要记得加)
model.addAppEventListener(this);
this.model = model;
}
public BillForm getEditor() {
return editor;
}
public void setEditor(BillForm editor) {
this.editor = editor;
}
}
4.功能注册里面注册xml,参数注册的名称要以Plugin开头
5.前台打开界面就可以看到
已成功XML 注意 model与editor 导入的类一定要注意。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfList" />
<property name="actionType" value="notedit" />
<property name="target" ref="printMenuAction" />
<property name="pos" value="after" />
<property name="action" ref="sysOAAction" />
</bean>
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfCard" />
<property name="actionType" value="notedit" />
<property name="target" ref="IMAction" />
<property name="pos" value="after" />
<property name="action" ref="sysOAAction" />
</bean>
<!--联查OA-->
<bean id="sysOAAction" class="nc.ui.pu.m21.action.OrderToOAAction">
<property name="model" ref="manageAppModel" />
<property name="code" value="sysOAAction" />
</bean>
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfList" />
<property name="actionType" value="notedit" />
<property name="target" ref="printMenuAction" />
<property name="pos" value="after" />
<property name="action" ref="orderimport" />
</bean>
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfCard" />
<property name="actionType" value="notedit" />
<property name="target" ref="IMAction" />
<property name="pos" value="after" />
<property name="action" ref="orderimport" />
</bean>
<!--采购订单导入-->
<bean id="orderimport" class="nc.ui.pu.m21.action.OrderImportExcelAction">
<property name="model" ref="manageAppModel"/>
</bean>
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfList" />
<property name="actionType" value="notedit" />
<property name="target" ref="printMenuAction" />
<property name="pos" value="after" />
<property name="action" ref="sendeamcction" />
</bean>
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfCard" />
<property name="actionType" value="notedit" />
<property name="target" ref="IMAction" />
<property name="pos" value="after" />
<property name="action" ref="sendeamcction" />
</bean>
<!-- 发送EAM -->
<bean id="sendeamcction" class="nc.ui.pu.m21.action.SendDataEamAction">
<property name="model" ref="manageAppModel" />
</bean>
<!-- 采购订单拦截 -->
<bean class="nc.ui.pubapp.plugin.action.ActionInterceptorInfo">
<property name="target" ref="saveAction"/>
<property name="interceptor">
<bean class="nc.ui.pu.m21.Interceptor.OrderSaveInterceptor">
<property name="model" ref="manageAppModel" />
<property name="editor" ref="billFormEditor" />
</bean>
</property>
</bean>
<!-- add by CYQ 2020年9月22日 离职人员修订按钮 -->
<bean id="ryxdAction" class="nc.ui.pu.m21.action.QuitPsndocEditAction">
<property name="editor" ref="billFormEditor" />
<property name="model" ref="manageAppModel" />
</bean>
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfList" />
<property name="actionType" value="notedit" />
<property name="target" ref="printMenuAction" />
<property name="pos" value="after" />
<property name="action" ref="ryxdAction" />
</bean>
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfCard" />
<property name="actionType" value="notedit" />
<property name="target" ref="IMAction" />
<property name="pos" value="after" />
<property name="action" ref="ryxdAction" />
<!-- -->
</bean>
</beans>
最后一种
直接在原有XML在添加 参考
<?xml version="1.0" encoding="gbk"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- 环境变量 -->
<bean id="context" class="nc.vo.uif2.LoginContext">
</bean>
<!-- 模板容器,负责对模板的统一装载 -->
<bean id="templateContainer" class="nc.ui.uif2.editor.TemplateContainer"
init-method="load">
<property name="context" ref="context" />
<property name="nodeKeies">
<list>
<value>bt</value>
</list>
</property>
</bean>
<!-- 对象转换器工厂,由此获取操作对象的特征信息,元数据要实现IBDObject接口 -->
<!-- 对于有元数据的VO,可以使用下面的配置 -->
<bean id="boadatorfactory" class="nc.vo.bd.meta.BDObjectAdpaterFactory" />
<!-- 应用服务类,负责进行模型操作的处理 -->
<bean id="batchModelService" class="nc.ui.pubapp.pub.smart.SmartBatchAppModelService">
<property name="serviceItf" value="nc.itf.sphzxzy.IMmcontrastMaintain" />
<property name="voClass" value="nc.vo.sphzxzy.mmcontrast.MMContrastVO" />
</bean>
<!-- 批量操作应用模型 ,缓存界面数据 -->
<bean id="batchBillTableModel" class="nc.ui.pubapp.uif2app.model.BatchBillTableModel">
<property name="context" ref="context" />
<property name="service" ref="batchModelService" />
<property name="validationService" ref="validateService" />
<property name="businessObjectAdapterFactory" ref="boadatorfactory" />
</bean>
<!-- 批量操作前台校验 -->
<bean id="validateService" class="nc.ui.uif2.model.DefaultBatchValidationService">
<property name="editor" ref="list" />
</bean>
<bean id="modelDataManager" class="nc.ui.pubapp.uif2app.model.BatchModelDataManager">
<property name="model" ref="batchBillTableModel" />
<property name="service" ref="batchModelService" />
</bean>
<!-- 编辑态关闭节点时提示是否保存 -->
<bean id="closingListener" class="nc.ui.uif2.FunNodeClosingHandler">
<property name="model" ref="batchBillTableModel" />
<property name="saveaction" ref="saveAction" />
<property name="cancelaction" ref="cancelAction" />
</bean>
<bean id="orgPanel" class="nc.ui.pubapp.uif2app.view.OrgPanel"
init-method="initUI">
<property name="model" ref="batchBillTableModel" />
<property name="dataManager" ref="modelDataManager" />
</bean>
<!-- 列表控件 -->
<bean id="list" class="nc.ui.pubapp.uif2app.view.ShowUpableBatchBillTable"
init-method="initUI">
<property name="model" ref="batchBillTableModel" />
<property name="voClassName" value="nc.vo.sphzxzy.mmcontrast.MMContrastVO" />
<property name="isBodyAutoAddLine" value="false" />
<property name="addLineAction" ref="addAction" />
</bean>
<!-- 事件监听 -->
<bean id="appEventHandlerMediator" class="nc.ui.pubapp.uif2app.model.AppEventHandlerMediator">
<property name="model" ref="batchBillTableModel" />
<property name="handlerGroup">
<list>
<!-- 表体字段编辑前事件 -->
<bean class="nc.ui.pubapp.uif2app.event.EventHandlerGroup">
<property name="event" value="nc.ui.pubapp.uif2app.event.card.CardBodyBeforeEditEvent"/>
<property name="handler">
<bean class="nc.ui.sphzxzy.mmcontrast.handler.BodyBeforeEditHandler"/>
</property>
</bean>
<!-- 表体表尾字段编辑后事件 -->
<bean class="nc.ui.pubapp.uif2app.event.EventHandlerGroup">
<property name="event" value="nc.ui.pubapp.uif2app.event.card.CardBodyAfterEditEvent"/>
<property name="handler">
<bean class="nc.ui.sphzxzy.mmcontrast.handler.BodyAfterEditHandler"/>
</property>
</bean>
</list>
</property>
</bean>
<!-- 界面布局总装-->
<bean id="container" class="nc.ui.uif2.TangramContainer"
init-method="initUI">
<property name="tangramLayoutRoot">
<bean class="nc.ui.uif2.tangramlayout.node.VSNode">
<property name="down">
<bean class="nc.ui.uif2.tangramlayout.node.CNode">
<property name="component" ref="list" />
</bean>
</property>
<property name="up">
<bean class="nc.ui.uif2.tangramlayout.node.CNode">
<property name="component" ref="orgPanel" />
</bean>
</property>
<property name="dividerLocation" value="31" />
</bean>
</property>
<property name="actions">
<list>
<ref bean="addAction" />
<ref bean="editAction" />
<ref bean="delAction" />
<ref bean="separatorAction" />
<ref bean="refreshAction" />
<ref bean="QueryAction" />
<!--<ref bean="printActionGroup" />-->
</list>
</property>
<property name="editActions">
<list>
<ref bean="addAction" />
<ref bean="delAction" />
<ref bean="separatorAction" />
<ref bean="saveAction" />
<ref bean="cancelAction" />
</list>
</property>
<property name="model" ref="batchBillTableModel" />
</bean>
<!-- Actions -->
<bean id="separatorAction" class="nc.funcnode.ui.action.SeparatorAction" />
<bean id="addAction" class="nc.ui.sphzxzy.mmcontrast.action.MmcontrastAddLineAction">
<property name="model" ref="batchBillTableModel" />
<property name="voClassName" value="nc.vo.sphzxzy.mmcontrast.MMContrastVO" />
</bean>
<bean id="editAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchEditAction">
<property name="model" ref="batchBillTableModel" />
</bean>
<bean id="delAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchDelLineAction">
<property name="model" ref="batchBillTableModel" />
</bean>
<bean id="saveAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchSaveAction">
<property name="model" ref="batchBillTableModel" />
<property name="editor" ref="list" />
</bean>
<!-- 查询 -->
<bean id="QueryAction" class="nc.ui.qili.rack.action.QueryAction">
<property name="batchBillTableModel" ref="batchBillTableModel"></property>
<property name="modelDataManager" ref="modelDataManager"></property>
<property name="list" ref="list"></property>
</bean>
<bean id="cancelAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchCancelAction">
<property name="model" ref="batchBillTableModel" />
<property name="editor" ref="list" />
</bean>
<bean id="refreshAction" class="nc.ui.uif2.actions.batch.BatchRefreshAction">
<property name="model" ref="batchBillTableModel"></property>
<property name="modelManager" ref="modelDataManager"></property>
</bean>
<!-- 打印管理,这是一个下拉按钮,按钮下边的放置三个子按钮预览、打印 、输出 -->
<bean id="printActionGroup" class="nc.funcnode.ui.action.MenuAction">
<property name="code" value="printManage" />
<property name="name">
<bean class="nc.ui.uif2.I18nFB">
<property name="resDir" value="common"></property>
<property name="resId" value="UC001-0000007"></property>
<property name="defaultValue" value="打印"></property>
</bean>
</property>
<property name="actions">
<list>
<ref bean="printpreviewaction" />
<ref bean="printaction" />
<ref bean="outputAction" />
</list>
</property>
</bean>
<!-- 预览 -->
<bean id="printpreviewaction" class="nc.ui.pubapp.uif2app.actions.SingleTablePrintAction">
<property name="preview" value="true" />
<property name="model" ref="batchBillTableModel" />
<property name="editor" ref="list" />
</bean>
<!-- 打印 -->
<bean id="printaction" class="nc.ui.pubapp.uif2app.actions.SingleTablePrintAction">
<property name="preview" value="false" />
<property name="model" ref="batchBillTableModel" />
<property name="editor" ref="list" />
</bean>
<!-- 输出 -->
<bean id="outputAction" class="nc.ui.pubapp.uif2app.actions.OutputAction">
<property name="model" ref="batchBillTableModel" />
<property name="parent" ref="list" />
</bean>
</beans>