You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Philippe Lhoste <Ph...@GMX.net> on 2011/02/12 18:51:31 UTC
Re: Pivot, Scala, Gradle, Life, the Universe and Everything
On 28/01/2011 14:05, Greg Brown wrote:
>> Not sure how to do that with pure BXML files.
>
> You can't do it purely with BXML, but since you are using Scala, you
> must be writing classes anyways. Take a look at the Hello World
> tutorial for an example of implementing the Application interface.
Even with Scala, when we have a pure BXML, we want to be able to run it
directly, as we do in Java.
I think I made a mistake, taking the path a bit too high in the bin
folder, or something.
The Gradle task is:
task runB(type: JavaExec) {
description = 'To run the BXML scripts. Pass the name as
-Psample=text/text_inputs'
main = 'org.apache.pivot.wtk.ScriptApplication'
classpath = sourceSets.main.runtimeClasspath
args "--src=/${basePath}/${sampleName}.bxml"
}
and now it works well, both with pure BXML and those using some Java
(now Scala) classes.
>>> Could be a JVM issue. Might also be related to the use of a
>>> volatile image for buffering. Try setting
>>> -Dorg.apache.pivot.wtk.disablevolatilebuffer=false when you start
>>> your app.
>>
>> I wasn't clear, I think: the issues I saw was on the online demos,
>> the applets. And yes, it might be related to the version of Java I
>> use.
>
> No, you were clear - I just didn't think it through. Are you using a
> Dell by any chance? I think that some of the other users who have
> reported this issue were using Dell hardware.
Indeed a Dell computer at work (an old one) and a modern HP at home,
both with ATI cards (not the best ones...).
Making (slow) progress on converting tutorials. Of course, I skip the
pure BXML ones, as there is nothing to convert.
Just did the Localization one, I made a fr version while I was at it.
(Attached, feel free to use it.)
I have fun converting Java loops to Scala comprehensions, like
for (int i = 0; i < fonts.length; i++) {
if (fonts[i].canDisplayUpTo(sampleResource) == -1) {
theme.setFont(fonts[i].deriveFont(Font.PLAIN, 12));
break;
}
}
becoming
fonts find (_.canDisplayUpTo(sampleResource) == -1) foreach {
f => theme.setFont(f.deriveFont(Font.PLAIN, 12))
}
I had to ask help on the scala-user list for this one, as Scala doesn't
have break built in.
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --