hi,

On Oct 27, 6:51 pm, Thomas Broyer <[EMAIL PROTECTED]> wrote:
> On 27 oct, 17:30, r a f t <[EMAIL PROTECTED]> wrote:
>
> > hello,
>
> > i'm trying to implement a custom widget. it seems more natural and
> > easy to extend a standard gwt widget and modify necessary parts.
>
> It depends... it might be better to extend Composite (or eventually
> implement the Widget "from scratch").
>
> > however it seems as gwt widgets aren't designed for this purpose and
> > most of the useful functionality is in package private methods.
>
> > i've found that (and indeed very surprised) if i change my package
> > name to com.google.gwt.user.client.ui i can use such methods as if my
> > widget is in that package. i'm not sure how that became possible. as
> > far as i know, classes from different sources are treated as different
> > packages even if they have the same package name.
>
> That's the case in "assembly worlds" (.NET), where actually you can
> have "assembly-protected" classes and methods but not "namespace-
> protected" things; but not in Java, which AFAIK treats the classpath
> as a single entity, whichever JAR or directory a resource comes from.
>
but you cannot access package private classes/methods in rt.jar in
same way.  i've checked that you can reach any third party jar. maybe
rt.jar is protected by other means

> > so what do you think ? can i count on this ?
>
> You can count on the fact that placing a class in one package gives it
> visibility on package-protected classes and methods; that's how Java
> works.
> The GWT-Incubator project *is* using this "feature" of Java (I for one
> call it a bug, but it's how it's been designed, so you have to live
> with it).
>
> > or am i somehow hacking the system ?
>
> If things are package-protected in GWT, they should be considered
> "internals" and can change without notice in the next version, so yes
> you're somehow "hacking the system" (or GWT for what it's worth).

you have definetely a point here
>
> What are you trying to do that requires package-protected access?

i'm trying to implement a closable panel (similar to incubator's
PinnedPanel) but there is nothing particular about how to do it.
i'm just playing and testing. as an example, DecoratedPopupPanel's
three arg constructor is package private, which does the main job.
similarly Widget.onAttach() and onDetach() are protected methods which
you can not directly call.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to