additional info screen throws an exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

additional info screen throws an exception

Branden Strickland
Chris, Jacques

A little light shed will prob send me on my way to finish this for a
patch...

Heres the deal.

On the main POS screen I have a button "Addtl Info" it maps to:
    <event button-name="menuAddtlInfo"
class-name="org.ofbiz.pos.event.MenuEvents" method-name="addtlInfo"
disable-lock="false"/>

In MenuEvents.java I have:
-------------------------------------
 public static synchronized void addtlInfo(PosScreen pos) {
        PosTransaction trans =
PosTransaction.getCurrentTx(pos.getSession());
        trans.addtlInfo(pos);
    }

In PosTranaction.java I have:
----------------------------------------
 public synchronized void addtlInfo(PosScreen pos) {

            try {

               Keyboard keyboard = new Keyboard(pos, "addtlinfo");
               keyboard.setText(getSaleAddtlInfo() == null ? "" :
getSaleAddtlInfo());
               setSaleAddtlInfo(keyboard.openDlg());

             }
                catch(Exception e){
                Debug.logError(e, module);
            }
            return;
    }
----------------------------------------------------ALSO------
 public void setSaleAddtlInfo(String info) {
        cart.setShippingInstructions(info);
    }

    public String getSaleAddtlInfo() {
        return cart.getShippingInstructions();
    }

and last but not least Keyboard.xml I've modified for dynamic XML
properties:
---------------------------------------------------------------------------------------------------------------
 public Keyboard(PosScreen pos, String pagename){
        m_pos = pos;

        m_pageSupport = pageMgr.loadPage(
                m_pos.getScreenLocation() + "/dialog/" + pagename);
        m_dialog = (XDialog)m_pageSupport;

        m_edit = (XEdit) m_pageSupport.findComponent("keyboard_input");
        m_edit.setText("");

        return;
    }

    public Keyboard(PosScreen pos){

        this(pos, m_defaultPageName);
        return;
    }

The Error I get is:

---- runtime exception report
--------------------------------------------------
Exception: java.lang.ClassCastException
Message: net.xoetrope.xui.XPage cannot be cast to net.xoetrope.swing.XDialog
---- stack trace
---------------------------------------------------------------
java.lang.ClassCastException: net.xoetrope.xui.XPage cannot be cast to
net.xoetrope.swing.XDialog
org.ofbiz.pos.screen.Keyboard.<init>(Keyboard.java:28)
org.ofbiz.pos.PosTransaction.addtlInfo(PosTransaction.java:1243)
org.ofbiz.pos.event.MenuEvents.addtlInfo(MenuEvents.java:406)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.ofbiz.pos.config.ButtonEventConfig.invoke(ButtonEventConfig.java:208)
org.ofbiz.pos.config.ButtonEventConfig.invokeButtonEvent(ButtonEventConfig.java:105)
org.ofbiz.pos.component.PosButton$1.construct(PosButton.java:121)
net.xoetrope.xui.helper.SwingWorker$2.run(Unknown Source)
java.lang.Thread.run(Thread.java:619)
--------------------------------------------------------------------------------

Something within XUI no doubt...

Figured I'd pass it your way.... I'm sure I'll figure it out though... just
possibly sooner with your help!

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: additional info screen throws an exception

Jacques Le Roux
Administrator
Branden,

It's pretty clear : XPage cannot be cast to XDialog. This happens in Keyboard.java line 28.
I guess this line :  m_dialog = (XDialog)m_pageSupport;

Jacques

From: "Branden Strickland" <[hidden email]>

> Chris, Jacques
>
> A little light shed will prob send me on my way to finish this for a
> patch...
>
> Heres the deal.
>
> On the main POS screen I have a button "Addtl Info" it maps to:
>    <event button-name="menuAddtlInfo"
> class-name="org.ofbiz.pos.event.MenuEvents" method-name="addtlInfo"
> disable-lock="false"/>
>
> In MenuEvents.java I have:
> -------------------------------------
> public static synchronized void addtlInfo(PosScreen pos) {
>        PosTransaction trans =
> PosTransaction.getCurrentTx(pos.getSession());
>        trans.addtlInfo(pos);
>    }
>
> In PosTranaction.java I have:
> ----------------------------------------
> public synchronized void addtlInfo(PosScreen pos) {
>
>            try {
>
>               Keyboard keyboard = new Keyboard(pos, "addtlinfo");
>               keyboard.setText(getSaleAddtlInfo() == null ? "" :
> getSaleAddtlInfo());
>               setSaleAddtlInfo(keyboard.openDlg());
>
>             }
>                catch(Exception e){
>                Debug.logError(e, module);
>            }
>            return;
>    }
> ----------------------------------------------------ALSO------
> public void setSaleAddtlInfo(String info) {
>        cart.setShippingInstructions(info);
>    }
>
>    public String getSaleAddtlInfo() {
>        return cart.getShippingInstructions();
>    }
>
> and last but not least Keyboard.xml I've modified for dynamic XML
> properties:
> ---------------------------------------------------------------------------------------------------------------
> public Keyboard(PosScreen pos, String pagename){
>        m_pos = pos;
>
>        m_pageSupport = pageMgr.loadPage(
>                m_pos.getScreenLocation() + "/dialog/" + pagename);
>        m_dialog = (XDialog)m_pageSupport;
>
>        m_edit = (XEdit) m_pageSupport.findComponent("keyboard_input");
>        m_edit.setText("");
>
>        return;
>    }
>
>    public Keyboard(PosScreen pos){
>
>        this(pos, m_defaultPageName);
>        return;
>    }
>
> The Error I get is:
>
> ---- runtime exception report
> --------------------------------------------------
> Exception: java.lang.ClassCastException
> Message: net.xoetrope.xui.XPage cannot be cast to net.xoetrope.swing.XDialog
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.ClassCastException: net.xoetrope.xui.XPage cannot be cast to
> net.xoetrope.swing.XDialog
> org.ofbiz.pos.screen.Keyboard.<init>(Keyboard.java:28)
> org.ofbiz.pos.PosTransaction.addtlInfo(PosTransaction.java:1243)
> org.ofbiz.pos.event.MenuEvents.addtlInfo(MenuEvents.java:406)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:597)
> org.ofbiz.pos.config.ButtonEventConfig.invoke(ButtonEventConfig.java:208)
> org.ofbiz.pos.config.ButtonEventConfig.invokeButtonEvent(ButtonEventConfig.java:105)
> org.ofbiz.pos.component.PosButton$1.construct(PosButton.java:121)
> net.xoetrope.xui.helper.SwingWorker$2.run(Unknown Source)
> java.lang.Thread.run(Thread.java:619)
> --------------------------------------------------------------------------------
>
> Something within XUI no doubt...
>
> Figured I'd pass it your way.... I'm sure I'll figure it out though... just
> possibly sooner with your help!
>
> Thanks!
>
Reply | Threaded
Open this post in threaded view
|

Ofbiz save order functionality

Christopher L
In reply to this post by Branden Strickland
Hi.

In case you haven't been watching the list, I uploaded the patch.

https://issues.apache.org/jira/browse/OFBIZ-1945

C

Reply | Threaded
Open this post in threaded view
|

RE: Ofbiz save order functionality

Christopher L
In reply to this post by Branden Strickland
Oops, that was not meant for the list.  Please ignore.

C

From: [hidden email]
To: [hidden email]
Subject: Ofbiz save order functionality
Date: Wed, 10 Sep 2008 10:13:24 -0500







Hi.

In case you haven't been watching the list, I uploaded the patch.

https://issues.apache.org/jira/browse/OFBIZ-1945

C


Reply | Threaded
Open this post in threaded view
|

Re: additional info screen throws an exception

Jacques Le Roux-2
In reply to this post by Jacques Le Roux
Hi Branden,

I don't know if you are still listening to this ML. But in case you are, I owe you some apologies.
Actually I just crossed the pb you reported there and the right answer should have been

You refer to an xml dialog definition which does not exist (or more certainly is not on the right path)

HTH more than one year later :/

Jacques

To: <[hidden email]>

> Branden,
>
> It's pretty clear : XPage cannot be cast to XDialog. This happens in Keyboard.java line 28.
> I guess this line :  m_dialog = (XDialog)m_pageSupport;
>
> Jacques
>
> From: "Branden Strickland" <[hidden email]>
>> Chris, Jacques
>>
>> A little light shed will prob send me on my way to finish this for a
>> patch...
>>
>> Heres the deal.
>>
>> On the main POS screen I have a button "Addtl Info" it maps to:
>>    <event button-name="menuAddtlInfo"
>> class-name="org.ofbiz.pos.event.MenuEvents" method-name="addtlInfo"
>> disable-lock="false"/>
>>
>> In MenuEvents.java I have:
>> -------------------------------------
>> public static synchronized void addtlInfo(PosScreen pos) {
>>        PosTransaction trans =
>> PosTransaction.getCurrentTx(pos.getSession());
>>        trans.addtlInfo(pos);
>>    }
>>
>> In PosTranaction.java I have:
>> ----------------------------------------
>> public synchronized void addtlInfo(PosScreen pos) {
>>
>>            try {
>>
>>               Keyboard keyboard = new Keyboard(pos, "addtlinfo");
>>               keyboard.setText(getSaleAddtlInfo() == null ? "" :
>> getSaleAddtlInfo());
>>               setSaleAddtlInfo(keyboard.openDlg());
>>
>>             }
>>                catch(Exception e){
>>                Debug.logError(e, module);
>>            }
>>            return;
>>    }
>> ----------------------------------------------------ALSO------
>> public void setSaleAddtlInfo(String info) {
>>        cart.setShippingInstructions(info);
>>    }
>>
>>    public String getSaleAddtlInfo() {
>>        return cart.getShippingInstructions();
>>    }
>>
>> and last but not least Keyboard.xml I've modified for dynamic XML
>> properties:
>> ---------------------------------------------------------------------------------------------------------------
>> public Keyboard(PosScreen pos, String pagename){
>>        m_pos = pos;
>>
>>        m_pageSupport = pageMgr.loadPage(
>>                m_pos.getScreenLocation() + "/dialog/" + pagename);
>>        m_dialog = (XDialog)m_pageSupport;
>>
>>        m_edit = (XEdit) m_pageSupport.findComponent("keyboard_input");
>>        m_edit.setText("");
>>
>>        return;
>>    }
>>
>>    public Keyboard(PosScreen pos){
>>
>>        this(pos, m_defaultPageName);
>>        return;
>>    }
>>
>> The Error I get is:
>>
>> ---- runtime exception report
>> --------------------------------------------------
>> Exception: java.lang.ClassCastException
>> Message: net.xoetrope.xui.XPage cannot be cast to net.xoetrope.swing.XDialog
>> ---- stack trace
>> ---------------------------------------------------------------
>> java.lang.ClassCastException: net.xoetrope.xui.XPage cannot be cast to
>> net.xoetrope.swing.XDialog
>> org.ofbiz.pos.screen.Keyboard.<init>(Keyboard.java:28)
>> org.ofbiz.pos.PosTransaction.addtlInfo(PosTransaction.java:1243)
>> org.ofbiz.pos.event.MenuEvents.addtlInfo(MenuEvents.java:406)
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> java.lang.reflect.Method.invoke(Method.java:597)
>> org.ofbiz.pos.config.ButtonEventConfig.invoke(ButtonEventConfig.java:208)
>> org.ofbiz.pos.config.ButtonEventConfig.invokeButtonEvent(ButtonEventConfig.java:105)
>> org.ofbiz.pos.component.PosButton$1.construct(PosButton.java:121)
>> net.xoetrope.xui.helper.SwingWorker$2.run(Unknown Source)
>> java.lang.Thread.run(Thread.java:619)
>> --------------------------------------------------------------------------------
>>
>> Something within XUI no doubt...
>>
>> Figured I'd pass it your way.... I'm sure I'll figure it out though... just
>> possibly sooner with your help!
>>
>> Thanks!
>>
>