Brief introduction
Now, the market is tightening. Frameworks can save time in the design and development phases. The IDE makes it easier for us to develop user interfaces. Standard GUI applications that define GUIs with different panel layouts have become a fundamental pattern. Based on this model, consider using a framework to improve execution speed, achieve higher parallel processing, and coordinate more relaxed development approaches. We're going to use the Java Swing application here to describe such a framework.
Simple application-Library management system
Here we discuss a simple library management system to understand the Xml-based GUI framework.
The flowchart above defines the design of the library user interface. Home directory, member login, user registration and book search, these are the Panels (panel) that exist in the application. As you can see from the flowchart, there are several possible processing paths in your application:
Home directory-> user Registration-> Book Search
Home Directory-> Member login-> book Search
Principle
The panel displayed at any time depends on the output of the previous panel. Therefore, you need to design a generic controller as the form for the entire framework, which provides the panel with the necessary input and handles the output that the Panel expects to return. These panels implement the Xsfpanel interface, in which an execute () method is used to deposit the input from the form into a hashmap and return the output from another hashmap. The controller of the framework handles the output returned using HashMap and is ready to determine which panel should be displayed.
public interface XSFPanel extends JPanel
{
public HashMap execute(HashMap inputs);
. . .
}