GWT's generated javascript is opaque to 'view source'

2009-01-22 Thread David H. Cook

I recently re-wrote an old page that I originally developed
using just 'google maps' APIs, to now use GWT and google maps.

One thing that I really LIKE about my original implementation
is that it is totally transparent (i.e. using any browser's view
source),
one can then see the whole implementation...the HTML as well as
all the JAVASCRIPT.  [a truly 'open source' webpage]

However, due to the fact that GWT is compiled, the source-code
is compiled in the development environment and the website
gets only the generated (and OBSCURED) javascript, thus
the implementation is now opaque to 'view source'.  For example,
even when I snoop with 'view source', learn that javascript is
in org.waterhawk.gwt.GWTGoogleMaps.nocache.js and then
do a 2nd 'view source' on THAT file, the resulting output
is very opaque and mostly worthless to someone wanting
to see the (resulting javascript) implementation.

So, my question is:  Is there some (non-default) compile
option or build-option that I could use to make the generated
javascript less obscure?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: GWT's generated javascript is opaque to 'view source'

2009-01-22 Thread David H. Cook

Tho, the resulting code isn't all that helpful,
your answer DOES work!   It's alot less obscure
than it was.

That answers it...thanks.


On Jan 22, 5:49 am, Paul Robinson ukcue...@gmail.com wrote:
  So, my question is:  Is there some (non-default) compile
  option or build-option that I could use to make the generated
  javascript less obscure?

 Add this to your GWTCompiler arguments:
 -style PRETTY

 Paul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: What am I misunderstanding about the event model?

2008-12-24 Thread David H. Cook

Reinier -

Thank you, thank you, for the EXCELLENT explanation in
your posts to this thread.  I totally get it now.

I like especially that you point out that, given GWT objectives
and constraints, it is NOT necessarily the right tool for
all webapps.

I guess I made the correct decision, back when I finally just
changed my design to use the GWT APIs in a straight-forward
way (rather than 'hack' down in and expose leaks.
Now I get your earlier reference to 'LEAKY'.

One last thing someone could do is to PUBLISH this sort of
perspective...i.e. put it in overview docs where new prospective
developers are apt to find it.

Cheers...

Dave [the base-noter]

On Dec 23, 8:45 pm, Reinier Zwitserloot reini...@gmail.com wrote:
 As I said, Event is a low level class. You don't use it from java
 code, you use it from JSNI code. Another low level 'class' is the DOM
 class. It is a repository of loads of static utility methods (you
 don't ever do 'new DOM()', you just call DOM.someMethod()). Anything
 you can do with Event objects without resorting to JSNI is done with
 the various methods in the DOM class that start with 'event'. For
 example, to get the thing that the event happened for, you use
 DOM.eventGetTarget(Event e). However, this returns an Element, which
 is another low level class. Elements, just like Events and
 JavaScriptObjects, don't have any useful methods for java GWT code.
 They are plenty useful when transported to JSNI methods, and there are
 plenty of methods in the DOM class that work on Elements. Generally,
 widgets CONTAIN an Element, so its not easy to go from Element to the
 widget it belongs to, which is why you're having so much trouble.

 Screwing about with DOM and Element will result in GWT projects that
 leak memory, especially on IE, unless you -really- know what you are
 doing. For example, if you add a listener yourself, you have to be
 very careful in removing it at the right time or the listener, and in
 turn every object it points at (and every object those objects point
 at, etcetera) are stuck in the browser forever (well, until the user
 closes the browser or the window with your app in it, but for a
 webapp, that's what 'forever' means, really).

 On Dec 24, 1:57 am, David Hoffer dhoff...@gmail.com wrote:

  In my case I need to support right click in Tree widgets so the global
  option doesn't help.  I'm willing to live with limited browser support if I
  can convert the Event returned via onBrowserEvent() to a TreeItem.

  -Dave

  On Tue, Dec 23, 2008 at 3:49 PM, lukehashj bobwazn...@gmail.com wrote:

   Those lego pieces are the special get a box of em for 20 bucks pieces
   -

   To implement this functionality I would use a little bit of JSNI and
   the onContextMenu functionality.

   Open up your module's main .html file and locate your body element.
   Add onContextMenu='someJavaScriptFunction()' to it.

   Next, add a script type='text/javascript'function
   someJavaScriptFunction(){ execute JSNI here }/script to the inner
   HTML of the head element and you are set!

   If you've not read about JSNI, here is a good resource:
  http://code.google.com/support/bin/answer.py?answer=75695topic=10213

   Obviously, this is a global solution - usually used to display an
   alternate context menu. If you're trying to implement right-click for
   a particular element that's a little bit more tricky and less reliable
   across browsers.

   On Dec 23, 3:23 pm, David Hoffer dhoff...@gmail.com wrote:
Sounds good, I'll try that for DoubleClickEventListener.

What lego pieces would you use to implement RightClickEventListener?

-Dave

On Tue, Dec 23, 2008 at 2:59 PM, lukehashj bobwazn...@gmail.com wrote:

 If you want the double-click event, create a DoubleClickEventListener
 that extends ClickListener. When the click event is fired a timer is
 started - if they click again before the timer executes, the
 onDoubleClick event fires. Otherwise, it's just treated as a single
 click. Using this mechanism, you can adjust the speed at which the
 user must double-click for you to get the event. This can be helpful
 in improving your websites accessibility (ease of navigation, etc).
 This also allows you to add a DoubleClickListener to any class that
 implements the SourcesClickEvents class.

 If you are rolling your own horizontal/vertical panels you're
 approaching composition from the completely wrong direction.
 You should probably create a class that extends Composite but includes
 all the functionality that you would have added to the base GWT class
 (es) and calls initWidget(on a horizontalPanel). Or, simply extend the
 GWT class and add the missing/desired functionality to it.

 The GWT widget/event classes are like legos - use the small parts to
 build a greater cohesive structure. Don't plan on the legos coming out
 of the box preassembled!

Re: What am I misunderstanding about the event model?

2008-12-22 Thread David H. Cook

Jason -

You wrote:
The problem with the standard DOM EventListeners is that only one
listener can be attached to an
Element. The other problem is that a custom Widget may be required to
listen for a sequence of
low-level events in order to trigger a single high-level event (think
MOUSEDOWN/UP/MOVE in relation
to itemDraggedAndDropped())

Yes!   I agree totatlly! There are nothing BUT problems with the event
model.
So, with those shortcomings, why did they implement it that way?

Like the 'roughian' man said so succinctly:
You can't addEventListener() to anything I'm aware of.

That's my criticism in a nutshell!  So, why didn't they implement it
that way?
Then they wouldn't have even NEEDED all those other (foolish) Listener-
APIs
with all their shortcomings!

You wrote:
 If you are extending the classes over and over again...

NO, I'm NOT!  I don't like it that I need to!  So, I refuse.

In fact, what I found myself doing was to change my whole design (from
what I had when I first implemented it in the old javascript-model) so
that
I am NOT implementing DBL-CLICK,  because of the need to sub-class.

[I found a thread a week ago or so, where someone found that in the
soon-to-be
released GWT 1.60, there was some refactoring of event-stuff, and I am
hoping
against hope that they were ripping out ALL the event-routines, and
simplifying,
but of course, they aren't.  The community would be in an uproar.
(Except for me.!)
I'd welcome it with open-arms, as I have just one small app written in
GWT, and
would be more than happy to re-write all the event-stuff, if they were
to redesign
it totally.]



On Dec 22, 3:04 am, Jason Morris lem...@gmail.com wrote:
 The GWT event model is a close relation of the standard Java event model.

 The problem with the standard DOM EventListeners is that only one listener 
 can be attached to an
 Element. The other problem is that a custom Widget may be required to listen 
 for a sequence of
 low-level events in order to trigger a single high-level event (think 
 MOUSEDOWN/UP/MOVE in relation
 to itemDraggedAndDropped()).

 So you hide the low-level events within Widget classes, which when they 
 receive the event can
 trigger the collection of ClickListeners / MouseListeners / 
 MyFancyListenerNumber3.

 adding your double-click behavior to each
 one in it's onBrowserEvent method, you're doing it wrong. The correct way is 
 to extend once, and
 allow for adding any additional listeners (double-click, keyboard, etc.) to 
 the extended class
 (which should trigger them in it's onBrowserEvent method). This way the event 
 handling logic remains
 separated from the Widget itself.

 Also bare in mind Composite style classes (like a TabPanel) that want to turn 
 a Click event on a tab
 into onBeforeTabSelected and onTabSelected for it's TabListeners.

 Hope that helps a bit.

 David H. Cook wrote:

  The more code I implement and the more event-related APIs
  I look at in GWT, the more confused I get.  After
  looking at complete examples about 'listeners' on website such as:
 http://examples.roughian.com/index.htm#Listeners~Summary
  or posts in this group, I conclude that the most general
  is an 'EventListener', because then I can get at ANY/ALL events
  that I might be interested in, as it's method gets 'Event e'
  as an input param.  But, what seems to me like
  a real NEGATIVE is that I must 'extend' (sub-class) an object
  to use EventListener, right?

  Now, if I only care about a 'click', then I do NOT need to extend,
  because there are 'clicklisteners', which listen for just ONE event
  type...'click'.  But, if I want, say, 'double-click', well, there
  are NOT any 'double-click' listeners, so it seems that I'll need
  to use the more general EventListener.

  That would be reasonable/acceptable if there was just
  ONE object that I wanted/needed to extend in a given app.
  But, let's say, I care about 'doubleclicks' from 3 different
  objects in the same app...anchors, tabs, and images.
  (Maybe not the best examples, but bear with me.)
  So, it seems that now I need to extend three objects, so I'll
  need 3 java classes (and thus, ...3 FILES...one class per file).
  [Some posts/examples mention 'widget builders'  as a separate
  class of developer.  But, I don't want to build new 'widgets'...
  I just want a write a simple app.

  Somehow, the APIs seem to be making things unnecessarily 'complex',
  when I compare this to how easy it was to implement events
  in javascript language (before I started using GWT).  And, its
  beginning to seem like the designers of the event-model/event-apis in
  GWT
  might have miss-designed the APIs?!  (I wasn't around at the
  beginning, so I don't know how the event-APIs looked in version 1.00.)

  Both the author of roughian website and other posters all seem to
  bemoan
  this need to extend, but all say it is necessary.  For example,
  roughian
  says:

  [Notes:
  This is something you should only use if you are subclassing a widget

What am I misunderstanding about the event model?

2008-12-21 Thread David H. Cook


The more code I implement and the more event-related APIs
I look at in GWT, the more confused I get.  After
looking at complete examples about 'listeners' on website such as:
http://examples.roughian.com/index.htm#Listeners~Summary
or posts in this group, I conclude that the most general
is an 'EventListener', because then I can get at ANY/ALL events
that I might be interested in, as it's method gets 'Event e'
as an input param.  But, what seems to me like
a real NEGATIVE is that I must 'extend' (sub-class) an object
to use EventListener, right?

Now, if I only care about a 'click', then I do NOT need to extend,
because there are 'clicklisteners', which listen for just ONE event
type...'click'.  But, if I want, say, 'double-click', well, there
are NOT any 'double-click' listeners, so it seems that I'll need
to use the more general EventListener.

That would be reasonable/acceptable if there was just
ONE object that I wanted/needed to extend in a given app.
But, let's say, I care about 'doubleclicks' from 3 different
objects in the same app...anchors, tabs, and images.
(Maybe not the best examples, but bear with me.)
So, it seems that now I need to extend three objects, so I'll
need 3 java classes (and thus, ...3 FILES...one class per file).
[Some posts/examples mention 'widget builders'  as a separate
class of developer.  But, I don't want to build new 'widgets'...
I just want a write a simple app.

Somehow, the APIs seem to be making things unnecessarily 'complex',
when I compare this to how easy it was to implement events
in javascript language (before I started using GWT).  And, its
beginning to seem like the designers of the event-model/event-apis in
GWT
might have miss-designed the APIs?!  (I wasn't around at the
beginning, so I don't know how the event-APIs looked in version 1.00.)

Both the author of roughian website and other posters all seem to
bemoan
this need to extend, but all say it is necessary.  For example,
roughian
says:

[Notes:
This is something you should only use if you are subclassing a widget
- it's not much use otherwise,
you can't addEventListener() to anything I'm aware of.
So, as a builder of widgets, you'd use this to pick up events and use
them in ways
that you can't do with the ordinarily supported event interfaces]

Clearly, I (and others?) must all be missing something.  Where have I
gone wrong?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: GWT event model

2008-12-08 Thread David H. Cook

I'll shoot from the hip and GUESS that the reason MIGHT
be that (hopefully) someone is fixing what I currently think
is a MAJOR flaw in the whole design/implementation of
events in GWT.

If I'm correct (that there really IS a flaw), it's that there needs
to be the concept of 'addEventListener' to every widget object
(instead of forcing one to subclass each widget, as seems to
be the case currently).

The problem as I see it is that stuff like 'addClickListener'
is very limiting, because you can't easily add events, like
double-click, etc, etc.

Sigh.  [But, I could be all wet with my guess/hope.]

On Dec 8, 11:06 am, Mike [EMAIL PROTECTED] wrote:
 Hi all,

 Today i was browsing the latest source code for GWT and i saw that
 many event-related classes have been deprecated. (E.g. CLickListener
 and SourcesClickEvents.) Is a major refactoring of the event mechanism
 forthcoming?

 (I was trying to figure out how the GWT event model works, i.e. i was
 wondering what the rock-bottom source for GWT events is and how they
 are `injected' into java. I discovered that GWT events are fired after
 handling browser events. In my opinion, this is not clearly explained
 in the GWT documentation. I worked an example, you can find it on my
 blog whatmovesmike.blogspot.com .)

 Bye, Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: There is a bug in CellPanel.java

2008-12-08 Thread David H. Cook

I'm just guessing and shooting from the hip, but
your problem is probably not a bug.

I've only been coding GWT for about a week now, but
have found that I must really read the docs carefully
and think globally, when it comes to stuff relating to
'styles' and stuff that is also controlled by .CSS files, etc.

As just one example, I spent a few HOURS debugging/fixing
a problem trying to reduce cell-size of something I was
adding to a VerticalPanel, and nothing would work.
Final fix was that it finally dawned on me, that most
all the 'panel' widgets in GWT are implemented with
table elements, and the fix was to tweak the styles
that I had for table-elements in my projects .CSS file.

Hope this helps your thinking...sorry that I don't have
a more specific answer.

On Dec 7, 9:55 pm, wurenhai [EMAIL PROTECTED] wrote:
 Let's read the following code:
 ==CellPanel.java===
   /**
    * Sets the height of the cell associated with the given widget,
 related to
    * the panel as a whole.
    *
    * @param w the widget whose cell height is to be set
    * @param height the cell's height, in CSS units
    */
   public void setCellHeight(Widget w, String height) {
     Element td = DOM.getParent(w.getElement());
     DOM.setElementProperty(td, height, height);
   }

   /**
    * Sets the horizontal alignment of the given widget within its
 cell.
    *
    * @param w the widget whose horizontal alignment is to be set
    * @param align the widget's horizontal alignment, as defined in
    *         [EMAIL PROTECTED] HasHorizontalAlignment}.
    */
   public void setCellHorizontalAlignment(Widget w,
       HorizontalAlignmentConstant align) {
     Element td = getWidgetTd(w);
     if (td != null) {
       setCellHorizontalAlignment(td, align);
     }
   }

   /**
    * Sets the vertical alignment of the given widget within its cell.
    *
    * @param w the widget whose vertical alignment is to be set
    * @param align the widget's vertical alignment, as defined in
    *         [EMAIL PROTECTED] HasVerticalAlignment}.
    */
   public void setCellVerticalAlignment(Widget w,
 VerticalAlignmentConstant align) {
     Element td = getWidgetTd(w);
     if (td != null) {
       setCellVerticalAlignment(td, align);
     }
   }

   /**
    * Sets the width of the cell associated with the given widget,
 related to the
    * panel as a whole.
    *
    * @param w the widget whose cell width is to be set
    * @param width the cell's width, in CSS units
    */
   public void setCellWidth(Widget w, String width) {
     Element td = DOM.getParent(w.getElement());
     DOM.setElementProperty(td, width, width);
   }

 
 The method setCellSize is defferent from setCellAlign.
 I want to say that, there is a bug use setCellSize:
     VerticalPanel v = new VerticalPanel();
     Button b = new Button(Button);
     v.setCellWidth(b, 100px);
     v.add(b);
 These codes are normal when i uesed in debug model, but there is a IE
 error after i comlie it. The td is null!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: setHorizonalAlignment doesn't do it now (fineprint)

2008-12-08 Thread David H. Cook

it's just hp.setCellHorizontalAlignment(button, HasAlignment.ALIGN_CENTER);

Ah, that compiled cleanly now...thanks!

You must stay REALLY busy, between posts here, email,
and your new email-based newbie-class.  Do you have help
on your website, or are you doing it all by yourself?


On Dec 8, 2:31 pm, Ian Bambury [EMAIL PROTECTED] wrote:
 Thanks!
 No I was not implying that there is an example there, just that
 setCellHorizontalAlignment
 is what you need - I was about to do something else, so I didn't expand.
 Sorry.

 Once you have a widget in a cell let's say 'button' in a HorizontalPanel
 'hp'

 it's just hp.setCellHorizontalAlignment(button, HasAlignment.ALIGN_CENTER);

 and the alignment is set.

 setHorizontalAlignment as you say, sets the alignment default for future
 adds

 That is a very slick website you've constructed!  [I assume

 you were already a heavy-duty website developer before

 you started learning Java?]

 Not really, though I had done a couple, but that mostly consisted of me
 telling people who worked for me what I wanted them to do. Before GWT and
 Java (I learnt both from scratch a couple of years ago) I'd done internet
 stuff, but is was things like replacing a fax-based document system with an
 electronic one over the internet - 3m documents a year, 160 offices in 80
 countries - all with different back end systems, some without an electricity
 supply. I like a challenge :-)

 Ian

 http://examples.roughian.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 Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: setHorizonalAlignment doesn't do it now (fineprint)

2008-12-08 Thread David H. Cook

Yeah, thanks, I've figured out some of that Eclipse stuff,
and I saw the nice summary of Eclipse cmds
on your website.  The Eclipse IDE is probably
the nicest one out there, tho NetBeans is a close
2nd...I've used it in the past, and the support for stuff
like tomcat/apache/MySQL/etc is neat.  I'm sure that
Eclipse has all that stuff too.

And the best part is that these nice IDEs are free!



On Dec 8, 6:03 pm, Ian Bambury [EMAIL PROTECTED] wrote:
 No, it's just me.
 In Eclipse, when you get to the HasAlignment.ALIGN_XX bit, if you
 haven't discovered this, type 'hasa' (no quotes) then press CTRL+Space,
 press enter to accept 'HasAlignment', press '.' to get the options, then use
 the arrow keys and press enter to accept the alignment.

 That looks amazingly complicated written out like that, but try it and see
 what happens.

 Ian

 http://examples.roughian.com

 2008/12/8 David H. Cook [EMAIL PROTECTED]



  it's just hp.setCellHorizontalAlignment(button,
  HasAlignment.ALIGN_CENTER);

  Ah, that compiled cleanly now...thanks!

  You must stay REALLY busy, between posts here, email,
  and your new email-based newbie-class.  Do you have help
  on your website, or are you doing it all by yourself?

  On Dec 8, 2:31 pm, Ian Bambury [EMAIL PROTECTED] wrote:
   Thanks!
   No I was not implying that there is an example there, just that
   setCellHorizontalAlignment
   is what you need - I was about to do something else, so I didn't expand.
   Sorry.

   Once you have a widget in a cell let's say 'button' in a HorizontalPanel
   'hp'

   it's just hp.setCellHorizontalAlignment(button,
  HasAlignment.ALIGN_CENTER);

   and the alignment is set.

   setHorizontalAlignment as you say, sets the alignment default for future
   adds

   That is a very slick website you've constructed!  [I assume

   you were already a heavy-duty website developer before

   you started learning Java?]

   Not really, though I had done a couple, but that mostly consisted of me
   telling people who worked for me what I wanted them to do. Before GWT and
   Java (I learnt both from scratch a couple of years ago) I'd done internet
   stuff, but is was things like replacing a fax-based document system with
  an
   electronic one over the internet - 3m documents a year, 160 offices in 80
   countries - all with different back end systems, some without an
  electricity
   supply. I like a challenge :-)

   Ian

  http://examples.roughian.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 Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Style issues with VerticalPanel vs FlowPanel

2008-12-06 Thread David H. Cook

Damn, I spoke too soon.  The code compiles cleanly, but
doesn't have any visual effect at all.  [The cellsize parameter is
a string, so I'm using stuff like 10px or 50px, right?]

Tried making cellsize BIGGER...no effect.  Smaller, no effect.

[Something else must be in charge...the fontsize of the text of
my widget (an anchor)?!?!]

I'm still missing somthing!



On Dec 6, 10:06 am, David H. Cook [EMAIL PROTECTED]
wrote:
 Gregor -

 Thanks for the confirmation!  (I finally deduced as much, after
 posting, that while one can set border size once before or after
 creating
 the VP, but that one must set the CellHeight for EACH cell
 since each cell could even contain a different widget type...hence the
 widget-arg.)

 And, I also just ran across the 'grid' UI-object after posting, and
 kinda figured
 that it might fit for me.  What has been eluding me when reading the
 API
 docs is that, when I don't see the expected method I want, that I need
 to look further down into sections on methods inherited from more
 general object types.  (Been just a bit too long ago that I did any
 serious Java-coding...sigh)

 My brain is slowly starting to understand these APIs...and they
 are SWEET once mastered!

 Thanks again for replying.

 Cheers...
 Dave

 On Dec 6, 8:07 am, gregor [EMAIL PROTECTED] wrote:

  Hi Dave,

  you could:

  a) allocate your anchors to the VP in a method that calls the required
  Vp setCellHeight(widget,height) method conveniently, e.g.:

  private void addAnchor(MyAnchor anchor) {
     myVP.add(anchor);
     myVP.setCellHeight(anchor,nnpx);

  }

  b) use a Grid with one column. Grid extends HTMLTable which has a
  ColumnFormatter with which you can apply your required height to all
  the cells using CSS. Note Grid needs to be sized up front, so it not
  always so convenient if you need to allocate items to it on the fly at
  run time (although you can add cells to it explicitly).

  regards
  gregor

  On Dec 6, 6:26 am, David H. Cook [EMAIL PROTECTED]
  wrote:

   After more doc reading, it now seems that the right approach is
   to use a VerticalPanel (i.e. so that ONE item per line is achieved),
   but then to alter the panel's border-width and cell-height.

   But, NOW what I can't quite understand, is how to code the
   'setCellHeight'
   method.  (What widget do they want for first arg?)  If they
   just had a code-sample in their foolish doc for this method, I'd
   be home free.  Anyone got a code snippet for this?

   TIA...
   Dave

   On Dec 6, 1:01 am, David H. Cook [EMAIL PROTECTED]
   wrote:

Been playing with both a VerticalPanel and a FLowPanel, but
I can't find a way to constrain a FlowPanel to just one entry per
line.

I've got a bunch (about 25) of anchor-elements (a tags).
When I add then to a VerticalPanel, I achieve the one item
per line, but there is way TOO MUCH wasted white-space,
with the default cell-size and borders, etc.

When I add each anchor to a FlowPanel, it solves the
white-space issue, but then I get multiple anchors per line,
all flowed together (which is no doubt why they call it that.)

So, has anyone come upon a UI-object/technique to
get achieve what I want?

(Conceptually, a table of one column, with all the cellpadding
and bordersizing set to minimal values sounds right, but without
a code sample, that seems time-consuming to achieve.)

Ideas?

TIA...
Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Style issues with VerticalPanel vs FlowPanel

2008-12-06 Thread David H. Cook

Ok, finally solved it.

I had my own project-specific .CSS file with default values for about
every html element that exists!  Removing it didn't help...some other
default
values (that Google supplies?) were still in effect.

But, the fix was to go into my proj-specific .CSS and make all table-
elements
have 'padding' of '0px' (previously, I had '1em')  This is no doubt
needed for
a 'VerticalPanel', because a VP gets implemented via some hidden
'table',
so the table-element styles effect it.

So, I'm now able to move on to more important stuff.
(Whew!)



On Dec 6, 12:04 pm, David H. Cook [EMAIL PROTECTED]
wrote:
 Damn, I spoke too soon.  The code compiles cleanly, but
 doesn't have any visual effect at all.  [The cellsize parameter is
 a string, so I'm using stuff like 10px or 50px, right?]

 Tried making cellsize BIGGER...no effect.  Smaller, no effect.

 [Something else must be in charge...the fontsize of the text of
 my widget (an anchor)?!?!]

 I'm still missing somthing!

 On Dec 6, 10:06 am, David H. Cook [EMAIL PROTECTED]
 wrote:

  Gregor -

  Thanks for the confirmation!  (I finally deduced as much, after
  posting, that while one can set border size once before or after
  creating
  the VP, but that one must set the CellHeight for EACH cell
  since each cell could even contain a different widget type...hence the
  widget-arg.)

  And, I also just ran across the 'grid' UI-object after posting, and
  kinda figured
  that it might fit for me.  What has been eluding me when reading the
  API
  docs is that, when I don't see the expected method I want, that I need
  to look further down into sections on methods inherited from more
  general object types.  (Been just a bit too long ago that I did any
  serious Java-coding...sigh)

  My brain is slowly starting to understand these APIs...and they
  are SWEET once mastered!

  Thanks again for replying.

  Cheers...
  Dave

  On Dec 6, 8:07 am, gregor [EMAIL PROTECTED] wrote:

   Hi Dave,

   you could:

   a) allocate your anchors to the VP in a method that calls the required
   Vp setCellHeight(widget,height) method conveniently, e.g.:

   private void addAnchor(MyAnchor anchor) {
      myVP.add(anchor);
      myVP.setCellHeight(anchor,nnpx);

   }

   b) use a Grid with one column. Grid extends HTMLTable which has a
   ColumnFormatter with which you can apply your required height to all
   the cells using CSS. Note Grid needs to be sized up front, so it not
   always so convenient if you need to allocate items to it on the fly at
   run time (although you can add cells to it explicitly).

   regards
   gregor

   On Dec 6, 6:26 am, David H. Cook [EMAIL PROTECTED]
   wrote:

After more doc reading, it now seems that the right approach is
to use a VerticalPanel (i.e. so that ONE item per line is achieved),
but then to alter the panel's border-width and cell-height.

But, NOW what I can't quite understand, is how to code the
'setCellHeight'
method.  (What widget do they want for first arg?)  If they
just had a code-sample in their foolish doc for this method, I'd
be home free.  Anyone got a code snippet for this?

TIA...
Dave

On Dec 6, 1:01 am, David H. Cook [EMAIL PROTECTED]
wrote:

 Been playing with both a VerticalPanel and a FLowPanel, but
 I can't find a way to constrain a FlowPanel to just one entry per
 line.

 I've got a bunch (about 25) of anchor-elements (a tags).
 When I add then to a VerticalPanel, I achieve the one item
 per line, but there is way TOO MUCH wasted white-space,
 with the default cell-size and borders, etc.

 When I add each anchor to a FlowPanel, it solves the
 white-space issue, but then I get multiple anchors per line,
 all flowed together (which is no doubt why they call it that.)

 So, has anyone come upon a UI-object/technique to
 get achieve what I want?

 (Conceptually, a table of one column, with all the cellpadding
 and bordersizing set to minimal values sounds right, but without
 a code sample, that seems time-consuming to achieve.)

 Ideas?

 TIA...
 Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: anchors with javascript: (tutorial or sample code?)

2008-12-05 Thread David H. Cook

Shawn -

Thanks for the excellent explanation!

After a few tries at coding it using some JSNI, I decided it felt too
ugly.
And, sure enough, after some more experimentation, I arrived at
a working ClickListener for an anchor that did NOT need any JSNI
at all.

Happiness is a first-time deployment of the GWT flavor containing most
of the functionality of the original maps/javascript based app.

Cheers...

Dave

On Dec 4, 2:19 am, Shawn Pearce [EMAIL PROTECTED] wrote:
 On Wed, Dec 3, 2008 at 18:08, David H. Cook [EMAIL PROTECTED]wrote:



  I'm coding my first GWT app, and trying to get my head around
  creating an anchor that calls native javascript.  It now occurs to me
  that even tho the goal is to write in java, there will still be some
  things that can only be done cleanly by utilizing some native
  javascript.  (Agreed?)

 For native JavaScript invocations, try to use Java method declarations, but
 mark the method as native and use GWT's JSNI feature to inline the
 JavaScript code.  It makes it far easier to pass values into JavaScript from
 Java, and to return values from JavaScript back into Java.  If you need to
 hold onto a plain JavaScript object or function, use the JavaScriptObject
 type in Java.  There's plenty more details in the GWT docs under JavaScript
 Integration or some such section.

 Given that, can someone point me to some sample GWT code

  using such anchors?

 If you really really want to use a javascript: sort of URL, I think you can
 use an Anchor widget:

   add(new Anchor(click here, false, javascript:mycode();));

 This generates the same as:

   a href=javascript:mycode();click here/a

 Another option is to use an Anchor with a ClickListener and JSNI:

   Anchor a = new Anchor(click here, false);
   a.addClickListener(new ClickListener() {
     public void onClick(Widget w) {
         callMyCode();
     }
   });
   add(a);

   private static native void callMyCode()/*-{ mycode(); }-*/;

  And, can someone explain when to use

  the anchor constructor with the 2nd boolean arg 'asHTML' set
  true and when to set it false?

 Marking it true (asHTML) means the text passed is set as the innerHTML,
 rather than as the innerText of the anchor element.  E.g.:

   add(new Anchor(blinkclick here, false, javascript:mycode();));

 yields:

   a href=javascript:mycode();lt;blinkgt;click here/a

 but this produces the dreaded blink the entire page effect:

   add(new Anchor(blinkclick here, true, javascript:mycode();));

 yields:

   a href=javascript:mycode();blinkclick here/a

 asHTML = true is generally a bad idea, unless you know exactly where that
 input came from.  It can be useful if your code is producing the HTML, or
 you read it from a known resource, but generally I have found you want
 asHTML = false because you want to avoid HTML injection attacks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Style issues with VerticalPanel vs FlowPanel

2008-12-05 Thread David H. Cook

Been playing with both a VerticalPanel and a FLowPanel, but
I can't find a way to constrain a FlowPanel to just one entry per
line.

I've got a bunch (about 25) of anchor-elements (a tags).
When I add then to a VerticalPanel, I achieve the one item
per line, but there is way TOO MUCH wasted white-space,
with the default cell-size and borders, etc.

When I add each anchor to a FlowPanel, it solves the
white-space issue, but then I get multiple anchors per line,
all flowed together (which is no doubt why they call it that.)

So, has anyone come upon a UI-object/technique to
get achieve what I want?

(Conceptually, a table of one column, with all the cellpadding
and bordersizing set to minimal values sounds right, but without
a code sample, that seems time-consuming to achieve.)

Ideas?

TIA...
Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Style issues with VerticalPanel vs FlowPanel

2008-12-05 Thread David H. Cook

After more doc reading, it now seems that the right approach is
to use a VerticalPanel (i.e. so that ONE item per line is achieved),
but then to alter the panel's border-width and cell-height.

But, NOW what I can't quite understand, is how to code the
'setCellHeight'
method.  (What widget do they want for first arg?)  If they
just had a code-sample in their foolish doc for this method, I'd
be home free.  Anyone got a code snippet for this?

TIA...
Dave



On Dec 6, 1:01 am, David H. Cook [EMAIL PROTECTED]
wrote:
 Been playing with both a VerticalPanel and a FLowPanel, but
 I can't find a way to constrain a FlowPanel to just one entry per
 line.

 I've got a bunch (about 25) of anchor-elements (a tags).
 When I add then to a VerticalPanel, I achieve the one item
 per line, but there is way TOO MUCH wasted white-space,
 with the default cell-size and borders, etc.

 When I add each anchor to a FlowPanel, it solves the
 white-space issue, but then I get multiple anchors per line,
 all flowed together (which is no doubt why they call it that.)

 So, has anyone come upon a UI-object/technique to
 get achieve what I want?

 (Conceptually, a table of one column, with all the cellpadding
 and bordersizing set to minimal values sounds right, but without
 a code sample, that seems time-consuming to achieve.)

 Ideas?

 TIA...
 Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---



anchors with javascript: (tutorial or sample code?)

2008-12-03 Thread David H. Cook

I'm coding my first GWT app, and trying to get my head around
creating an anchor that calls native javascript.  It now occurs to me
that even tho the goal is to write in java, there will still be some
things that can only be done cleanly by utilizing some native
javascript.  (Agreed?)

Given that, can someone point me to some sample GWT code
using such anchors?  And, can someone explain when to use
the anchor constructor with the 2nd boolean arg 'asHTML' set
true and when to set it false?

TIA...

Dave

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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
-~--~~~~--~~--~--~---