Re: Unable to Traverse with IVisitor: Some Class Names Have $1 at the end

2012-11-01 Thread Carl-Eric Menzel


 Most of the time, the class names are right, but sometimes, I don't
 get Wicket org names, I get these:
 
 com.mycompany.MyForm.MyPanel$1   ( -- on a Button!)
 com.mycompany.SomeForm$1   ( -- on a Button!)
 
 What's going on here, why can't I get the actual
 org.apache.wicket.markup.html.form.Button class names?

That's Java for you. When you create a button like this:

class MyPage {
  ...
  new Button() {
...
  }
}

...then you actually create a new class at that spot. It's anonymous,
so it doesn't have a really usable name, but internally, the compiler
and VM use enclosingclassname$someindexvalue to create that name.
Thus, you get MyPage$1 if this is the first anonymous subclass you
create within MyPage.

My usual solution to this is to not just print out the class name, but
first check whether the class name contains a $, and if so, get the
superclass instead.

Carl-Eric

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Unable to Traverse with IVisitor: Some Class Names Have $1 at the end

2012-11-01 Thread eugenebalt
Thanks Duesen, but if I get the superclass, how can I actually get the type
of *this* class?

I need to find out if the anonymous class is a Button, a TextField, a Link,
etc.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Unable-to-Traverse-with-IVisitor-Some-Class-Names-Have-1-at-the-end-tp4653532p4653536.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Unable to Traverse with IVisitor: Some Class Names Have $1 at the end

2012-11-01 Thread Alexander Cherednichenko
hi Eugene.
Super class will do that for you -- when you create an anonymous subclass
of a button, its parent would be a Button.

So just print out parent class name if the component's class name contains
$ sign it will do the trick.

best wishes,
alex
On Nov 1, 2012 6:09 PM, eugenebalt eugeneb...@yahoo.com wrote:

 Thanks Duesen, but if I get the superclass, how can I actually get the type
 of *this* class?

 I need to find out if the anonymous class is a Button, a TextField, a Link,
 etc.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Unable-to-Traverse-with-IVisitor-Some-Class-Names-Have-1-at-the-end-tp4653532p4653536.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Unable to Traverse with IVisitor: Some Class Names Have $1 at the end

2012-11-01 Thread eugenebalt
Thanks. Working now.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Unable-to-Traverse-with-IVisitor-Some-Class-Names-Have-1-at-the-end-tp4653532p4653538.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org