1. In our workflow approval interface, sometimes we need to add a custom approval button. One method is recommended below.
Idea: 1. Implement an interface com. Kingdee. EAS. Framework. Client. workflow. iworkflowuisupport in our custom document editlui. Java
Public interface iworkflowuisupport
{
Public abstract iworkflowuienhancement getworkflowuienhancement ();
}
2. Compile an internal class to implement the iworkflowuienhancement interface or inherit the defaultworkflowuienhancement class. Rewrite the related set and get methods and assign values to the corresponding menu bar and toolbar.
This interface returns an object that can obtain the menu bar and toolbar of the approval interface.
Public interface iworkflowuienhancement
{
Public abstract list getapprovemenus (coreuiobject );
Public abstract list getapporvetoolbuttons (coreuiobject );
Public abstract string getqueryfieldnamebindingwf (coreuiobject );
Public Abstract Boolean enableentryprocess (bosobjecttype)
Throws exception;
}
============================== Specific implementation code ======== ==========================================
Public class vpnuniteditui extends actvpnuniteditui implements
Iworkflowuisupport {
// Implement the interface method. Return a method for obtaining the menu bar and toolbar.
Public iworkflowuienhancement getworkflowuienhancement (){
Demowfenhancement = new demowfenhancement ();
List buttonlist = new arraylist ();
Buttonlist. Add (btnaudit );
Buttonlist. Add (btnunaudit );
Try {
Demowfenhancement. setapporvetoolbuttons (buttonlist );
} Catch (exception e ){
E. printstacktrace ();
}
Return demowfenhancement;
}
/**
*
* On the workflow approval page, you can use getapprovemenus to obtain the menu bar object and getapporvetoolbuttons to obtain the toolbar object.
* You can add a menu bar or toolbar by yourself.
* @ Author Administrator
*
*/
Class demowfenhancement extends defaultworkflowuienhancement {
List menulist = NULL;
List toolbarlist = NULL;
Public list getapprovemenus (coreuiobject uiobject ){
Return menulist;
}
Public list getapporvetoolbuttons (coreuiobject uiobject ){
Return toolbarlist;
}
Public String getqueryfieldnamebindingwf (coreuiobject uiobject ){
Return "ID ";
}
Public Boolean enableentryprocess (bosobjecttype objecttype)
Throws exception {
Return false;
}
Public void settoolbar (list) throws exception {
Menulist = List;
}
Public void setapporvetoolbuttons (list) throws exception {
Toolbarlist = List;
}
}
}