Return-Path: Delivered-To: apmail-incubator-pivot-user-archive@minotaur.apache.org Received: (qmail 88672 invoked from network); 4 Nov 2009 22:10:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Nov 2009 22:10:09 -0000 Received: (qmail 50799 invoked by uid 500); 4 Nov 2009 21:10:09 -0000 Delivered-To: apmail-incubator-pivot-user-archive@incubator.apache.org Received: (qmail 50754 invoked by uid 500); 4 Nov 2009 21:10:09 -0000 Mailing-List: contact pivot-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pivot-user@incubator.apache.org Delivered-To: mailing list pivot-user@incubator.apache.org Received: (qmail 50745 invoked by uid 99); 4 Nov 2009 21:10:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 21:10:09 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [203.10.1.244] (HELO outbound-mail03.westnet.com.au) (203.10.1.244) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 21:10:07 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkQFAO988Up8lAFF/2dsb2JhbACBT4MkyRmQYINqUwSBZYMj X-IronPort-AV: E=Sophos;i="4.44,682,1249228800"; d="xml'?java'?scan'208,217";a="38275097" Received: from dsl-124-148-1-69.qld.westnet.com.au (HELO mail.sael.com.au) ([124.148.1.69]) by outbound-mail03.westnet.com.au with ESMTP; 05 Nov 2009 05:09:40 +0800 Received: by mail.sael.com.au (Postfix, from userid 5001) id 15C1B118C018; Thu, 5 Nov 2009 07:09:39 +1000 (EST) X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on server.sael X-Spam-Level: Received: from workstation.localnet (workstation.sael [192.168.3.12]) by mail.sael.com.au (Postfix) with ESMTP id 709A6118C017 for ; Thu, 5 Nov 2009 07:09:25 +1000 (EST) From: Scott Lanham To: pivot-user@incubator.apache.org Subject: Re: Custom Class and WTKXSerializer Problem Date: Thu, 5 Nov 2009 07:09:46 +1000 User-Agent: KMail/1.12.2 (Linux/2.6.31-14-generic; KDE/4.3.2; x86_64; ; ) References: <200911041144.52383.lists@sael.com.au> <168ef9ac0911040830l354f13dcn27ee095147b3582d@mail.gmail.com> In-Reply-To: <168ef9ac0911040830l354f13dcn27ee095147b3582d@mail.gmail.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_a2e8Kg4zNiu1foy" Message-Id: <200911050709.46547.lists@sael.com.au> X-Old-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.4 --Boundary-00=_a2e8Kg4zNiu1foy Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi Todd, Attached is some sample code that causes a cast exception. On Thu, 5 Nov 2009 02:30:02 am Todd Volkert wrote: > It should work as you expect. A few things to check: > > - Are you constructing it using a element? > - If you put a sys-out in your DataTableView constructor, is it getting > run? > - Do you provide a no-args constructor in DataTableView? > > If none of these checks yield any leads, you can send the WTKX in question, > and I'll have a look. > > -T > > On Tue, Nov 3, 2009 at 8:44 PM, Scott Lanham wrote: > > Hi, > > > > I have a ScrollPane that contains as it's view a simple subclass of > > TableView > > called DataTableView. When retrieving an instance of DataTableView > > defined in a > > wtkx file using WTKXSerializer.get() a TableView is returned, not a > > DataTableView. The strange thing is that I have previously had success > > with a > > custom Form done in the same way. Any clues as to where I may be going > > wrong > > is very appreciated. > > > > Cheers, > > > > Scott. > --Boundary-00=_a2e8Kg4zNiu1foy Content-Type: text/x-java; charset="UTF-8"; name="testing.java" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="testing.java" package testing; import org.apache.pivot.collections.HashMap; import org.apache.pivot.collections.List; import org.apache.pivot.collections.Map; import org.apache.pivot.wtk.Application; import org.apache.pivot.wtk.Button; import org.apache.pivot.wtk.ButtonPressListener; import org.apache.pivot.wtk.DesktopApplicationContext; import org.apache.pivot.wtk.Display; import org.apache.pivot.wtk.PushButton; import org.apache.pivot.wtk.Window; import org.apache.pivot.wtk.content.TableViewRowEditor; import org.apache.pivot.wtkx.WTKXSerializer; public class testing implements Application { private Window appWindow = null; private TestTableView view = null; private PushButton btn = null; public static void main(String[] args) { DesktopApplicationContext.main( testing.class, args ); } public void startup( Display display, Map properties ) throws Exception { WTKXSerializer serial = new WTKXSerializer(); appWindow = (Window) serial.readObject( this, "testing.xml" ); view = (TestTableView) serial.get( "view" ); TableViewRowEditor editor = new TableViewRowEditor(); view.setRowEditor( editor ); btn = (PushButton) serial.get( "btnNewRow" ); btn.getButtonPressListeners().add( new ButtonPressListener() { public void buttonPressed( Button button ) { HashMap map = new HashMap(); map.put( "col1", "newCol1" ); map.put( "col2", "newCol2" ); ((List)(view.getTableData())).add( map ); //view.getRowEditor().edit( view, ((List)(view.getTableData())).indexOf( map ), 0 ); view.getRowEditor().editRow( view, 0, 0 ); } }); PushButton btnDel = (PushButton) serial.get( "btnDelRow" ); btnDel.getButtonPressListeners().add( new ButtonPressListener() { public void buttonPressed( Button button ) { int selectIndex = view.getSelectedIndex(); if ( selectIndex != -1 ) ((List)(view.getTableData())).remove( selectIndex, 1 ); } }); PushButton btnMax = (PushButton) serial.get( "btnMaxWidthTest" ); btnMax.getButtonPressListeners().add( new ButtonPressListener() { public void buttonPressed( Button button ) { view.getColumns().get( 0 ).setMaximumWidth( 100 ); } }); appWindow.open(display); } public boolean shutdown( boolean optional ) throws Exception { if ( appWindow != null ) appWindow.close(); return false; } public void suspend() throws Exception { } public void resume() throws Exception { } } --Boundary-00=_a2e8Kg4zNiu1foy Content-Type: application/xml; name="testing.xml" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="testing.xml" [{col1:"val1", col2:"val2"},{col1:"val3", col2:"val4"}] --Boundary-00=_a2e8Kg4zNiu1foy Content-Type: text/x-java; charset="UTF-8"; name="TestTableView.java" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="TestTableView.java" // Copyright 2008 SAEL Pty Ltd, Australia. package testing; import org.apache.pivot.wtk.TableView; public class TestTableView extends TableView { public TestTableView() { } } --Boundary-00=_a2e8Kg4zNiu1foy--