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
-- -- -- -- -- -- -- -- -- -- -- -- -- --
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{ firstName: "Prénom",
lastName: "Nom",
street: "Adresse",
city: "Ville",
state: "Ãtat",
postalCode: "Code postal",
country: "Pays"
}