You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Neil Clayton <ne...@cloudnine.net.nz> on 2003/07/21 23:47:04 UTC

[JELLY] - how to enable logging? (SWT specific)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, I'm experimenting with Jelly / SWT and JFace, with some success. That's a 
good thing :-0

However; I *think* Im having problems with a Jexl expression, except I'm not 
sure. That's a bad thing.   

I'm guessing that my expression is incorrect, and is not being evaluated (I 
can use a very simple version of this expression and it works, so I know that 
the execution of my script is proceeding to that point at least).

The script is as follows (this sits inside a window tag):

		<fillLayout type="vertical"/>
		<sashForm type="horizontal" var="sash">
	
			<label text="This would be a tree" parent="${sash}"/>
			<scrolledComposite var="scrolled" parent="${sash}" type="V_SCROLL, BORDER"  
background="132,251,232">
			 	<fillLayout/>
			 	<composite var="grid">
				 	<fillLayout/>
			 		<label text="yay" background="12,12,12"/>
			 	</composite>
		 		<onEvent type="Resize" var="resizeEvent">
		 			${ grid.computeSize(scrolled.getBounds().width, 
org.eclipse.swt.SWT.DEFAULT) }
		 		</onEvent>
		 		${grid.setSize(10, 10) }
			</scrolledComposite>

The idea is that when the scrolled-composite is resized, the grid is resized 
to fit inside (well, height can vary, width will always be fixed to the width 
of the parent).... except nothing happens.

If I change the <onEvent> content to be ${grid.setSize(100,100)} it is shown 
larger than the default of 10,10...  so I know the event handler is being 
called.

Weird thing is, if I put an invalid expression in there, Jelly doesn't fail 
with any exception - is this normal behavior?  Also, is there a way to enable 
more logging (I get *none*), so that I can see what's going on in more 
detail?

Lastly, I have a default log4j.properties in the root of the cp, with

log4j.logger.org.apache.commons.jelly.tags.swt=DEBUG
log4j.logger.org.apache.commons=DEBUG

but this appears to have no effect - e.g: I dont see the text "Running 
script!", mentioned below in main(). Perhaps log4j is not being used or 
initialized? 

I am starting the script using:

	public static void main(String[] args) {
		log.debug("Running script!");

		JellyContext context = new JellyContext();
		XMLOutput output;
		try {
			output = XMLOutput.createXMLOutput(System.out);
		} catch (UnsupportedEncodingException e) {
			throw new RuntimeException("died creating output", e);
		}
		
		
		try {
			context.runScript("src/JFaceThumbnailer.jelly", output);
			output.flush();
		} catch (Throwable e) {
			e.printStackTrace();
		}
	}

Neil


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/HF9aLXcfQF3yrNoRAqQMAJ4+c2SBsFNoY2mFsUzSgLOryXkKHACgwb8H
uqPuR/7LOqIaYt5cDh2RTN8=
=E5GU
-----END PGP SIGNATURE-----