Invoking event listener

I'm new to reflection api and would like to know whether it's possible or not using Method class to invoke event listener without using awt or swing? And if it's possible some sample code would be nice.

I mean I don't want to use gui components. In fact
I'm writing console program. I just want to use event
listener to implement keyboard listener(pressing
buttons).Oh. That won't work. To capture events from the console, you'll be needing to dabble with native code. AWT events are generated by AWT components, in response to events from the underlying windowing system

Similar Messages

  • Error occured in invoking event "contextInitialized()" on listener class co

    Hi All,
    I am working on JSF 1.2 on SAP NetWeaver CE. I am able to execute sample JSF application successfully when NO java program is written in the application. When I write a java program inside the JSF application...I am getting following error. Please let me know how to proceed on this:
    "Application error occurred during the request procession."
    Error occured in invoking event "contextInitialized()" on listener class com.sun.faces.config.ConfigureListener.
    Details:
    java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:654)
    at com.sap.engine.boot.loader.ResourceMultiParentClassLoader.loadClassLocal(ResourceMultiParentClassLoader.java:198)
    at com.sap.engine.boot.loader.MultiParentClassLoader.findClassInLoaderGraph(MultiParentClassLoader.java:302)
    at com.sap.engine.boot.loader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:256)
    at com.sap.engine.boot.loader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:228)
    at com.sun.faces.config.ManagedBeanFactoryImpl.getManagedBeanClass(ManagedBeanFactoryImpl.java:227)
    at com.sun.faces.config.ManagedBeanFactoryImpl.scanForAnnotations(ManagedBeanFactoryImpl.java:1130)
    at com.sun.faces.config.ManagedBeanFactoryImpl.<init>(ManagedBeanFactoryImpl.java:156)
    at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:926)
    at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:507)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:402)
    at com.sap.engine.services.servlets_jsp.server.application.WebEvents.contextInitialized(WebEvents.java:74)
    at com.sap.engine.services.servlets_jsp.server.deploy.ApplicationThreadInitializer.run(ApplicationThreadInitializer.java:198)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:152)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)
    Rgds,
    Pathan

    Pathan wrote:
    java.lang.UnsupportedClassVersionError: Bad version number in .class fileThe Java version of the Java compiler used is newer than the Java version of the Java runtime used.
    E.g. compiling with JDK 1.6 and running with JRE 1.5 would cause this error.

  • How does custom event listener work.

    Hi,
    With reference to Custom Event Listener, I wanted to know the behaviour of Custom Listener whether they are sync or async.
    For Example :
    Suppose i have a method1() which has the listener1() get invoked at some operation at line #1 of method();
    The task of listener1() takes 2 minutes aprox.
    Then my question is does method1() waits until listener1() finishes its task(2 Minutes) ?
    What is he default behavior of listner1()
    Can we change the default behavior of custom listners ?
    Thanks & Regards,

    jwenting wrote:
    rephrase your question in gramatically (and preferably syntactically) correct English so people can actually understand what you're asking.You took the words straight out of my mouth
    Mel

  • BeforeSave event listener reverting doc to unsaved [AS, CS5]

    Hi,
    I've got an AppleScript, which is triggered by a beforeSave event listener.  This script makes some modifications to the active document, and then the save proceeds.  The problem I'm encountering is that, after the save, the document appears as saved momentarily, but then immediately reverts back to unsaved.  This is evident by an asterisk disappearing and reappearing next to the document name in the document window's title bar.  If I comment out the document modification code, the save works as expected. 
    It seems like maybe the save is continuing while the script is still in progress, and this is why the document reverts to unsaved.  However, shouldn't the beforeSave event take place before the save occurs, and not proceed until the script has finished executing?
    Things I've checked and/or tried…
    * I've checked to see if somehow my script is being triggered a second time after the save is complete.  It is not.
    * I've tried having my script save the document on completion, but this fails because the database is busy.
    * I've tested with beforeSaveAs, and it encounters the same problem.
    * I've tested on multiple machines.  What's weird is that it occurs on some, and not on others.  So, it's not consistent.
    * I have seen the problem in Mac OS X 10.5.x and 10.6.x.  I have not tested it in 10.7.x yet.
    * I have seen the problem with CS5, but have not yet encountered it with 5.5.
    Anyone have any thoughts or suggestions?
    Thanks,
    -Ben

    Thanks for the ideas regarding beforeInvoke, Ben.  I will try to check that out.  In my situation, here's essentially how my script is working...
    BeforeSave is invoked.
    Script makes a change to the document, which should be captured in the saved file.
    Document saves.
    Document appears saved for a moment, and then appears unsaved (asterisk in the document title).
    My biggest problem is that this behavior isn't consistent.  I have dozens of users, all running the same script, and the problem only occurs with certain users and at random times. I can move a problematic document from a user's machine to a different machine, and the problem doesn't occur there.  It's very difficult to troubleshoot because I can't reproduce it consistently.

  • Creating a singleton Event Listener class

    A typical singleton OO design pattern involved a protected (or private)
    no-arg
    constructor and a public instance() method that manages a private static
    variable
    referencing the single instance, internally invoking the no-arg constructor.
    A class designated in web.xml as a <listener> must have a public no-arg
    constructor.
    (from http://e-docs.bea.com/wls/docs61/webapp/app_events.html#178593)
    Anyone thoughts on how to accomplish both goals?
    What I want to do: I'd like to set up a singleton to listen for session
    events.
    Other code will query this one-and-only-one session event listener for
    various
    information. Some of this info I can currently get from the runtime via
    MBeans but
    some I can't, hence my investigation into session event listeners.
    TIA, matt.

    Hi Matt,
    This sounds like a case where you will need to have two classes -- your
    singleton class, and then your session event listener class, which would use
    the singleton class.
    Dennis Munsie
    Developer Relations Engineer
    BEA Support
    "Matt Hembree" <[email protected]> wrote in message
    news:[email protected]..
    A typical singleton OO design pattern involved a protected (or private)
    no-arg
    constructor and a public instance() method that manages a private static
    variable
    referencing the single instance, internally invoking the no-argconstructor.
    >
    A class designated in web.xml as a <listener> must have a public no-arg
    constructor.
    (from http://e-docs.bea.com/wls/docs61/webapp/app_events.html#178593)
    Anyone thoughts on how to accomplish both goals?

  • Error trying to register a Java event listener

    I'm trying to register a java event listener in 11g with the following piece of code:
    DECLARE
    b BOOLEAN := FALSE;
    BEGIN
    b := DBMS_XDB.createFolder('/public/resconfig');
    b := DBMS_XDB.createResource(
    '/public/resconfig/hr_event.xml',
    '<ResConfig xmlns="http://xmlns.oracle.com/xdb/XDBResConfig.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/xdb/XDBResConfig.xsd
    http://xmlns.oracle.com/xdb/XDBResConfig.xsd">
    <event-listeners default-language="Java">
    <listener>
    <description>Category application</description>
    <schema>HR</schema>
    <source>xdbproject.OpenOfficeEventHandler</source>
    <language>Java</language>
    <events>
    <Post-Create/>
    <Post-LinkIn/>
    </events>
    </listener>
    </event-listeners>
    <defaultChildConfig>
    <configuration>
    <path>/public/resconfig/hr_event.xml</path>
    </configuration>
    </defaultChildConfig>
    </ResConfig>');
    END;
    This results in the following error message
    ORA-31146: Ugyldig lytterkilde HR.xdbproject.OpenOfficeEventHandler
    ORA-06512: ved "XDB.DBMS_XDB", line 174
    ORA-06512: ved line 5
    which translates to Invalid listener source.
    My class is loaded in the HR schema, and implements the XDBRepositoryEventListener
    Does anybody have a suggestion to what I'm doing wrong, or how I can find out what makes my class invalid as a listener source?

    Check if it validates against the restrictions set in the XML Schema (Appendix A, Oracle XMLDB Developers Guide):
    XDBResConfig.xsd: XML Schema for Resource Configuration
    This section presents the Oracle XML DB supplied XML schema used to configure repository resources. This is accessible in Oracle XML DB Repository at path /sys/schemas/PUBLIC/xmlns.oracle.com/xdb/XDBResConfig.xsd.
    XDBResConfig.xsd
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://xmlns.oracle.com/xdb/XDBResConfig.xsd"
            xmlns:xdb="http://xmlns.oracle.com/xdb"
            xmlns:rescfg="http://xmlns.oracle.com/xdb/XDBResConfig.xsd"
            elementFormDefault="qualified" xdb:schemaOwner="XDB" version="1.0" >
      <annotation>
        <documentation>
          This XML schema declares the schema of an XDB resource configuration,
          which includes default ACL, event listeners and user configuration.
          It lists all XDB repository events that will be supported.
          Future extension can be added to support user-defined events and
          XML events.
        </documentation>
      </annotation>
      <simpleType name="language">
        <restriction base="string">
          <enumeration value="Java" />
          <enumeration value="C" />
          <enumeration value="PL/SQL" />
        </restriction>
      </simpleType>
      <complexType name = "existsNode">
         <all>
           <element name="XPath" type = "string" minOccurs="1" maxOccurs="1" />
           <element name="namespace" type = "string" minOccurs="0" maxOccurs="1" />
         </all>
      </complexType>
      <!-- listener pre-condition element  -->
      <complexType name = "condition">
         <all>
           <element name="existsNode" type = "rescfg:existsNode" minOccurs="0" maxOccurs="1" />
         </all>
      </complexType>
      <complexType name = "events">
        <all>
          <element name="Render" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Create" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Create" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Delete" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Delete" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Update" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Update" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Lock" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Lock" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Unlock" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Unlock" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-LinkIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-LinkIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-LinkTo" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-LinkTo" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-UnlinkIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-UnlinkIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-UnlinkFrom" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-UnlinkFrom" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-CheckIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-CheckIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-CheckOut" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-CheckOut" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-UncheckOut" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-UncheckOut" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-VersionControl" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-VersionControl" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Open" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Open" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-InconsistentUpdate" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-InconsistentUpdate" type="string" minOccurs="0" maxOccurs="1"/>
        </all>
      </complexType>
      <!-- event listener element  -->
      <complexType name = "event-listener">
        <all>
          <element name="description" type = "string" minOccurs="0" maxOccurs="1"/>
          <element name="schema" type = "string" minOccurs="0" maxOccurs="1"/>
          <element name="source" type = "string" minOccurs="1" maxOccurs="1"/>
          <element name="language" type = "rescfg:language" minOccurs="0" maxOccurs="1"/>
          <element name="pre-condition" type = "rescfg:condition" minOccurs="0" maxOccurs="1"/>
          <element name="events" type = "rescfg:events" minOccurs="0" maxOccurs="1"/>
        </all>
      </complexType>
      <complexType name="event-listeners">
        <sequence>
          <element name="listener" type = "rescfg:event-listener" minOccurs="1" maxOccurs="unbounded"/>
        </sequence>
        <attribute name = "default-schema" type = "string" xdb:baseProp="true" use="optional"/>
        <attribute name = "default-language" type = "rescfg:language" xdb:baseProp="true"
                   use="optional"/>
        <attribute name = "set-invoker" type = "boolean" xdb:baseProp="true" default="false" />
      </complexType>
      <complexType name="defaultPath">
        <all>
          <element name="pre-condition" type = "rescfg:condition" minOccurs="0" maxOccurs="1"/>
          <element name="path" type="string" minOccurs="0" maxOccurs="1" xdb:transient="generated"/>
          <element name = "resolvedpath" type = "string" minOccurs="1" maxOccurs="1"
                   xdb:baseProp="true" xdb:hidden="true"/>
          <element name = "oid" type = "hexBinary" minOccurs="1" maxOccurs="1" xdb:baseProp="true"
                   xdb:hidden="true"/>
        </all>
      </complexType>
      <complexType name="defaultACL">
        <sequence>
          <element name="ACL" type="rescfg:defaultPath" minOccurs="1" maxOccurs="unbounded"/>
        </sequence>
      </complexType>
      <complexType name = "defaultConfig">
        <sequence>
          <element name="configuration" type="rescfg:defaultPath" minOccurs="1" maxOccurs="unbounded"/>
        </sequence>
      </complexType>
      <simpleType name="link-type">
        <restriction base="string">
          <enumeration value="None"/>
          <enumeration value="Hard"/>
          <enumeration value="Weak"/>
          <enumeration value="Symbolic"/>
        </restriction>
      </simpleType>
      <simpleType name="path-format">
        <restriction base="string">
          <enumeration value="OID"/>
          <enumeration value="Named"/>
        </restriction>
      </simpleType>
      <simpleType name="link-metadata">
        <restriction base="string">
          <enumeration value="None"/>
          <enumeration value="Attributes"/>
          <enumeration value="All"/>
        </restriction>
      </simpleType>
      <simpleType name="unresolved-link">
        <restriction base="string">
          <enumeration value="Error"/>
          <enumeration value="SymLink"/>
          <enumeration value="Skip"/>
        </restriction>
      </simpleType>
      <simpleType name="conflict-rule">
        <restriction base="string">
          <enumeration value="Error"/>
          <enumeration value="Overwrite"/>
          <enumeration value="Syspath"/>
        </restriction>
      </simpleType>
       <simpleType name="section-type">
         <restriction base="string">
           <enumeration value="None"/>
           <enumeration value="Fragment"/>
           <enumeration value="Document"/>
         </restriction>
       </simpleType>
      <!-- XLinkConfig complex type -->
        <complexType name="xlink-config">
         <sequence>
          <element name="LinkType" type = "rescfg:link-type"/>
          <element name="PathFormat" type = "rescfg:path-format" minOccurs="0" default="OID"/>
          <element name="LinkMetadata" type = "rescfg:link-metadata" minOccurs="0" default="None"/>
         </sequence>
         <attribute name="UnresolvedLink" type = "rescfg:unresolved-link" default="Error"/>
        </complexType>
      <!-- XIncludeConfig element -->
        <complexType name="xinclude-config">
         <sequence>
          <element name="LinkType" type = "rescfg:link-type"/>
          <element name="PathFormat" type = "rescfg:path-format" minOccurs="0" default="OID"/>
          <element name="ConflictRule" type = "rescfg:conflict-rule" minOccurs="0" default="Error"/>
         </sequence>
         <attribute name="UnresolvedLink" type = "rescfg:unresolved-link" default="Error"/>
        </complexType>
      <!-- SectionConfig element -->
      <complexType name="section-config">
       <sequence>   
        <element name="Section" maxOccurs="unbounded">
          <complexType>
            <sequence>
             <element name="sectionPath" type="string"/>
             <element name="documentPath" type="string" minOccurs="0"/>
             <element name="namespace" type="string" minOccurs="0"/>
            </sequence>
            <attribute name="type" type="rescfg:section-type" default="None"/>
          </complexType>
        </element>
       </sequence>
      </complexType>
      <!-- ContentFormat element -->
      <simpleType name="content-format" >
        <restriction base="string">
          <enumeration value="text"/>
          <enumeration value="binary"/>
        </restriction>
       </simpleType>
      <!-- resource configuration element  -->
      <complexType name = "ResConfig">
        <all>
          <element name="defaultChildConfig" type="rescfg:defaultConfig" minOccurs="0"  maxOccurs="1"/>
          <element name="defaultChildACL" type="rescfg:defaultACL" minOccurs="0" maxOccurs="1"/>
          <element name="event-listeners" type = "rescfg:event-listeners" minOccurs="0" maxOccurs="1"/>
          <element name="XLinkConfig" type="rescfg:xlink-config" minOccurs="0" maxOccurs="1"/>
          <element name="XIncludeConfig" type="rescfg:xinclude-config" minOccurs="0" maxOccurs="1"/>
          <element name="SectionConfig" type="rescfg:section-config" minOccurs="0" maxOccurs="1"/>
          <element name="ContentFormat" type="rescfg:content-format" minOccurs="0" maxOccurs="1"/>
          <!-- application data -->
          <element name="applicationData" minOccurs="0" maxOccurs="1" >
             <complexType>
               <sequence>
                 <any namespace="##other" maxOccurs="unbounded" processContents="lax"/>
               </sequence>
             </complexType>
         </element>
        </all>
        <attribute name = "enable" type = "boolean" xdb:baseProp="true" default="true" />
        <attribute name = "copy-on-inconsistent-update" type = "boolean" use="optional" />
      </complexType>
      <element name="ResConfig" type="rescfg:ResConfig" xdb:defaultTable = "XDB$RESCONFIG" />
    </schema>
    acl.xsd: XML Schema for ACLs
    This section presents the Oracle Database supplied XML schema used to represent access control lists (ACLs).
    acl.xsd
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://xmlns.oracle.com/xdb/acl.xsd" version="1.0"
            xmlns:xdb="http://xmlns.oracle.com/xdb"
            xmlns:xdbacl="http://xmlns.oracle.com/xdb/acl.xsd"
            elementFormDefault="qualified">
       <annotation>
         <documentation>
            This XML schema describes the structure of XDB ACL documents.
            Note : The "systemPrivileges" element below lists all supported
              system privileges and their aggregations.
              See dav.xsd for description of DAV privileges
            Note : The elements and attributes marked "hidden" are for
              internal use only.
         </documentation>
         <appinfo>
           <xdb:systemPrivileges>
            <xdbacl:all>
              <xdbacl:read-properties/>
              <xdbacl:read-contents/>
              <xdbacl:read-acl/>
              <xdbacl:update/>
              <xdbacl:link/>
              <xdbacl:unlink/>
              <xdbacl:unlink-from/>
              <xdbacl:write-acl-ref/>
              <xdbacl:update-acl/>
              <xdbacl:link-to/>
              <xdbacl:resolve/>
              <xdbacl:write-config/>
            </xdbacl:all>
           </xdb:systemPrivileges>
         </appinfo>
       </annotation>
      <!-- privilegeNameType (this is an emptycontent type) -->
      <complexType name = "privilegeNameType"/>
      <!-- privilegeName element
           All system and user privileges are in the substitutionGroup
           of this element.
        -->
      <element name = "privilegeName" type="xdbacl:privilegeNameType"
               xdb:defaultTable=""/>
      <!-- all system privileges in the XDB ACL namespace -->
      <element name = "read-properties" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "read-contents" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "read-acl" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "update" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "link" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "unlink" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "unlink-from" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "write-acl-ref" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "update-acl" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "link-to" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "resolve" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "all" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <!-- privilege element -->
      <element name = "privilege" xdb:defaultTable="">
        <complexType>
          <sequence>
            <any maxOccurs="unbounded" processContents="lax"/>
          </sequence>
        </complexType>
      </element>
      <!-- ace element -->
      <element name = "ace" xdb:defaultTable="">
        <complexType>
          <sequence>
            <element name = "grant" type = "boolean"/>
            <choice>
              <element name="invert" xdb:transient="generated">
                <complexType>
                  <sequence>
                    <element name="principal" type="string"
                             xdb:transient="generated" />
                  </sequence>
                </complexType>
              </element>
              <element name="principal" type="string" xdb:transient="generated"/>
            </choice>
            <element ref="xdbacl:privilege" minOccurs="1"/>
            <!-- "any" contain all app info for an ACE e.g.reason for creation -->
            <any minOccurs="0" maxOccurs="unbounded" namespace="##other"/>
            <!-- HIDDEN ELEMENTS -->
            <choice minOccurs="0">
              <element name = "principalID" type = "hexBinary"
                       xdb:baseProp="true" xdb:hidden="true"/>
              <element name = "principalString" type = "string"
                       xdb:baseProp="true" xdb:hidden="true"/>
            </choice>
            <element name = "flags" type = "unsignedInt" minOccurs="0"
                     xdb:baseProp="true" xdb:hidden="true"/>
          </sequence>
          <attribute name = "collection" type = "boolean"
                     xdb:transient="generated" use="optional"/>
          <attribute name = "principalFormat"
                     xdb:transient="generated" use="optional">
            <simpleType>
              <restriction base="string">
                <enumeration value="ShortName"/>
                <enumeration value="DistinguishedName"/>
                <enumeration value="GUID"/>
                <enumeration value="XSName"/>
              </restriction>   
            </simpleType>
          </attribute>
          <attribute name = "start_date" type = "dateTime" use = "optional"/>
          <attribute name = "end_date" type = "dateTime" use = "optional"/>    
        </complexType>
      </element>
      <!-- acl element -->
      <complexType name="inheritanceType">
        <attribute name="type" type="string" use="required"/>
        <attribute name="href" type="string" use="required"/>
      </complexType>
      <complexType name="aclType">
       <sequence>
        <element name = "schemaURL" type = "string" minOccurs="0"
                 xdb:transient="generated"/>
        <element name = "elementName" type = "string" minOccurs="0"
                 xdb:transient="generated"/>
        <element name = "security-class" type = "QName" minOccurs="0"/>
        <choice minOccurs="0">
          <element name="extends-from" type="xdbacl:inheritanceType"/>
          <element name="constrained-with" type="xdbacl:inheritanceType"/>
        </choice>
        <element ref = "xdbacl:ace" minOccurs="1" maxOccurs = "unbounded"/>
        <!-- this "any" contains all application specific info for an ACL,
             e.g., reason for creation  -->
        <any minOccurs="0" maxOccurs="unbounded" namespace="##other" />
        <!-- HIDDEN ELEMENTS -->
        <element name = "schemaOID" type = "hexBinary" minOccurs="0"
                 xdb:baseProp="true" xdb:hidden="true"/>
        <element name = "elementNum" type = "unsignedInt" minOccurs="0"
                 xdb:baseProp="true" xdb:hidden="true"/>
       </sequence>
       <attribute name = "shared" type = "boolean" default="true"/>
       <attribute name = "description" type = "string"/>
      </complexType>
      <complexType name="rule-based-acl">
        <complexContent>
          <extension base="xdbacl:aclType">
            <sequence>
              <element name = "param" minOccurs="0" maxOccurs="unbounded">
                <complexType>
                  <simpleContent>
                    <extension base="string">
                      <attribute name = "name" type = "string" use = "required"/>
                    </extension>
                  </simpleContent>
                </complexType>
              </element>
            </sequence>
          </extension>
        </complexContent>
      </complexType>
      <element name = "acl" type="xdbacl:aclType" xdb:defaultTable = "XDB$ACL"/>
      <element name = "write-config" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
    </schema>Message was edited by:
    Marco Gralike

  • [svn:bz-trunk] 23085: Fix test to explicitly remove an event listener after the test is finished .

    Revision: 23085
    Revision: 23085
    Author:   [email protected]
    Date:     2011-10-21 07:49:33 -0700 (Fri, 21 Oct 2011)
    Log Message:
    Fix test to explicitly remove an event listener after the test is finished. Not doing this was causing the test to throw an RTE.
    Modified Paths:
        blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-amf/MessagingAuthProSendTest.mxml

    Thanks for the ideas regarding beforeInvoke, Ben.  I will try to check that out.  In my situation, here's essentially how my script is working...
    BeforeSave is invoked.
    Script makes a change to the document, which should be captured in the saved file.
    Document saves.
    Document appears saved for a moment, and then appears unsaved (asterisk in the document title).
    My biggest problem is that this behavior isn't consistent.  I have dozens of users, all running the same script, and the problem only occurs with certain users and at random times. I can move a problematic document from a user's machine to a different machine, and the problem doesn't occur there.  It's very difficult to troubleshoot because I can't reproduce it consistently.

  • Adding an event listener to combo box

    I am working on a mortgage calculator and I cannot figure out how to add an event listener to a combo box.
    I want to get the mortgage term and interest rate to calucate the mortgage using the combo cox. Here is my program.
    Modify the mortgage program to allow the user to input the amount of a mortgage
    and then select from a menu of mortgage loans: 7 year at 5.35%, 15 year at 5.50%, and
    30 year at 5.75%. Use an array for the different loans. Display the mortgage payment
    amount. Then, list the loan balance and interest paid for each payment over the term
    of the loan. Allow the user to loop back and enter a new amount and make a new
    selection, with resulting new values. Allow user to exit if running as an application
    (can't do that for an applet though).
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.text.NumberFormat;
    import java.util.Locale;
    //creates class MortgageCalculator
    public class MortgageCalculator extends JFrame implements ActionListener {
    //creates title for calculator
         JPanel row = new JPanel();
         JLabel mortgageCalculator = new JLabel("MORTGAGE CALCULATOR", JLabel.CENTER);
    //creates labels and text fields for amount entered          
         JPanel firstRow = new JPanel(new GridLayout(3,1,1,1));
         JLabel mortgageLabel = new JLabel("Mortgage Payment $", JLabel.LEFT);
         JTextField mortgageAmount = new JTextField(10);
         JPanel secondRow = new JPanel();
         JLabel termLabel = new JLabel("Mortgage Term/Interest Rate", JLabel.LEFT);
         String[] term = {"7", "15", "30"};
         JComboBox mortgageTerm = new JComboBox(term);
         JPanel thirdRow = new JPanel();
         JLabel interestLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
         String[] interest = {"5.35", "5.50", "5.75"};
         JComboBox interestRate = new JComboBox(interest);
         JPanel fourthRow = new JPanel(new GridLayout(3, 2, 10, 10));
         JLabel paymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
         JTextField monthlyPayment = new JTextField(10);
    //create buttons to calculate payment and clear fields
         JPanel fifthRow = new JPanel(new GridLayout(3, 2, 1, 1));
         JButton calculateButton = new JButton("CALCULATE PAYMENT");
         JButton clearButton = new JButton("CLEAR");
         JButton exitButton = new JButton("EXIT");
    //Display area
         JPanel sixthRow = new JPanel(new GridLayout(2, 2, 10, 10));
         JLabel displayArea = new JLabel(" ", JLabel.LEFT);
         JTextArea textarea = new JTextArea(" ", 8, 50);
    public MortgageCalculator() {
         super("Mortgage Calculator");                     //title of frame
         setSize(550, 350);                                             //size of frame
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container pane = getContentPane();
         GridLayout grid = new GridLayout(7, 3, 10, 10);
         pane.setLayout(grid);
         pane.add(row);
         pane.add(mortgageCalculator);
         pane.add(firstRow);
         pane.add(mortgageLabel);
         pane.add(mortgageAmount);
         pane.add(secondRow);
         pane.add(termLabel);
         pane.add(mortgageTerm);
         pane.add(thirdRow);
         pane.add(interestLabel);
         pane.add(interestRate);
         pane.add(fourthRow);
         pane.add(paymentLabel);
         pane.add(monthlyPayment);
         monthlyPayment.setEnabled(false);
         pane.add(fifthRow);
         pane.add(calculateButton);
         pane.add(clearButton);
         pane.add(exitButton);
         pane.add(sixthRow);
         pane.add(textarea); //adds texaarea to frame
         pane.add(displayArea);
         setContentPane(pane);
         setVisible(true);
         //Adds Listener to buttons
         calculateButton.addActionListener(this);
         clearButton.addActionListener(this);
         exitButton.addActionListener(this);
         mortgageTerm.addActionListener(this);
         interestRate.addActionListener(this);
    public void actionPerformed(ActionEvent event) { 
         Object command = event.getSource();
         JComboBox mortgageTerm = (JComboBox)event.getSource();
         String termYear = (String)mortgageTerm.getSelectedItem();
    if (command == calculateButton) //calculates mortgage payment
         int year = Integer.parseInt(mortgageTerm.getText());
         double rate = new Double(interestRate.getText()).doubleValue();
         double mortgage = new Double(mortgageAmount.getText()).doubleValue();
         double interest = rate /100.0 / 12.0;
         double monthly = mortgage *(interest/(1-Math.pow(interest+1,-12.0 * year)));
                   NumberFormat myCurrencyFormatter;
                   myCurrencyFormatter = NumberFormat.getCurrencyInstance(Locale.US);
                   monthlyPayment.setText(myCurrencyFormatter.format(monthly));
         if(command == clearButton) //clears all text fields
                   mortgageAmount.setText(null);
                   //mortgageTerm.setText(null);
                   //interestRate.setText(null);
                   monthlyPayment.setText(null);
              if(command == exitButton) //sets exit button
                        System.exit(0);
         public static void main(String[] arguments) {
              MortgageCalculator mor = new MortgageCalculator();

    The OP already did this to both JComboBoxes.
    mochatay, here is a new actionPerformed method for you to use.
    I've improved a few things here and there...
    1) You can't just cast the ActionEvent's source into a JComboBox!
    What if it was a JButton that fired the event? Then you would get ClassCastExceptions (I'm sure you did)
    So check for all options, what the source of the ActionEvent actually was...
    2) You can't assume the user will always type in valid data.
    So enclose the Integer and Double parse methods in try-catch brakcets.
    Then you can do something when you know that the user has entered invalid input
    (like tell him/her what a clumsy idiot they are !)
    3) As soon as user presses an item in any JComboBox, just re-calculate.
    I did this here by programmatically clicking the 'Calculate' button.
    Alternatively, you could have a 'calculate' method, which does everything inside the
    if(command==calculateButton) if-block.
    This will be called when:
    a)calculateButton is pressed
    b)when either of the JComboBoxes are pressed.
    public void actionPerformed (ActionEvent event)
            Object command = event.getSource ();
            if (command == calculateButton) //calculates mortgage payment
                int year = 0;
                double rate = 0;
                double mortgage = 0;
                double interest = 0;
                /* If user has input invalid data, tell him so
                and return (Exit from this method back to where we were before */
                try
                    year = Integer.parseInt (mortgageTerm.getSelectedItem ().toString ());
                    rate = new Double (interestRate.getSelectedItem ().toString ()).doubleValue ();
                    mortgage = new Double (mortgageAmount.getText ()).doubleValue ();
                    interest = rate / 100.0 / 12.0;
                catch (NumberFormatException nfe)
                    /* Display a message Dialogue box with a message */
                    JOptionPane.showMessageDialog (this, "Error! Invalid input!");
                    return;
                double monthly = mortgage * (interest / (1 - Math.pow (interest + 1, -12.0 * year)));
                NumberFormat myCurrencyFormatter;
                myCurrencyFormatter = NumberFormat.getCurrencyInstance (Locale.US);
                monthlyPayment.setText (myCurrencyFormatter.format (monthly));
            else if (command == clearButton) //clears all text fields
                /* Better than setting it to null (I think) */
                mortgageAmount.setText ("");
                //mortgageTerm.setText(null);
                //interestRate.setText(null);
                monthlyPayment.setText ("");
            else if (command == exitButton) //sets exit button
                System.exit (0);
            else if (command == mortgageTerm)
                /* Programmatically 'clicks' the button,
                As is user had clicked it */
                calculateButton.doClick ();
            else if (command == interestRate)
                calculateButton.doClick ();
            //JComboBox mortgageTerm = (JComboBox) event.getSource ();
            //String termYear = (String) mortgageTerm.getSelectedItem ();
        }Hope this solves your problems.
    I also hope you'll be able to learn from what I've indicated, so you can use similar things yourself
    in future!
    Regards,
    lutha

  • Can't remove event listener from Image

    I'm clearly missing something and would appreciate some help.  I'm trying to run an event handler when an Image completes loading,  then remove the handler so that it won't  run again should the image be reloaded later.
    The problem that I'm having is that the event handler simply wont' go away, despite calling removeEventListener on the Image object.
    The following example demonstrates the problem (the example doesn't actually do anything useful...it's just the shortest example to demonstrate the problem).  (To run the  app, you'll have to provide any ol' JPEG file named "myImage.jpg" in the "src" directory of your project).
    What I expect to happen is :
         1) on startup, the image loads and loadComplete() runs.
         2)  loadComplete removes the event Listener so that subsequent re-loads won't re-fire the handler.  I only want the handler to  run once.
         3) "loadComplete" shoudl  be displayed in the Debug console.
         4) A button click should display only "Changing  Image" in the Debug console
    What I get instead is that the loadComplete handler isn't  removed, and every  time I click the button, loadComplete runs when the image is re-loaded   (i.e., every button click results in both "Change Image" AND "loadComplete"  being displayed in the Debug console).
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Image width="655" height="181" source="myImage.jpg" id="myImage" autoLoad="true" scaleContent="true" complete="loadComplete()" x="100" y="100"/>
        <mx:Button x="100" y="341" label="Button" click="click(event)"/>
        <mx:Script>
            <![CDATA[
                private function loadComplete():void
                    trace ("loadComplete");
                    myImage.removeEventListener("complete", loadComplete);
                private function click(evt:Event):void
                    trace ("Changing Image");
                    myImage.load("myImage.jpg");    //  Reload same image; it's just an example
            ]]>
        </mx:Script>
    </mx:Application>

    Hi,
    You can remove only event listeners that you added with the addEventListener() method in an ActionScript block. You cannot remove an event listener  that was defined in the MXML tag, even if it was registered using a call  to the addEventListener()method that was made inside a tag attribute.
    Check this page for reference.
    http://livedocs.adobe.com/flex/3/html/help.html?content=events_05.html
    You can modify the code a bit a get it working
    <mx:Image width="655" height="181" id="myImage" scaleContent="true"
              x="100" y="100"
              creationComplete="myImage_creationCompleteHandler(event)"/>
    private function myImage_creationCompleteHandler(event:FlexEvent):void
         myImage.addEventListener("complete",myImage_completeHandler);
         myImage.load("myImage.jpg");
    private function myImage_completeHandler(event:Event):void
         myImage.removeEventListener("complete",myImage_completeHandler);

  • How do I assign a mouseclick event Listener to a simplebutton already nested in a movie clip when it's dropped on stage?

    I'm trying to assign a mouseclick event listener to a simplebutton nested within a movie clip's later frames, starting at frame 2 and up. This card, however, is not added to my game until later, and when the player clicks on it/turns it over.
    There are four files involved in this program:
    #1 The main actionscript file, which corresponds to
    #2 my dreamQuester .fla file.
    #3 my artifactCard file movieClip's corresponding .as file,
    #4 my combo1.as file corresponding to a an instance of a simpleButton named combo1 that is already
    nested --and this instance is already named-- inside/as a child of said artifactCard movieclip.
    What I've done so far isn't working:
    In my main dreamQuester.as file, when a player clicks on an artifactCard, its MOUSE_DOWN event
    listener takes them to this function (clickArtCard), where the trouble is at:
    // player clicked on the artC card--which is a child of posArt1 on stage--to turn card over:
            function clickArtCard(a_event:MouseEvent) {
                var thisArtCard:artifactCard = (a_event.target as artifactCard);
                thisArtCard.gotoAndStop(unclickedArt1);  // go to frame number of artifact
                                    // card where combo1 button is.
                thisArtCard.removeEventListener(MouseEvent.CLICK,clickArtCard);
                thisArtCard.buttonMode = false;
                trace("combo1.combo is:" + combo1.combo);
                trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1);
                posArt1.artC.combo1.addEventListener(MouseEvent.MOUSE_DOWN, comboClickedWHO);
    when the artC card--the static public instance of artifactCard--is clicked, it only gets to the
    trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1); which returns this error message:  
    TypeError: Error #1010: A term is undefined and has no properties.
        at MethodInfo-61()
    So do how would I declare a static public variable of this simpleButton at the start of my main .as
    file to make it defined to get a mouseDown actionListener into my pre-existing-and-named-instance
    combo1 simpleButton?
    perhaps there is a way, while the debug movie program is running, to click on the simpleButton and see exactly
    what it's parent heirarchy is, to see the name of all parents above the simpleButton incase they are
    different then what I think?
    (just in case, I was hoping to squeeze a zip file containing these files to be less than 9MB incase someone was willing to look at my files to see what I've done so far, but 9 megs is just too big! even though all graphics I've imported where turned into vector graphics with trace bitmap. I wish there was a way to check the file size of each symbol in Flash CS4, here...)
    Thank you so much for any help!
    ~Ethan

    Just use a
    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
    function keyPressed(event:KeyboardEvent):void {
         //trace(event.keyCode);
         if(event.keyCode == ???){
              // play the sound
    Where I show the "???" you would replace with the keyCode for the key you want pressed for that sound.  To determine the keyCode you can use the trace line that I have commented out.
    Note that when testing in Flash you often need to disable the keyboard shortcuts in the Flash Player in order to be able to use alot of the keys.  You will find this option in the Control menu options in the player.

  • How can I check if a function is or is not called from the event listener? in Flash CS4 (AS3)

    Hi,
    I came across a little problem.
    I put an event listener inside a for loop and the for loop inside a function.
    I want the for loop to end as soon as the event listener inside the for loop calls its function.
    Here is the general code for a better picture.
    Code:
    this.addEventListener(Event.ENTER_FRAME, function#1);
    function function#1(event:Event):void{
              if(something is true){
                        for(var i = 0; i < numOfmy_mcs; i++){
                                  this["my_mc_"+String(i)].addEventListener(MouseEvent.CLICK, function#2);
    function function#2(e:Event):void{
    //do something cool here
    Thank you for any help!

    kglad wrote:
    that for-loop (if it executes), defines listeners for interactive objects.  that will complete long before any object is clicked.
    Well yes but it does it again and again (frames per second times seconds = number of times it goes through the code if i'm not mistaken), because it is inside a function, and through testing i found out that it works like this:
    Example:
    there are 5 my_mc's in my project: (my_mc_0, my_mc_1, my_mc_2, my_mc_3, my_mc_4)
    if i click my_mc_0 function#2 is called and executed. BUT only after the loop finishes (i know this from tons of testing)...which is unnecessary since you cannot click two places at once. This might not be a problem in this example because i am only using 5 my_mc's buy if i use 500000000 my_mc's it would make a lot of difference.
    is there a way to stop the loop if the function is called?
    ...maybe there is a better way to write it, the only alternative i know that works is if i manually write every single listener and this also is logical in this example but as i said next to impossible if the numbers get bigger.
    -Note
    I didn't specify this earlier but function#2 makes the if statement false so it wont jump back into it.
    Thank you for the help I really appreciate it!
    3rd edit...don't know what's wrong with me

  • Help with event listener

    I'm having some trouble trying to figure out how this event listener will work.
    The main application is building an arrayCollection of a calendarDay custom components which is displayed by a DataGroup.
    Within each calendarDay custom component i may create an arrayList of a DriverDetailComponent custom components displayed within the calendarDay by a DataGroup.
    If a user double clicks on the DriverDetailComponent that is two layers in I would like to change states of the main application.  I'm having trouble figuring out what item in the main application to set the listener on.  Please help.
    I can't figure out how to post the below as scrollable code snips so this is very long.
    Main application code:
    <code><?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:components="components.*"
                   preinitialize="readDataFile()"
                   creationComplete="buildRowTitles()"
                   width="1024" height="512"  backgroundColor="#A4BDD8">
        <s:states>
            <s:State name="State1"/>
            <s:State name="driverDetailState"/>
        </s:states>
        <!--
        <fx:Style source="EventCalendar.css"/>
        creationComplete="readDataFile()"    creationComplete="driversList.send()"-->
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->       
            <mx:DateFormatter id="myDateFormatter"
                              formatString="EEE, MMM D, YYYY"/>
            <!--<s:HTTPService id="driversList"
                           url="files/drivers.xml"
                           result="driversList_resultHandler(event)"
                           fault="driversList_faultHandler(event)"/>
            <s:HTTPService id="postDriversList"
                           url="files/drivers.xml"
                           method="POST"
                           result="postDriversList_resultHandler(event)"
                />-->
            <!--<s:Move id="expandTab"
                    target="{labelTab}"
                    xBy="250"/>-->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import components.CalendarDay;
                import components.TruckDriver;
                import components.calendarDay;
                import events.CancelChangeDriversEvent;
                import events.ChangeDriversEvent;
                import events.EditDriverEvent;
                import mx.collections.ArrayCollection;
                import mx.collections.ArrayList;
                import mx.containers.Form;
                import mx.controls.Alert;
                import mx.controls.CalendarLayout;
                import mx.core.FlexGlobals;
                import mx.core.IVisualElement;
                import mx.core.WindowedApplication;
                import mx.printing.FlexPrintJob;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                import mx.rpc.xml.SimpleXMLEncoder;
                import spark.components.Application;
                import utilities.FormatUtil;
                import utilities.ObjectToXML;
                /* public var prefsFile:File; */ // The preferences prefsFile
                [Bindable] public var driversXML:XML; // The XML data
                public var stream:FileStream; // The FileStream object used to read and write prefsFile data.
                public var fileName:String="driversArrayCollection";
                public var directory:String = "AceTrackerData";
                public var dataFile:File = File.documentsDirectory.resolvePath(directory + "\\" + fileName);
                [Bindable]
                public var drivers:ArrayCollection=new ArrayCollection();
                private var fileStream:FileStream;
                [Bindable]
                public var calendarDayArray:ArrayCollection = new ArrayCollection;
                public var i:int;
                [Bindable]
                public var weekOneTitle:String;
                [Bindable]
                public var weekTwoTitle:String;
                [Bindable]
                public var weekThreeTitle:String;
                [Bindable]
                public var weekFourTitle:String;
                public var day:Object;
                protected function readDataFile():void
                    if(dataFile.exists)
                        fileStream = new FileStream();
                        fileStream.open(dataFile, FileMode.READ);
                        drivers = fileStream.readObject() as ArrayCollection;
                        fileStream.close();
                    else
                        drivers = new ArrayCollection();
                        var driver:TruckDriver = new TruckDriver("New", "Driver", 000);
                        drivers.addItem(driver);
                        saveData(drivers);
                    buildCalendarArray();
                protected function buildCalendarArray():void
                    calendarDayArray.removeAll();
                    for (i=0; i<28; i++)
                        var cd:calendarDay = new calendarDay;
                        cd.dateOffset= i-7
                        cd.drivers=drivers;
                         cd.addEventListener("editDriverEvent",editDriverEvent_Handler);
                        calendarDayArray.addItem(cd);
              private function saveData(obj:Object):void//this is called on the postDriversList result handler to create and write XML data to the file
                    var fs:FileStream = new FileStream();
                    fs.open(dataFile, FileMode.WRITE);
                    /* fs.writeUTFBytes(myXML); */
                    fs.writeObject(drivers);
                    fs.close();
                protected function driverschedule1_changeDriversHandler(event:ChangeDriversEvent):void
                    saveData(drivers); 
                    readDataFile();//i read the drivers file again, this refreshes my data, and removes any temporary data that may have been stored in the drivers array
                    buildCalendarArray();
                    currentState = 'State1';//this hides the driversdetail window after we've clicked save
                    /* postDriversList.send(event.driverInfo); */  //this needs to be different
                    /* Alert.show("TEST"); */
                protected function driverschedule1_cancelChangeDriversHandler(event:CancelChangeDriversEvent):void
                    /* Alert.show("Changes have been canceled."); */
                    readDataFile();//this re-reads the saved data file so that the changes that were made in the pop up window
                    // are no longer reflected if you reopen the window
                    buildCalendarArray();
                    currentState = 'State1';  //this hides the driversdetail window after we've clicked cancel
                protected function buildRowTitles():void
                    var calendarDay0:Object;
                    var calendarDay6:Object;
                    calendarDay0=calendarDayArray.getItemAt(0);
                    calendarDay6=calendarDayArray.getItemAt(6);
                    weekOneTitle = calendarDay0.getDayString() + " - " + calendarDay6.getDayString();
                    weekTwoTitle=calendarDayArray.getItemAt(7).getDayString()+ " - " + calendarDayArray.getItemAt(13).getDayString();
                    weekThreeTitle=calendarDayArray.getItemAt(14).getDayString()+ " - " + calendarDayArray.getItemAt(20).getDayString();
                    weekFourTitle=calendarDayArray.getItemAt(21).getDayString()+ " - " + calendarDayArray.getItemAt(27).getDayString();
            ]]>
        </fx:Script>
        <s:Group height="100%" width="100%">
            <s:layout>
                <s:BasicLayout/>  <!--This is the outermost layout for the main application MXML-->
            </s:layout>
        <s:Scroller width="95%" height="100%"  >
        <s:Group height="100%" width="100%"  ><!--this groups the vertically laid out row titles hoizontally with the large group of calendar days and day titles-->
            <s:layout>
                <s:HorizontalLayout/>
            </s:layout>
        <s:Group height="95%" width="50" ><!--this is the group of row titles layed out vertically-->
            <s:layout>
                <s:VerticalLayout paddingLeft="40" paddingTop="35"/>
            </s:layout>
            <s:Label text="{weekOneTitle}"
                     rotation="-90"
                     backgroundColor="#989393"
                     height="25%" width="115"
                     fontWeight="normal" fontSize="15"
                     paddingTop="4" textAlign="center"  />
            <s:Label text="{weekTwoTitle}"
                     rotation="-90"
                     backgroundColor="#989393"
                     height="25%" width="115"
                     fontWeight="normal" fontSize="15"
                     paddingTop="4" textAlign="center" />
            <s:Label text="{weekThreeTitle}"
                     rotation="-90"
                     backgroundColor="#989393"
                     height="25%" width="115"
                     fontWeight="normal" fontSize="15"
                     paddingTop="4" textAlign="center"  />
            <s:Label text="{weekFourTitle}"
                     rotation="-90"
                     backgroundColor="#989393"
                     height="25%" width="115"
                     fontWeight="normal" fontSize="15"
                     paddingTop="4" textAlign="center"  />
        </s:Group>
        <s:Group height="100%" width="100%" >
            <!--this vertically groups together the horizontal day names group and the tile layout datagroup of calendar days-->
            <s:layout>
                <s:VerticalLayout paddingLeft="5"/>
            </s:layout>
        <s:Group width="100%" >
            <s:layout><!--this group horizontal layout is for the Day names at the top-->
                <s:HorizontalLayout paddingTop="10"/>
            </s:layout>
            <s:Label id="dayNames" text="Sunday" width="16%" fontWeight="bold" fontSize="18" textAlign="center"/>
            <s:Label text="Monday" width="16%" fontWeight="bold" fontSize="18" textAlign="center"/>
            <s:Label text="Tuesday" width="16%" fontWeight="bold" fontSize="18" textAlign="center"/>
            <s:Label text="Wednesday" width="16%" fontWeight="bold" fontSize="18" textAlign="center"/>
            <s:Label text="Thursday" width="16%" fontWeight="bold" fontSize="18" textAlign="center"/>
            <s:Label text="Friday" width="16%" fontWeight="bold" fontSize="18" textAlign="center"/>
            <s:Label text="Saturday" width="16%" fontWeight="bold" fontSize="18" textAlign="center"/>
        </s:Group>
            <!--<s:SkinnableContainer width="16%">-->
                <s:DataGroup id="calendarDataGroup"
                             dataProvider="{calendarDayArray}"
                             itemRenderer="{null}"  resizeMode="scale"
                              height="100%" width="100%"
                              >  <!--  I had to use a null renderer because otherwise each instance is added in a group container renderers.DriverScheduleRenderer-->
                    <s:layout >
                        <s:TileLayout requestedColumnCount="7" />
                    </s:layout>
                </s:DataGroup>
            <!--</s:SkinnableContainer>-->
        <!--<mx:FormItem label="Today's Date:">
            <s:TextInput id="dateToday"
                         text="{myDateFormatter.format(testDate)}"/>
        </mx:FormItem>-->
        <!--<components:DriverSchedule drivers="{drivers}"
                                   changeDriversEvent="driverschedule1_changeDriversHandler(event)"/>-->
            <s:HGroup>  <!--this groups together my drivers button and my print button at the bottom of the calendar-->
            <s:Button id="showDriverDetailButton"
                      label="Driver List"
                      click="currentState = 'driverDetailState'">
                <!--</s:Button>
                <s:Button id="printButton"
                    label="Print"
                    >  click="printButton_clickHandler(event)"-->
                </s:Button>
            </s:HGroup>    <!--this is the end of the small hgroup which pairs my drivers button with the print button-->                  
        </s:Group><!--this ends the vertical grouping of the day names and the tile layout calendar-->   
    </s:Group>        <!--this ends the horizontal grouping of the calendar (names and days) with the week labels at the left-->
        </s:Scroller>
            <s:SkinnableContainer includeIn="driverDetailState"
                                  width="95%" height="95%"  horizontalCenter="0" verticalCenter="0"
                                  backgroundColor="#989898" backgroundAlpha="0.51">
                <s:BorderContainer horizontalCenter="0" verticalCenter="0">
                <components:DriverSchedule id="driverSchedule"
                                            drivers="{drivers}"
                                           changeDriversEvent="driverschedule1_changeDriversHandler(event)"
                                           cancelChangeDriversEvent="driverschedule1_cancelChangeDriversHandler(event)"
                                           />
                </s:BorderContainer>
            </s:SkinnableContainer>
        </s:Group>  <!--end of basic layout group-->
    </s:WindowedApplication>
    </code>
    calendarDay.mxml code:
    <code>
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark"
             xmlns:mx="library://ns.adobe.com/flex/mx"
             creationComplete="initDay()"
              width="100%">  <!--width="16%" height="25%"  width="160" height="112"-->
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
            <mx:DateFormatter id="myDateFormatter"
                              formatString="MMM D"/>
        </fx:Declarations>
        <fx:Metadata>
            [Event(name = "editDriverEvent", type="events.EditDriverEvent")]
        </fx:Metadata>
        <fx:Script>
            <![CDATA[
                import components.CalendarDay;
                import components.DriverDetailComponent;
                import events.EditDriverEvent;
                import mx.collections.ArrayCollection;
                import mx.collections.ArrayList;
                import mx.controls.CalendarLayout;
                import mx.controls.DateField;
                [Bindable]
                public var todayCollection:ArrayCollection = new ArrayCollection;
                [Bindable]
                public var todayList:ArrayList=new ArrayList; //arraylist created as data provider for dataGroup, this is where all drivers with an arrival date of today are added
                [Bindable]
                public var currDate:Date =new Date; //this will be used to contain the current real world date
                [Bindable]
                public var calDate:Date = new Date; //this is used below to determine the date of the calender day that is being created
                [Bindable] 
                public var todaysDate:CalendarDay;
                [Bindable]
                public var currDay:int;
                [Bindable]
                public var dateOffset:int;
                public var drivers:ArrayCollection= new ArrayCollection();
                   public var driver:Object;  
                public var rowLabel:String;
                public function initDay():void
                    todaysDate  = new CalendarDay(currDate, currDate.day, dateOffset)//currDate represents the day the operating system says today is
                        currDay=todaysDate.returnDate().getDate();//currDay is an int representing the day of the month
                        calDate=todaysDate.returnDate();//calDate represents the actual date on the calendar (MM-DD-YYY) that is currently being evaluated
                        /* if (currDay ==currDate.getDate()) //i want to highlight the day if it is in fact today
                            cont.styleName="Today";
                            if (calDate.getDate() == currDate.getDate())
                            calDayBorder.setStyle("backgroundColor", "#FFFF00");
                        else
                            calDayBorder.setStyle("backgroundColor", "#EEEEEE");
                         addDrivers(); 
                    return;
                  public function addDrivers():void
                       var count:int = 0;
                      /*var driverDetail:DriverDetailComponent;
                      var driver =  */
                    for each (driver in drivers)
                    {//i check the date value based on data entry of mm-dd-yy format against the calculated date for the day
                        //the calender is building and if it is equal the drivers information is added to this day of the calendar
                        if (DateField.stringToDate(driver.arrivalDate,"MM/DD/YYYY").getDate() == calDate.getDate())
                                var driverDetail:DriverDetailComponent = new DriverDetailComponent; //i create a new visual component that adds the id and destination to the calendar day
                                driverDetail.driverid = drivers[count].id; //i feed the id property which is the truck# - firstName
                                driverDetail.driverToLoc=drivers[count].toLoc; //i feed the toLoc which is the current destination of the driver
                                driverDetail.driverArrayLocation=count;   //here i feed the location of this driver in the "drivers" array so i know where it's at for the click listener
                                todayList.addItem(driverDetail);
                            //this concatenates the drivers truck number first name and destination to display in the calendar day
                                /* todayList.addItem(driver.truckNumber + " - " + driver.firstName + " - " + driver.toLoc); */
                    count ++;
                public function getDayString():String
                    rowLabel =myDateFormatter.format(calDate);
                    return rowLabel;
            ]]>
        </fx:Script>
        <s:BorderContainer id="calDayBorder" width="160" styleName="Today" cornerRadius="2" dropShadowVisible="true" height="100%">
            <s:layout>
                <s:BasicLayout/>   
            </s:layout>
            <!--I need to make a custom item renderer for my calendar days that limits the height and width of the day, and also puts the items
            closer together so i can fit maybe 5 drivers on a single day-->
            <s:DataGroup dataProvider="{todayList}"
                         itemRenderer="spark.skins.spark.DefaultComplexItemRenderer"
                         bottom="-2"
                         width="115" left="2">  <!--width="94%"  width="100"  width="16%"-->
                <s:layout >
                    <s:VerticalLayout gap="-4"/> <!--The reduced gap pushes the drivers together if there are serveral on one day. This helps cleanly show several drivers on one day-->
                </s:layout>
            </s:DataGroup >
            <s:Label  text="{currDay}" right="3" top="2" fontSize="14" fontWeight="bold"/>
        </s:BorderContainer>
    </s:Group>
    </code>
    DriverDetailComponent code:
    <code><?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark"
             xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Metadata>
            [Event(name = "editDriverEvent", type="events.EditDriverEvent")]
        </fx:Metadata>
        <fx:Script>
            <![CDATA[
                import events.EditDriverEvent;
                import mx.controls.Alert;
                [Bindable]
                public var driverid:String;
                [Bindable]
                public var driverArrayLocation:int;
                [Bindable]
                public var driverToLoc:String;
                protected function label1_doubleClickHandler(event:MouseEvent):void
                    Alert.show("You have selected " +driverid +" at location "  + driverArrayLocation.toString() +" in the drivers ArrayCollection.");
                    var eventObject:EditDriverEvent = new EditDriverEvent("editDriverEvent",driverArrayLocation);
                    dispatchEvent(eventObject);
            ]]>
        </fx:Script>
        <s:Label id="driverDetailLabel" text="{driverid} - {driverToLoc}"  doubleClick="label1_doubleClickHandler(event)" doubleClickEnabled="true"/>
    </s:Group>
    </code>

    lkb3 wrote:
    I'm trying to add a listener to [this JOptionPane pane dialog box|http://beidlers.net/photos/d/516-1/search_screenshot.JPG|my dialog box], so that when it pops up, the cursor is in the text box, but then if the user clicks a button other than the default, the cursor reverts back into the text box.
    The code I have is this:
      // BUILD DIALOG BOX
    JLabel option_label = new JLabel("Select a search option:");
    // Create the button objects
    JRadioButton b1 = new JRadioButton("Search PARTS by name");
    JRadioButton b2 = new JRadioButton("Search ASSEMBLIES by name");
    JRadioButton b3 = new JRadioButton("Search DRAWINGS by name");
    JRadioButton b4 = new JRadioButton("Search all by DESCRIPTION");
    b1.setSelected(true);
    // Tie them together in a group
    ButtonGroup group = new ButtonGroup();
    group.add(b1);
    group.add(b2);
    group.add(b3);
    group.add(b4);
    // Add them to a panel stacking vertically
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));
    panel.add(b1);
    panel.add(b2);
    panel.add(b3);
    panel.add(b4);
    JLabel name_label = new JLabel("Enter a search term (add *'s as required)");
    JTextField name = new JTextField(30);
    name.addComponentListener(new ComponentListener() {
    public void componentHidden(ComponentEvent ce) { }
    public void componentMoved(ComponentEvent ce) { }
    public void componentResized(ComponentEvent ce) {
    ce.getComponent().requestFocus();
    public void componentShown(ComponentEvent ce) { }
    Object[] array = { option_label, panel, name_label, name };
    // GET INPUT FROM USER
    int res = JOptionPane.showConfirmDialog(null, array, "Select", JOptionPane.OK_CANCEL_OPTION);
    String searchTerm = name.getText();This sucessfully has the focus in the text box when opened; is there a way to get the focus to go back into the text box after the user clicks a radio button?
    Thanks!
    [this JOptionPane pane dialog box|http://beidlers.net/photos/d/516-1/search_screenshot.JPG|dialog Joption]
    you will need to add ItemListener to the JRadioButtons

  • Remove event listener from loaded external swf

    I have a main movie timeline that loads an external swf. When I unload the swf from the main timeline I get an error from this:  my_FLVPlybk.addEventListener(VideoEvent.COMPLETE, vidEnd);
    is there any way to remove the event listener from the loaded swf from the main timeline?
    THANKS!

    if you're publishing for fp 10+, use unloadAndStop() applied to your swf's loader.  that has a fair chance of solving the problem.
    if that fails, you should explicitly stop my_FLVPlybk.

  • Keyboard Event Listener doesn't work in Browser

    Is there a reason why a keyboard event listener would not work if the flash is embedded in an HTML? The rest of my game is running fine in the background, but I can't launch the movieClip "nextCar." My code is below, if that makes any difference...
    function goNow (event:KeyboardEvent): void {
        thisOtherKey = event.keyCode;
        if (thisOtherKey == 32) {
            nextCar.gotoAndPlay(2);
            parkingQue.play();
            tries++;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, goNow);

    This may be a silly question, but have you tryed clicking on your swf after it opens up in the browser, and then trying the keyboard controls?
    I don't know of any issues that cause event listeners to workwhen debugging, but not in a browser.  So, I'm thinking maybe your just not focused on the swf.

  • How to send the Event Listener arguments in AS3?

    In MXML
    <mx:Button click="clickHandler();"
    mouseDown="downHandler(event);" mouseOver="overHandler(btn);"
    mouseMove="moveHandler('RAJAN');"/>
    but AS3
    var btn:Button = new Button();
    btn.addEventListener(MouseEvent.CLICK, clickHandler, flase,
    0, true);
    only this kind of AS3 event only added, any other possibility
    to pass the arguments to handler function.
    please help.

    From that link:
    If you define an event listener inline (inside the MXML tag),
    you can add any number of parameters as long as the listener
    function's signature agrees with that number of parameters.
    If you add a listener with the addEventListener() method (in
    ActionScript), you cannot pass any additional parameters to the
    listener function, and that listener function can declare only a
    single argument, the Event object (or one of its subclasses).
    To pass additional parameters to listener functions defined
    in AS, you must define the parameters in the listener function and
    then call some other method passing it the additional parameters in
    the call from the listener.
    You can also define your own custom events, and then you are
    free to define what args your event listeners take, and access the
    data from the event object.

Maybe you are looking for

  • Safari 6.0.4 keeps crashing

    I had this problem with Safari ever since installing version 6 back on Lion. Then I did a clean install of Mountain Lion 10.8.0 and Safari is still crashing from time to time. Even all the updates up to ML 10.8.3 did not make a difference. I tried di

  • Cannot open iTunes because of Error 1639, please help

    A lot of things have gone on with our computer as of lately. After we cleaned it up iTunes hasn't been intacked. I tried to download it again with the installment cd that came with my ipod suffel and the regular ipod, neither would allow full downloa

  • LOV getting disabled while passivation

    When running my ADF application with AM pooling switched off to test passivation/activation, a particular LOV is getting disabled once you select a value for it. User should be allowed to change the value here as many times he/she wishes. Issue occur

  • Charge iphone 5c/s at least 40%???

    I'm worrying again about charging my iphone. Is it true that you MUST not charge your iphone below 40 or 30% because this is a li-on battery??! Please clear my question because I notice that my iphone 5c is draining too fast and i followed already th

  • Display Settings for Gaming on MBP

    I'm playing Half Life 2...it auto sets everything, but it defaults into 4:3 mode, should I not be in widescreen mode? It has options for 16x9 and 16x10...should I go with one of those or stick with the 4:3? The 4:3 mode seems to be stretched to fit a