[Laszlo-dev] [Laszlo-checkins] r1572 - openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers
Max Carlson
max at openlaszlo.org
Tue Aug 15 17:01:23 EDT 2006
Hi Phil,
It looks like this change broke the build - drag and drop no longer
works in LzPix for swf or dhtml. You cal also run a simpler test case
at http://localhost:8080/legals/lps/includes/lfc/test/state.lzx
Let me know how it goes!
-Max
pbr at openlaszlo.org wrote:
> Author: pbr
> Date: 2006-08-15 14:20:05 -0400 (Tue, 15 Aug 2006)
> New Revision: 1572
>
> Modified:
> openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzFont.lzs
> openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs
> openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzState.lzs
> Log:
> Summary: Convert LFC to new class system in Helpers dir
>
> New Features:
>
> Bugs Fixed: LPP-2390
>
> Technical Reviewer: ptw
> QA Reviewer: (pending)
> Doc Reviewer: (pending)
>
> Documentation:
>
> Release Notes:
>
> Details:
> I also made a small modification to LzNode.lzs to define $isstate:
> var $isstate = false;
> $isstate is used in a few places in the code so I did NOT convert those
> files to use the preferred,
> this instanceof LZState
> This variable is used to detect if the object is of type LZState. This
> can
> be done at a later date once the whole class system has been converted.
>
> Tests:
>
> Files:
> M LzFont.lzs
> M LzSelectionManager.lzs
> M LzState.lzs
>
>
> Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzFont.lzs
> ===================================================================
> --- openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzFont.lzs 2006-08-15 18:18:34 UTC (rev 1571)
> +++ openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzFont.lzs 2006-08-15 18:20:05 UTC (rev 1572)
> @@ -10,6 +10,8 @@
> //=============================================================================
> // DEFINE OBJECT: LzFont
>
> +class LzFont {
> +
> // @keywords private_constructor
> // @field String style: The style of the font; one of "plain", "bold", "italic", or
> // @field String name: The name of this font
> @@ -23,7 +25,9 @@
> // @field [Number] rsbtable: Array of character right-side-bearings indexed
> // by character codes (typically ASCII).
> //=============================================================================
> -function LzFont ( fontobject , attrs , style ){
> +function initialize ( fontobject , attrs , style ){
> + super.initialize(fontobject, attrs, style);
> +
> //@field String name: The name of this <b><i>LzFont</i></b>.
> this.name = fontobject.name;
> //@field String style: The style of this <b><i>LzFont</i></b>.
> @@ -47,8 +51,10 @@
>
> //this is a constant set in the textfield the runtime uses. should match the
> //value set in SWFWriter.java
> -LzFont.prototype.leading = 2;
> +var leading = 2;
>
> -LzFont.prototype.toString = function (){
> +function toString (){
> return "Font style " + this.style + " of name " + this.name;
> }
> +
> +} // End of LzFont
>
> Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs
> ===================================================================
> --- openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs 2006-08-15 18:18:34 UTC (rev 1571)
> +++ openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs 2006-08-15 18:20:05 UTC (rev 1572)
> @@ -13,7 +13,7 @@
> // @field Boolean toggle: If true, a re-selected element will lose
> // the selection.
> //=============================================================================
> -var LzSelectionManager = Class( "LzSelectionManager" , LzNode );
> +class LzSelectionManager extends LzNode {
>
> //------------------------------------------------------------------------------
> // @param LzView view: A view above this one in the hierarchy that will determine
> @@ -27,7 +27,7 @@
> //
> // @keywords private
> //------------------------------------------------------------------------------
> -LzSelectionManager.prototype.construct= function ( view , args ) {
> +function construct ( view , args ) {
> super.construct( view , args );
>
> this.toggle = args.toggle == true;
> @@ -47,7 +47,7 @@
> // Called with a new member to be selected.
> // @param o: The new element that got selected.
> //-----------------------------------------------------------------------------
> -LzSelectionManager.prototype.select = function ( o ){
> +function select ( o ){
> if ( this.isSelected( o ) && ( this.toggle ||
> this.isMultiSelect( o ) ) ) {
> this.unselect( o );
> @@ -73,7 +73,7 @@
> // @param o: The object to test for selectedness.
> // @return: The selectedness of the input object.
> //-----------------------------------------------------------------------------
> -LzSelectionManager.prototype.isSelected = function ( o ) {
> +function isSelected ( o ) {
> return this.selectedHash[ o.getUID() ];
> }
>
> @@ -82,7 +82,7 @@
> // @keywords private
> // @param s: The object to make selected
> //-----------------------------------------------------------------------------
> -LzSelectionManager.prototype.makeSelected = function ( s ) {
> +function makeSelected ( s ) {
> if ( this.selectedHash[ s.getUID() ] ) return;
>
> //@field selectedHash: A hash of currently selected objects (by UID)
> @@ -98,7 +98,7 @@
> // @keywords protected
> // @param o: The object to make unselected
> //-----------------------------------------------------------------------------
> -LzSelectionManager.prototype.unselect = function ( o ){
> +function unselect ( o ){
> for ( var i= this.selected.length-1 ; i >= 0; i-- ){
> if ( this.selected[ i ] == o ) {
> this.selectedHash[ o.getUID() ] = false;
> @@ -112,7 +112,7 @@
> //-----------------------------------------------------------------------------
> // Unselects any selected objects.
> //-----------------------------------------------------------------------------
> -LzSelectionManager.prototype.clearSelection = function (){
> +function clearSelection (){
> var s;
> while ( s = this.selected.pop()){
> s[ this.sel ] ( false );
> @@ -127,14 +127,14 @@
> //
> // @return Array: An array representing the current selection.
> //-----------------------------------------------------------------------------
> -LzSelectionManager.prototype.getSelection = function (){
> +function getSelection (){
> return this.selected;
> }
>
> //-----------------------------------------------------------------------------
> // @keywords private
> //-----------------------------------------------------------------------------
> -LzSelectionManager.prototype.selectRange = function ( s , e ){
> +function selectRange ( s , e ){
> var pview = s.immediateparent;
>
> var svs = pview.subviews;
> @@ -162,7 +162,7 @@
> // @keywords protected
> // @return Boolean: If true, multi select. If false, don't multi select
> //------------------------------------------------------------------------------
> -LzSelectionManager.prototype.isMultiSelect = function ( ){
> +function isMultiSelect ( ){
> return LzKeys.isKeyDown( "control" );
> }
>
> @@ -172,28 +172,31 @@
> // @keywords protected
> // @return Boolean: If true, range select. If false, don't range select
> //------------------------------------------------------------------------------
> -LzSelectionManager.prototype.isRangeSelect = function( ){
> +function isRangeSelect( ){
> return LzKeys.isKeyDown( "shift" );
> }
>
> -LzSelectionManager.prototype.toString = function (){
> +function toString (){
> return "LzSelectionManager";
> }
>
> +} // End of LzSelectionManager
> +
> +
> //=============================================================================
> // Implements same functionality as a normal selection manager, but without
> // storing view references, which become invalid as views created by a datapath
> // that uses lazy replication do. Does this by storing subview numbers.
> //=============================================================================
> -var LzDataSelectionManager = Class( "LzDataSelectionManager" ,
> - LzSelectionManager );
>
> +class LzDataSelectionManager extends LzSelectionManager {
> +
> //------------------------------------------------------------------------------
> // Makes the given view selected
> // @keywords protected
> // @param LzView o: The view to be selected
> //------------------------------------------------------------------------------
> -LzDataSelectionManager.prototype.makeSelected = function ( o ){
> +function makeSelected ( o ){
> var so = o.datapath.p;
> if ( this.manager == null ) this.manager = o.cloneManager;
> if ( so.sel ) return;
> @@ -206,7 +209,7 @@
> // Unselect the given view
> // @param LzView o: The view to be unselected
> //------------------------------------------------------------------------------
> -LzDataSelectionManager.prototype.unselect = function ( o ){
> +function unselect ( o ){
> var so = o.datapath.p;
> so.sel = false;
> for ( var i= this.selected.length-1 ; i >= 0; i-- ){
> @@ -225,7 +228,7 @@
> // @param LzDataPath s: The datapath that was at top of the selection stack
> // @param LzView e: The newly selected view
> //------------------------------------------------------------------------------
> -LzDataSelectionManager.prototype.selectRange = function ( s , e ){
> +function selectRange ( s , e ){
> var nodes = this.manager.nodes;
>
> var st = -1;
> @@ -266,7 +269,7 @@
> // Returns a list of datapointers, which point to the selected records
> // @return Array: A list of datapointers
> //------------------------------------------------------------------------------
> -LzDataSelectionManager.prototype.getSelection = function (){
> +function getSelection (){
> var r = [];
> for ( var i = 0; i < this.selected.length ; i++ ){
> r.push( new LzDatapointer( null , {pointer : this.selected[i] }));
> @@ -279,7 +282,7 @@
> // list
> //
> //------------------------------------------------------------------------------
> -LzDataSelectionManager.prototype.clearSelection = function ( ){
> +function clearSelection ( ){
> while ( this.selected.length ){
> var p = this.selected.pop();
> p.sel = false;
> @@ -292,7 +295,7 @@
> // Tests whether the given view is selected
> // @param LzView o: The view to test for selectedness
> //------------------------------------------------------------------------------
> -LzDataSelectionManager.prototype.isSelected = function ( o){
> +function isSelected ( o){
> return o.datapath.p.sel;
> }
>
> @@ -303,7 +306,7 @@
> // @param Boolean val: new value for selected
> // @keywords private
> //------------------------------------------------------------------------------
> -LzDataSelectionManager.prototype.__LZsetSelected = function ( p, val ){
> +function __LZsetSelected ( p, val ){
> var cl = this.manager.getCloneForNode( p, true );
> if (cl) {
> cl.datapath[this.sel](val);
> @@ -311,3 +314,5 @@
> p.sel = val;
> }
> }
> +
> +} // End of LzDataSelectionManager
>
> Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzState.lzs
> ===================================================================
> --- openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzState.lzs 2006-08-15 18:18:34 UTC (rev 1571)
> +++ openlaszlo/branches/legals/WEB-INF/lps/lfc/helpers/LzState.lzs 2006-08-15 18:20:05 UTC (rev 1572)
> @@ -12,10 +12,10 @@
> //
> //=============================================================================
>
> -var LzState = Class( "LzState" , LzNode );
> +class LzState extends LzNode {
>
> -DeclareEvent(LzState.prototype, 'onapply' );
> -DeclareEvent(LzState.prototype, 'onremove' );
> +DeclareEvent(prototype, 'onapply' );
> +DeclareEvent(prototype, 'onremove' );
>
> // @field Boolean apply: <code>setAttribute('apply', true)</code> will
> // apply the state. <code>setAttribute('apply', false)</code> will
> @@ -31,36 +31,36 @@
> // state can only be called after the state is applied, and upon
> // application <code>this</code> will refer to the view that encloses
> // the state, rather than the state itself.
> -LzState.prototype.setters.apply = "setApply";
> -LzState.prototype.setters.$setters = null;
> +setters.apply = "setApply";
> +setters.$setters = null;
> //---
> //@keywords private
> //---
> -LzState.prototype.setters.$delegates = "__LZstoreDelegates";
> +setters.$delegates = "__LZstoreDelegates";
> //---
> //@keywords private
> //---
> -LzState.prototype.setters.$refs = "checkRefs";
> -LzState.prototype.setters.$delegates = "checkDelegates";
> -LzState.prototype.staterefs = { apply : true };
> -LzState.prototype.stateevents = { onremove : true , onapply : true };
> -LzState.prototype.$isstate = true;
> -LzState.prototype.asyncnew = false;
> -LzState.prototype.setters.asyncnew = "__LZsetProperty";
> +setters.$refs = "checkRefs";
> +setters.$delegates = "checkDelegates";
> +var staterefs = { apply : true };
> +var stateevents = { onremove : true , onapply : true };
> +$isstate = true; // Defined in LzNode
> +var asyncnew = false;
> +setters.asyncnew = "__LZsetProperty";
>
> //@field pooling: If true, the state will merely hide any views it has created
> //when it is removed, instead of destroying them.
> -LzState.prototype.setters.pooling = "__LZsetProperty";
> +setters.pooling = "__LZsetProperty";
>
> // When __LZsourceLocation is set, it should only apply to the state,
> // not the parent
> // @keywords private
> -LzState.prototype.setters.__LZsourceLocation = "__LZsetProperty";
> +setters.__LZsourceLocation = "__LZsetProperty";
>
> //------------------------------------------------------------------------------
> // @keywords private
> //------------------------------------------------------------------------------
> -LzState.prototype.construct = function ( parent , args ){
> +function construct ( parent , args ){
> super.construct( parent , args );
> this.heldArgs = {};
> this.appliedChildren = [];
> @@ -70,7 +70,7 @@
> //------------------------------------------------------------------------------
> // @keywords private
> //------------------------------------------------------------------------------
> -LzState.prototype.createChildren = function ( carr ){
> +function createChildren ( carr ){
> this.subh = carr;
> this.__LZinstantiationDone();
> }
> @@ -79,7 +79,7 @@
> //------------------------------------------------------------------------------
> // @keywords private
> //------------------------------------------------------------------------------
> -LzState.prototype.setApply = function ( doapply ){
> +function setApply ( doapply ){
> if ( typeof(doapply) == 'function' ){
> // this happens because there is an attribute with the same name as
> //a function and both attributes and functions are sent in
> @@ -105,7 +105,7 @@
> // Applies the state to the state's parent. If the state is already applied,
> // has no effect
> //------------------------------------------------------------------------------
> -LzState.prototype.apply = function ( ){
> +function apply ( ){
> //@field Boolean isapplied: true if the state is currently applied
> if ( this.isapplied ){
> return;
> @@ -147,7 +147,7 @@
> // method does not currently restore the previous values of any attributes that
> // were changed by the state
> //------------------------------------------------------------------------------
> -LzState.prototype.remove = function () {
> +function remove () {
> if ( !this.isapplied ){
> return;
> }
> @@ -189,7 +189,7 @@
> // Clean up after yourself
> // @keywords private
> //---
> -LzState.prototype.destroy = function ( ) {
> +function destroy ( ) {
> // stop pooling
> this.pooling = false;
> // clean up delegates and views
> @@ -202,7 +202,7 @@
> //-----------------------------------------------------------------------------
> // @keywords private
> //-----------------------------------------------------------------------------
> -LzState.prototype.__LZapplyArgs = function ( args ){
> +function __LZapplyArgs ( args ){
> var oset = {};
> for ( var a in args ){
> //handle flash bug where objects slots are enumerated multiple times
> @@ -221,7 +221,7 @@
> //-----------------------------------------------------------------------------
> // @keywords private
> //-----------------------------------------------------------------------------
> -LzState.prototype.checkRefs = function ( refs ){
> +function checkRefs ( refs ){
> var parrefs = {};
> var myrefs = {};
>
> @@ -248,7 +248,7 @@
> //-----------------------------------------------------------------------------
> // @keywords private
> //-----------------------------------------------------------------------------
> -LzState.prototype.checkDelegates = function ( delarr ){
> +function checkDelegates ( delarr ){
> var pardels = [];
> var mydels = [];
>
> @@ -292,21 +292,21 @@
> //-----------------------------------------------------------------------------
> // @keywords private
> //-----------------------------------------------------------------------------
> -LzState.prototype.__LZsetProperty = function ( prop, propname ){
> +function __LZsetProperty ( prop, propname ){
> this[propname] = prop;
> }
>
> //-----------------------------------------------------------------------------
> // @keywords private
> //-----------------------------------------------------------------------------
> -LzState.prototype.__LZstoreDelegates = function ( delarr ){
> +function __LZstoreDelegates ( delarr ){
> this.heldArgs.$delegates = delarr;
> }
>
> //-----------------------------------------------------------------------------
> // @keywords private
> //-----------------------------------------------------------------------------
> -LzState.prototype.__LZdetach = function ( aview ){
> +function __LZdetach ( aview ){
> aview.setVisible( false );
> return aview;
> }
> @@ -314,7 +314,9 @@
> //=============================================================================
> // @keywords private
> //=============================================================================
> -LzState.prototype.__LZretach = function ( aview ){
> +function __LZretach ( aview ){
> aview.setVisible( true );
> return aview;
> }
> +
> +} // End of LzState
>
> _______________________________________________
> Laszlo-checkins mailing list
> Laszlo-checkins at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins
More information about the Laszlo-dev
mailing list