ITMill 5.0.0 beta and CustomLayout problems

For some reason, I cannot get it working, probably I’ve missed something, but can’t figure out what exactly…

The layout is:


<table border="1" width="100%" height="100%">
  <tr height="10%">
    <td width="10%"></td>
    <td width="80%" align="justify" valign="middle"><div location="progressIndicator" width="100%"></div></td>
    <td width="10%"></td>
  </tr>
</table>

Im trying to show a progress window with a progress indicator. So, here is window initialization code:


Window w = new Window("Progress...");
CustomLayout layout = new CustomLayout ( "ProgressWindowLayout");
w.setLayout(layout);
ProgressIndicator pi = new ProgressIndicator();
layout.addComponent ( pi, "progressIndicator");
w.setWidth(300);
w.setHeight(150);

And finally Im showing this window from main app’s window:


getApplication().getMainWindow().addWindow(w);

I do see new window correctly, moreover, I do see my custom layout
template there (thanks to border=“1” in a table definition), but there are no progress indicator there at all. %|

Thanks in advance,
Dmitri

By a quick glance, I did not see any problems in your code. IMO is should work this way.

So this is probably a bug. As it might be browser specific, which browser are you using?

Im using Safari 3.0.4 (523.12) on Mac OS X 10.4.11 PPC, however, the same result is with Firefox 2.0.0.11 on the same Mac.

Hi… Tried this out with the following test program:


package com.itmill.test;

import com.itmill.toolkit.Application;
import com.itmill.toolkit.ui.CustomLayout;
import com.itmill.toolkit.ui.ProgressIndicator;
import com.itmill.toolkit.ui.Window;

public class T1 extends Application {

	public void init() {
		 Window w = new Window("Progress...");
		CustomLayout layout = new CustomLayout ( "ProgressWindowLayout");
		 w.setLayout(layout);
		 ProgressIndicator pi = new ProgressIndicator();
		 layout.addComponent ( pi, "progressIndicator");
		 w.setWidth(300);
		 w.setHeight(150);
			setTheme("example");
			setMainWindow(w);
	}
}

And the result looks this (Safari 3, MacBook Pro):

Oh… I see the problem. There seems to be a bug in processing CustomLayouts in subwindows.


package com.itmill.test;

import com.itmill.toolkit.Application;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.CustomLayout;
import com.itmill.toolkit.ui.ProgressIndicator;
import com.itmill.toolkit.ui.Window;

public class T1 extends Application {

	public void init() {
		setTheme("example");

		Window main = new Window("Test");
		setMainWindow(main);
		
		 Window w = new Window("Progress...");
		CustomLayout layout = new CustomLayout ( "ProgressWindowLayout");
		 w.setLayout(layout);
		 ProgressIndicator pi = new ProgressIndicator();
		 layout.addComponent ( pi, "progressIndicator");
		 w.setWidth(300);
		 w.setHeight(150);
		 main.addWindow(w);
		 
		 main.addComponent(new Button("restart",this,"close"));
	}
}

Shows as

I’ll forward this to dev-team…

BTW: As a debugging tip, you can add &debug=1 to your application url and a debug window appears and shows changes server actually sends to client. In this case you can see that the progress indicator is properly sent to client and thus the bug is in ICustomLayout widget.

Anyways, Matti promised to resolve this asap.

Ah, so that’s fine, minus another issue for release :slight_smile:
Thanks !

Hi!

Issue is resolved in our SVN repository. I hope we can release a next version soon.

cheers,
matti

I hope that we’ll have nightly builds available in the future to make propagation of this kind of fixes faster.

Good idea, I’ll ask Marko to set this up. We already have internal setup for this.

Here it goes…
http://forum.itmill.com/posts/list/351.page

Thanks guys, for your responses and for debug option, it’s useful one even for itmill-built applications as well.

Regards,
Dmitri

It should be possible to do the proper layout with layout components too, such as ExpandLayout, and probably easier than with CustomLayout, but the layout alignments do not work very well yet.

Looks like there’s also a problem that the ProgressIndicator can become zero width inside some layouts.

yep, I just wanted to try custom layout and as well to solve such problem that I was unable to place progress indicator and button in the center of the window, regardless of it’s size with standard layout managers. Eg I was able to center progress and button horizontally, but was not able to center vertically.

Just downloaded the first nightly build :wink:

And just a question - I noticed, there are no more setSizeFull mehtod in layouts as well as Sizeable interface is deprecated. Any new methodology is planned for controlling component sizes ?

Regards,
Dmitri

Yes. To make it easier for component developers to implement size for their components the Sizable interface is to be removed. Components that has a controllable size will implement HasSize interface and use Size object to store very general size information. Previously all Sizeable components had similar logic in them. Usage example of new component resizing below.



component.getSize().setHeight(height, unit)

Hm, now (with nightly build and corrected setWidth/height usages) it falls with NullPointerException on this line:

splitter.getSize().setSizeFull ();

, where splitter is a SplitPanel, looks like getSize() in SPlitPanel component returns null or not yet implemented

Oops :oops:

Yep, that method (getSize() in SplitPanel) was unintentianally left undone (always returns null), but it’s fixed now. The next nightly should have it fixed.

I guess this is the drawback of using IDE’s like Eclipse, which do most of the coding for you. Or maybe I should check my TODO list more often :slight_smile:

[quote]
Oops :oops:
[/quote]And of course the forum crashed while I was typing the message, and my login information disappeared :slight_smile:

:slight_smile:

Regarding IDEs- yes, that’s now almost terrible for me, when I sit to vi for quick fixes and begin expecting from it all those IDE featues like completion, suggestion, autoimorts, etc etc etc :slight_smile: :slight_smile: