Event Listener dispatcher giving an ClassCast Exception in C++ 3.6.1

Hi,
I have attached a Event listener to underlying NamedCache and when I update the cache entry I didn't get any alerts. But When I checked the
coherence log I found following Exception available. But I'm not doing any sort of Casting as mentioned below.
2012-01-17 11:12:55.793/0.320 Oracle Coherence for C++ RTC 3.6.1.0 <Info> (thread=main): Connected Socket to 169.52.37.237/169.52.37.237:9099
2012-01-17 11:13:04.859/9.386 Oracle Coherence for C++ RTC 3.6.1.0 <Error> (thread=ExtendTcpCacheService:coherence::component::util::TcpInitiator:coherence::component::util::Service::EventDispatcher): An exception occurred while dispatching the following event:
coherence::component::util::RunnableCacheEvent: coherence::util::MapListenerSupport::FilterEvent{coherence::component::net::extend::RemoteNamedCache::BinaryCache[source=coherence::component::net::extend::RemoteNamedCache::BinaryCache@0x69f090c4] updated: key=Binary(length=19), old value=Binary(length=713), new value=Binary(length=713), filters=[NULL]}
2012-01-17 11:13:04.860/9.387 Oracle Coherence for C++ RTC 3.6.1.0 <Error> (thread=ExtendTcpCacheService:coherence::component::util::TcpInitiator:coherence::component::util::Service::EventDispatcher): The following exception was caught by the event dispatcher:
2012-01-17 11:13:04.860/9.387 Oracle Coherence for C++ RTC 3.6.1.0 <Error> (thread=ExtendTcpCacheService:coherence::component::util::TcpInitiator:coherence::component::util::Service::EventDispatcher): NULL
coherence::lang::ClassCastException: attempt to cast from a "gce::coherence::CoherenceEventHandler" to a "coherence::util::MapListener" at void coherence::lang::coh_throw_class_cast(const std::type_info&, const std::type_info&)(ClassCastException.cpp:27)
at coherence::lang::coh_throw_class_cast(std::type_info const&, std::type_info const&)
at coherence::lang::TypedHandle<coherence::util::MapListener> coherence::lang::cast<coherence::lang::TypedHandle<coherence::util::MapListener>, coherence::lang::Object>(coherence::lang::TypedHandle<coherence::lang::Object> const&, bool)
at coherence::lang::TypedHandle<coherence::util::MapListener> coherence::lang::cast<coherence::lang::TypedHandle<coherence::util::MapListener>, coherence::lang::Object>(coherence::lang::TypedHolder<coherence::lang::Object> const&, bool)
at coherence::lang::TypedHandle<coherence::util::MapListener> coherence::lang::cast<coherence::lang::TypedHandle<coherence::util::MapListener>, coherence::lang::Object>(coherence::lang::MemberHolder<coherence::lang::Object> const&, bool)
When I wrote a sample application It works without any problem. Only difference of above exception coming program is this c++ library is loaded true JNI and relevant event listener is added during a JNI method call. Please explain me why this exception is coming. I have attached the relevant code as well.
CoherenceEventListener.hpp
* File: CoherenceEventHandler.hpp
* Author: srathna1
* Created on 05 January 2012, 10:15
#ifndef COHERENCEEVENTHANDLER_HPP
#define     COHERENCEEVENTHANDLER_HPP
#include "coherence/util/MapEvent.hpp"
#include "coherence/util/MapListener.hpp"
#include <iostream>
//#include <map>
#include "coherence/lang.ns"
#include "mihelper.hpp"
#include "MiCoherence.hpp"
#include <string>
#include "MICoherenceDataObject.hpp"
using coherence::util::MapEvent;
using coherence::util::MapListener;
using namespace coherence::lang;
* A MapListener implementation that prints each event as it receives
* them.
namespace gce {
namespace coherence {
class CoherenceEventHandler
: public class_spec<CoherenceEventHandler,
extends<Object>,
implements<MapListener> > {
friend class factory<CoherenceEventHandler>;
public:
CoherenceEventHandler(CMiCoherence * miCoh) : mi(miCoh), msgSeqNo(1) {
virtual void entryInserted(MapEvent::View vEvent) {
Object::View vKey = vEvent->getKey();
String::View key = cast<String::View > (vKey);
Object::View vValue = vEvent->getNewValue();
char topic[100];
strcpy(topic, key->getCString());
Managed<gce::coherence::MICoherenceDataObject>::View pos = cast<Managed<gce::coherence::MICoherenceDataObject>::View > (vValue);
std::cout << key << " = " << pos << std::endl;
virtual void entryUpdated(MapEvent::View vEvent) {
Object::View vKey = vEvent->getKey();
String::View key = cast<String::View > (vKey);
Object::View vValue = vEvent->getNewValue();
char topic[100];
strcpy(topic, key->getCString());
Managed<gce::coherence::MICoherenceDataObject>::View pos = cast<Managed<gce::coherence::MICoherenceDataObject>::View > (vValue);
std::cout << key << " = " << pos << std::endl;
gce::coherence::MICoherenceDataObject msg = *pos;
virtual void entryDeleted(MapEvent::View vEvent) {
private:
CMiCoherence * mi;
int msgSeqNo;
#endif     /* COHERENCEEVENTHANDLER_HPP */
Event Registration code
NamedCache::Handle miCoherenceCache = NULL;
try {
String::View cacheName = szConnect;
miCoherenceCache = CacheFactory::getCache(cacheName);
} catch (const std::exception& e) {
LOGERR("initializing coherence middleware cache error: %s", e.what());
return MI_ERR_BADSTATE;
nConnectState = miCoherenceCache->getCacheService()->isRunning() == true ? 1 : 0;
miCoherenceCache->addFilterListener(gce::coherence::CoherenceEventHandler::create(this));
Please give me a clue why Cohrence Internal Event Dispatcher giving exception.....
Thanks and regards,
Sura

Hi,
Even when I try to to test the MemberListener while closing the Coherene Java Cache Cluster I can see following Exception. Something similar to EventListener.
2012-01-18 20:06:18.868/44.346 Oracle Coherence for C++ RTC 3.6.1.0 <Error> (thread=ExtendTcpCacheService:coherence::component::util::TcpInitiator:coherence::component::util::Service::EventDispatcher): The following exception was caught by the event dispatcher:
2012-01-18 20:06:18.868/44.346 Oracle Coherence for C++ RTC 3.6.1.0 <Error> (thread=ExtendTcpCacheService:coherence::component::util::TcpInitiator:coherence::component::util::Service::EventDispatcher): NULL
coherence::lang::ClassCastException: attempt to cast from a "gce::coherence::CoherenceMemberListener" to a "coherence::net::MemberListener"
at void coherence::lang::coh_throw_class_cast(const std::type_info&, const std::type_info&)(ClassCastException.cpp:27)
at coherence::lang::coh_throw_class_cast(std::type_info const&, std::type_info const&)
at coherence::lang::TypedHandle<coherence::net::MemberListener> coherence::lang::cast<coherence::lang::TypedHandle<coherence::net::MemberListener>, coherence::lang::Object>(coherence::lang::TypedHandle<coherence::lang::Object> const&, bool)
at coherence::lang::TypedHandle<coherence::net::MemberListener> coherence::lang::cast<coherence::lang::TypedHandle<coherence::net::MemberListener>, coherence::lang::Object>(coherence::lang::TypedHolder<coherence::lang::Object> const&, bool)
at coherence::lang::TypedHandle<coherence::net::MemberListener> coherence::lang::cast<coherence::lang::TypedHandle<coherence::net::MemberListener>, coherence::lang::Object>(coherence::lang::MemberHolder<coherence::lang::Object> const&, bool)
at coherence::net::MemberEvent::dispatch(coherence::lang::TypedHandle<coherence::util::Listeners const>) const
at coherence::component::util::ListenerCallback::translateMemberEvent(coherence::lang::TypedHandle<coherence::net::MemberEvent const>)
at coherence::component::util::ListenerCallback::memberLeaving(coherence::lang::TypedHandle<coherence::net::MemberEvent const>)
at coherence::net::MemberEvent::dispatch(coherence::lang::TypedHandle<coherence::util::Listeners const>) const
at coherence::component::net::extend::RemoteService::dispatchMemberEvent(coherence::net::MemberEvent::Id)
at coherence::component::net::extend::RemoteService::connectionError(coherence::lang::TypedHandle<coherence::net::messaging::ConnectionEvent const>)
at coherence::component::net::extend::RemoteCacheService::connectionError(coherence::lang::TypedHandle<coherence::net::messaging::ConnectionEvent const>)
at coherence::net::messaging::ConnectionEvent::dispatch(coherence::lang::TypedHandle<coherence::util::Listeners const>) const
at coherence::component::util::Peer::DispatchEvent::run()
at coherence::component::util::Service::EventDispatcher::onNotify()
at coherence::component::util::Daemon::run()
at coherence::lang::Thread::run()
on thread "ExtendTcpCacheService:coherence::component::util::TcpInitiator:coherence::component::util::Service::EventDispatcher"
Seems to be like loading with JNI will giving some exceptions.
Please help me on this...
Thanks and regards,
Sura

Similar Messages

  • DropdownByKey UI element is giving Classcast exception

    Hi
    In my webdynpro view if i add "DropdownbyKey" UI element and the run the application,it is giving Classcast Exception.i am getting following error
    The initial exception that caused the request to fail, was:
       java.lang.ClassCastException
        at com.sap.tc.webdynpro.progmodel.context.Paths.getAttributeInfoFor(Paths.java:202)
        at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.DropDownByKeyAdapter.setViewAndNodeElement(DropDownByKeyAdapter.java:240)
        at com.sap.tc.webdynpro.clientimpl.html.uielements.adaptmgr.URAdapterManager.getAdapterFor(URAdapterManager.java:231)
        at com.sap.tc.webdynpro.clientimpl.html.uielements.adaptmgr.URAdapterManager.getAdapterFor(URAdapterManager.java:64)
        at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.FlowLayoutAdapter$Items.getControl(FlowLayoutAdapter.java:318)
        ... 39 more
    Please help
    thanks
    Prasad

    Hi Sriram,
    You need to bind the property "selectedKey"  for the DropdownByKey UIElement
    http://help.sap.com/saphelp_nw04/helpdata/en/08/13dbfb6e779743bb2ca641ebcb3411/frameset.htm
    Regards, Anilkumar

  • When calling webservice Session event listener threw exception

    Hi All,
    I have Schdule the process to call webservice for 1 hour.
    When it accessed It is throwing Exception But data send to Server and received response as true from webservice.
    Exception details found in log file.
    2007-12-04 01:00:36 StandardManager[npbpqa] Session event listener threw exception
    java.lang.IllegalStateException: getAttribute: Session already invalidated
         at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:925)
         at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:124)
         at org.apache.axis.transport.http.AxisHTTPSessionListener.destroySession(AxisHTTPSessionListener.java:43)
         at org.apache.axis.transport.http.AxisHTTPSessionListener.sessionDestroyed(AxisHTTPSessionListener.java:72)
         at org.apache.catalina.session.StandardSession.expire(StandardSession.java:623)
         at org.apache.catalina.session.StandardSession.expire(StandardSession.java:572)
         at org.apache.catalina.session.StandardManager.processExpires(StandardManager.java:746)
         at org.apache.catalina.session.StandardManager.run(StandardManager.java:823)
         at java.lang.Thread.run(Thread.java:534)
    Can any one help me urgently.
    Thanks in advance.
    Venkat K
    Edited by: venkat2007 on Dec 4, 2007 2:44 PM

    The service is working fine from a web page that my coworker did.  I have not installed soap UI yet, but I used it at my last job.  Since I posted this I have a new computer, have installed BizTalk Server 2013 R2 and Visual Studio 2013 Premium.
     This is what I've done...
    Created a new Host called BizTalkServerApplication64 with the '32-Bit only' unchecked.
    Created a new host instance using the new host.
    Created a new Send Handler for both Adapters 'WCF-BasicHttp' and 'WCF-Custom' using the new host.
     configured both Send Ports (WCF-BasicHttp and WCF-Custom) to use the new send handler.
    Have tried binding the logical port to both basic and the custom ports.
    Now I get a different error which is:
    Error Description: System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to http://lbenson/MDSVC2/Service1.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due
    to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. --->
    System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host...
    Any suggestions for this error?  I'm not sure if this means I'm closer to getting it work or further.
    Thanks for your help!
    Jean
    jRenae.s

  • URGENT : EVENT Listener Problem

    Hi All,
    Thanks for your time. I am facing a Small issue with Event
    dispatcher and Add Event listener. Well i will explain the problem.
    I am having one MovieClip named BUTTON_SET and i gave
    "ButtonSet.as" as linkage Class.
    Inside that BUTTON_SET i am having some Buttons and they are
    also having "UIButton.as" as linkage class
    UIButton Dispatching press and release events, But unable to
    capture it using ButtonSet Class. Here with i have attached the
    Code and i gave the Source URL Too.
    upto my Knowledge : UIButton class is not initiated When the
    ButtonSet is ready to addListener.
    Please Help me to fix this.
    if i don't find a solution i need to change all my class
    structures.
    CLICK HERE FOR SOURCE
    CODE

    According to your Code, When you are calling the InitHandler
    Functionction the Buttons may/may not be Initiated. So use the
    Enterframe to check whether its loaded or not.
    Write down this in the ButtonSet to replace the init Handler
    Call.
    this.onEnterFrame = Delegate.create(this, initHandler);
    inside the initHandler remove the function This will help you
    if you are not using any Enterframe for any other manipulation)
    delete this.onEnterFrame;

  • Which object in hierarchy should add event listener?

    Hello all,
    I'm quite new to the whole OOP thing, and one of the things I keep wondering about is this:
    Which class should listen for events if the choice is between a contained class or a containing class?
    For example:
    An instance of Game holds an instance of Board which holds an array of instances of fields.
    This might be a scenario for a simple board game, I guess (In my case I am working on Reversi).
    A player should click a field to place a piece on it. I could let the Field class listen for the click event,
    but when a player places a piece, other pieces might have to flip, so an object at a higher level should handle this (board / game / maybe another object).
    So in order to make sure this happens, I could let the field object listen for the event and than tell the higher-level-object to do his thing, or I could
    let the higher-level-object add an event listener on the field object, and than both flip the nescesary pieces as well as tell the field to add a piece on itself.
    Could anyone explain which and why either solution (or maybe a third on) is better?
    Thanks for your time!

    qdudu wrote:
    Hello all,
    I'm quite new to the whole OOP thing, and one of the things I keep wondering about is this:
    Which class should listen for events if the choice is between a contained class or a containing class?The class that can respond to the events should implement the Listener.
    For example:
    An instance of Game holds an instance of Board which holds an array of instances of fields.
    This might be a scenario for a simple board game, I guess (In my case I am working on Reversi).
    A player should click a field to place a piece on it. I could let the Field class listen for the click event,
    but when a player places a piece, other pieces might have to flip, so an object at a higher level should handle this (board / game / maybe another object).Sounds like Board would be a good choice, then.
    So in order to make sure this happens, I could let the field object listen for the event and than tell the higher-level-object to do his thing, or I could
    let the higher-level-object add an event listener on the field object, and than both flip the nescesary pieces as well as tell the field to add a piece on itself.Sounds like the field object can't do much except forward the event to the real handler. In that case I'd vote for the higher-level-object as the listener.
    Could anyone explain which and why either solution (or maybe a third on) is better?In this case it could be either one. Try both and see. But based on the little you've posted here I'd vote for the higher-level-object, the Board.
    %

  • Cell event listener

    Hi,
    Assume I have jtable which have three column: numberone, numbertwo, and result.....
    I put value 1 into numberone column ( row one ), and put value 2 into numbertwo column (row one).... and when I press Enter or change the cell to down or left or right, suddenly result column is put value 3. This is simple addition jtable. How do I make such event listener. When I change the cell( after putting value in numberone column and numbertwo column ), the result column compute the value in numberone column and numbertwo column.

    what's wrong????My testing stinks.import java.awt.*;
    import javax.swing.event.*;
    import javax.swing.*;
    public class Test3 extends JFrame {
      JTable jt = new JTable(10,3);
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        content.add(new JScrollPane(jt), BorderLayout.CENTER);
        jt.getModel().addTableModelListener(new TableModelListener() {
          public void tableChanged(TableModelEvent tme) {
            int col=tme.getColumn(), row=tme.getFirstRow();
            if (col!=2) {
              try {
                int val0 = Integer.parseInt(jt.getValueAt(row, 0).toString()),
                    val1 = Integer.parseInt(jt.getValueAt(row, 1).toString());
                jt.setValueAt(new Integer(val0 + val1), row, 2);
              } catch (Exception e) {
                jt.setValueAt("Error", row, 2);
        setSize(300,300);
        setVisible(true);
      public static void main(String[] args) { new Test3(); }
    }

  • Error ocurring when Event Listener methode in "for statement" is called

    Hy guys,
    I would be gratefull if somebody could answer me how can I
    call a method from flex in "for statement", that is actually in my
    remote service implemented. I call the method loadAssetsResult()
    (event listener method in my action script) and get a collection of
    objects back. In the same method I want to iterate throught this
    collection and call another method from remote service, that is
    specified for this object. Problem is when I call this remote
    method inside of this loop statement. I get the error when I write
    my code like following one:
    public function loadAssetsResult(event:ResultEvent):void {
    for (i=0; i<event.result.length; i++) {
    a = new Asset();
    a.longName = event.result
    .longName;
    a.shortName = event.result.shortName;
    a.isin = event.result
    .isin;
    a.nsin = event.result.nsin;
    a.currentDayClose = event.result[0].currentQuote.dayClose;
    //Schluskurs
    assets.addItemAt(a, i);
    RO.getIndicatorCollection(i);
    DataBinding();
    When I comment the row: RO.getIndicatorCollection() it works,
    of course without these additional data that I get from that
    method. I need to call this method inside loop statement (for each
    object), but I don't know how, without getting this error?
    please somebody help me with some ideas
    br
    Sheila

    Kris,
    First of all you should increase the value of logging-config/character-limit element in tangosol-coherence.xml to see the message entirely. The default setting is 4096 which is not enough to see your exception text.
    When you do that I believe you will see that the actual exception is java.lang.ClassNotFoundException indicating that the node that has the listener installed doesn't know about the class that is being put into the cache and could be easily fixed as shown here: http://www.tangosol.com/faq-coherence.jsp#classnotfound
    Please let me know if that doesn't help.
    Gene

  • How to remove event listener when all the MoviClip are off the stage

    Hi i am newbie to as3,
        I am creating animation using as3 in which i duplicate the circle ten time,then pushing into an array and giving random motion. When all the duplicate object goes outside the stage then i should remove the event listener. But right now when one duplicate object goes off the stage the event listener is removed. Thanks in advance

    //---------code for creating random bubble movement------//
    var bubbleNo:Number = 10;
    var vx:Number = .3;
    var vy:Number = .5;
    var bubbles:Array = new Array();
    var bubbleRadius:Number = 9;
    var myColor:ColorTransform = this.transform.colorTransform;
    init();
    function init():void {
    for(var i:Number = 0; i<bubbleNo; i++){
              var bubble = new newBall();
    bubble.x = Math.random() * stage.stageWidth;
    bubble.y = Math.random() * stage.stageHeight;
    //bubble.color = Math.random
    //trace("bubble.x=="+bubble.x+"bubble.y=="+bubble.y);
    bubbles.push(bubble);
    myColor.color = Math.random() * 0xFFFFFF
    bubble.transform.colorTransform = myColor;
    addChild(bubble);
              addEventListener(Event.ENTER_FRAME,createBubble);
    //addEventListener(Event.ENTER_FRAME,createBubble);
    function createBubble(event:Event):void{
    for(var k:Number = bubbles.length-1; k>0; k--){
              var bubble = (newBall)(bubbles[k]);
              bubble.x += vx;
              bubble.y += vy;
              if(bubble.x - 18 > stage.stageWidth || bubble.x + 18 < 0  || bubble.y - 18 > stage.stageHeight || bubble.y + 18 < 0){
                        removeChild(bubble);
                        bubbles.splice(k, 1);
                        //trace("out"+bubbles.length);
                        if(bubbles.length <= 0 );
                                  removeBubble();
                                  trace(bubbles.length);
                                  //removeEventListener(Event.ENTER_FRAME,createBubble)
                        trace("all Bubbles cleared");
                        function removeBubble():void{
                                  removeEventListener(Event.ENTER_FRAME,createBubble)

  • Classcast exceptions when persistence units deployed as shared libraries

    Hi
    We are using weblogic 10.3.3 & eclipse link 2.0 persistent units:
    We have uim-entities.jar(persistent unit) under uim-core-lib.ear(/APP-INF/lib) that is deployed as a shared library. We have multiple applications(ears) referring to this shared library (same persistent name, "default") using lib-ref in weblogic-application.xml. We are facing issue while deploying and running the application.(Primarily classcast exceptions on log4j classes and entity DAOs). If the persistent unit is replication in each app's APP-INF/lib, we are not seeing those exceptions.
    Are there any known issues in using persistent units as shared libraries.
    Pasting the exception for your reference:
    log4j:ERROR Could not create an Appender. Reported error follows.
    java.lang.ClassCastException: org.apache.log4j.ConsoleAppender cannot be cast to org.apache.log4j.Appender
    at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:238)
    at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:171)
    at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:184)
    at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:502)
    at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:415)
    at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:919)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:790)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:682)
    at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:811)
    at oracle.communications.inventory.api.framework.logging.LogFactory.<clinit>(LogFactory.java:176)
    at oracle.communications.inventory.api.framework.listener.InventoryEntityLifeCycleEventListener.<clinit>(InventoryEntityLifeCycleEventListener.java:36)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:88)
    at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListenerMetadata.getClassForName(EntityListenerMetadata.java:158)
    at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListenerMetadata.process(EntityListenerMetadata.java:311)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.MappedSuperclassAccessor.processEntityListeners(MappedSuperclassAccessor.java:796)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processListeners(EntityAccessor.java:1064)
    at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.addEntityListeners(MetadataProcessor.java:104)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:327)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:151)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:195
    Thanks,
    Murali

    Murali,
    Hi, the CCE for Apache Log4J is outside of the scope of JPA - i have not see the "oracle.communications.inventory.api.framework.logging" package in play before - what kind of connection factory are you using or are you using JTA?
    Note: WebLogic 10.3.4.0 has been upgraded to enable container managed persistence context injection and no longer requires the use of shared libraries. See the wiki post...
    http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support
    For WebLogic 10.3.3.0 and JPA 2.0 usage as application managed libraries using the <wls:prefer-application-packages/> weblogic-application.xml tag see the wiki post...
    http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#DI_1.1:_Alternative_3:_Application_Level_Shared_Library_-InUse
    thank you
    /Michael O'Brien
    http://www.eclipselink.org

  • 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

  • EJB 3.0 JNDI lookup results in Classcast Exception

    Hello everybody,
    I�m experiencing a strange problem when I want to retrieve a stateless session bean from a POJO in my enterprise app. I am using EJB 3.0, running on Glassfish build 33 and JDK 1.5.
    I have successfully deployed my ear file which has the EJB.jar and the war file in it. I�m using JSF 1.2 in the web app and I am able to use all session beans using the injection annotation in my managed beans (this is how it is supposed to be according to the spec.). However, I now need to acces a stateless session bean from a POJO (non-managed or backing bean) which resides also in the war file. I�m using the following code to retrieve the session bean:
    (where IMySessionBean = remote interface and MySessionBean is the implementation)
    try {
    ic = new InitialContext();
    MySessionBean mybean = (MySessionBean )ic.lookup("env/IMySessionBean");
    When casting the object from the lookup into MySessionBean I get a classcast Exception. However, I can see the session bean using the JNDI browser that comes with Glassfish and it�s deployed and available. If mybean is of type Object, I see that the lookup method returns a wrapper of my session bean.
    Here�s what the stacktrace says:
    java.lang.ClassCastException: com.myproject.ejb.interfaces._IMySessionBean_Wrapper
         at ...
    Do I miss something here and there�s more required to obtain a reference to the session bean? I�m pretty much stuck here and any help is greastly appreciated!
    Thanks in advance!
    Cheers,
    Joerg

    Hi Joerg,
    In the session bean client view, the bean implementation class is never used. The client
    only interacts with the local or remote interface.
    Regarding the lookup, the more portable approach is to
    lookup the ejb reference through the component environment of the web application
    rather than doing a direct global lookup. If you have already defined any ejb reference
    injections somewhere in the web app, you can look up the same dependencies via
    java:comp/env. For example, if your managed bean has the following @EJB annotation :
    @EJB(name="mybeanref") IMySessionBean beanRef;
    You can look up the same underlying dependency in your utility class :
    IMySessionBean beanRef = (IMySessionBean) new InitialContext().lookup
    ("java:comp/env/mybeanref");
    Note that the portion of the lookup string after java:comp/env/ comes from the name() attribute
    of @EJB. @EJB name() has the same semantics as the ejb-ref-name in the deployment
    descriptor. You can find more info on these topics in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • 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

Maybe you are looking for

  • Error in Fiori IW_BEP component add-on installation

    Hi all, We are getting an error when we install Fiori IW_BEP component installation as part of pre-requisites for Gateway component. this is we are doing in ECC 6.0 EHP7 Netweaver 7.4 version. the error is : "Component IW_BEP is already retrofitted i

  • Template/Theme for Right to Left (RTL) pages (Arabic)

    Dear All, Please can some one provide me with online documentation or links with detail steps to create Templates / Themes for pages to be displayed in Arabic language (Right to Left). Thanks Best Regards Arif Khadas

  • Can't add Computer or New Computer list on 10.3.9 Server Workgroup manager

    I have a 10.3.9 server with Open Directory running. I can manage user and group preferences (Workgroup manager v2.0.1) but can't add a computer or new computer list because the option is disabled. If I connect to it's open directory from another serv

  • MBP 15' Volume issues & shut down OSX Yosemite

    I just purchased MBP 15' spent 4K total 1TB SSD and did my Time Machine Restore of my previous system and now i'm having Volume control issues With Volume button not controlling Volume at all and when i try to Log out of user account  to shut down th

  • "Import Metadata Wizard" functionality in OMB+

    Using OWB 9.2 Is it possible to access the functionality of the "Import Metadata Wizard" from OMB+? I need to dynamically import objects from a known host:port:service:schema. One way to invoke the "Import Metadata Wizard" from the client is to selec