/*----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Fever Framework code. The Initial Developer of the Original Code is Romain Ecarnot. Portions created by Initial Developer are Copyright (C) 2006 the Initial Developer. All Rights Reserved. Contributor(s): Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -----------------------------------------------------------------------------*/ import org.aswing.tree.Identifiable; import com.bourre.core.HashCodeFactory; import fvaswing.components.tree.FvTreeBinder; /** * Abstract {@link fvaswing.components.FvTree} tree item implementation to speed * up processing with big data model and manage clone item process. * *

Item is defined as {@code Identifiable}
* Extends this class to build your own tree item structure. * * @author Romain Ecarnot */ class fvaswing.components.tree.FvTreeItem implements Identifiable { //------------------------------------------------------------------------- // Private properties //------------------------------------------------------------------------- private var _sID : String; private var _value; //------------------------------------------------------------------------- // Public API //------------------------------------------------------------------------- /** * Sets new value for current item. */ public function setValue( o ) : Void { if( o != _value ) { _value = o; FvTreeBinder.notifyUpdate( getIdCode(), _value ); } } /** * Returns item value. */ public function getValue() { return _value; } /** * Returns the idCode( String ) of the instance. */ public function getIdCode() : String { return _sID; } /** * Returns item clone. * *

Overrides in subclass to build a correct clone of * your value. */ public function clone() : FvTreeItem { var o : FvTreeItem = new FvTreeItem(); o.setValue( _value ); return o; } /** * Returns item value to display in tree cell. */ public function toString() : String { return _value.toString(); } //------------------------------------------------------------------------- // Private implementation //------------------------------------------------------------------------- /** * Constructor. */ private function FvTreeItem() { _sID = String( HashCodeFactory.getKey( this ) ); } }