tried: class TreeX extends Tree {
            public native TreeItem getRoot()
            /*-{
                 return [EMAIL PROTECTED]::root;
                 }-*/;
        }

or

class TreeX extends Tree {
            public native TreeItem getRoot()
            /*-{
                 return this.root;
                 }-*/;
        }
both dont wok .

in tree again i need access to root TreeItem . Tree contains TreeItem and
its is again hidden inside and no common interface shared wit TreeItem is
there . I have a workaroun , and each such workaround gives me more code ,
and more code means more bugs and bad readability. As Tree isnt final (god
bless) I can add him interface which can have same methods to access childer
as TreeItem have and than i can have clean nice method using Tree as
TreeItem . Anyway I am very intrested with that jsni approach , can somebody
show me please how to make accessor for private fied root in Tree using
jsni. Thanx



On Tue, Aug 26, 2008 at 8:51 AM, Rene <[EMAIL PROTECTED]> wrote:

> jason that jni method seems interesting , can you provide small simple
> example ? Thanx.
>
>
> On Tue, Aug 26, 2008 at 2:55 AM, Ian Bambury <[EMAIL PROTECTED]> wrote:
>
>> This is a case I looked into recently.
>>
>> Yes you can take VerticalSplitPanel and HorizontalSplitPanel and amend
>> them, but you also have to take the abstract SplitPanel and something else
>> (I can't remember what) and maybe even more (I gave up because they are
>> fundamentally flawed anyway for anything but very simple use)
>>
>> But having to maintain your own copies of classes because they can't be
>> subclassed isn't really the way forward, is it?.
>>
>> On the plus side, it does indicate that the GWT team might still rethink
>> the whole internal design of splitpanels, so maybe we'll eventally be able
>> to use them in disclosurepanels and move them about without them going
>> weird.
>>
>> Ian
>>
>>
>>
>>
>> 2008/8/26 obesga <[EMAIL PROTECTED]>
>>
>>
>>> ... just simply take the HorizontalSplitPanel.java original class file
>>> form svn and remake it to your needs ?
>>>
>>> Beyond this, subclassing and inheritance are double side knifnes: they
>>> can do a great service, but they can broke code ocultation and
>>> funtionality of a class.
>>>
>>>
>>> And Widget is the worst example, as far as
>>> java.lang.Object
>>>  extended by com.google.gwt.user.client.ui.UIObject
>>>      extended by com.google.gwt.user.client.ui.Widget
>>>          extended by com.google.gwt.user.client.ui.Composite
>>>
>>> Composite directly inherits Wigdet; and its purpose is to be used as
>>> superclass of your custom wigdets
>>>
>>> I'm not saying GWT code is perfect, I have - like others - MHO about
>>> this...
>>>
>>> Oskaloko
>>>
>>>
>>>
>>>
>>> On 25 ago, 19:52, "Ian Bambury" <[EMAIL PROTECTED]> wrote:
>>> > It's not 'bits of code' it's the whole of both split panels. You can't
>>> > subclass them.
>>> >
>>> > 2008/8/25 Jason Essington <[EMAIL PROTECTED]>
>>>  >
>>> >
>>> >
>>> >
>>> >
>>> > > Visibility is an important concept in java. It allows a developer to
>>> > > cordon bits of code that are not meant to be accessed outside of the
>>> > > current class (private) or an extending class (protected). This
>>> allows
>>> > > a developer to "publish" a stable interface while preventing
>>> > > implementation details from being artificially fixed.
>>> >
>>> > > Now, if you have a very specific use case that requires access to
>>> > > something with private visibility, there is a way to handle it.
>>> > > Javascript has no concept of visibility, so you can use a JSNI method
>>> > > to get around Java's private keyword. By doing this, you acknowledge
>>> > > that you are accessing something that has no guarantee of actually
>>> > > being there in a future release (that's why it was private) but it'll
>>> > > allow you access where you really think you need it.
>>> >
>>> > > This little trick is of course a technique of last resort, so it
>>> > > should only be used if there is absolutely no other way to accomplish
>>> > > your intended task.
>>> >
>>> > > -jason
>>> >
>>> > > On Aug 25, 2008, at 8:53 AM, Rene wrote:
>>> >
>>> > > > I just want to say hello to developers of gwt  , and thank them for
>>> > > > making my life harder :) .  I want to extend HorizontalSplitPanel
>>> to
>>> > > > get acces to Split element to get his width dinamicly for layout
>>> > > > purposes , maybe its stupid then tell mi please why , but its
>>> > > > functional anyway and with HorizontalSplitPanel impossible as its
>>> > > > final. Can you please remove that keyword ?
>>> >
>>> > > > I know java has some keyword which can be used to protect access to
>>> > > > classes so they are less vulnerable for attacks , is it applicable
>>> > > > here in gwt in web context ? Library classes are meant for
>>> extending
>>> > > > so why restrict programmers to use classes only way you meant them
>>> ?
>>> > > > Its very limiting and man have to re implement thing already
>>> > > > implemented in library just for one getter or so.
>>> >
>>> > > > Also f.e in Widget there are layoutData which can be very useful
>>> for
>>> > > > me. And just for that i have to make wrapper around that class . I
>>> see
>>> > > > source , its not closed source so why restricting that ?
>>> >
>>> > > > I would be wary glad if you in near future can little free that and
>>> > > > other code. I can than make applications build on gwt smaller and
>>> > > > quicker .
>>> >
>>> > > > joke: I have a tip which I use on my old code and so - open find
>>> and
>>> > > > replace and remove all private and all final keywords. wala , code
>>> is
>>> > > > clear , readable , and functional as before . Java don't need to be
>>> > > > unreadable crap as rubist a pythonist think.
>>> >
>>> > > > Nice day
>>> >
>>> > --
>>> > Ianhttp://examples.roughian.com
>>> > ___________________________________
>>> >
>>> > Life is either a daring adventure or nothing.
>>> > Security is mostly a superstition.
>>> > It does not exist in nature.
>>> > - Helen Keller
>>> > ___________________________________
>>>
>>> Life is either a daring adventure or nothing.
>>> Security is mostly a superstition.
>>> It does not exist in nature.
>>> - Helen Keller
>>> ___________________________________
>>>
>>>
>>> >>>
>>>
>
>
> --
> Rene Dohan
>
> http://inno-a-dev.blogspot.com/
>
>


-- 
Rene Dohan

http://inno-a-dev.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
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