Is a static var 'copied' when and object is cloned?

HI,
If you have an abstract class that has a static object as a property,
i.e.
public abstract class xyz implements Cloneable, Runnable {
static Manager M;
Thread runner;
and a concrete class is created by cloning this object, i.e.
public void run(){
if(x!=null){ // if we are the server process
while (runner!=null){
try{
Concrete_xyz = (Concrete_xyz) clone(); // (Concrete xyz implements xyz)
Concrete_xyz.x = null;
Concrete_xyz.runner = new Thread(Concrete_xyz);
Concrete_xyz.runner.start();
}catch(Exception e){}
}else{
run(client);
will all the clones share the static Manager object? ....is this a stupid question?
any help much appreciated

Well, not a stupid one, just kinda obvious. There is one and only one copy of each static field for any loaded class. The only time there would be more than one is when more than one class loader loads the class, in which case the classes are truly the same (just happen to have the code).
Cloning, serialization/deserialization, etc. will never duplicate static fields.
Chuck

Similar Messages

  • How do I copy text and objects from pages to and paste into Email, objects don't show in Email

    Anyone know how I copy text and objects from pages and paste into Email, objects don't show in Email, thanks

    You can't expect Mail to support all the objects of Pages which can include anything up to charts generated from spreadsheet tables.
    Even if Mail was a superset of Pages, what would the recipients who don't have either Mail or Pages, make of it?
    Peter

  • AS3: static vars and on-stage MC's

    hi,
    my basic problem is as follows:
    i have one swf which loads another one. both of them have
    document class.
    i want to access a variable of the main swf's class from the
    inner swf's
    class, so i turned that var into static. it works fine, as
    long as i don't
    access MC's on the main swf's stage from its class. i've
    tried to solve it
    using the 'ApplicationDomain' but it still fails.
    for testing purposes i've made 2 swf's - 'main.swf' and
    'inner.swf', where
    on the main's stage i've placed a button, with instance name
    'myBtn'.
    this is the main's class:
    package {
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.system.*;
    import flash.events.*;
    public class MainClass extends MovieClip {
    private static var myStatic:String = "abc";
    private var ldLoader:Loader;
    public function MainClass(){
    loaderInfo.addEventListener(Event.INIT, myOnInit);
    private function myOnInit(eEvent){
    ldLoader = new Loader();
    var urlRequest = new URLRequest("inner.swf");
    var context:LoaderContext = new LoaderContext (false,
    ApplicationDomain.currentDomain);
    ldLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    completeHandler);
    ldLoader.load(urlRequest, context);
    this.myBtn.addEventListener(MouseEvent.MOUSE_UP,btnUp);
    private function btnUp(evt){
    trace("btn up");
    private function completeHandler(evt){
    var inner = this.addChild(evt.target.content);
    inner.myOnInit();
    static function get staticVar():String{
    return myStatic;
    this is the inner's class:
    package {
    import flash.display.MovieClip;
    public class InnerClass extends MovieClip{
    public function InnerClass(){}
    public function myOnInit(){
    trace(MainClass.staticVar);
    when i compile 'inner' i get the following error:
    1119: Access of possibly undefined property myBtn through a
    reference with
    static type MainClass.
    the only way to avoid this error is to comment the last line
    of the
    'myOnInit' function in the main class, however then there's
    no access to the
    main's MC's.
    any solution?
    thanks in advance,
    eRez
    www.allofme.com

    Hi,
    can you give us a bit of code ... that will help. And did you
    declare your movieClip before (and outside of) the constructor?
    Like this i mean:
    class RandImg{
    private var mcDefault:MovieClip; // --> here it is ..
    mcDefault
    public function RandImg(){ // --> cunstructor
    trace("mcDefault path = " + mcDefault);
    If mcDefault is not declare before and outside your
    constructor, its impossible for your class to access it. Of course
    you are probably aware of that .. but im trying to figure out what
    can be the problem .. just guessing.
    So please give us some code and we will try to help!

  • Copy constructor and temporary objects in C++

    I'd need some clarification on how constructor works when the argument is  a temporary object. I defined a dummy MyVect class with operator+ and copy constructor:
    class MyVect {
    public:
    MyVect() {
    cout << "Constructor" << endl;
    MyVect(const MyVect &vect){
    cout << "Copy Constructor" << endl;
    ~MyVect() {
    cout << "Destructor" << endl;
    MyVect operator+(const MyVect &v) const {
    cout << "operator+" << endl;
    MyVect result
    return result;
    Then I test it with this very simple code pattern:
    MyVect v1;
    MyVect v2;
    MyVect v3(v1 + v2);
    The output is:
    Constructor
    Constructor
    operator+
    Constructor
    Destructor
    Destructor
    Destructor
    The first two constructor calls are for v1 and v2, then operator+ for  v1+v2 is called, and  inside it there is a constructor call for result object. But then no copy constructor (nor constructor) for v3 is called. In my limited understanding of C++, I guessed that once the temporary object resulting from v1+v2 has been created, then it would be the argument of the copy constructor call. Instead it looks like the compiler transforms the temporary into v3, since v3 is correctly initialized as the sum of v1 and v2 (I tried with a more complicated version of MyVect to verify this). This behavior reminds me of the move semantics introduced with C++11, but I'm not using the -std=c++11 flag (and in fact if I try to define a move constructor the compilation fails).
    Can anyone please help me to understand what's happening under the hood? Thanks.
    Last edited by snack (2013-02-13 10:44:28)

    wikipedia wrote:The following cases may result in a call to a copy constructor:
    When an object is returned by value
    When an object is passed (to a function) by value as an argument
    When an object is thrown
    When an object is caught
    When an object is placed in a brace-enclosed initializer list
    These cases are collectively called copy-initialization and are equivalent to:[2] T x = a;
    It is however, not guaranteed that a copy constructor will be called in these cases, because the C++ Standard allows the compiler to optimize the copy away in certain cases, one example being the return value optimization (sometimes referred to as RVO).
    Last edited by Lord Bo (2013-02-13 13:58:47)

  • Can I copy MATERIAL adapter object and create new business object in R3AC1

    Hi experts,
    I need to copy MATERIAL adapter object and create a new business object R3AC1.
    Please let me know whether this is feasible.
    Thanks & Regards,
    Keya

    Usually  when there is a need to change/create an adapter object, I suggest to change object class to CUSTOMIZING in R3AC1. Then save it and call transaction R3AC3. There do necessary changes and afterwards switch back to original object class. There is no copy functionality for adapter objects. Kindly use transaction R3AC3 to create a new adapter object and maintain all tabs according to your requirements. When you are finished, kindly change the object class "CUSTOMIZING" to the original class name you're copying and the new adapter object will be visible in R3AC1.
    Documentation can be found in
       https://service.sap.com/ce    -> Early Product Training         > SAP CRM 4.0 & mySAP CRM Edition 2004 .. on the learning map, please choose "Development Consultant" -> Open "Enhance CRM Scenarios"
    Here you can find a lot of guides and SAP tutors on how to create an adapter object, example coding, and so on.
    To enable Filter Fields for an Adapter object make requisite changes in table SMOFFILFLD and generate the Adapter Object using SMOGGEN. CHeck table CRMPAROLTP in ECC to enable Filtering

  • Tried to check on updates for CS6 64 bit - Received message saying application manager may be damaged - download and install new copy - when I try this I receive message ERROR 404 I have a PC - any help would be gratefully received - thanks - William

    Tried to check on updates for CS6 64 bit - Received message saying application manager may be damaged - download and install new copy - when I try this I receive message ERROR 404 I have a PC - any help would be gratefully received - thanks - William

    reset your preferences:
    dreamweaver:  http://helpx.adobe.com/dreamweaver/kb/restore-preferences-dreamweaver-cs4-cs5.html
    flash:  http://helpx.adobe.com/flash/kb/re-create-preferences-flash-professional.html
    indesign:  https://forums.adobe.com/thread/526990
    lightroom:  http://www.lightroomforums.net/showthread.php?14226-Resetting-%28or-Trashing-%29-the-Light room-Preferences-file
    photoshop:  https://forums.adobe.com/thread/375776
    if that fails, uninstall ps, clean (Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6) and reinstall.  then use the manual updates.

  • Possible Bug with Drag-and-Drop Being Published via HTML5 - Getting "Undefined" Error When Dragging Object

    Hello,
    I came up with a way to use drag-and-drop interactions that will take advantage of file input so that I may create a drag-and-drop interaction that uses one draggable object over and over allowing multiple scoring/tracking possibilities.  Example use...is having the draggable object be dynamic in that it randomly changes its text so that a learner can drag a term it's possible classification.........thus allowing the possibility of having many terms easily loaded without having to redo a drag-and-drop interaction for each needed terms/classifications updates/changes.
    My Issue: When using a variable to represent the text for a draggable Smart Shape object, I'm getting the error message "undefined" when, clicking/pressing on the object, as well as during the drag of the object. This issue occurs when publishing the project in an HTML5 format.  Flash interestingly enough seems to work perfect...but we are not interested in publishing via Flash any longer.
    To better help you explore this error message, I've set up a test project so that you can see when and how the "undefined" message shows up during a drag-and-drop interaction.  I've also included the Captivate 8 project file used to make the exploration project I'm sharing in this post.
    Link to Captivate project I created for you all to explore "undefined" error message": http://iti.cscc.edu/drag_and_drop_bug/
    Link to this Captivate 8 Project file: http://iti.cscc.edu/drag_and_drop_bug.cptx
    It's pretty interesting how things react in this demo, please try the following actions to see some interesting happenings:
    Drag the Yellow (or variable drag box) to the drag target.
    Drag Black Hello square to Drag target and click undo or reset - watch the undefined message come up on the Yellow (or variable drag box).
    Drag the Yellow (or variable drag box) to the drag target and then use the undo or reset.
    Move both draggable boxes to the drag target and use the undo and reset buttons...
    Anyhow, I know you all are sharp and will run the demo through its paces.
    I'd really be very honored if anyone help me figure out how I could (when publishing out to HTML5) no longer have the "undefined" error message show up when using drag-and-drop with a variable for shape text. This technique has been well received at the college I work at...and I have many future project requests for using such an idea on a variety of similar interactions. I'd love see a solution or see if this might be a bug Adobe may be able to fix!
    I tried to find a solution to the issue documented here for quite some time, but I was not able to find anyone with this problem much less attempting the idea I'm sharing in the help request -  save the darn "undefined" message that comes up!
    Many thanks in advance for any help and/or direction that you all may be able to provide,
    Paul

    Hello,
    I just wanted to supply a minor update related to my drag-and-drop question/issue stated above:
    I did another test using Captivate 7, and found that the undefined error (publishing as HTML5) does not appear and the variable data remains visible - except the variable data turns very small and does not honor any font size related settings.
    I did go ahead and submit this to Adobe as a possible bug today.
    Thanks again for any help related to this issue.  If the issued documented above is solved, it will allow many amazing things to be done using Captivate's drag-and-drop for both regular type projects as well as interaction development for iBooks! 
    Matter of fact if this issue gets fixed, I'll publish a Blog entry (or video) on way's I've used Captivate's drag-and-drop to create dynamic learning activities for Higher Ed. and for use in iBooks.
    ~ Paul

  • Static between Apogee One and Logic 9...When track is armed but not recordi

    The static only happens when i sing into the mic or strum the guitar. It begins to happen when i have input monitoring enabled or the track armed (R). It slowly creeps up after a few minutes of NOT recording and just having the track armed. I can make multiple passes at recording and it will eventually go away or...i have to quit logic and apogee and restart but if i leave the track armed and not record continuously its back! Its like a terrible crackle and its as loud as the instrument im trying to record.

    I dont have an FTP at this time and i tried uploading to steven slate drums but havnt been on there for a while and wasnt able to ...Too bad apples forum doesnt allow mp3s or wavs

  • How to copy cubes and other objects?

    Hello All,
    I have implemented APO -Demand Planning Project for one hub Europe in our BW system.NOw we want to roll out the implementation globally and want to copy all the BI objects for seven hubs only changing the field of hub whereever we are using it in routines.
    One way of copying all the objects is XML export and import.But for that purpsoe i have to change the XML file maually.We have four cubes , ten ODSs and number of reports and lots of user exit code.Data in ODSs are coming from flat files and it is further updating Cubes.
    Anybody knows here any other way to copy the cubes and ODSs and other related objects such as infosources and infopackages etc.
    Thanks and Regards
    Yogesh Mali

    You need to change the format
    double tap on the work and then you can select how much you want to copy, to paste just long press on any empty space > paste
    Navigation does work, but you must make a map offline (open maps > select the area/city > menu > offline) 
    Don't forget to give Kudos (Click on the half star + )
    "I'd rather be hated for who I am, than loved for who I am not." Kurt Cobain (1967-1994)

  • Delayed response of when moving objects in diagram and panel, happend in LV 6, only for vi's compiled from previous versions. any suggestions?

    When I using the mouse to select portion of the diagram or the panel, or when I moving objects- I found that in all the vi's that I compiled from former versions of labview- there is a delay of close to a second to the actual selection or movement of the item. This happens in 2 machines out of 5 that I tested it, and it happened both in windows 2000 and in windows 98. any suggestions?

    Sometimes a video driver issue. Update your video driver.
    Or turn down the video driver hardware acceleration. Right-click an
    empty area of the desktop, choose the Settings tab, choose the Advanced
    button.
    The location of this differs in different versions of Windows.
    Win2000: go to Troubleshooting, and turn down the slider for hardware
    acceleration.
    Win98: I think it's on another tab.
    Mark
    ilan wrote:
    >
    > Delayed response of when moving objects in diagram and panel, happend
    > in LV 6, only for vi's compiled from previous versions. any
    > suggestions?
    >
    > When I using the mouse to select portion of the diagram or the panel,
    > or when I moving objects- I found that in all the vi's that I compiled
    > from former versions of labview- there is a delay
    of close to a second
    > to the actual selection or movement of the item. This happens in 2
    > machines out of 5 that I tested it, and it happened both in windows
    > 2000 and in windows 98. any suggestions?

  • Illustrator Crashing when labeling Layers, Groups and Objects - Windows 7

    For some reason Illustrator seems to crash (fairly consistently) when labeling Layers, groups and objects with a common label - so ctrl+v each label.
    Generally, I can label around 3 in a row before it crashes. I've replicated this error working both on and off the network. Our operating system is Windows 7

    Version: Illustrator CC (up to date)
    Language: English UK
    Group/ object label example: hr.style: gradient transparency.
    this error seems to occur when the files are over 500KB -  also the files are purely vector and contain very little in the way of transparencies.

  • TS4062 I'm stuck on "waiting for items to copy" when I try to sync my laptop and iPod touch. What can I do about this?

    I'm stuck on "waiting for items to copy" when I try to sync my laptop and iPod touch. It was fine until the latest update. It's very frustrating. What can I do about this?

    Hi maasailand giraffe,
    Welcome to the Support Communities!
    First of all, thanks for the detailed notes of the troubleshooting steps you've already tried.  It's hard to pinpoint exactly what is going on in your specific case, but I do have a few more ideas for you to try.
    Starting with just one of your iPads, when you get stuck on the "waiting for items to copy" step, just disconnect your iPhone.  There are probably some orphaned or corrupt files that need to be addressed.  I would suggest closing all of your open apps and then backing your iPad up to iCloud.  Then review the articles below to move or delete any big files on your device.  These can include Voice Memos (iPhone), music, photos on your camera roll, photos or videos that are attached to your Messages, email attachments, etc.
    iPhone, iPad, and iPod: Understanding capacity
    http://support.apple.com/kb/HT1867
    iOS: "Not enough free space" alert when trying to sync
    http://support.apple.com/kb/TS1503?viewlocale=en_US
    iOS: Import personal photos and videos from iOS devices to your computer
    http://support.apple.com/kb/ht4083
    How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    Remember that you can download any content you have purchased directly to your iPad.
    Downloading past purchases from the iTunes Store, App Store, and iBooks Store
    http://support.apple.com/kb/HT2519
    If you need to sync from iTunes, check your settings in the Summary tab to be sure you are only syncing items you have placed a checkmark in front of.
    iOS: Syncing with iTunes
    http://support.apple.com/kb/HT1386
    Give this a try on one of your iPads, and hopefully these steps will work for your other devices as well.
    Cheers,
    Judy

  • Communicate between SWF & Global static vars

    Sorry for my inglish...
    I’m having some problems on getting full communication between loaded SWFs. I'm totally stuck and my timing is running.
    Suppose the following scenario:
    Father-SWF has his own class and loads A-SWF and B-SWF. A and B SWF has his own class and package. To exchange values and run functions between SWF, I’m using a Global class with public static vars. Some of this vars are function, example:
    GLOBAL CLASS WITH STATIC VARS (com. with other class and package beetween SWF)
    package scripts
         public class GlobalAct
              public static var mainStage:Object;
              public static var myFuncGlobalA:Function;
              public static var myFuncGlobalB:Function;
    MAIN CLASS FATHER SWF
    package
         import flash.display.MovieClip;
         import scripts.GlobalAct;
         public class FatherClass extends
    MovieClip
              public function FatherClass():void
                   GlobalAct.mainStage
    = this;
                   GlobalAct.
    myFuncGlobal = myFunc;
              public function myFunc():void
                   //some wird stuff
    A_SWF CLASS
    package
    scripts
         import flash.display.MovieClip;
         import scripts.GlobalAct;
         public class Layout extends
    MovieClip
              private var someMc:MovieClip;
              public function Layout()
                    someMc
    = new MovieClip();
                    someMc. addEventListener(MouseEvent.CLICK,
    mouseFunc);
              public function mouseFunc (evt:MouseEvent):void
                   GlobalAct. myFuncGlobalA ();
    B_SWF CLASS
         Similar to A-SWF class but with other kind of functions…calling “GlobalAct.myFuncGlobalB();” for example.
    This works great, when I run Father-SWF, it load every SWF and functions run from SWF to SWF.
    The problem happens when I load Father-SWF in another SWF. There is a MAIN-SWF with his own set os class and a Global static vars Class.
    MAIN-SWF loads a SWF that will load Father-SWF into the MAIN-SWF.
    WORKING
    Father-SWF -> many SWF that could load other SWF
    NOT WORKING
    Main SWF -> SWF -> Father-SWF -> many SWF that could load other SWF
    When this happens none of the Global functions seems to work. The other Global vars seems OK, only function vars seems not to work.
    I only get the error: “TypeError: Error #1006: value is not a function. at scripts::Layout/ mouseFunc ()” when I try to click a button inside A-SWF.
    Does I lose my Global reference when loading the Father-SWF in another SWF?
    How can I make this bullet proof and generic for every situation?
    What’s the best oop practice to communicate between class and SWF on AS3?

    I figured it out.
    It's under the pop-up window. Select edit locations to select confirm.

  • How to know when an object is deleted?

    Hi,
    In Java, instances of classes are eliminate by garbage collector and programmers have no chance to do it.
    I need to do something, when the instance of a class ends its cycle-life .
    How do I know when an object is going to be deleted, in order to make some thing bounded to this event?
    thank you
    Regards
    Angelo

    Thank you for your help ...
    Here some code (I hope that I didn't forget something important):
    1. A class inside the JaveaBeans to manage events:
         * NavBean_EventsBroadcaster is a singleton class used in the JavaBean to manage (fire)
         * the events; and also to manage (add/remove) the listeners.
         * Events are raised when users push buttons with the purpose to change the display of
         * records (of the table) on the screen.
        public class NavBean_EventsBroadcaster implements Serializable {
            private transient Vector listeners;
            private static NavBean_EventsBroadcaster eventsBroadcaster_ForNavBeans = null;
             Method to get the instance of the singleton class
               static public NavBean_EventsBroadcaster getSingletonInstance() {
                    if (eventsBroadcaster_ForNavBeans == null) {
                        eventsBroadcaster_ForNavBeans = new NavBean_EventsBroadcaster();
                    return eventsBroadcaster_ForNavBeans;
                } // getSingletonInstance
            * fireTheEvent_X_navBean(): method that raise events
            public void fireTheEvent_X_navBean(
                    Object source,
                    NavigatorBean_eventsList_ENUM nbEvtENUM,
                    ResultSet rst,
                    int keyReg) {
                if (listeners != null && !listeners.isEmpty()) {
                    // object is going to be created (it contains the infos about the event)
                    NavBeanDB_EventDescriptor event_descr =
                            new NavBeanDB_EventDescriptor(
                            source, // dBbeanNavigator
                            nbEvtENUM,
                            rst,
                            keyReg);
                    // copy of the lisener to use it for add or remove
                    Vector targets;
                    synchronized (this) {
                        targets = (Vector) listeners.clone();
                    // proper event (select first, next, prev, last reg) is raised
                    Enumeration enumerat = targets.elements();
                    while (enumerat.hasMoreElements()) {
                        NavBeanDBListener_INTERFACE l =
                               (NavBeanDBListener_INTERFACE) enumerat.nextElement();
                        l.firedNavigationBeanEvents(event_descr);
                        System.out.println("Method fireTheEvent ----- key = " + priKeyOnTheScreen);
                }  // if
        } // fireTheEvent()
             * Adds a listener to the listener list.
             * @param l The listener to add.
            synchronized public void addNavBeanAddListener(NavBeanDBListener_INTERFACE l) {
                if (listeners == null) {
                    listeners = new Vector();
                listeners.addElement(l);
                System.out.println("E' stato registrato un nuovo ascoltatatore per navigationBar");
            } // addNavBeanAddListener()
         * Removes a listener from the listener list.
         * @param l The listener to remove.
        synchronized public void removeNavBeanRemoveListener(NavBeanDBListener_INTERFACE l) {
            if (listeners.contains(l)) {
                listeners.remove(l);
        }  // removeNavBeanRemoveListener()
        } // class NavBean_EventsBroadcaster2. The used interface
          * This is the interface that specifies the contract between a NavBeans
          * source and listener classes.
          * @author Owner
         public interface NavBeanDBListener_INTERFACE extends EventListener {
             public void firedNavigationBeanEvents(NavBeanDB_EventDescriptor evt);
         } // interface NavDB_BeansListener_INTERFACE3. the class adapter
        public abstract class DbNavigatorBean_Adapter implements NavBeanDBListener_INTERFACE {
             NavigatorBean_eventsList_ENUM navigatorBean_eventsList_ENUM;
             public DbNavigatorBean_Adapter() { // costruttore
             } // costruttore
              * This class have to be implemented from listeners to get events.
              * @param evt
             // NavigatorBean_eventsList_ENUM {user_chang, sequential_first, sequential_prev, sequential_next, sequential_last}
             public void firedNavigationBeanEvents(NavBeanDB_EventDescriptor evt) {
                 navigatorBean_eventsList_ENUM = evt.getEventType();
                 switch (navigatorBean_eventsList_ENUM) {
                     case user_chang:
                         toDoWhen_user_changeRegistration(evt);
                         break;
                     case sequential_first:
                         toDoWhen_setted_firstRegistration(evt);
                         break;
                     case sequential_prev:
                         toDoWhen_setted_prevRegistration(evt);
                         break;
                     case sequential_next:
                         toDoWhen_setted_nextRegistration(evt);
                         break;
                     case sequential_last:
                         toDoWhen_setted_lastRegistration(evt);
                         break;
                 } // witch case
             } // firedNavigationBeanEvents()
             abstract public void toDoWhen_user_changeRegistration(NavBeanDB_EventDescriptor evt); // { }
             abstract public void toDoWhen_setted_firstRegistration(NavBeanDB_EventDescriptor evt); // { }
             abstract public void toDoWhen_setted_nextRegistration(NavBeanDB_EventDescriptor evt); // { }
             abstract public void toDoWhen_setted_prevRegistration(NavBeanDB_EventDescriptor evt); // { }
             abstract public void toDoWhen_setted_lastRegistration(NavBeanDB_EventDescriptor evt); // { }
         } // class class DbNavigatorBean_Adapter_base4. the class used to describe the event
       Class used to dercribe the event that happened.
       public class NavBeanDB_EventDescriptor extends EventObject {
           private NavigatorBean_eventsList_ENUM navigationBean_events_ENUM;
           private int primaryKeyOfRegOnTheScreen;
           private ResultSet resultSet;
           private int totOfRegsRegistredOnTheTable;
            * Costructor: is used to describe the events
            * @param source
            * @param nbEvtENUM
            * @param rst
            * @param keyReg
           public NavBeanDB_EventDescriptor( // costruttore
                   Object source,
                   NavigatorBean_eventsList_ENUM nbEvtENUM,
                   ResultSet rst,
                   int keyReg) {
               super(source);
               this.navigationBean_events_ENUM = nbEvtENUM;
               this.resultSet = rst;
               this.primaryKeyOfRegOnTheScreen = keyReg;
               extractTotRegsInTheTable(rst);
       //        this.totOfRegsRegistredOnTheTable = rgsRegNmbr;
               System.out.println("Viene creata una istanza di event descriptor");
           }// costruttore
            * which possibe action caused the event,
            * was pushed the button (first, prev, next, last, user select...)
            * @return
           public NavigatorBean_eventsList_ENUM getEventType() {
               return navigationBean_events_ENUM;
           } // getEventType
            * primmary key of registration on the screen
            * @return
           public int getPrimaryKeyOfTheRegOnTheScreen() {
               return primaryKeyOfRegOnTheScreen;
           } // getKeyRegOnTheScreen
           * resultSet showed on the screen
           public ResultSet getTheFullRegistrationOnTheScreen() {
               return resultSet;
           } // getTheFullRegistrationOnTheScreen
           Number of registrations actually on the table.
           public int getTotRegsRegistredOnTheTable() {
               return this.totOfRegsRegistredOnTheTable;
           } // getRegsRegistredNmbr
            private classe that get data
           private void extractTotRegsInTheTable(ResultSet rst) {
               ResultSet localRst =rst;
               try {
                   int curRow = localRst.getRow();
                   localRst.last();
                   this.totOfRegsRegistredOnTheTable = localRst.getRow();
                   localRst.absolute(curRow);
               } catch (SQLException ex) {
                   Logger.getLogger(NavBeanDB_EventDescriptor.class.getName()).log(Level.SEVERE, null, ex);
       } // class NavBeansEvent5. a possible use of the JavaBeans
       public class TableClients extends JFrame
           implements LinkTablesToDlgThatRandomizeSelections_INTERFACE {
       private NavigationBean navigationBean;
       public TableClients() {   // constructor
            navigationBean = new NavigationBean();
            navigationBean.initializeDBbeanNavigator(...);
            this.add(navigationBean);
            navigationBean.addActionNavigatorListener(new DbNavigatorBean_Adapter() {
                        @Override
                        public void toDoWhen_user_changeRegistration(NavBeanDB_EventDescriptor nbdbed) {
                            // do something
                        @Override
                        public void toDoWhen_setted_firstRegistration(NavBeanDB_EventDescriptor nbdbed) {
                                // do something
                        @Override
                        public void toDoWhen_setted_nextRegistration(NavBeanDB_EventDescriptor nbdbed) {
                                // do something
                        @Override
                        public void toDoWhen_setted_prevRegistration(NavBeanDB_EventDescriptor nbdbed) {
                                // do something
                        @Override
                        public void toDoWhen_setted_lastRegistration(NavBeanDB_EventDescriptor nbdbed) {
                                // do something
    } // constructor
    } // class TableClientsthis code works well...
    But if I implement the javaBeans on more than one Dialogs (windows) and the user uses
    this dialogs sequentially, then the JavaBean responds to the events always as the caller is the
    first dialog that run...
    If I delete all listener (on the dialog) when the dialog is close then I have not problems
    still thank you
    Regards
    Angelo

  • Ensuring a static var stays updated

    Sorry for spamming the boards but I have another question...
    I want to get the index of the image currently in the center of the carousel and then I want to use this index number in other classes but it has to stay updated each time. I successfully managed to get the index of the image that is currently being clicked on (this image will then be moved to the center of the carousel so as long as one always clicks on an image at the start, my method will work ) but I dont know how to allow other classes to access this. I tried saving it as a static var and then trying to access it by using the following:
    private var coverIndex : int = CoverFlow.selectedCoverIndex;
    But I receive the error msg that selectedCoverIndex is not available to static class CoverFlow or something of that sort. This is what my CoverFlow code looks like (i.e. where I determine which image I want to position in the center):
    public class CoverFlow extends Sprite {
      public var covers : Vector.<DisplayObject>;
      private var cover : DisplayObject;
      private var coverIndex : int;
      private static var selectedCoverIndex : int; // Create a static coverIndex so I can easily use this data for external classes
      private function show(id : uint) : void // e : Event
       for (var i : Number = 0;i < covers.length; i++)
        cover = covers[i];
        // Tried putting if i == id as last statment to stop website coming up automatically but it still does since it then loops through again.
        if (i < id)
         setChildIndex(cover, i);
         TweenLite.to(cover, tweenDuration, {x: (id - i + 1) * -coverDistance, z: coverZ, rotationY: -coverRotationY, ease:easing });
        } else if (i > id)
         setChildIndex(cover, covers.length - 1 - i);
         TweenLite.to(cover, tweenDuration, {x: ((i - id + 1) * coverDistance), z: coverZ, rotationY: coverRotationY, ease:easing });
        } else if(i == id)
         setChildIndex(cover, covers.length - 1);
         TweenLite.to(cover, tweenDuration, {x: 0, z: selectedCoverZ, rotationY: 0, ease:easing });
      //____________________________________________________________________________Mouse functions on CoverFlow
      private function onClick(event : MouseEvent) : void
       // Always display product clicked on as center image
       cover = event.target as DisplayObject;
       coverIndex = covers.indexOf(cover);
       show(coverIndex); // Show the index number of the current displayed object
       selectedCoverIndex = getCoverIndex();
       trace("Index of Selected Cover : " + selectedCoverIndex);
      //____________________________________________________________________________Getters
      public function getCoverIndex() : int
       trace("Cover Index: " + coverIndex);
       return coverIndex;
    Hope you understand what I mean!!

    How stupid of me!!!
    I am not 100% sure it worked though... To start off it returns the current value (null) but then once I have clicked on one of the images, the coverIndex should change to the corresponding value. In the CoverFlow class it changes to a different value but I am not sure it does in the ProductSummaryLabel class (the latter is the class that imports the value from the CoverFlow class). The reason I believe this is that when in the CoverFlow I call the method setLabel from the ProductSummaryLabel class, which in turn is supposed to find the text in an array of texts which corresponds to the same index as that of the coverIndex, I receive athe following error message: "cannot reach a property or method with a null object reference". This seems to indicate that this variable in the ProductSummaryLabel class still contains the original null value and does not update itself.
    This is what my setLabel method in ProductSummaryLabel class looks like:
    public function setLabel() : void
       // Summary text depends on coverIndex, i.e. which image is currently in the center
       coverIndex = CoverFlow.selectedCoverIndex; // This should update itself each time I call the setLabel method!
       trace("Cover Index (Product Summary Label class setLabel()): " + coverIndex);
       var desiredSummaryString : String = uebersicht[coverIndex];
       trace("Product summary text: " + desiredSummaryString);
       productSummaryLabel.text = desiredSummaryString;
       productSummaryLabel.visible = true;
       trace("Step 10: Summary loaded");
    Below is the method in the CoverFlow class which gets the current coverIndex value and below that is the method which calls the setLabel method from the ProductSummaryLabel class (where pl is declared above as  private var pl : ProductSummaryLabel;).
    public function getCoverIndex() : int
       return coverIndex;
    private function onClick(event : MouseEvent) : void
       // Always display product clicked on as center image
       cover = event.target as DisplayObject;
       coverIndex = covers.indexOf(cover);
       show(coverIndex); // Show the index number of the current displayed object
       selectedCoverIndex = getCoverIndex();
       trace("Index of Selected Cover : " + selectedCoverIndex);
       // Ensures the text of prodctSummaryLabel is updated
       pl.setLabel();

Maybe you are looking for