The view is discussed below.
Document is an abstract document class that contains all the data and how to display information, we have come out by Page, Paragraph, Row, etc.
Frame represents a form object, responsible for constructing a form, a menu bar, a toolbar, and more, it can accept the user's command, and then pass the command to Document.
View represents a view object, which is responsible for drawing document data, which draws a visual area in the Update () method.
In addition to drawing document data, the view may also draw scroll bars, ruler, and so on. Decorator mode is finally sent, abstract out the VIEW interface, the inheritance system implemented using the Decorator is as follows:
Define the View interface first:
Public interface view {??? void dispose (); ??? void update (); ??? void setActualsize; ??? Int getActualWidth (); ??? Int getActualHeight ();? ?? Int getFullWidth (); ??? Int getFullHeight (); ??? int getLeftPosition (); ??? void EnSureTVisible ();
Write the abstract class ViewDecorator:
Public Abstract Class View {??? protected for meaning = null; ??? public viewDecorator (view component) {??????? this.component = company; ???}}
To simplify, we only implement a scrollViewDecorator, and RulerViewDecorator is not implemented. If you are interested in implementing RulerViewDecorator, then add it to the system.
Now pay attention to TextView, because TextView needs to display the visual part of the document data, so you must calculate the total size of TextView (the actual size of TextView is determined by the upper control, and the user adjusts the window may change). The calculation method is as follows:
The red part is the total size of TextView.