Interal getter/setters

This has been bothering me for a bit now and I still haven't
found the reason anywhere.
the following code is acceptable in Flex:
[Bindable(event="someEvent")]
public function get xxx():String {..}
[Bindable(event="someEvent")]
private function get xxx():String {..}
[Bindable(event="someEvent")]
protected function get xxx():String {..}
but the following:
[Bindable(event="someEvent")]
internal function get xxx():String {..}
gives me an error in flex builder saying that data binding
won't be detected. what's wrong with using "internal"?

Let me brake my question to two:
1. in My JSP page, I need to get an exception from either the entity or the view class if I insert a duplicate value into the associated table. How can I do that?You can mark the attribute as unique key attribute and choose to implement the unique-key validation in the Bc4J side. See help on UniqueKey and how to establish such validation
2. How can I access the entity's getter/setter functions in the JSP page?You cannot access entities directly. You have to expose the accessors via ViewObject Rows and use those Rows from the JSP/or any client side.
Thank you

Similar Messages

  • Great Idea: Property Annotations alternative to getter/setters

    Currently, a huge amount of Java objects use property fields with getter/setter accessors:
    class MyClass
         protected int xyz;
         public int getXyz() {
              return xyz;
         public int setXyz(int xyz) {
              this.xyz = xyz;
    }.NET uses a slightly simpler syntax which internally generates getter/setter methods:
    class MyClass
         protected int xyz;
         public int Xyz {
              get {
                   return xyz;
              set {
                   xyz = value;
    }Most of the time (90%+), the getters and setters just set/return. Of course, there are times where it's necessary to implement additional logic without changing the interface presented to other classes. However, there are lots of cases where there is huge amounts of trivial getter/setter code. Also, it takes effort to maintain the getters/setters, when fields are added, deleted, or renamed.
    Wouldn't it be much nicer to have trivial getters/setters implied via annotations? Instead of the above examples, do:
    class MyClass
         // defaults to providing both getter and setter.
         @PublicProperty
         protected int xyz;
    }You could have variants for protected access, private access, and parameters for getter only or setter only. And, you would continue to use the traditional syntax when you want to do non-trivial getter/setter logic.
    The big advantage is that this syntax would be much easier to maintain. Much less code to scroll through. Much easier to rename fields. Easier to delete fields. Easier to add new fields without relying on IDE "generate getter/setter" features.
    What does everyone think?

    MelGohan + dizzy,
    Java Beans and every library and framework built on top of Java Beans (such as JSF and EJB 3.0) require getters/setters; they aren't an optional design consideration. I could avoid such libraries entirely, but that is extreme.
    aconst_null + YAT,
    Interesting point about annotation limitations. However, Java Beans based frameworks such as JSF and EJB 3.0 could have support for such annotations. For example, in JSF, when you use {#bean.property}, the framework could check for getProperty()/setProperty() or check for an annotated instance variable named "property".
    Or maybe there should be a language level solution to this rather than an annotation-based patch. Any time there is a large volume of rubber stamp code like this, there is probably a better design.

  • How to access getter/setters from the entity classes

    Let me brake my question to two:
    1. in My JSP page, I need to get an exception from either the entity or the view class if I insert a duplicate value into the associated table. How can I do that?
    2. How can I access the entity's getter/setter functions in the JSP page?
    Thank you

    Let me brake my question to two:
    1. in My JSP page, I need to get an exception from either the entity or the view class if I insert a duplicate value into the associated table. How can I do that?You can mark the attribute as unique key attribute and choose to implement the unique-key validation in the Bc4J side. See help on UniqueKey and how to establish such validation
    2. How can I access the entity's getter/setter functions in the JSP page?You cannot access entities directly. You have to expose the accessors via ViewObject Rows and use those Rows from the JSP/or any client side.
    Thank you

  • Custom component/tag class:  ---which setters/getters do what?

    Hi
    I'm trying to create a custom component, but, there is a major concept that I do not understand...
    ---What are the setters/getters in the "component" class used for?...
    ---What are the setters/getters in the "tag" class used for?
    Another way of asking is...
    ---Which setters/getters are used simply to keep track of attribute name/id/key?
    ---Which setters and getters refer to the actual objects that the attribute names point to?
    The reason for my confusion is that nearly all "custom component" examples I've seen thus far, utilize attributes that point to "String" objects... (i.e., as opposed to ArrayList, HashMap, etc)...
    This makes it difficult for me to distinguish whether the String values in the getters/setters are referring to the String name/"id" of the attribute...or, the String "value" of the attribute...
    I have not been able to verify how I should code the getter/setters (and type casts) for other kinds of objects like ArrayLists, HashMaps, etc
    For example, a typical logic mechanism Ive seen in the custom "tag" examples is as follows...
    in a "tag" class...
            if( tabledata != null )
                if (isValueReference (tabledata))
                    FacesContext context = FacesContext.getCurrentInstance ();
                    Application app = context.getApplication ();
                    ValueBinding vb = app.createValueBinding (tabledata);
                    component.setValueBinding ("tabledata", vb);
                else
                    component.getAttributes ().put ("tabledata", tabledata);
    in the "component" class...
        public void setTabledata (List tabledata)
            this.tabledata = tabledata;
        public List getTabledata ()
            if(null != tabledata)
                return tabledata;
            ValueBinding _vb = getValueBinding ("tabledata");
            if(_vb != null)
                return (List)_vb.getValue (getFacesContext ());
            else
                return null;
        }...considering the above code,
    ---when/where should the "tabledata" variable be referring the "name/id" of the attribute?...
    ---when/where should the "tabledata" variable be referring to the "value" of the attribute?...
    ...as, I need to change the type casting to adjust to what it should be...
    ***NOTE: This is one error that I'm getting, and I believe it is because I do not understand how getter/setter is used in "component" and "tag" classe, i.e., :
    "org.apache.jasper.JasperException: jsp.error.beans.property.conversion
         org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)"...
    Thanks for any help on this!
    sd

    The "tabledata" variable always refers the local value of the attribute.
    When using a value binding to some backing bean,
    the local value is null and the model value is owned by the bean.
    You don't need any casting in the tag class nor the component class.
    The setters/getters in the component class specify the type of the attributes.
    Conversion from/to String to/from the type is done automatically if possible.
    When the automatic conversion is impossible, you should specify f:converter
    for the attribute.

  • How can I get the reset button to work?

    When you click on the reset button, this error below comes up. If you can't find the button it is the navy colored rectangular thing in the lower left corner of page.
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
        at flash.display::DisplayObjectContainer/removeChild()
        at AddATree2/onReset()
    Here is the code:
    THERE IS AN ATTACHED .FLA AND 3 AS FILES, RESET, TREE, AND ADDATREE2
    Appreciate your thoughts!  w_sights
    ADDATREE2.AS
    /* AS3
        Copyright 2008 __MyCompanyName__.
    package
         *    Class description.
         *    @langversion ActionScript 3.0
         *    @playerversion Flash 9.0
         *    @author
         *    @since  19.05.2009
        import flash.display.Sprite;
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        import flash.events.Event;
        import flash.utils.Timer;
        import flash.text.TextField;
        import flash.text.TextFormat;
        import flash.text.StyleSheet;
        import Reset;
        import Tree;
        public class AddATree2 extends MovieClip {
            // CLASS CONSTANTS
             //  CONSTRUCTOR
             *    @Constructor
            public function AddATree2(){
                reset.addEventListener( MouseEvent.CLICK, onReset ) ;
                reset.buttonMode = true ;
                reset.mouseChildren = false;
                mcAdd.addEventListener ( MouseEvent.CLICK , onClick ) ;
                mcAdd.buttonMode = true ;
                mcAdd.mouseChildren = false;
                //var reset_btn:reset = new reset();
            //  PRIVATE VARIABLES
                private var clickCount:Number = 0;
            //  PUBLIC VARIABLES
                public var reset:MovieClip = new MovieClip();
            //  GETTER/SETTERS
            //  PUBLIC METHODS
            //  EVENT HANDLERS
            private function onClick ( evt : MouseEvent ) : void
                clickCount++;
                switch(clickCount)
                    case 1:
                            var tree = new Tree ( ) ;
                            addChild ( tree ) ;
                            tree.x = 430;
                            tree.y = 300;
                            tree.scaleX = .95;
                            tree.scaleY = .95;
                            var brickham:BrickhamScriptProBMP = new BrickhamScriptProBMP();
                            var fmt:TextFormat = new TextFormat();
                            fmt.font =  brickham.fontName;
                            fmt.size = 58;
                            /*var regularText:TextField =  new TextField();
                            regularText.autoSize = "left";
                            regularText.embedFonts = true;
                            regularText.defaultTextFormat = fmt;
                            //regularText.text = "Merry Christmas"
                            addChild(regularText);
                            var css:StyleSheet = new StyleSheet();
                            css.setStyle("p", {fontFamily:brickham.fontName, fontSize:78,color:"#FFFFFF"});
                            //css.setStyle("a", {textDecoration:"underline"});
                            var webText:TextField = new TextField();
                            webText.autoSize = "left";
                            webText.embedFonts = true;
                            webText.styleSheet = css;
                            webText.htmlText = "<p>Merry Christmas</p>";
                            webText.x = 52;
                            webText.y = 41;
                            addChild(webText);
                            break;
                    case 2:
                            var tree2 = new Tree();
                            addChild(tree2);
                            tree2.x = 175;
                            tree2.y = 450;
                            tree2.scaleX = .65;
                            tree2.scaleY = .65;
                            break;
                    case 3:
                            var tree3 = new Tree();
                            addChild(tree3);
                            tree3.x = 45;
                            tree3.y = 365;
                            tree3.scaleX = .45;
                            tree3.scaleY = .45;
                            break;
               /*     case 4:
                            var tree4 = new Tree();
                            addChild(tree4);
                            tree4.x = 660;
                            tree4.y = 195;
                            tree4.scaleX = .25;
                            tree4.scaleY = .25;
                            break;
            //mcAdd.removeEventListener ( MouseEvent.CLICK , onClick ) ;
            //  PRIVATE & PROTECTED INSTANCE METHODS
            /*reset_btn.addEventListener(MouseEvent.CLICK, resetButton);*/
            function onReset(event:MouseEvent)
                var webText:TextField = new TextField();
                var reset:MovieClip = new MovieClip();
                reset.x = 450;
                reset.y = 500;
                reset.scaleX = .01;
                reset.scaleY = .01;
                addChild(reset);
                stage.addEventListener(MouseEvent.CLICK, removeWebText);
                var tree = new Tree();
                removeChild(tree);
                var tree2 = new Tree();
                removeChild(tree2);
                var tree3 = new Tree();
                removeChild(tree3);
            public function removeWebText(event:MouseEvent):void
                var webText:TextField = new TextField();
                var fmt:TextFormat = new TextFormat();
                removeChild(webText);
    TREE.AS
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        public class Tree extends MovieClip
            function Tree()
                addEventListener ( Event.ADDED_TO_STAGE , onAddedToStage ) ;
            private function onAddedToStage ( evt : Event ) : void
                width = stage.stageWidth ;
                height = stage.stageHeight ;
    RESET.AS
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        public class Reset extends MovieClip
            function Reset()
                addEventListener ( Event.ADDED_TO_STAGE , onAddedToStage ) ;
            private function onAddedToStage ( evt : Event ) : void
                width = stage.stageWidth ;
                height = stage.stageHeight ;

    Hello:
    Thank you for responding so quickly.
    I have added child and it has removed the error. However, the button icon has disappeared as you can see when you play the .swf and the reset button doesn't clear the stage of everything but the star and the back ground.
    See new code:
    /* AS3
        Copyright 2008 __MyCompanyName__.
    package
         *    Class description.
         *    @langversion ActionScript 3.0
         *    @playerversion Flash 9.0
         *    @author
         *    @since  19.05.2009
        import flash.display.Sprite;
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        import flash.events.Event;
        import flash.utils.Timer;
        import flash.text.TextField;
        import flash.text.TextFormat;
        import flash.text.StyleSheet;
        import Reset;
        import Tree;
        public class AddATree2 extends MovieClip {
            // CLASS CONSTANTS
             //  CONSTRUCTOR
             *    @Constructor
            public function AddATree2(){
                reset.addEventListener( MouseEvent.CLICK, onReset ) ;
                reset.buttonMode = true ;
                reset.mouseChildren = false;
                mcAdd.addEventListener ( MouseEvent.CLICK , onClick ) ;
                mcAdd.buttonMode = true ;
                mcAdd.mouseChildren = false;
                //var reset_btn:reset = new reset();
            //  PRIVATE VARIABLES
                private var clickCount:Number = 0;
            //  PUBLIC VARIABLES
                public var reset:MovieClip = new MovieClip();
            //  GETTER/SETTERS
            //  PUBLIC METHODS
            //  EVENT HANDLERS
            private function onClick ( evt : MouseEvent ) : void
                clickCount++;
                switch(clickCount)
                    case 1:
                            var tree = new Tree ( ) ;
                            addChild ( tree ) ;
                            tree.x = 430;
                            tree.y = 300;
                            tree.scaleX = .95;
                            tree.scaleY = .95;
                            var brickham:BrickhamScriptProBMP = new BrickhamScriptProBMP();
                            var fmt:TextFormat = new TextFormat();
                            fmt.font =  brickham.fontName;
                            fmt.size = 58;
                            /*var regularText:TextField =  new TextField();
                            regularText.autoSize = "left";
                            regularText.embedFonts = true;
                            regularText.defaultTextFormat = fmt;
                            //regularText.text = "Merry Christmas"
                            addChild(regularText);
                            var css:StyleSheet = new StyleSheet();
                            css.setStyle("p", {fontFamily:brickham.fontName, fontSize:78,color:"#FFFFFF"});
                            //css.setStyle("a", {textDecoration:"underline"});
                            var webText:TextField = new TextField();
                            webText.autoSize = "left";
                            webText.embedFonts = true;
                            webText.styleSheet = css;
                            webText.htmlText = "<p>Happy Happy</p>";
                            webText.x = 52;
                            webText.y = 41;
                            addChild(webText);
                            break;
                    case 2:
                            var tree2 = new Tree();
                            addChild(tree2);
                            tree2.x = 175;
                            tree2.y = 450;
                            tree2.scaleX = .65;
                            tree2.scaleY = .65;
                            break;
                    case 3:
                            var tree3 = new Tree();
                            addChild(tree3);
                            tree3.x = 45;
                            tree3.y = 365;
                            tree3.scaleX = .45;
                            tree3.scaleY = .45;
                            break;
               /*     case 4:
                            var tree4 = new Tree();
                            addChild(tree4);
                            tree4.x = 660;
                            tree4.y = 195;
                            tree4.scaleX = .25;
                            tree4.scaleY = .25;
                            break;
            //mcAdd.removeEventListener ( MouseEvent.CLICK , onClick ) ;
            //  PRIVATE & PROTECTED INSTANCE METHODS
            /*reset_btn.addEventListener(MouseEvent.CLICK, resetButton);*/
            function onReset(event:MouseEvent)
                var webText:TextField = new TextField();
                var reset:MovieClip = new MovieClip();
                reset.x = 450;
                reset.y = 500;
                reset.scaleX = .01;
                reset.scaleY = .01;
                addChild(reset);
                stage.addEventListener(MouseEvent.CLICK, removeWebText);
                var tree = new Tree();
                addChild(tree)
                var tree2 = new Tree();;
                addChild(tree2);
                var tree3 = new Tree();
                addChild(tree3);
                removeChild(tree);
                removeChild(tree2);
                removeChild(tree3);
            public function removeWebText(event:MouseEvent):void
                var webText:TextField = new TextField();
                var fmt:TextFormat = new TextFormat();
                addChild(webText);
                removeChild(webText);
    ===============
    TREE.AS
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        public class Tree extends MovieClip
            function Tree()
                addEventListener ( Event.ADDED_TO_STAGE , onAddedToStage ) ;
            private function onAddedToStage ( evt : Event ) : void
                width = stage.stageWidth ;
                height = stage.stageHeight ;
    RESET.AS
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        public class Reset extends MovieClip
            function Reset()
                addEventListener ( Event.ADDED_TO_STAGE , onAddedToStage ) ;
            private function onAddedToStage ( evt : Event ) : void
                width = stage.stageWidth ;
                height = stage.stageHeight ;

  • Getting class properties

    hi can anyone tell me how to get setters from a class ??
    a little example can be very helpful thanx !

    Once you get the Class object you can user the getMethods call to get a list of methods available. Then you can inspect the methods for the one's that look credible.
    import java.lang.reflect.*;
    Class cls = theObject.getClass();
    Method [] methods = cls.getMethods();
    int i;
    for(i = i; i < methods.length; i++) {
      Method m = methods;
    if(m.getReturnType() == VOID.type && // setters have no return
    m.getName.subString(0, 3).equals("set") &&
    m.getParameterTypes().lenght == 1) {
    // then m is probably a setter
    To use a setter found in this way use
    m.invoke(theObject, new Object[]{
       .. parameters ..});

  • Error while genetrating gettter method on Context node attribute

    Hi,
    I am working in SAP CRM 7.0 Ehp1.Now I need to create get_p_a and set_p_a method
    on context node attribute.But while selecting attribute and clicking on right and selecting
    on generate P-Getter,getting an error (error message - View not copied or enhanced with wizard; processing not possible).
    This is a custom context node attribute and need to create gettter,setter method.
    Kindly assist on this or suggest is there any way to create method on required context node attribute.
    Regards
    Viren

    Hi there,
    Creation of Getter  Setter is not possible for the AET Generated Views and Components.
    It seems your view is generated using AET Table enhancement feature of Ehp1 and the context node is thus a based on a Z BOL object created by a feature of AET of Ehp1
    For such context node, generation of getter setters is not  possible with right click.
    If you need any of GET_ , SET_, GET_P_ or GET_V , then you need to copy the GET_P_XYZ etc method you find on context node class.
    Hope this helps
    Thanks & Regards
    Suchita

  • Using a FireFX Class

    I found this class today which is really cool:
    http://www.gskinner.com/blog/archives/2007/11/fire_effect_com.html
    However, I've never used a public class before.  I've been reading up on them all morning.  I'll provide the code for it here as well.  Anyway, the author also provides a sample application using the class; however, it's a bit different than what I've been reading.  He doesn't call the class in his code;however, it seems he has the class in his library, which is news to me.
    Anyway, the biggest thing I'm after is trying to design my own application calling this class and just hardcoding the fire aspects in my application.  However, I'm coming up empty at every angle.  Any help would be much appreciated!
    Here's the class he created:
    * FireFX by Grant Skinner. May 30, 2007
    * Visit www.gskinner.com/blog for documentation, updates and more free code.
    * You may distribute and modify this class freely, provided that you leave this header intact,
    * and add appropriate headers to indicate your changes. Credit is appreciated in applications
    * that use this code, but is not required.
    * Please contact [email protected] for more information.
    package com.gskinner.effects {
                import flash.display.BitmapData;
                import flash.geom.Matrix;
                import flash.geom.Point;
                import flash.geom.ColorTransform;
                import flash.filters.ColorMatrixFilter;
                import flash.filters.BlurFilter;
                import flash.filters.DisplacementMapFilter;
                import flash.display.Sprite;
                import flash.display.MovieClip;
                import flash.events.Event;
                import flash.display.Bitmap;
                import flash.display.DisplayObject;
                public class FireFX extends Sprite {
                            private var _fadeRate:Number=0.4;
                            private var _distortionScale:Number=0.4;
                            private var _distortion:Number=0.5;
                            private var _flameHeight:Number=0.3;
                            private var _flameSpread:Number=0.3;
                            private var _blueFlame:Boolean = false;
                            private var _smoke:Number = 0;
                // private properties:
                            // display elements:
                            private var displayBmp:BitmapData;
                            private var scratchBmp:BitmapData;
                            private var perlinBmp:BitmapData;
                            // geom:
                            private var mtx:Matrix;
                            private var pnt:Point;
                            private var drawColorTransform:ColorTransform;
                            // filters:
                            private var fireCMF:ColorMatrixFilter;
                            private var dispMapF:DisplacementMapFilter;
                            private var blurF:BlurFilter;
                            // other:
                            private var endCount:Number;
                            private var bmpsValid:Boolean=false;
                            private var perlinValid:Boolean=false;
                            private var filtersValid:Boolean=false;
                            private var _target:DisplayObject;
                            public function FireFX() {
                                        var frame:DisplayObject = getChildAt(0);
                                        frame.visible = false;
                                        frame.height = height;
                                        frame.width = width;
                                        scaleX = scaleY = 1;
                                        mtx = new Matrix();
                                        pnt = new Point();
                                        startFire();
                            // getter/setters:
                            override public function set width(value:Number):void {
                                        bmpsValid &&= (value == width);
                                        super.width = value|0;
                            override public function get width():Number {
                                        return super.width;
                            override public function set height(value:Number):void {
                                        bmpsValid &&= (value == height);
                                        super.height = value|0;
                            override public function get height():Number {
                                        return super.height;
                            [Inspectable(defaultValue=0.4,name='fadeRate (0-1)')]
             * Sets the rate that flames fade as they move up. 0 is slowest, 1 is fastest.
             * @default 0.4
                            public function set fadeRate(value:Number):void {
                                        filtersValid &&= (value == _fadeRate);
                                        _fadeRate = value;
                            public function get fadeRate():Number {
                                        return _fadeRate;
                            [Inspectable(defaultValue=0.4,name='distortionScale (0-1)')]
             * Sets the scale of flame distortion. 0.1 is tiny and chaotic, 1 is large and smooth.
             * @default 0.4
                            public function set distortionScale(value:Number):void {
                                        perlinValid &&= (value == _distortionScale);
                                        _distortionScale = value;
                            public function get distortionScale():Number {
                                        return _distortionScale;
                            [Inspectable(defaultValue=0.4,name='distortion (0-1)')]
             * Sets the amount of distortion. 0.1 is little, 1 is chaotic.
             * @default 0.4
                            public function set distortion(value:Number):void {
                                        filtersValid &&= (value == _fadeRate);
                                        _distortion = value;
                            public function get distortion():Number {
                                        return _distortion;
                            [Inspectable(defaultValue=0.3,name='flameHeight (0-1)')]
             * Sets the how high the flame will burn. 0 is zero gravity, 1 is a bonfire.
             * @default 0.3
                            public function set flameHeight(value:Number):void {
                                        perlinValid &&= (value == _flameHeight);
                                        _flameHeight = value;
                            public function get flameHeight():Number {
                                        return _flameHeight;
                            [Inspectable(defaultValue=0.3,name='flameSpread (0-1)')]
             * Sets the how much the fire will spread out around the target. 0 is no spread, 1 is a lot.
             * @default 0.3
                            public function set flameSpread(value:Number):void {
                                        filtersValid &&= (value == _flameSpread);
                                        _flameSpread = value;
                            public function get flameSpread():Number {
                                        return _flameSpread;
                            [Inspectable(defaultValue=false,name='blueFlame')]
             * Indicates whether it should use a blue or red flame.
             * @default false
                            public function set blueFlame(value:Boolean):void {
                                        filtersValid &&= (value == _blueFlame);
                                        _blueFlame = value;
                            public function get blueFlame():Boolean {
                                        return _blueFlame;
                            [Inspectable(defaultValue=0,name='smoke (0-1)')]
             * Sets the amount of smoke. 0 little, 1 lots.
             * @default 0
                            public function set smoke(value:Number):void {
                                        filtersValid &&= (value == _smoke);
                                        _smoke = value;
                            public function get smoke():Number {
                                        return _smoke;
                            [Inspectable(defaultValue='',name='target')]
             * Sets the amount of smoke. 0 little, 1 lots.
             * @default
                            public function set targetName(value:String):void {
                                        var targ:DisplayObject = parent.getChildByName(value);
                                        if (targ == null) {
                                                    try { targ = parent[value] as DisplayObject; }
                                                    catch (e:*) {}
                                        target = targ;
             * Defines the shape of the fire. The fire will burn upwards, so it should be near the bottom, and centered in the FireFX component.
             * @default
                            public function set target(value:DisplayObject):void {
                                        _target = value;
                                        clear();
                            public function get target():DisplayObject {
                                        return _target;
             * Clears the fire.
                            public function clear():void {
                                        if (displayBmp) {
                                                    displayBmp.fillRect(displayBmp.rect,0);
             * Stops the fire effect after letting it burn down over 20 frames.
                            public function stopFire():void {
                                        // let the fire burn down for 20 frames:
                                        if (endCount == 0) { endCount = 20; }
                            private function updateBitmaps():void {
                                        if (displayBmp) {
                                                    displayBmp.dispose();
                                                    displayBmp = null;
                                                    scratchBmp.dispose();
                                                    scratchBmp = null;
                                                    perlinBmp.dispose();
                                                    perlinBmp = null;
                                        displayBmp = new BitmapData(width, height, true, 0);
                                        scratchBmp = displayBmp.clone();
                                        perlinBmp = new BitmapData(width*3, height*3, false, 0);
                                        while (numChildren) { removeChildAt(0); }
                                        addChild(new Bitmap(displayBmp));
                                        updatePerlin();
                                        updateFilters();
                                        bmpsValid = true;
                            private function updatePerlin():void {
                                        perlinBmp.perlinNoise(30*_distortionScale,20*_distortionScale,1,-Math.random()*1000|0,fals e,true,1|2,false);
                                        perlinBmp.colorTransform(perlinBmp.rect,new ColorTransform(1,  1-_flameHeight*0.5  ,1,1,0,0,0,0));
                                        perlinValid = true;
                            function updateFilters():void {
                                        if (_blueFlame) {
                                                    fireCMF = new ColorMatrixFilter([0.8-0.55*_fadeRate,0,0,0,0,
                                                                                                                                                     0,0.93-0.48*_fadeRate,0,0,0,
                                                                                                                                                     0,0.1,0.96-0.35*_fadeRate,0,0,
                                                                                                                                                     0,0.1,0,1,-25+_smoke*24]);
                                                    drawColorTransform = new ColorTransform(0,0,0,1,210,240,255,0);
                                        } else {
                                                    fireCMF = new ColorMatrixFilter([0.96-0.35*_fadeRate,0.1,0,0,-1,
                                                                                                                                                     0,0.9-0.45*_fadeRate,0,0,0,
                                                                                                                                                     0,0,0.8-0.55*_fadeRate,0,0,
                                                                                                                                                     0,0.1,0,1,-25+_smoke*24]);
                                                    drawColorTransform = new ColorTransform(0,0,0,1,255,255,210,0);
                                        dispMapF = new DisplacementMapFilter(perlinBmp,pnt,1,2,14*_distortion,-30,"clamp");
                                        blurF = new BlurFilter(32*_flameSpread,32*_flameSpread,1);
                                        filtersValid = true;
                            private function startFire():void {
                                        endCount = 0;
                                        addEventListener(Event.ENTER_FRAME,doFire);
                            private function doFire(evt:Event):void {
                                        if (_target == null) { return; }
                                        if (!bmpsValid) { updateBitmaps(); }
                                        if (!perlinValid) { updatePerlin(); }
                                        if (!filtersValid) { updateFilters(); }
                                        if (endCount == 0) {
                                                    var drawMtx:Matrix = _target.transform.matrix;
                                                    drawMtx.tx = _target.x-x;
                                                    drawMtx.ty = _target.y-y;
                                                    scratchBmp.fillRect(scratchBmp.rect,0);
                                                    drawColorTransform.alphaOffset = -Math.random()*200|0;
                                                    scratchBmp.draw(_target,drawMtx,drawColorTransform,"add");
                                                    scratchBmp.applyFilter(scratchBmp,scratchBmp.rect,pnt,blurF);
                                                    displayBmp.draw(scratchBmp,mtx,null,"add");
                                        dispMapF.mapPoint = new Point( -Math.random()*(perlinBmp.width-displayBmp.width)|0, -Math.random()*(perlinBmp.height-displayBmp.height)|0 );
                                        displayBmp.applyFilter(displayBmp,displayBmp.rect,pnt,dispMapF);
                                        displayBmp.applyFilter(displayBmp,displayBmp.rect,pnt,fireCMF);
                                        if (endCount != 0 && --endCount == 0) {
                                                    removeEventListener(Event.ENTER_FRAME,doFire);
    Then, this is the sample application he gave:
    import fl.controls.Slider;
    import fl.controls.Label;
    import fl.events.SliderEvent;
    var params:Array = ["distortion","distortionScale","fadeRate","flameHeight","flameSpread","smoke"]
    var l:uint = params.length;
    for (var i:uint=0; i<l; i++) {
                var label:TextField = new TextField();
                label.textColor = 0;
                label.text = params[i];
                label.width = 140;
                label.x = 350;
                label.y = 55+50*i;
                addChild(label);
                label = new TextField();
                label.textColor = 0x999999;
                label.text = "0.35";
                label.name = params[i]+"fld";
                label.width = 30;
                label.x = 490;
                label.y  = 55+50*i;
                addChild(label);
                var slider:Slider = new Slider();
                slider.name = params[i];
                slider.minimum = -2;
                slider.maximum = 2;
                slider.addEventListener(SliderEvent.THUMB_DRAG,handleSlider);
                addChild(slider);
                slider.x = 350;
                slider.width = 170;
                slider.y = 75+50*i;
                slider.snapInterval = 0.05;
                slider.value = 0.35;
                fireFX[params[i]] = 0.35;
    function handleSlider(evt:SliderEvent):void {
                fireFX[evt.target.name] = evt.target.value;
                (getChildByName(evt.target.name+"fld") as TextField).text = String(evt.target.value);
    blueFlame.addEventListener(Event.CHANGE,handleCheckBox);
    hideText.addEventListener(Event.CHANGE,handleCheckBox);
    function handleCheckBox(evt:Event):void {
                fireFX.blueFlame = blueFlame.selected;
                obj.visible = !hideText.selected;
    Thanks again.

    Looks like he has fireFX instance on the timeline. Most probably this instances symbol base class is com.gskinner.effects.FireFX
    You just need to create a directory structure that reflects his package:
    com/gskinner/effects/
    where you place his FireFX.as
    Or, alternatively, you can remove package path from the class header and place FireFx where all you classes (or your application) are:
    package com.gskinner.effects {
    to
    package {
    Then you will just need to instantiate the class.

  • UML code generation

    Hi,
    I'm developing an application of ~50+ classes in UML on JSE8 and use java code generation.
    The question is about aggregations.
    Navigable aggregations translate in java code to a class attribute, and to the corresponding getter/setters-methods.
    A non-navigable aggregation is not translated to java code at all.
    ( I would expect it should translate to an attribute, but without getter/setters.
    My understanding is, "navigable" means "navigable from outside the class". Correct?)
    So how can I model an aggregation, which translates to an attribute in java, without generating the getters/setters?
    And where can I find a comprehensive list of how elements in class diagrams are translated to java code?
    Where is the JSE8-UML-manual, which includes all these details about UML code generation?
    Thanks a lot for any useful hint!

    Hi,
    actually, the code generator is correct.
    A non-navigable association should not generate an attribute.
    Consider the example:
    class Order -> class Date
    You have navigation from class order to class date, but not otherwise.
    This means that, given a Order object, you can find it's associated Date.
    However, the inverse is not true: given a Date object you have no means of "navigating" or finding out which Order objects would have that date. This is what navigation means.
    This should be translated into something like this
    class Order{
    Date theDate;
    class Date{
    int day, whatever;
    //no ref to order-non navigable
    If navigation from both classes were possible, a much more complicated code would be needed. It would be something along these lines, considering a 1-1 association (a *-1 association would require multiple order references to be stored at Date, with yet more complications):
    class Order{
    Date theDate;
    void setDate(Date d)
    theDate=d;
    d.setOrder(this);
    class Date{
    int day,whatever;
    Order theOrder; //navigation to order
    void setOrder(Order o)
    theOrder=o;
    Care should be taken to ensure proper consistency between references (ie: the order in date should never be changed without making a corresponding change to the new order object).
    All this serves to show, you should use navigation sparringly (as needed) , otherwise you're just complicating your code more than you should.
    Greets
    Jorge

  • Best Practice Question - Business Logic in Value Objects?

    Just wondering what people's thoughts on best practices for setting properties of Value Objects.
    For instance, I have several getter/setters in one of my Value Objects with logic in the setter that uses the value to set values of other properties.
    For example, I have a Value Object that has the following properties:
    category (of type Category, which is another Value Object with properties "name" and "id")
    categoryId (of type int)
    categoryUpdated (of type Boolean)
    I have a collection of Category Objects in the Model. When I set the categoryId of this class, I set the "categoryUpdated" to true, and dispatch an CairngormEvent to that find the "category" with the specified "categoryId" and set the "category" property to this item.
    So what is the best practice? To simply make the "categoryId" a public variable, and create a new Event/Command to perform all this logic? Or is it ok to do it all in the Value Object setter?
    Thanks.

    Hi Eric,
    I can't speak for best practices, but the only logic I've ever added to a VO were getters: an example was a set of getters on an airline flight VO to get overall flight departure/arrival times/cities from an array of flight segments in a property of the VO.
    I feel uneasy (in the nicest possible way) about your VO for two reasons: firstly it has a strong dependency on bits of the Cairngorm framework to look up the category (and VOs normally don't need to depend on anything), and secondly the intent of Commands in Cairngorm is more to represent user gestures than to wire up VO properties (I often see people shoehorning stuff into Commands that might be better of as plain old business utility classes). I would rather see an UpdateCategoryCommand (that's what the user is trying to do?) that updates categoryId and hits a delegate to populate the category property.
    That said you might have a very good reason for doing this. Could you tell us where the code is that's setting categoryId, and if anything is using categoryUpdated?
    Cheers,
    Robin

  • Dynamic select using jsp?

    grrrrr............ok so I'm kinda new to this, and just a little frustrated. I'm gonna ramble here, so any time I sound like I don't know what I'm talking about it 's because I don't..correct me. I want to include a bean in a jsp which will buil d a dynamic select box on the fly. That is, connect to an LDAP db and place each value returned in the query in a select box. Now, I can compile and run the bean in my IDE and watch the output in the console. It's correct because I see "<select><option value = hall>hall....</select>". In the buildSelectBox() method I'm using System.out.println to display each line of my select box (is that right?). Now, when I copy the .class file over to the server I was initially getting an error because the bean wasn't found. I resolved that by properly compiling the bean in a package. Problem is that if I call the bean.buildSelect() method in the .jsp nothing comes back. The page is left blank. What in the world is that about? Can someone push me toward a tutorial that can push me in the right direction or sumthin? Why am I having so much trouble with this? Should I be building the select on the jsp?
    regards,
    mat

    Hi!
    If i understand you correctly :-) you are doing not very right things. I don't want it to seem like I'm going to teach you, but:
    The Bean that has buildSelect() method is not a bean at all. Usualy Beans contain getter/setters and accumulate data. If you want to build html code dynamicaly then you should use servlets(Which is not very flexible in your situation, I think), not JSPs. And if you are using JSPs then you have to make Tag which will do this everything.
    Other way is to use Struts framework which is very good and flexible for building web applications - it has it's own tags for many cases. You can make loops in JSPs, use beans and all that stuff.
    Guys will correct me if I missed something.
    Good luck

  • Wait ms Timer Multiple returning inaccurate timer value

    We are using the Wait Until Next ms Multiple Timer value to set the interval that data is recorded to a file. Because of Windows 2000 time indeterminancy, the Wait Until Next ms Multiple Timer value is written to file, along with the data point, and is used to calculate the derivative between two successive points. With a delay of 1 sec (1000 ms), the actual interval ranges from 1025 to 1035 ms. At several (random!) points during the acquisition, the difference between successive ms values is considerably smaller than 1000 ms (e.g. 15-25 ms). The following difference compensates for the previous error e.g. the difference will be 2025-2055ms. The data that we are recording is a smoothly continuou
    s function and it appears that the sample is actually recorded at approximately 1000 plus ms. Thus it appears that the Wait Until Next ms Multiple waits the appropriate amount of time to record the data point, but outputs an erroneous ms timer value. We added a ms Timer function to the VI, which also experienced a similar glitch. This glitch does not correspond to the wraparound point; it occurs at approximately 60 to 130 sec intervals. We took the timing code only (no data acquisition, etc) and created a VI that wrote just the time values to a file. This is attached, along with the generated data in a spreadsheet. This consistently executed every 1000 ms but occasionally confused the intervals by 1-57 ms. The pattern was reversed from the previous problem by having a long interval and then a short interval. Any insight would be greatly appreciated!
    Attachments:
    CollectingSampleData.vi ‏47 KB
    Create_XCoord.vi ‏25 KB
    sampledata.xls ‏91 KB

    Agree completely but why can't LV provide access to the windows multimedia
    timer like LabWindows does? Provide me a timer, I can start/stop by changing
    its properties and run that in a separate thread. Obviously if I have
    another thread starving this timer thread, it won't help much but using
    multi-media timer, I have seen very good results on a windows2000 machine.
    Now win95/98 and derivatives are all other story.
    vishi
    "Al S" wrote in message
    news:[email protected]..
    > There are a couple of things going on that affect your results.
    > 1. Windows is not a real-time operating system. As it multi-tasks,
    > you have little control over when it gives time to your application.
    > Loop times may vary depend
    ing on what else Windows decides during that
    > iteration. Especially when doing file I/O: if your disk is busy, a
    > loop interation may take longer. Windows may also be doing some disk
    > buffering, so occasionally a loop interation may take much longer than
    > usual as the buffered data from multiple loop interations gets written
    > to disk.
    > 2. Wait Until Next ms Multiple doesn't garuntee equal loop times.
    > With the millisecond multiple input set to 1000, if one iteration
    > starts with the PC's clock at xx:xx:xx.001, Wait Until Next ms
    > Multiple will wait 0.999 seconds. If an iteration starts with the
    > PC's clock at xx:xx:xx.999, Wait Until Next ms Multiple will wait
    > 0.001 seconds.
    > 3. In your main loop, you check to see if the millisecond timer value
    > * 60 equals the desired Length of Data Collection. If your loop
    > doesn't execute every millisecond, you may miss the equals case and
    > then your loop won't stop. You should check >= rather than just =.

  • How do I add a subset of records to a set of records?

    I have a result set of consultants and branch offices and I need to add a subset of employees to each branch office.
    I added an Employee[ ] subset to my consultant getter/setters. A PL/SQL package returns a cursor result set
    of consultants and branch offices and another cursor result set of employees. Each employee is assigned an
    office ID and each consultant and branch office is assigned an office ID.
    I am unsure in Java how to traverse the employee result set to get each subset of employees with the correct office.
    Here is the code that calls the PL/SQL and loads my vector array with consultants and branch offices:
        public Consultant[] getConsultants(String pvConsultant_Firm,
                                            String pvAddr_City_Main,
                                            String pvAddr_State_Main,
                                            String pvAddr_Zip_Main, 
                                            String pvAddr_City_Branch,
                                            String pvAddr_State_Branch,
                                            String pvAddr_Zip_Branch,
                                            String pvResidency,
                                            String pvFirst_Name,    
                                            String pvLast_Name,
                                            String pvOrder_By_Office,
                                            String pvOrder_By_Employee,
                                            String display_Branch,
                                            String display_Employee)
          Vector retval = new Vector();
          DBConnection conn = new DBConnection();
          CallableStatement cstmt = conn.prepareCall("begin " + PACKAGE + "Get_Consultant_Cursors(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);end;");
          ResultSet rsConsultant;
          ResultSet rsEmployee;
          Consultant curConsult;
          Employee curEmployee;
          try
             if(cstmt!=null)
                String Consult_Type = null;
                if ("true".equalsIgnoreCase(display_Branch) ||
                     "true".equalsIgnoreCase(display_Employee)){
                   Consult_Type = null;
                else {
                   Consult_Type = "MAIN";
                cstmt.setString("pvConsultant_Firm", pvConsultant_Firm);
                cstmt.setString("pvOffice_Type", Consult_Type);
                cstmt.setString("pvAddr_City_Main", pvAddr_City_Main);
                cstmt.setString("pvAddr_State_Main", pvAddr_State_Main);
                cstmt.setString("pvAddr_Zip_Main", pvAddr_Zip_Main);
                cstmt.setString("pvAddr_City_Branch", pvAddr_City_Branch);
                cstmt.setString("pvAddr_State_Branch", pvAddr_State_Branch);
                cstmt.setString("pvAddr_Zip_Branch", pvAddr_Zip_Branch);
                cstmt.setString("pvResidency", pvResidency);
                cstmt.setString("pvFirst_Name", pvFirst_Name);
                cstmt.setString("pvLast_Name", pvLast_Name);
                cstmt.setString("pvOrder_By_Employee", pvOrder_By_Employee);
                cstmt.setString("pvOrder_By_Office", pvOrder_By_Office);
                cstmt.registerOutParameter("pcurConsultant_Office", OracleTypes.CURSOR);
                cstmt.registerOutParameter("pcurConsultant_Employee", OracleTypes.CURSOR);
                cstmt.execute();
                rsConsultant = (ResultSet)cstmt.getObject("pcurConsultant_Office");
                rsEmployee = (ResultSet)cstmt.getObject("pcurConsultant_Employee");
                while(rsConsultant.next())
                    curConsult = getConsultant(rsConsultant);
                    retval.add(curConsult);
                     if ("true".equalsIgnoreCase(display_Employee)){
    HOW DO I HANDLE THIS?
                 rsConsultant.close();
                 conn.closeCstmt(cstmt);
              catch (SQLException e)
                 conn.logToFile(this, "getConsultants()", e);
              conn.close();
           return (Consultant[])retval.toArray(new Consultant[retval.size()]);
        }

    It will basically look something like this:
    Consultant A           Main Office
                                                 Employee 1
                                                 Employee 2
                                                 Employee 3
                           Branch A       
                                                 Employee 4
                                                 Employee 5
                           Branch B
                                                 Employee 6
                                                 Employee 7
    Consultant B           Main Office
                                                 Employee 8
                                                 Employee 9
                           Branch A       
                                                 Employee 10
                                                 Employee 11The consultant and branch offices are in one result set and the employees are in another. I need to combine them
    so I can return them and display them as above in my JSP.

  • PropertyNotFound Exception in Hibernate

    Hi,
    Can smeone help me on this error?
    I have defined variables in a file Rates.as :
    public class Rates.as{
    public var rate1:String;
    public var rate2:String;
    public var rate3:String;
    public function getRate1() :String{
    return rate1();
    public function setRate1(value:String) :void{
    rate1=value;
    /*similar getter & setters for rate2 and rate 3 */
    When i depolyed in tomcat, it shows PropertynotfoundException. : cannot find getter for rate1: RatesVO
    How do i fix this ?????!!!

    Hi,
    Can smeone help me on this error?
    I have defined variables in a file Rates.as :
    public class Rates.as{
    public var rate1:String;
    public var rate2:String;
    public var rate3:String;
    public function getRate1() :String{
    return rate1();
    public function setRate1(value:String) :void{
    rate1=value;
    /*similar getter & setters for rate2 and rate 3 */
    When i depolyed in tomcat, it shows PropertynotfoundException. : cannot find getter for rate1: RatesVO
    How do i fix this ?????!!!

  • Dynamic Data Structure

    Hi all,
    I have a UI which may change or i may add some specific properties to the UI.
    I want to have a data structure class which would be created on the basis of the properites.
    Suppose employee is a UI component,then again i have to have one more UI component called department.
    The class which i am using for e.g. persistence should be generated differently.
    I do see reflection as one of the solution for generating the class.
    edit: to generate the fields or getter,setters to be precise, as i already have the class
    But is reflection is the best way,.is there any better ways to do it?
    Edited by: java_jamboree on May 28, 2008 10:30 PM

    java.uitl.Map and its implementations.

Maybe you are looking for