Two UI questions: expanding multiline TextField, and Table row tooltip

Here are two short questions I could not find answers using the book, the demos and the javadoc:

  1. I have added a TextField into a VerticalLayout and I would like it to be multiline and use as much vertical space as possible for its contents area. Is it possible? Unfortunately I can’t use TextField.setRows() since I do not want to constraint that. Is there a workaround?

  2. I would like to add a popup tooltip to each row of a Table. Is it possible in any way? It would be just great since Vaadin provides nice rich-text tooltips.

Thanks,
Cyril

Hi,

  1. See
    this ticket
    .

  2. You can’t add tooltips to the items, but you could add eg. a question mark icon (in an Embedded) for each row that you can put the tooltip in.

Thanks a lot for answering so rapidly.

  1. I tried that out. However, it’s not clear to me which vaadin version the ticket’s solution targets, and which vaadin version this
    online javadoc
    is about…
    I’ve switched from “6.1.5” to “6.2.0.pre1” in my pom.xml, and it looks like I have the fixed vaadin code now, but I still get a non-vertically-expanding textarea with the following snippet:

    // vLayout is a VerticalLayout that occupies all screen height.
    TextField textField = new TextField();
    textField.setColumns(0);
    textField.setRows(1); // same problem with 2
    textField.setSizeFull();
    vLayout.addComponent(textField);
    vLayout.setExpandRatio(textField, 1.0f);

Did I miss something? I really can’t afford waiting for vaadin 7 to have an expanding textarea :cold:

EDIT: worse: now even when I setRows(15), my textarea is 2 rows high !!

  1. That’s a neat idea! Done and working.

I’m guessing that the vLayout is not actually filling the vertical space - you need to set it 100% high. Here’s a trivial demonstration:

public void init() {
	setMainWindow(new Window("Testcase Application"));

	// Make sure that the window content is 100% high, so that the text
	// field is able to fill the window
	((VerticalLayout) getMainWindow().getContent()).setSizeFull();

	TextField tf = new TextField();
	tf.setRows(1);
	tf.setSizeFull();
	getMainWindow().addComponent(tf);
}

If you comment out line 6 the TF will not fill the window, because the layout’s height is undefined.

Hi!

Just call setSizeFull() for you textfield and you ought to get what you want. Of course there needs to be some room for textfield. Debug consoles (add ?debug to location) analyze layouts function will help you if this is the problem.

Like this:



        Window mainWindow = new Window("Biiig textfield");
        setMainWindow(mainWindow);
        mainWindow.getContent().setSizeFull();
        TextField tf = new TextField();
        tf.setSizeFull();
        mainWindow.addComponent(tf);


cheers,
matti

Ouh, you where there first Henkka. Shouldn’t open all messages of past two weeks on tabs…

You were (both) right :slight_smile:
I usually setSizeFull() every component but this time I just let one slip away!
Thanks for your time, help is really appreciated!