flextable show / hide column

2010-12-07 Thread David Cox
Its a bit silly, but there is no (or i couldnt find at least) a 1
liner for show/hide columns in flextables

there is this:
 myflextable.getRowFormatter().setVisible(arg0, arg1);
but there is not this:
myflextable.getColumnFormatter().setVisible(arg0, arg1);

DUH?!?! what were you thinking?

anyway, for super lazy people, here is a quick work-around:
setColumnVisible(myflextable, column, true);

private void setColumnVisible(FlexTable table, int Col, boolean b) {
for(int i=0; i table.getRowCount(); i++) {
table.getCellFormatter().setVisible(i, Col, b);
}
}

of course, you could type is as a 1 liner in your code, but i use it a
lot, hence the need for a function.

/David

-- 
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-tool...@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: Saving data on the server

2010-12-07 Thread David Cox
Thanks mate!

Some good info there.

For now, im going to stick with the serialize to file, just because
I'm a long way from actually doing something practical with the data,
and because i can quickly see what changes I have made.
The good thing about RPC implementation is I can just swap out the
method for something substantial later on.
I guess that was the intention at least.

/David

On 14 Nov, 00:30, Brett Thomas brettptho...@gmail.com wrote:
 The get and set functions are called getters and setters - they are part of
 the javabean specification:http://en.wikipedia.org/wiki/JavaBean

 I'm guessing the XML library you are using requires java objects to be
 defined as javabeans. I've seen a couple other libraries that do that too -
 not sure why they work that way.

 For the bigger picture, that all depends on your server setup. If you're
 just experimenting, I'd suggest using GWT with Google App Engine, and
 storing data via hibernate. Google has a good tutorial for using GWT with
 app engine/hibernate. I think a database is almost alwasy easier than
 serializing objects to a file.

 To your point about changing your data model: I've found that app engine is
 really bad for this. There isn't (I don't think) a simple way to delete all
 objects of this class out of the box. When I was just experimenting with
 app engine, I found it easier to just create new class definitions than
 modify existing classes.

 Good luck learning GWT!
 Brett







 On Sat, Nov 13, 2010 at 2:38 PM, David Cox cox.spir...@gmail.com wrote:
  So, i managed to solve my own problem again, but I'm no 100% on how i
  did it.

  What i did was remove all my functions in the class and then re-added
  them with the create getter and setter for private String

  Then i made sure that the variable was set using the actual setter
  function. ie: this.setTitle(Title).
  I also had other function in the class.
  Like myfucntion(String title, int counter) or something like that.
  Origionaly i have stuff like
  this.Title = title.

  I had to change these to this.setTitle(title). Even though all the
  setTitle function does exaclty: this.title = title.
  For some reason this fixes it.

  as far as i can tell, the rules for successful xml serialisation as as
  such:
  1. The each variable you want serialised must have a set command
  called that has the same name with a set prefix
  2. this function must be called at least once or that particular
  variable will not be searilised (once it is called though, you can
  then go back to using direct methods like this.Title = title. )
  3. each variable MUST also have a public function wiht the same name
  and a get prefix.

  It took me ages to work this out, and i would love it if someone out
  there could explain why.
  My only guess is that it does have 1 convenient feature, and that is,
  you can actually use this to determine which variables will be seen in
  the resulting serialised XML, but you can still work happily with all
  the other variables in an object (like counters and states) and not
  have them appear in the output.

  Nice one. Just wish i found a tutuorial out there that explained this
  to me from the start.

  Am still interested to hear what others do.

  /David

  --
  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-tool...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2Bunsubs 
  cr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-tool...@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: Saving data on the server

2010-11-13 Thread David Cox
So, i managed to solve my own problem again, but I'm no 100% on how i
did it.

What i did was remove all my functions in the class and then re-added
them with the create getter and setter for private String

Then i made sure that the variable was set using the actual setter
function. ie: this.setTitle(Title).
I also had other function in the class.
Like myfucntion(String title, int counter) or something like that.
Origionaly i have stuff like
this.Title = title.

I had to change these to this.setTitle(title). Even though all the
setTitle function does exaclty: this.title = title.
For some reason this fixes it.

as far as i can tell, the rules for successful xml serialisation as as
such:
1. The each variable you want serialised must have a set command
called that has the same name with a set prefix
2. this function must be called at least once or that particular
variable will not be searilised (once it is called though, you can
then go back to using direct methods like this.Title = title. )
3. each variable MUST also have a public function wiht the same name
and a get prefix.

It took me ages to work this out, and i would love it if someone out
there could explain why.
My only guess is that it does have 1 convenient feature, and that is,
you can actually use this to determine which variables will be seen in
the resulting serialised XML, but you can still work happily with all
the other variables in an object (like counters and states) and not
have them appear in the output.

Nice one. Just wish i found a tutuorial out there that explained this
to me from the start.

Am still interested to hear what others do.

/David

-- 
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-tool...@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.



Saving data on the server

2010-11-12 Thread David Cox
Hi, I'm kinda new to GWT.

Anyway, I managed to perform an RPC call to the server for an array of
objects, each. The object class (with a few strings and a few ints) is
defined on the client side, but the server seems happy to reference to
it.

But now i want to have the server write (and later read) the data to
file.
I have been experimenting with Serialising Java Objects as XML from
the server side. However the server seems to only write each object in
the array, but not the data that is actually IN the object (ie: added
by the user)

?xml version=1.0 encoding=UTF-8?
java version=1.6.0_18 class=java.beans.XMLDecoder
 array class=com.mysite.client.myObject length=3
  void index=0
   object class=com.mysite.client.myObject/
  /void
  void index=1
   object class=com.mysite.client.myObject/
  /void
  void index=2
   object class=com.mysite.client.myObject/
  /void
 /array
/java

Even when I just reference one object: like myObject test = new
myObject(abc, 100, 10, blahblah); the xml output is just the class
definition.

I have looked at many example online and they say that i should see
the data in the object as well.
Perhaps because the class is client side and special in a gwt sort
of way, this is not possible?
Probably I am doing something silly.

Probably, even, gwt has better and more standardised ways saving and
retrieving data on the server side. What simple methods do others do?
I really like the sound of using serialisable xml because it seems to
mean that I don't have to update the save/load routine when I update
and develop the class. But maybe its better to just put it all in a
DB.

/David.

-- 
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-tool...@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.



Images in buttons

2010-11-03 Thread David Cox
Hi everyone

I thought I would pick up gwt and play around with trying to make some
pretty standard stuff. But, I have been bashing my head on this one
for a bit.

I have a horizontal layout with [button - image - button] and have
managed to make the buttons cycle through a number of images.
Now I want to pretty up the buttons by making them into images of
arrows. This is fine using code like:

private PushButton LeftButton = new PushButton(new Image(images/gui/
left.png));
or
LeftButton.setStyleName(mainleftbutton); and then doing it in CSS.

However, my arrow pictures are huge and (while i could make many
copies with photoshop) what I would really like to do is be able to
code it so that the button (and image) is scaled to a specific width.
ie: like 100px high.

I guess the end goal here, would eventually have the buttons floating
over the image, but i suppose that is a long way off for me.

Any suggestions?
David

-- 
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-tool...@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: Images in buttons

2010-11-03 Thread David Cox
Thanks pete!

Your solution is great and simple, and i worked that out too, but I
havn't tested if you can still size the image after it has been
attached to the button. Would be very interesting to try that some
time.
Also, it didn't work for me when i tried to declare all the widgets in
the entry point part of the class.
Actually, i gave it a few hours and got exactly what i wanted.

What i did was solve the floating issue first, then the image size
issue fell in place pretty easily.
I wanted to have was buttons with semi-transparent images over the top
of another image.
Like a left arrow on the left and a right arrow on the right.
I found some tutorials on how to add CSS fixed headers and footers and
then applied the principals to left and right.

Then i noticed the z-index function, so i just did the same with an
image widget and just put it under the button.

The result is that its all done with CSS.

/* left and right button placement */
/* scaleing and floating */
.mainleftbutton, .mainrightbutton {
clear: both;
 position: relative;
 width: 3em;
 height: 3em;
 margin-top:240px;
}

/* left, right difference */
.mainleftbutton { margin-right: -3em; }
.mainrightbutton { margin-left: -3em; }

/* places button over the image */
img.mainrightbutton, img.mainleftbutton { z-index: 9; }
div.mainrightbutton, div.mainleftbutton { z-index: 10; }

Then you just add these styles to both the images and the buttons and
they pick up the width,heights and placements independantly!
  LeftButton.setStyleName(mainleftbutton);
  LeftArrow.setStyleName(mainleftbutton);
  RightArrow.setStyleName(mainrightbutton);
  RightButton.setStyleName(mainrightbutton);

Very happy.
Thanks for your advice about the loading times too, need to keep that
in mind.

/David

On Nov 3, 5:51 pm, pete superp...@geekcity.de wrote:
 As far as I remembered, I instinctively tried to resize the image that
 is assigned to the button and that worked...

 I.e. Image image = new Image(source);
 image.setWidth(100px);
 image.setHeight(50px);
 PushButton button = new PushButton(image);

 I think if your image is really huge and only used for the button, it
 is indeed smarter though, to make a smaller copy and resize that,
 since if you let the browser resize, it still needs to load the full
 image from the server (if I'm not mistaken...)

 I don't understand what exactly you mean by button floating over the
 image though, so I can't give you any tip about that...

 Greetz

 On Nov 2, 10:33 pm,DavidCoxcox.spir...@gmail.com wrote:

  Hi everyone

  I thought I would pick up gwt and play around with trying to make some
  pretty standard stuff. But, I have been bashing my head on this one
  for a bit.

  I have a horizontal layout with [button - image - button] and have
  managed to make the buttons cycle through a number of images.
  Now I want to pretty up the buttons by making them into images of
  arrows. This is fine using code like:

  private PushButton LeftButton = new PushButton(new Image(images/gui/
  left.png));
  or
  LeftButton.setStyleName(mainleftbutton); and then doing it in CSS.

  However, my arrow pictures are huge and (while i could make many
  copies with photoshop) what I would really like to do is be able to
  code it so that the button (and image) is scaled to a specific width.
  ie: like 100px high.

  I guess the end goal here, would eventually have the buttons floating
  over the image, but i suppose that is a long way off for me.

  Any suggestions?
 David

-- 
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-tool...@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.