Window

A Window object represents a resizable window. The Window class is a subclass of WindowPanel, which itself is a subclass of BaseWindow. BaseWindow is a direct child of BaseComponent. The class hierarchy is shown in Figure 2.6.

Figure 2.6. The hierarchy of the Window class


Tables 2.4, 2.5, and 2.6 present the attributes of the BaseWindow class, WindowPanel class, and Window class, respectively.

Table 2.4. The attributes of the BaseWindow class
NameUsageTypeDefaultAccessibility
datacontrolsvisibilityTag onlybooleanfalsefinal
 Description. Indicates if the datapath associated with this window will cause the window to be invisible if it matches no data or visible if it matches data.
haswindowfocusTag and JSbooleanfalseread-write
 Description. Indicates if this window has the focus.
minheightTag onlynumber50final
 Description. The minimum height of this window in pixels.
minwidthTag onlynumber60final
 Description. The minimum width of this window in pixels.
stateTag and JSnumber1read-only
 Description. The stat of this window. The value is one of these: 1 (selected), 2 (not selected), 3 (dragging), 4 (disabled), and 5 (resizing).

Table 2.5. The attributes of the WindowPanel class
NameUsageTypeDefaultAccessibility
closeableTag and JSbooleanfalseread-write
 Description. Indicates if this window panel can be closed.
inset_bottomTag and JSnumber20read-write
 Description. The bottom inset for the content area in pixel.
inset_leftTag and JSnumber6read-write
 Description. The left inset for the content area in pixel.
inset_rightTag and JSnumber11read-write
 Description. The right inset for the content area in pixel.
inset_topTag and JSnumber22read-write
 Description. The top inset for the content area in pixel.
titleTag and JSstring read-write
 Description. The title of this window panel.
titlearea_inset_topTag and JSnumber6read-write
 Description. The top inset for the window title area in pixel.

Table 2.6. The attributes of the Window class
NameUsageTypeDefaultAccessibility
resizableTag and JSbooleanfalseread-write
 Description. Indicates if this window can be resized. A resizable window has a handle it its lower-right corner that the user can drag to resize the window.

The BaseWindow class adds three methods:

close()

Hides the window, the same as setting the visible attribute to false.

open()

Shows the window, the same as setting the visible attribute to true.

setVisible(visible)

Sets the visible attribute.

The WindowPanel and Window classes do not add new methods.

The windowTest1.lzx file in Listing 2.6 features an LZX application that displays a resizable window.

Listing 2.6. A resizable window
<canvas height="200" width="400">
    <window resizable="true" width="200" height="200">
        <text>OpenLaszlo is cool!</text>
    </window>
</canvas>

You can invoke the LZX application using this URL:

http://localhost:8080/lps-4.0.x/app02/windowTest1.lzx

The generated output is shown in Figure 2.7.

Figure 2.7. A Window object


You can resize the window by dragging the arrow at the right bottom corner. You can also draw the window around the canvas. If the window is nested inside a container, such as a view, the window can move beyond the container.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset