Author: ben
Date: 2007-11-14 17:16:43 -0800 (Wed, 14 Nov 2007)
New Revision: 7279
Added:
openlaszlo/trunk/lps/components/lz/alert.lzx
openlaszlo/trunk/lps/components/lz/modaldialog.lzx
Modified:
openlaszlo/trunk/lps/components/lz/library.lzx
openlaszlo/trunk/lps/components/lz/window.lzx
Log:
Change 20071114-ben-Q by [EMAIL PROTECTED] on 2007-11-14 17:12:09 PST
in /Users/ben/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Make alert, window, and modaldialog all have reference pages.
New Features:
Bugs Fixed: LPP-4986 Refguide 'alert' page has the wrong content
Doc Reviewer: lou
Documentation:
lz/window.lzx included the definition of three classes: alert,
window, and modaldialog. The doc system seems to only generate
doc for the first class in a file. I split lz/window.lzx up
into three files, one for each class.
This risked breaking includes, because users expect
<alert> to be defined when they include lz/window.lzx.
I made window.lzx include the two files I just created,
to avoid any such problems.
Tests:
Good data in each of these:
http://localhost:8080/trunk/docs/reference/lz.window.html
http://localhost:8080/trunk/docs/reference/lz.alert.html
http://localhost:8080/trunk/docs/reference/lz.modaldialog.html
This test still works:
http://localhost:8080/trunk/test/components/lz/test-window.lzx
Added: openlaszlo/trunk/lps/components/lz/alert.lzx
Property changes on: openlaszlo/trunk/lps/components/lz/alert.lzx
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: openlaszlo/trunk/lps/components/lz/library.lzx
===================================================================
--- openlaszlo/trunk/lps/components/lz/library.lzx 2007-11-15 01:16:31 UTC
(rev 7278)
+++ openlaszlo/trunk/lps/components/lz/library.lzx 2007-11-15 01:16:43 UTC
(rev 7279)
@@ -27,6 +27,8 @@
<include href="hscrollbar.lzx"/>
<include href="vscrollbar.lzx"/>
<include href="window.lzx"/>
+ <include href="modaldialog.lzx"/>
+ <include href="alert.lzx"/>
<include href="windowpanel.lzx"/>
<include href="tabs.lzx"/>
Added: openlaszlo/trunk/lps/components/lz/modaldialog.lzx
Property changes on: openlaszlo/trunk/lps/components/lz/modaldialog.lzx
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: openlaszlo/trunk/lps/components/lz/window.lzx
===================================================================
--- openlaszlo/trunk/lps/components/lz/window.lzx 2007-11-15 01:16:31 UTC
(rev 7278)
+++ openlaszlo/trunk/lps/components/lz/window.lzx 2007-11-15 01:16:43 UTC
(rev 7279)
@@ -8,6 +8,8 @@
<include href="lz/windowpanel.lzx" />
<include href="utils/layouts/simplelayout.lzx"/>
<include href="utils/layouts/resizelayout.lzx"/>
+ <include href="lz/modaldialog.lzx" />
+ <include href="lz/alert.lzx" />
<class name="window" extends="windowpanel">
<attribute name="defaultplacement" value="wcontent" type="string"/>
@@ -76,210 +78,8 @@
</class>
- <!--- A modal dialog window. -->
- <class name="modaldialog" extends="windowpanel"
- x="${(immediateparent.width - this.width)/2}"
- y="${(immediateparent.height - this.height)/3}"
- focustrap="true"
- visible="false">
+
- <!--- The left inset for the dialog contents from the edge of the
- window inner frame. -->
- <attribute name="content_inset_left" value="14"/>
- <!--- The top inset for the dialog contents from the edge of the window
- inner frame. -->
- <attribute name="content_inset_top" value="10"/>
- <!--- The right inset for the dialog contents from the edge of the
- window inner frame -->
- <attribute name="content_inset_right" value="14"/>
- <!--- The bottom inset for the dialog contents from the edge of the
- window inner frame. -->
- <attribute name="content_inset_bottom" value="10"/>
-
- <!--- @keywords private -->
- <attribute name="defaultplacement" value="mdcontent" type="string"/>
- <view name="mdpadding"
- width="${mdcontent.width + parent.content_inset_left +
parent.content_inset_right}"
- height="${mdcontent.height + parent.content_inset_top +
parent.content_inset_bottom}">
- <view x="${classroot.content_inset_left}"
y="${classroot.content_inset_top}"
- name="mdcontent">
- <state apply="${!classroot._usecontentwidth}">
- <attribute name="width" value="${parent.immediateparent.width
- - classroot.content_inset_left-
classroot.content_inset_right }"/>
- </state>
- <state apply="${!classroot._usecontentheight}">
- <attribute name="height"
- value="${parent.immediateparent.height
- - classroot.content_inset_top-
classroot.content_inset_bottom}"/>
- </state>
- <!-- this is the "defaultplacement" view -->
- </view>
- </view>
-
- <!--- Opens the dialog (use this method, not setVisible). While the
- dialog is open, the user will not be able to interact with other
- windows or UI elements in the application. -->
- <method name="open">
- //need to show this before taking the mode, so that any default
- //buttons contained by the this window will get hasdefault=true
- this.setVisible( true );
- LzModeManager.makeModal( this );
- this.bringToFront();
- </method>
-
- <!--- Closes the dialog. -->
- <method name="close">
- this.setVisible( false );
- LzFocus.clearFocus();
- LzModeManager.release( this );
- </method>
-
- <!--- @keywords private -->
- <method name="passModeEvent" args="event_name, view">
- return false;
- </method>
- </class>
-
-
- <class name="alert" extends="modaldialog">
-
- <!--- Alert shows only this button, if button2 isn't set. Default:
"OK".
- You may specify a different string to change the text of the
- button. -->
- <attribute name="button1" value="OK" type="string"/>
-
- <!--- If a string is set for this attribute, a second button will be
- shown to the left of the first with this text. -->
- <attribute name="button2" value="" type="string"/>
-
- <!--- After the alert is closed, this is set to true if button1 ("OK")
- is pressed or false if button2 is pressed. You can check for the
- result value using the onresult event. -->
- <attribute name="result" value="null"/>
-
- <!--- The x position of the button text. Default: 0 (left). -->
- <attribute name="text_x" value="0" type="number"/>
- <!--- The y position of the button text. Default: 0 (top). -->
- <attribute name="text_y" value="0" type="number"/>
-
- <!--- Minimum width for the alert. Default: 100 for a 1 button alert,
- 170 for a 2 button alert.
- @keywords final -->
- <attribute name="minwidth" value="$once{button2 == '' ? 100 : 170}"/>
-
- <!--- This event is sent when a button is pressed. Use this to check
the
- result value. -->
- <event name="onresult"/>
-
- <!--- The max length of a line of text before it wraps. Default: 1/3 of
- the parent's width - width of window dressing and margin. -->
- <attribute name="maxtextwidth"
- value="${Math.round(parent.width/3) - inset_left - inset_right
- - content_inset_left - content_inset_right}"/>
-
- <text name="alerttext" x="${parent.text_x}" y="${parent.text_y}"
- resize="true" text="${parent.text}" multiline="true">
- <method name="setText" args="t">
- super.setText(t);
- if (!parent._usecontentwidth) {
- this.setWidth(parent.width
- - parent.inset_left - parent.inset_right
- - parent.content_inset_left -
parent.content_inset_right );
- } else {
- var twidth = this.getTextWidth();
- if (twidth > parent.maxtextwidth) {
- // multiline text looks funny unless its a bit wider
- // since there is always extra space on the right
- twidth = parent.maxtextwidth;
- }
- this.setWidth(twidth);
- }
- </method>
- </text>
-
- <!--- Opens the alert window. -->
- <method name="open" >
- this.result = null;
- if ( this.onresult ){
- this.onresult.sendEvent( null );
- }
- super.open();
- </method>
-
- <!--- Closes the alert window. This method is used by the alert
- button(s). If button1 is clicked, close is passed a true value.
If
- button2 is clicked, close is passed a false value.
- @param Boolean res: a boolean result value. -->
- <method name="close" args="res">
- this.result = res;
- if ( this.onresult ){
- this.onresult.sendEvent( res);
- }
- super.close();
- </method>
-
- <view x="${immediateparent.width > this.width?
- immediateparent.width - this.width : 0}"
- y="${immediateparent.alerttext.height + parent.content_inset_top}">
- <simplelayout axis="x" spacing="5"/>
- <button onclick="classroot.close( false )"
- text="${classroot.button2}"
- visible="${classroot.button2 != '' }">
- </button>
- <button isdefault="true" onclick="classroot.close( true )"
- text="${classroot.button1}"
- visible="${classroot.button1 != '' }"
- name="b1">
- </button>
- </view>
- <doc>
- <tag name="shortdesc"><text>
- A window.
- </text></tag>
- <text>
-
- <p>The <tagname>window</tagname> tag creates a floating view that
may
- be moved and optionally resized by the user. Set the
- <attribute>closeable</attribute> attribute to <code>true</code>
in
- order to show a window close button.</p>
-
- <example>
- <canvas height="250">
- <window x="10" y="10" width="300" height="200"
- title="my window"
- resizable="true" closeable="true">
- <text>Hello</text>
- </window>
- </canvas>
- </example>
-
- <p>Views placed within a <tagname>window</tagname> tag will be
placed
- inside the smaller content area within the window. Because of
this,
- you will often want to constrain to the dimensions of the content
- area, rather than to the window dimensions. To do this, tags
placed
- within a window can use the <field>immediateparent</field>
property
- rather than the <field>parent</field> property.</p>
-
- <example title="Sizing to the content area">
- <canvas height="150">
- <window x="10" y="10" width="200" height="100"
- resizable="true">
- <button width="${immediateparent.width}"
- height="${immediateparent.height}">
- This is a really big button
- </button>
- </window>
- </canvas>
- </example>
-
- <seealso>
- <tags>modaldialog alert</tags>
- </seealso>
- </text>
- </doc>
-
- </class>
-
</library>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins