Resolve how to develop custom controls for finereport

As a plug-in report software, finereport needs to develop its own functions with special needs. The developed plug-in package fan software is provided by the official. You can find it on the fan software forum. This paper will mainly introduce how to develop a user-defined control. Here is the methodology.

Step 1: instantiate the interface of a registered control

Give four information about our control class, interface class, icon path, control type name

The second step is to rewrite the control class

Because to change the filtering method, you need to rewrite a filter

Step 3: inherit the front-end control JS

OK ~ the above is all the code development ~ then write an XML and package it into a plug-in with ant.

Code interpretation:

First, what does this code mean?

I defined a control type as CustomCombo@R_553_2419 @Editor control, which he inherited Combo@R_553_2419 @All methods and properties of the editor, and I declare the newly defined control type tag as customcombo. What is the use of this tag, other uses will not be mentioned. Just the use here is that Java itself can't let the front end take what controls are generated ~ but by telling the front end a configuration, The front-end JS engine (let's call it this way) ~ executes the corresponding script according to this configuration to generate the corresponding DOM style ~ you understand this ~ a configuration returned in the background is to generate the customcombo control ~ then it finds the corresponding key value fr like a map CustomCombo@R_553_2419 @Editor ~ then throw the configuration of the control into this method for execution. Our controls are generated.

Because there is no requirement to modify the front end in this example ~ so no change has been made ~ let's look at the background.

Our example is to modify the way of fuzzy matching.

So what happened to the original control matching mechanism, It's like this: suppose I'm a boss (mom can only assume it). Now I want to know the details of a paper contract, but how can I find a large pile of paper contracts in the company? Of course, I need a secretary (beauty is the best). I tell her what information I want about the contract ~ then she can find it and give me the contract finally found.

We have controls here Combo@R_553_2419 @The boss, Combo@R_553_2419 @Datafilter is a secretary, which means that every secretary here must have his own method to find a contract. In the past, the secretary found everything as long as it was a little relevant. The new secretary only found the contract matching the information prompted by the boss ~ the matching method is ismatch. This code is like this, In fact, code development can be mapped to many transaction processing in real life as long as careful analysis ~ because code is also designed by people, logic can not escape people's thinking of dealing with affairs.

The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. At the same time, I also hope to support a lot of programming tips!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>