Re: Event Filtering

2015-02-06 Thread Scott Palmer

> On Feb 6, 2015, at 8:21 PM, Tomas Mikula  wrote:
> 
>> On Fri, Feb 6, 2015 at 7:33 PM, Scott Palmer  wrote:
>> Is it possible to modify the event in an event filter or otherwise tweak
>> the event that is ultimately received by the target?
>> 
>> 

>>  
>> There are no public constructors for KeyEvents,
> 
> Are we looking at the same Javadoc?
> http://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/KeyEvent.html#KeyEvent-javafx.event.EventType-java.lang.String-java.lang.String-javafx.scene.input.KeyCode-boolean-boolean-boolean-boolean-
> 

No. :-)
I wanted to do this originally with Java 7
The JavaFX 2.2 docs do not list any constructors.

>> 
>> I suppose the 8u40 support for formatted fields is what should be used for
>> my example, but the idea of tweaking the events before they are delivered
>> to an event handler, or synthesizing a new event is more general.  Is it
>> possible?
>> 
>> Scott
> 
> 1. So I think that you can proceed with what you have in mind: consume
> an event and create and fire a new one (with Event.fireEvent(target,
> event)), but I am afraid that is going to mess the order of events.
> Suppose you type JavaFX *really* quickly (or when the UI thread is
> busy with something else). IMO you end up with is JFXAVA instead of
> JAVAFX.

Yeah that would be a problem. I suppose I could be extra clever and remember 
and consume the 'F' and 'X' events in my filter and then fire new ones after I 
see my synthesized event come through.
This is starting to smell though.

> 
> 2. You could instead consume the event in the event filter and handle
> it properly yourself, i.e. call textField.replaceSelection() and such.
> (Not very nice, I know, I would not like reproducing TextField's
> behavior.)

Agreed.

> 
> 3. I understand that you don't want some property to ever hold an
> invalid value, but does it have to be the textProperty of the
> textfield?

It just makes things easier to use without the intermediate property and 
temporary lowercase state on the textProperty, but yes that is one workaround.

> If you set up your data flow like this:
> 
> ObservableValue upper = EasyBind.map(textField.textProperty(),
> String::toUpperCase)
> upper.addListener((obs, oldVal, newVal) -> textField.setText(newVal));
> 
> And then use `upper` wherever you used textField.textProperty()
> before, the rest of your code will never observe any lowercase
> characters.
> 
> 4. Your idea of tweaking an event on its route is interesting, though.
> Let's see if other people have some opinion about that.

Perhaps a new kind of filter could simply return an event if it is meant to be 
passed on, or return null to prevent it from going any further. Then I would 
just return a different event than the one that was passed in if I needed to 
tweak it.
Perhaps returning an array of events would be more appropriate, then one event 
could cause many downstream events.


Scott

Re: Event Filtering

2015-02-06 Thread Tomas Mikula
On Fri, Feb 6, 2015 at 7:33 PM, Scott Palmer  wrote:
> Is it possible to modify the event in an event filter or otherwise tweak
> the event that is ultimately received by the target?
>
> Let's say I have a TextField and I only want to allow typing of capital
> letters.  That is easy enough to enforce with an event filter.. if the
> KeyTyped event doesn't represent a capital letter I can consume it in an
> event filter and it won't get to the control.
>
> But let's say that I want to allow the user to type lowercase letters and
> have them appear in uppercase.  I don't ever want the text property of the
> TextField to hold a lowercase character.  Can that be done?
>
> There are no public constructors for KeyEvents,

Are we looking at the same Javadoc?
http://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/KeyEvent.html#KeyEvent-javafx.event.EventType-java.lang.String-java.lang.String-javafx.scene.input.KeyCode-boolean-boolean-boolean-boolean-

> and the fields are
> immutable.  So it doesn't seem like I can change the event that is
> delivered to the target.  (What are the copyFor(...) methods on Event used
> for?)

You don't need to worry about the copyFor methods, AFAIK they are used
only by the event dispatching mechanism. I think you need to implement
them if you define your own event type.

>
> I suppose the 8u40 support for formatted fields is what should be used for
> my example, but the idea of tweaking the events before they are delivered
> to an event handler, or synthesizing a new event is more general.  Is it
> possible?
>
>  Scott

1. So I think that you can proceed with what you have in mind: consume
an event and create and fire a new one (with Event.fireEvent(target,
event)), but I am afraid that is going to mess the order of events.
Suppose you type JavaFX *really* quickly (or when the UI thread is
busy with something else). IMO you end up with is JFXAVA instead of
JAVAFX.

2. You could instead consume the event in the event filter and handle
it properly yourself, i.e. call textField.replaceSelection() and such.
(Not very nice, I know, I would not like reproducing TextField's
behavior.)

3. I understand that you don't want some property to ever hold an
invalid value, but does it have to be the textProperty of the
textfield? If you set up your data flow like this:

ObservableValue upper = EasyBind.map(textField.textProperty(),
String::toUpperCase)
upper.addListener((obs, oldVal, newVal) -> textField.setText(newVal));

And then use `upper` wherever you used textField.textProperty()
before, the rest of your code will never observe any lowercase
characters.

4. Your idea of tweaking an event on its route is interesting, though.
Let's see if other people have some opinion about that.

Regards,
Tomas


Re: Build farm for OpenJFX (on ARM)

2015-02-06 Thread Mani Sarkar
Hi all,

We are still working on the ARM build of OpenJFX, whilst building it on a
Fedora virtual machine, we got the following errors:

>
> *Successfully started process 'command
> '/scratch/jenkins/workspace/crosslibs/gcc-linaro-arm-linux-gnueabihf-raspb
> ian-2012.09-20120921_linux/bin/arm-linux-gnueabihf-g++''*
> /scratch/jenkins/workspace/crosslibs/gcc-linaro-arm-linux-gnueabihf-raspb
> ian-2012.09-20120921_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../..
> /../../arm-linux-gnueabihf/bin/ld:
> cannot find -lgtk-x11-2.0
> /scratch/jenkins/workspace/crosslibs/gcc-linaro-arm-linux-gnueabihf-raspb
> ian-2012.09-20120921_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../..
> /../../arm-linux-gnueabihf/bin/ld:
> cannot find -lgdk-x11-2.0
> /scratch/jenkins/workspace/crosslibs/gcc-linaro-arm-linux-gnueabihf-raspb
> ian-2012.09-20120921_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../..
> /../../arm-linux-gnueabihf/bin/ld:
> cannot find -lgio-2.0
> /scratch/jenkins/workspace/crosslibs/gcc-linaro-arm-linux-gnueabihf-raspb
> ian-2012.09-20120921_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../..
> /../../arm-linux-gnueabihf/bin/ld:
> cannot find -lgobject-2.0
> /scratch/jenkins/workspace/crosslibs/gcc-linaro-arm-linux-gnueabihf-raspb
> ian-2012.09-20120921_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../..
> /../../arm-linux-gnueabihf/bin/ld:
> cannot find -lgthread-2.0
> /scratch/jenkins/workspace/crosslibs/gcc-linaro-arm-linux-gnueabihf-raspb
> ian-2012.09-20120921_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../..
> /../../arm-linux-gnueabihf/bin/ld:
> cannot find -lglib-2.0 collect2: error: ld returned 1 exit status
> Process 'command
> '/scratch/jenkins/workspace/crosslibs/gcc-linaro-arm-linux-gnueabihf-raspb
> ian-2012.09-20120921_linux/bin/arm-linux-gnueabihf-g++'' finished with
> exit value 1 (state: FAILED) :graphics:linkArmv6hfFontFreetype FAILED
> :graphics:linkArmv6hfFontFreetype (Thread[main,5,main]) completed.
> Took 0.057 secs.
>

The above errors are a result of this command:
/scratch/jenkins/workspace/crosslibs/gcc-linaro-arm-linux-gnueabihf-raspb
ian-2012.09-20120921_linux/bin/arm-linux-gnueabihf-g++

Its one of the lines in buildSrc/crosslibs/crosslibs-armv6hf.sh

Has anyone come across this issues? Also solutions like these won't work:

sudo apt-get install

or

yum install...

I would like to get access to tars or zips that I can explode into a folder
and serve it to the build script.

Any help will be highly appreciated.

Cheers,
Mani

On Thu, Feb 5, 2015 at 10:26 PM, Richard Bair 
wrote:

> Cool!
>
> > On Feb 5, 2015, at 2:19 PM, Mani Sarkar  wrote:
> >
> > Hi All,
> >
> > As per Chris's message and the tweet I got last night / this morning I'm
> > updating you (which I was intending to do when the time was right), that
> we
> > now have a successful OpenJFX build on Cloudbees, see
> > https://adopt-openjdk.ci.cloudbees.com/view/OpenJDK/job/OpenJFX/.
> >
> > Our build farm is able to build an updated artefact each day. Currently
> its
> > a Linux build, the ARM build is on its way, an issue with a dependency
> has
> > hindered us, but once that is also successful you will be able to
> download
> > both these binaries from the above Cloudbees location.
> >
> > I'll add to what Chris has mentioned, I was not aware of another
> initiative
> > to build OpenJFX binaries and ours is to not duplicate the effort but
> make
> > such opensource binaries related to OpenJDK available to everyone in the
> > community.
> >
> > We need all the help you can give us. As you can see from the list on the
> > cloud farm, something or the other always needs to be attended to.
> >
> > Thanks.
> >
> > Cheers,
> > Mani
> >
> > On Thu, Feb 5, 2015 at 8:35 AM, Chris Newland  >
> > wrote:
> >
> >> Hi Johan, all,
> >>
> >> Following the announcement that JDK builds for ARM will no longer
> include
> >> JavaFX I started talking with the OpenJDK Adoption group
> >> (https://wiki.openjdk.java.net/display/Adoption/Main) about the
> >> possibility of using their CloudBees CI system to produce OpenJFX
> binaries
> >> (for all operating systems including ARM) as a way to help keep JavaFX
> >> alive on IoT devices.
> >>
> >> For those who don't know the Adoption group, its mission is to help
> >> developers get started with building OpenJDK, testing new features,
> >> submitting bug reports, and cleaning up code.
> >>
> >> Adoption has a CloudBees CI set up and I've been talking with Mani
> Sarkar
> >> (@theneomatrix369) about setting up an OpenJFX CI project with
> >> cross-compile support that builds OpenJFX for all archs.
> >>
> >> The cross-compile instructions here
> >>
> >>
> https://wiki.openjdk.java.net/display/OpenJFX/Cross+Building+for+ARM+Hard+Float
> >> are working great for me locally so now we're trying to work out how to
> >> move that to the cloud.
> >>
> >> I don't want to tread on anyone's toes here and we're not trying to
> become
> >> any kind of official source for JavaFX, just trying to mak

Event Filtering

2015-02-06 Thread Scott Palmer
Is it possible to modify the event in an event filter or otherwise tweak
the event that is ultimately received by the target?

Let's say I have a TextField and I only want to allow typing of capital
letters.  That is easy enough to enforce with an event filter.. if the
KeyTyped event doesn't represent a capital letter I can consume it in an
event filter and it won't get to the control.

But let's say that I want to allow the user to type lowercase letters and
have them appear in uppercase.  I don't ever want the text property of the
TextField to hold a lowercase character.  Can that be done?

There are no public constructors for KeyEvents, and the fields are
immutable.  So it doesn't seem like I can change the event that is
delivered to the target.  (What are the copyFor(...) methods on Event used
for?)

I suppose the 8u40 support for formatted fields is what should be used for
my example, but the idea of tweaking the events before they are delivered
to an event handler, or synthesizing a new event is more general.  Is it
possible?

 Scott


Re: Directional light in JavaFX 3D

2015-02-06 Thread Chien Yang

Sorry, I forgot to paste the JIRA link before hitting the send button.

https://javafx-jira.kenai.com/browse/RT-33899

- Chien

On 2/6/15 3:16 PM, Chien Yang wrote:

Hi Herve,

A JIRA for directional light has already been filed but there is no 
immediate plan to add this feature at the moment. Currently JavaFX 3D 
only supports point light and ambient light.


- Chien

On 2/6/15 3:10 PM, Herve Girod wrote:

Hello,

Are there plans to implement an API allowing directional lights ? it 
seems

that for now there exist only spot and ambiant light in JavaFX 3D.

Hervé






Re: Directional light in JavaFX 3D

2015-02-06 Thread Chien Yang

Hi Herve,

A JIRA for directional light has already been filed but there is no 
immediate plan to add this feature at the moment. Currently JavaFX 3D 
only supports point light and ambient light.


- Chien

On 2/6/15 3:10 PM, Herve Girod wrote:

Hello,

Are there plans to implement an API allowing directional lights ? it seems
that for now there exist only spot and ambiant light in JavaFX 3D.

Hervé




Directional light in JavaFX 3D

2015-02-06 Thread Herve Girod
Hello,

Are there plans to implement an API allowing directional lights ? it seems
that for now there exist only spot and ambiant light in JavaFX 3D.

Hervé


[8u60] review request: RT-40000: Eliminate split packages across JavaFX modules

2015-02-06 Thread Kevin Rushforth

Chien,

Please review the following refactoring:

https://javafx-jira.kenai.com/browse/RT-4
http://cr.openjdk.java.net/~kcr/RT-4/webrev.00/

Thanks.

-- Kevin



[8u60] Review request for RT-39859: NSInternalInconsistencyException Crash

2015-02-06 Thread Morris Meyer

Kevin and Dave,

Please review this fix for RT-39859.  The fix was to check to make sure 
the submenu item is contained within the menu prior to trying to delete 
it from the menu.


Thanks!

--morris

WEBREV - http://cr.openjdk.java.net/~morris/RT-39859.01a/
JIRA - https://javafx-jira.kenai.com/browse/RT-39859



Re: new FormattedTextField

2015-02-06 Thread Kevin Rushforth

EA docs for 8u40 are not available, but you can look in the FX 9 docs here:

http://download.java.net/jdk9/jfxdocs/

Specifically:

http://download.java.net/jdk9/jfxdocs/javafx/scene/control/TextFormatter.html

-- Kevin


Pedro Duque Vieira wrote:

Hi,

Where can I find information or API specs about the new FormattedTextField
(or whatever is its name) introduced in 8u40?

Thanks, best regards

  


new FormattedTextField

2015-02-06 Thread Pedro Duque Vieira
Hi,

Where can I find information or API specs about the new FormattedTextField
(or whatever is its name) introduced in 8u40?

Thanks, best regards

-- 
Pedro Duque Vieira


Please review open bundling

2015-02-06 Thread David Hill


Jira: https://javafx-jira.kenai.com/browse/RT-39976
Webrev: http://cr.openjdk.java.net/~ddhill/RT-39976/

This change provides for building the build in an OpenJFX context.
Or ... if you want to try it in a close build:  gradle 
openZip[Mac|Win|Linux|Armv6hf]



--
David Hill
Java Embedded Development

"A man's feet should be planted in his country, but his eyes should survey the 
world."
-- George Santayana (1863 - 1952)



Re: Execution environment for javafx.scene.web

2015-02-06 Thread Kevin Rushforth
Additionally, if you aren't going to display the primary Stage in the 
Application start(Stage) method then I also recommend you call:


Platform.setImplicitExit(false);

in the start method, since you will need to control the life-cycle of 
the application yourself and call Platform.exit() to exit the FX runtime.


-- Kevin


Anton Tarasov wrote:

Hi Michael,

Yes, WebEngine can be used separately from WebView.

(See inline, please)

On 05/02/15 02:53, Michael Pozhidaev wrote:

Hello everybody,

I am working on the technology representing the information in form
which adjusted to the perception of blind people. It is just as
an addition to usual screen readers.

For a long time there was a rather big problem, it is a web browsing. My
environment is implemented in Java but I was unable to get any web
browser features.Any web surfing activity was possible only if you are
using a fully functional browser, like Firefox, Chrome, etc.

 From time to time I looked for any browser implementations in Java but
everything what I got  never looked interesting. The picture totally
changed when I found javafx.scene.web. At a glance it looks like exactly
what I need!

The key feature which looks nice to me is a splitting a visualization 
and

a background engine. I need exactly the engine which manages DOM, can
execute JavaScript, sends all notifications and events, but don't take
care about graphical representation. The description for WebEngine class
says that it suits completely.

OK, but I would like to ensure that JavaFX itself suits as well. 
Meaning, may I

use WebEngine class without creating _*graphical*_ application? In other
words, what should the execution environment for WebEngine be?

There are two questions I would like to understand:

1. Should I create a full graphical application in JavaFX traditions to
be able to use WebEngine? My application uses a speech feedback as a
main way to bring information to users. If it is required that I should
have a complete graphical scene for using WebEngine it would be bad news
for me.


Well, you need to create a JavaFX application in order to start using 
WebEngine,

but you don't need to display any GUI (Stage, Scene etc.) on the screen.

If that works for you, then basicly it may look as follows:

import javafx.application.Application;
import javafx.scene.web.WebEngine;
import javafx.stage.Stage;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker.State;

public class MyWebApp extends Application {
static WebEngine web;

public MyWebApp() {}

public void start(Stage s) {
web = new WebEngine();
web.getLoadWorker().stateProperty().addListener(
new ChangeListener() {
public void changed(ObservableValue ov, State 
oldState, State newState) {

if (newState == State.SUCCEEDED) {
System.out.println(web.getTitle());
}
}
});
web.load("http://javafx.com";);
}
}

The "start" method is your entry point into the JavaFX App thread.
That's where WebEngine must be created and managed, and you can't do 
it anywhere else
(that's why you need a JavaFX app even if you don't plan to use any 
GUI stuff).


You may also launch a JavaFX app tradittionally, via the "main" method:

import javafx.application.Application;

public class Main {
public static void main(String[] args) {
Application.launch(MyWebApp.class, args);
}
}

The "launch" method won't return untill JavaFX has exited, so you need 
to start your base logic (start your worker threads) before this call.


The way you access your WebEngine instance is either via its 
associated listeners or via Platform.runLater():


Platform.runLater(new Runnable() {
public void run() {
 System.out.println(MyWebApp.web.getLocation());
 }
});

Both ways you do it on the JavaFX App thread.

One more thing is that you should prevent JavaFX from auto-exit. This 
happens after the last Stage is closed.
As you don't have any Stage open, you should tell JavaFX that you want 
it to continue until you explicitly request it to exit.


This is what you need to call first from the "start" method:

Platform.setImplicitExit(false);

(Actually, WebEngine itself should prevent JavaFX from auto-exit, but 
you're better to do that explicitly.)



2. Do I understand correctly that JavaFX applications are able to be
launched just in Java Virtual Machine? Meaning, they do not need a
complete web browser, right? I found that javafx.scene.web using
webkit and it is OK. I am asking that the user shouldn't need opening 
a web

browser window and run JavaFX application in it, yes?


What you're telling about is the "applet mode". You're not limited to 
it. You can launch your JavaFX app as a standlone application.

So, you don't need to open a browser.



Help me please! If these questions would be OK I would be able t

In(Sanity) Testing Mondays

2015-02-06 Thread Vadim Pakhnushev

Reminder, Monday is our weekly sanity testing.

You can find your testing assignment at:

https://wiki.openjdk.java.net/display/OpenJFX/Sanity+Testing

Also please remember that the repo will be locked from 1am PST until 1pm 
PST.


Happy testing!

Thanks,
Vadim


Re: Execution environment for javafx.scene.web

2015-02-06 Thread Anton Tarasov

Hi Michael,

Yes, WebEngine can be used separately from WebView.

(See inline, please)

On 05/02/15 02:53, Michael Pozhidaev wrote:

Hello everybody,

I am working on the technology representing the information in form
which adjusted to the perception of blind people. It is just as
an addition to usual screen readers.

For a long time there was a rather big problem, it is a web browsing. My
environment is implemented in Java but I was unable to get any web
browser features.Any web surfing activity was possible only if you are
using a fully functional browser, like Firefox, Chrome, etc.

 From time to time I looked for any browser implementations in Java but
everything what I got  never looked interesting. The picture totally
changed when I found javafx.scene.web. At a glance it looks like exactly
what I need!

The key feature which looks nice to me is a splitting a visualization and
a background engine. I need exactly the engine which manages DOM, can
execute JavaScript, sends all notifications and events, but don't take
care about graphical representation. The description for WebEngine class
says that it suits completely.

OK, but I would like to ensure that JavaFX itself suits as well. Meaning, may I
use WebEngine class without creating _*graphical*_ application? In other
words, what should the execution environment for WebEngine be?

There are two questions I would like to understand:

1. Should I create a full graphical application in JavaFX traditions to
be able to use WebEngine? My application uses a speech feedback as a
main way to bring information to users. If it is required that I should
have a complete graphical scene for using WebEngine it would be bad news
for me.


Well, you need to create a JavaFX application in order to start using 
WebEngine,

but you don't need to display any GUI (Stage, Scene etc.) on the screen.

If that works for you, then basicly it may look as follows:

import javafx.application.Application;
import javafx.scene.web.WebEngine;
import javafx.stage.Stage;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker.State;

public class MyWebApp extends Application {
static WebEngine web;

public MyWebApp() {}

public void start(Stage s) {
web = new WebEngine();
web.getLoadWorker().stateProperty().addListener(
new ChangeListener() {
public void changed(ObservableValue ov, State oldState, 
State newState) {

if (newState == State.SUCCEEDED) {
System.out.println(web.getTitle());
}
}
});
web.load("http://javafx.com";);
}
}

The "start" method is your entry point into the JavaFX App thread.
That's where WebEngine must be created and managed, and you can't do it 
anywhere else
(that's why you need a JavaFX app even if you don't plan to use any GUI 
stuff).


You may also launch a JavaFX app tradittionally, via the "main" method:

import javafx.application.Application;

public class Main {
public static void main(String[] args) {
Application.launch(MyWebApp.class, args);
}
}

The "launch" method won't return untill JavaFX has exited, so you need 
to start your base logic (start your worker threads) before this call.


The way you access your WebEngine instance is either via its associated 
listeners or via Platform.runLater():


Platform.runLater(new Runnable() {
public void run() {
 System.out.println(MyWebApp.web.getLocation());
 }
});

Both ways you do it on the JavaFX App thread.

One more thing is that you should prevent JavaFX from auto-exit. This 
happens after the last Stage is closed.
As you don't have any Stage open, you should tell JavaFX that you want 
it to continue until you explicitly request it to exit.


This is what you need to call first from the "start" method:

Platform.setImplicitExit(false);

(Actually, WebEngine itself should prevent JavaFX from auto-exit, but 
you're better to do that explicitly.)



2. Do I understand correctly that JavaFX applications are able to be
launched just in Java Virtual Machine? Meaning, they do not need a
complete web browser, right? I found that javafx.scene.web using
webkit and it is OK. I am asking that the user shouldn't need opening a web
browser window and run JavaFX application in it, yes?


What you're telling about is the "applet mode". You're not limited to 
it. You can launch your JavaFX app as a standlone application.

So, you don't need to open a browser.



Help me please! If these questions would be OK I would be able to
significantly improve my environment!

Thank you in advance! :))


You're welcome!

Regards,
Anton.