Re: Scroll Gesture in ListView

2015-10-15 Thread Werner Lehmann

Hi Johan,

wouldn't it be possible to use an event filter on the listview? It would 
see (and consume) the event before it even gets to the listcell.


Werner

On 06.10.2015 10:02, Johan Vos wrote:

So it seems to me we need something like "gestureTransparent", by which we
can indicate a Node not to be interested in handling gestures. The code for
picking the target Node currently ignores the Node if it has the
mouseTransparent set. I would propose to add a gestureTransparent property
on Node, and to add the following check:
if we need to find the pickedTarget for a gestureEvent, it should never
return a node with gestureTransparent set to true.


Re: Backport for [JDK-8131151] Pressing ESC in a nested alert closes self and parent alert

2015-09-28 Thread Werner Lehmann

Hi Jonathan,

that's all I am asking. Thanks,

Werner

On 28.09.2015 01:41, Jonathan Giles wrote:

I have no issue picking up this backport and attempting to get it into
an 8u release. No promise though.

-- Jonathan




Backport for [JDK-8131151] Pressing ESC in a nested alert closes self and parent alert

2015-09-24 Thread Werner Lehmann

Hi,

since there seems to be an opportunity to have fixes backported to 8, 
I'd like to ask for a backport of the fix for


[JDK-8131151] Pressing ESC in a nested alert closes self and parent alert
https://bugs.openjdk.java.net/browse/JDK-8131151

Looks as if the fix is pretty simple. Without this we seem to be forced 
to disallow closing dialogs with escape key because the following 
yes/no/cancel alert would be dismissed right away from the same 
keypress. Admittedly, it is not critical in any way but the backport 
risk should be low.


Rgds
Werner


Re: Use of clipping in TabPaneSkin

2015-09-06 Thread Werner Lehmann

Hi Pedro,

from my understanding there is no automatic clipping feature on control 
bounds. If the tabpane could not grow to accomadate its content, the 
content would overlap the tabpane bounds if it is bigger. You can find a 
similar pattern on the titledpane for example.


Werner

On 06.09.2015 23:06, Pedro Duque Vieira wrote:

Hi,

Yes but isn't that redundant, you're setting the clip equal to the width
and height of the component so to me it seems that it's not doing anything.
I would understand if the clipping area was for a part of the component,
not for the whole component.

Probably I'm missing something.

Thanks, best regards,


Re: Use of clipping in TabPaneSkin

2015-09-05 Thread Werner Lehmann

Hi,

On 04.09.2015 19:54, Pedro Duque Vieira wrote:

What's the purpose of this?


looks as if there is a clipping rectangle being updated whenever 
width/height of the clipped area changes?


Werner


Re: JavaFx: printer dialog is shown behind main window(stage)

2015-06-15 Thread Werner Lehmann

Hi Alexander,

this seems to be a known bug:
https://bugs.openjdk.java.net/browse/JDK-8088395

Rgds
Werner

On 15.06.2015 07:54, Александр Свиридов wrote:

The printer dialog appears. But! it appears behind the main window
but not in front of main window! This strange behaviour happens only
when dialog appears the first time. The second and other times it's
in front of the main window. How to fix it?




Re: Maximum size of a canvas?

2015-05-15 Thread Werner Lehmann

Hi Jeff,

interesting idea although I am not sure in which way this improves 
things. I am already scaling the canvas node if it is bigger than 
necessary (due to previous zoom, works like supersampling then) or 
smaller than necessary (if the maximum size is reached but I need to 
present the content bigger than that).


Looks as if the scaling of the canvas and the scaling of the 
graphicscontext might both be applied at the same time - unless one is 
simply a shortcut to the other. I have to experiment on this one.


Rgds
Werner

On 15.05.2015 16:15, Jeff Hain wrote:

Instead of creating an eventually (and quadratically) huge canvas,
you could try using Canvas.getGraphicsContext().scale(2
double)/translate(2 double),
and "bind" the scroll bars to the {canvas dimensions, applied transform}
data.


Re: slightly ot: java9 runtime images

2015-05-15 Thread Werner Lehmann

Hi Tom,

could you do this with File.deleteOnExit? Question is, can it delete 
jars on its own classpath...


Werner

On 14.05.2015 08:22, Tom Eugelink wrote:

Unfortunately you cannot have the spawned JVM cleanup after itself, otherwise I 
could stop the initial JVM after it spawned the other.


Maximum size of a canvas?

2015-05-13 Thread Werner Lehmann

Hi,

is there a way to somewhat safely determine the maximum size of a 
canvas? I am using the canvas to display a report result in a custom 
report viewer control. The report can be zoomed in which basically means 
that I recreate the canvas with a bigger size (the canvas is inside a 
scrollpane).


On previous experiments I discovered that it is probably not safe to use 
more than twice the screen width or height, according to


  Screen.getPrimary().getBounds()

Turns out that might be too optimistic since I just had my application 
lock up: the application thread was waiting on a countdownlatch. Since 
this was in the debugger I could suspend all threads and the quantum 
thread was busy in


  com.sun.prism.d3d.D3DResourceFactory.nCreateTexture

At that time the canvas size was 3396.0 x 2400.0 for a screen resolution 
of 1920 x 1200. I can reproduce this every time now. If I change the 
code so that the canvas size never exceeds either width or height of the 
screen (up to 1698.0 x 1200.0) the problem goes away but then of course 
I have less quality on a 400% zoom...


Rgds
Werner


Re: QML vs. FXML

2015-03-05 Thread Werner Lehmann

Like this?

http://wiki.eclipse.org/Efxclipse/Tooling/FXGraph

On 05.03.2015 16:23, Doug Schaefer wrote:

You really want to use a domain specific language that’s easy to read
and write. QML is that. I find XML tags overwhelm the rest of the
text making it hard to understand what’s going on, and hard to write
unless you have a good XML editor.  QML has less cruft and it’s
easier to see what’s happening with a quick glance.




Re: focus property in composed control

2015-02-23 Thread Werner Lehmann

Hi Tom,

lately I've been battling similar issues. One important thing I learned 
here is that if my custom control wraps a TextField in its skin I have 
to make sure that the custom control is not focus-traversable.


It also seems difficult to have focus on the custom control in terms of 
Node.focused while actual focus is on the TextField in the skin. 
ComboBox may have the same issue with its embedded TextField. At least 
the FakeFocusTextField inside the ComboBoxListViewSkin looks like a 
workaround for this. But I can't do the same because this uses (package) 
private API.


And the creative implementation of Node.FocusedProperty (to make sure 
that focus switch is an atomic change for focus change listeners) 
reminded me of Tomas' latest posting about "Suspendable listener 
notifications". This would be nice to have in FX so we don't need 
private workarounds...



http://tomasmikula.github.io/blog/2015/02/10/val-a-better-observablevalue.html


Werner

On 23.02.2015 09:03, Tom Eugelink wrote:

What would be the best way to forward the focusProperty of the
TextField to the control's focusProperty?


Re: Question/feedback regarding Windows Hi DPI support and how it will affect applications

2015-02-18 Thread Werner Lehmann
My usecase is not about "retina or not". It is about showing a report 
result in "actual size" which means I need to scale it depending on the 
screen DPI.


Current workaround is this...

-Dcom.sun.javafx.screenDPI=109

...but I can't really advertise this to users.

Werner

On 18.02.2015 12:23, Mike Hearn wrote:

You can reflectively access Screen.getPixelScale() to learn if you're on
Retina. Of course, don't expect to swap out the JRE for a newer one
automatically if you do this (I bundle so it's not so problematic).


Re: Question/feedback regarding Windows Hi DPI support and how it will affect applications

2015-02-18 Thread Werner Lehmann

Hi Jim,

interesting read. I guess I learned more about the topic than I can 
help. Also found this resource interesting:


http://kynosarges.de/GuiDpiScaling.html

Some thoughts. Obviously it is less desirable to require every 
application to do their own scaling. I can't imagine that this would 
work on a larger basis. As to the question of integer vs float 
coordinates, there is a lot of snapToPixel stuff going on. And one of 
the reasons is to get crisp pixel-aligned lines. Snapping to logical 
coordinates could then snap to non-integer physical coordinates (if the 
scaling factor is 125% or somesuch). Which may be ok if hidpi makes up 
for it...


As to em-based styling, I was under the impression that there was a 
constant factor for 1em. Reading section "RESIZING FOR DIFFERENT SCREEN 
DPI" in modena.css I am not so sure anymore. The resource above also is 
unsure (FWIW):


"JavaFX em handling is inconsistent, sometimes referring to the 
automatically acquired system font but at other times yielding a 
hard-coded default size."


Finally, it would be nice to get information about the actual screen 
DPI. In my tests Screen.getDpi always returns 96, regardless of what it 
actually is...


Werner


Re: Event Filtering

2015-02-09 Thread Werner Lehmann
I see. Looks as if the textfield in a combobox cannot be subclassed 
because of "final" restrictions. As a last resort, you could use your 
own textfield as a buttoncell - which would of course skip over all 
special handling for editable comboboxes in the skin...


Werner

On 09.02.2015 12:44, Scott Palmer wrote:

When the actual control is an editable combobox it gets more
complicated. That is the case that prompted my original message.


Re: Event Filtering

2015-02-09 Thread Werner Lehmann

Hi Scott,

at least in Java 8 you can override TextInputControl#replaceText and/or 
TextInputControl#replaceSelection to convert lowercase into uppercase. I 
have used it for exactly this purpose.


Werner

On 07.02.2015 01:33, Scott Palmer wrote:

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?


Re: How to "apply" skin?

2015-02-09 Thread Werner Lehmann

Hi Tomas,

I think the expected way of doing this is to defer the code which 
requires the control width until normal layout passes come across it. Or 
maybe not only defer that code but actually move it to layouting methods.


Werner

On 09.02.2015 00:51, Tomas Mikula wrote:

Actually, I want skins to be applied in the whole sub-tree of a node.
The node itself may not be a control, but it may contain controls.


Re: Label prefHeight vs wrapText

2015-02-05 Thread Werner Lehmann
Sorry to dig up this old thread. Just wanted to mention a much simpler 
workaround if a label inside a vbox does not wrap its text:


label.setMinHeight(Region.USE_PREF_SIZE);

As before the trick is to prevent vbox from reducing the label height 
below its pref height to preserve the wrapping - even if other children 
of the vbox need to be shrunk.


Werner

On 28.05.2014 18:10, Werner Lehmann wrote:

Martin,

thanks for the explanation. Feels good to finally understand this ;-)
And while I created a ticket as per your suggestion...

[#RT-37309] VBox: vshrink layout hint similar to vgrow

...it seems I can use this as a workaround:


 label1.minHeightProperty().bind(Bindings.createDoubleBinding(
 () -> label1.prefHeight(vbox.getWidth()),
 vbox.widthProperty()));


Maybe something similar could be made available per label boolean
property. So basically the ability to ask a label to consider wrapping
when calculating its minHeight... I can imagine that this might have
made more sense as a default behavior: if people explicitly ask for
wrapping text, they would probably accept a larger minHeight.

Werner


Re: CSS under 1.8.0_40 not identical to 31 or older

2015-02-05 Thread Werner Lehmann
FWIW, we are also experiencing css differences between 8u25 and 8u40. In 
some custom controls portions appear completely unstyled on 8u40, as if 
the selectors would stop working. Couldn't take a closer look so far due 
to time constraints...


Werner


Re: How to use scaleX/Y to change layout bounds?

2015-01-28 Thread Werner Lehmann

Hi Tobi,

wrap the button into a group.

Werner

On 28.01.2015 07:51, Tobias Bley wrote:

Hi,

when I call button.setScaleX(.5) and button.setScaleY(.5) the button
changes it’s size only visually - the layout  bounds does not change…
How can I change this behaviour?

Best regards, Tobi




Re: Is it possible to have a SwingNode inside a JFXPanel

2015-01-28 Thread Werner Lehmann

We have had both scenarios and encountered issues in these areas:
- dragdrop inside the component/node and between swing/fx
- repaint issues, sometimes the jfxpanel would appear all black
- resize issues, changes to the content of either swingnode or jfxpanel 
would not be passed to the containing element

- can't tab from components in a jfxpanel to nodes of the containing scene
- for a combobox in a jfxpanel in a swingnode: can't select elements 
from the dropdown, even clicking the dropdown scrollbar would close the 
dropdown
- reduced framerate / increased cpu load inside jfxpanel, especially for 
animations


Some of these are resolved, others are not (issues were reported). I'd 
recommend to test the above early if relevant for your application.


Werner

On 27.01.2015 20:36, Pedro Duque Vieira wrote:

Hi,

I'm migrating a Swing app and I have a scenario where I need to have a
SwingNode inside a JFXPanel and also a JFXPanel inside a SwingNode.

Are this configurations possible?


Re: TableView API, no lazy retrieval of visible cell content possible?

2015-01-28 Thread Werner Lehmann

Robert,

I think Tomas is right, load your thumbnails on demand when updateItem 
is called for an item with missing thumbnail. You say that the cell of a 
visible item gets reused for another item. If that is the case I guess 
that the item is "moved" to another cell. Wouldn't it be possible to 
have an image property on your items and the lazy loading is done on the 
item, triggered when the item is passed to updateItem of any cell? That 
should trigger the demand-loading and it would be robust against the 
tableview exchanging cells for individual items.


As to the question when to start or stop lazy loading for items, I would 
add the load-demands to a stack. Each time the image for a new item is 
requested it is put to the top of the stack and you have one or more 
threads processing items on the stack (LIFO). An an image is requested 
which is already on the stack move it to the top of the stack. If an 
item is removed from a cell remove it from the stack. That should do it.


Werner

On 28.01.2015 09:30, Robert Krüger wrote:

Doesn't help. The patterns of this property being changed are just as
unusable for my purposes as with the other approaches (e.g. I can clearly
see that item is set to a different value for a cell that is still visible,

...



Re: Make TableView height match content

2015-01-07 Thread Werner Lehmann

Hi Dan,

typically it is not a good idea to do this. TableView has a reason to 
manage scrolling on its own: if the tableview has 10 items you don't 
want to have all these nodes in the scenegraph when it is sufficent to 
show the visible ones.


Your approach may have some value if the number of items is quite low. 
In that case I'd suggest to skip tableview and put your items in that 
same vbox. Of course you'd have to handle columns yourself then.


Werner

On 06.01.2015 21:26, Dan Smith wrote:

Putting this another way: TableViews automatically wrap their content
in a (implicit?) scroll pane.  I'd like to turn that off.  Is there
any way to do so?


Re: switching skins at runtime

2014-12-29 Thread Werner Lehmann
That's what I meant: clear children, or undo whatever you are doing to 
them, in dispose(). At any rate I wouldn't know if that is correct. It 
is just how I assume this would work.


On 29.12.2014 11:44, Tom Eugelink wrote:

That works for unbinding listeners to skinnable and the reset code for style 
class, I still need to clear the childeren.

Tom


Re: switching skins at runtime

2014-12-29 Thread Werner Lehmann

I think this is something you need to do in SkinBase.dispose.

Werner

On 26.12.2014 22:55, Tom Eugelink wrote:

Hm, I've got it working, but I need to call a "getChildren().clear()"
before I start creating nodes in a skin. If not, the control will
retain the nodes an old skin has created. Also any style classes that
were assigned remain, but those can be reset easily.

Never the less I feel that setSkin() should clear the children and
reset the style classes itself?


Re: Scrollbars on *View or better VirtualFlow based UI elements

2014-12-15 Thread Werner Lehmann

Hi Tomas,

On 15.12.2014 16:10, Tomas Mikula wrote:

To add an idea, semi-transparent scrollbars could be shown over the
content when the mouse approaches the edge. This would avoid
flickering andto save space at the same time. I realize one could not
use this if the scrollbars would cover some interactive controls at
the edge of the content.


Sounds similar to invisible scrollbars which appear on hover only. 
Personally I don't like either one. I guess it is a matter of taste. In 
a touch scenario it is a bit of problem though because usually you 
cannot rely on hover events.



Also, I would like to see some new creative way of scrolling the
content, especially for cases when the full length of the content is
not known, e.g. a ListView with variable cell sizes, or a possibly
infinite stream of items that are loaded as needed. In these cases,
the scrollbar length always lies about the actual total length of the
content.


If you have variable cell sizes an easy way to map this to a scrollbar 
is to use the number of items, possibly with some adjustments involving 
the height of the known cells. From my impression this is what virtual 
flow does but I could be wrong.


An infinite stream of items can be scrolled with the "Google Picasa" 
light table approach. You can find an implementation of this concept in 
ControlsFX, see the PlusMinusSlider control.


Werner


Select-binding still warns about null steps

2014-12-15 Thread Werner Lehmann

Hi,

it seems as if bindings created with Bindings.selectXXX still do not 
support null steps fully. With RT-35957 the log level of NPEs caused by 
null steps was reduced to FINE. Howver, in 8u25 there is a still a 
warning logged for a perfectly normal operation:



Dez 15, 2014 12:59:44 PM 
com.sun.javafx.binding.SelectBinding$SelectBindingHelper getObservableValue
WARNING: Exception while evaluating select-binding [window]


Example code:


  @Override
  public void start(Stage primaryStage) throws Exception
  {
ObjectBinding binding = Bindings.select(primaryStage.sceneProperty(), 
"window");
binding.get();
  }


Explanation for this seems obvious, on level WARNING there is at least 
one line logged always, unaffected by the change to FINE:



final PlatformLogger logger = Logging.getLogger();
if (logger.isLoggable(Level.WARNING)) {
Logging.getLogger().warning("Exception while evaluating 
select-binding " + stepsToString());
if (ex instanceof  IllegalStateException) {
logger.warning("Property '" + propertyNames[i] + "' does 
not exist in " + obj.getClass(), ex);
} else if (ex instanceof NullPointerException) {
logger.fine("Property '" + propertyNames[i] + "' in " + 
properties[i] + " is null", ex);
} else {
Logging.getLogger().warning("", ex);
}
}


As a result I am getting exception warnings logged leading to questions 
leading to explanations and bug tickets etc. I tried to work around it 
by reducing the log level:


- created file "logging.properties" in classpath root with content 
"beans.level = OFF"

- added VM argument "-Djava.util.logging.config.file=logging.properties"

While this works standalone it does not seem to be accepted in a 
Webstart JNLP file because it is not a whitelisted secure property.


Any ideas about that?

Thx,
Werner


Re: High resolution printing

2014-12-09 Thread Werner Lehmann

Hi Kevin,

yes it has, and my users can save their reports to a PDF file, open it, 
and print it. I just felt there should be a more direct way to print a 
report.


Anyway, I decided to use Jasper's built-in print-exporter which works 
with Java 1.4 AWT printing. This means I have a working solution which 
unfortunately does not use the FX printing API. As a consequence, print 
dialogs look a bit dated and are not modal on my stage. However, even 
with FX printing dialogs would not be modal (RT-27983), only to be 
resolved with Java 9...


Werner

On 09.12.2014 19:12, Kevin Loverde wrote:

Doesn't Jasperreports have a PDF rendering method? That might be a
simpler route.


High resolution printing

2014-12-09 Thread Werner Lehmann

Hi,

I'd like to print a canvas node with native printer resolution. What is 
the best way to achieve that? I suppose I can't just set the canvas 
width and height to the printer page size equivalent because at 600 DPI 
this would mean about 5000x7000px. And as far as I know a canvas this 
size can be a problem. Aand there are printers with even higher resolutions.


Should I print to a 72 DPI canvas instead, e.g. 600x850px? My content is 
not bigger than this anyway, talking about Jasperreports rendered at 72 
DPI to an AWT graphics surface. Still I'd like to make use of higher 
print resolution to get crisp text and to avoid pixel upscaling.


Looks as if it was intended to provide a "printer canvas" but I guess 
such API is not available.

https://wiki.openjdk.java.net/display/OpenJFX/Printing+for+JavaFX

Alternatively I could skip the FX printing API altogether and use AWT 
"graphics printing". Maybe it is the best option this content.


Any recommendations?

Rgds
Werner


Re: Permutation of scene graph children

2014-12-02 Thread Werner Lehmann

Hi Peter,

didn't know about that one. It basically does what Tom suggested: makes 
a copy, sorts that one, then uses ObservableList.setAll to get one 
change event. So it is what I am doing already but still removes/adds 
children ;-)  The remove/add approach also does work for now, it just 
could be a little more efficent...


Werner

On 02.12.2014 12:08, Pete Moss wrote:

You can also try using FXCollections.sort() directly on the children and
see if that helps since you were wondering about a sort operation. This is
intended specifically for use with ObservableList objects. This has worked
well for me. I don't know how many events this will end up firing, since it
wasn't important to me, but it is worth investigating.

- Peter


Re: Permutation of scene graph children

2014-12-02 Thread Werner Lehmann

Hi Anirvan,

On 02.12.2014 06:33, Anirvan Sarkar wrote:

java.util.List doesn't support a swap operation but there is
Collections.swap(List, int, int)
for
that.


thanks for the pointer. Added a comment and a vote :)


Also there exists a JIRA RT-39128
 for getting swap support
on ObservableList.


Please see my comment on the other reply.

Thx.

Werner


Re: Permutation of scene graph children

2014-12-02 Thread Werner Lehmann

Tom,

I know about Collections.swap but it looks like a bad idea to use on 
scene graph children because it seems to temporarily have a duplicate 
element in the list and I can't have a node twice in the scene graph. 
The setAll approach is what I am using now but native permutation or 
swap support would be better because it does not remove/add nodes, 
triggering CSS and possibly some listeners on scene or parent properties.


Werner
On 02.12.2014 10:21, Tom Schindl wrote:

I'd rather like to see ObservableList.move()/swap() which since we now
have Java8 this could be implemented as a default methods.

I think what you can do to make the swap only fire one event is to use

Object[] data = l.toArray();
// reorder

l.setAll(data);


Tom


Re: TreeItem enhancements

2014-12-01 Thread Werner Lehmann

Hi Jonathan,

sure, I'll file that tweak.

About prototyping: this is probably the only thing I can do here, 
prototyping. I'd rather prepare a pull request with treeitem 
enhancements while using them already for our product at the same time.
That could be a win-win situation and I could provide somewhat proven 
and tested code. Otherwise I end up implementing stuff twice. 
Unfortunately I don't see a way how to do this without running into 
legal and technical issues (*) on the way...


With controlsfx it is similar on a smaller scale.

Werner

(*) package private stuff, keeping treeview compatibility, backport 
if/when code eventually arrives in jfx.next, and probably 
Integer.MAX_VALUE more ;-)


On 01.12.2014 20:20, Jonathan Giles wrote:

These sound like decent suggestions - I would encourage you to file a
tweak request in jira. It would be great if in the development of your
work you could prototype and explore these suggestions in greater depth
- I am always happy to work with patches as a starting point.

-- Jonathan


TreeItem enhancements

2014-12-01 Thread Werner Lehmann

Hi,

I am currently building a visual designer for Jasper Reports (to be 
embedded in our product). The design model is basically a design tree, 
so I am extending TreeItem for its element classes, e.g. StaticText or 
SubReport. This has two benefits: 1. I get to show the model in a 
TreeView, and 2. I get tree change notifications bubbled from leaf to 
root item - both at no extra cost.


Obviously "my" TreeItems have additional observable properties such as 
x/y/w/h. It would be very cool if changes to those properties could also 
be bubbled to the root using the same change bubbling technique. Only 
little things are missing here:


- ability to create TreeItem.children with an observable-list extractor
- ability to bubble ListChangeListener.Change.wasUpdated events

Also, if we could create TreeItem.children for ourselves in a factory or 
somesuch, we could use a Filtered- or SortedList, too. I imagine this 
could simplify tree filtering a lot (ScenicView!).


Thoughts about this?

Rgds
Werner


Permutation of scene graph children

2014-12-01 Thread Werner Lehmann

Hi,

occasionally I need to move a child in its children list and would like 
to avoid a remove/add operation. For example, this could be useful to 
change z-order in a StackPane, or change vertical order on a VBox, or 
when synchronizing item order in a model with corresponding node order 
in a skin.


java.util.List does not support a move or swap operation. I had hoped a 
sort operation with a clever comparator might do the trick, triggering a 
permutation listchange event. However, any attempt in this direction 
bombs, complaining about "duplicate children added". On the other hand 
there is rudimentary support for this in Node.toFront and flags exist on 
Parent: "childrenTriggerPermutation", "childSetModified".


Any thoughts about getting swap support on ObservableList and/or 
permutation support on Parent.children?


Werner


Re: Classpath-relative URLs in CSS

2014-10-15 Thread Werner Lehmann

Here's the ticket. Tried it also on 8u25, same result.

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

Werner

On 15.10.2014 16:25, Werner Lehmann wrote:

sure, I'll create a ticket. This is on 8u11.


Re: Classpath-relative URLs in CSS

2014-10-15 Thread Werner Lehmann

Hi,

sure, I'll create a ticket. This is on 8u11. Please see also below.

On 15.10.2014 14:36, David Grieve wrote:

Two pieces of information are passed into the converter. The first is
the value that was given in the style, e.g., "/mint/report_16x16.png".
The second is the URL of the stylesheet as determined when the
stylesheet is loaded. The stylesheet URL may be null, as would be the
case for an in-line style.


Ok, in my case the style is not inline but in a stylesheet. When 
execution gets to this conditional inside URLConverter.decode,



if (stylesheetUrl != null && stylesheetUrl.trim().isEmpty() == false) {


it always enters that block and finds a return statement. Only after 
that block the classloader would be asked but it never gets there. I can 
imagine it would work with an inline style.



If the resource is copied over to the build directory that eclipse uses
on the class-path, then there shouldn't be a problem.


The resource must be copied to the bin directory because I can access it 
in code even if the resource is in another project. But CSS doesn't see 
it - that's what puzzles me so much.


Werner


Re: Classpath-relative URLs in CSS

2014-10-15 Thread Werner Lehmann

Hi David,

classpath-relative URLs in CSS do not seem to work, unfortunately. For 
example,


  -fx-background-image: url("/mint/report_16x16.png");

has no effect. Relative addressing does work. Looks to me as if there is 
a bug in com.sun.javafx.css.converters.URLConverter.resolve. Basically 
it seems to work like this:


- if url is absolute (has a scheme, e.g. http), use it verbatim
- if stylesheet url is present, use that to resolve the image url
- otherwise go to contextclassloader

I don't get to the last step because the stylesheet url in the second 
step is always present. Am I seeing things, or is there another way to 
do this?


By the way, even with relative addressing I still cannot access images 
during debugging in Eclipse if the stylesheet is in a different Eclipse 
project than the referenced image resource. This really hurts 
modularization and resource reuse (or I am forced to do this in code). 
Any idea about that?


Rgds
Werner


On 01.06.2012 04:03, David Grieve wrote:

In the current implementation, absolute paths without a scheme are
not resolved relative to the class path. I have created RT-21967 to
track the issue.


Re: CSS: style leaks from unrelated stylesheet

2014-10-09 Thread Werner Lehmann

Thanks, David.

This means I would always override getUserAgentStylesheet (for 8u20 on 
Control, for 8u40+ on Region). And selectors in the stylesheet should be 
sufficiently specific because only 8u40+ actually limits them to the 
declaring node.


For the record, I'm not talking about controlsfx - but that may have 
been the template for it.


Werner

On 09.10.2014 15:27, David Grieve wrote:

In 8u20 and before, adding a stylesheet via
Control.getUserAgentStylesheet will simply add the user-agent stylesheet
to the entire scene, not just the control. This has been fixed in 8u40
where the getUserAgentStylesheet method is now public API on Region and
the styles added will affect only the Region and its children.

Incidentally, the code you point out from the 3rd party control
(controlsfx) was added as a work-around for a separate issue related to
Control.getUserAgentStylesheet(). I believe the 8u40 branch of
controlsfx has removed this work-around and is using the
Region#getUserAgentStylesheet method.

On 10/9/14, 8:58 AM, Werner Lehmann wrote:

Turns out that the 3rd party control adds its stylesheet like this:

class SomeControlSkin...
   static {
 StyleManager.getInstance().addUserAgentStylesheet(...)
   }

In this way it is not only using private API but also the stylesheet
is not associated with only such control nodes and therefore seems to
affect other nodes, too. Is this correct, and should the stylesheet
rather be provided by overriding Control.getUserAgentStylesheet?

Werner

On 09.10.2014 12:00, Werner Lehmann wrote:

Then a dialog stage is displayed and its scene does not use the 3rd
party control. However, a combobox list-cell (its button cell) is still


Re: CSS: style leaks from unrelated stylesheet

2014-10-09 Thread Werner Lehmann

Turns out that the 3rd party control adds its stylesheet like this:

class SomeControlSkin...
  static {
StyleManager.getInstance().addUserAgentStylesheet(...)
  }

In this way it is not only using private API but also the stylesheet is 
not associated with only such control nodes and therefore seems to 
affect other nodes, too. Is this correct, and should the stylesheet 
rather be provided by overriding Control.getUserAgentStylesheet?


Werner

On 09.10.2014 12:00, Werner Lehmann wrote:

Then a dialog stage is displayed and its scene does not use the 3rd
party control. However, a combobox list-cell (its button cell) is still


CSS: style leaks from unrelated stylesheet

2014-10-09 Thread Werner Lehmann

Hi,

I have a strange effect with stylesheets. Somehow a style is applied 
although the defining stylesheet is not in the scene. Consider this 
scenario:


Primary stage with a 3rd party control. The control's jar file contains 
a stylesheet with style


  .list-cell { -fx-pref-height: 24; }

Then a dialog stage is displayed and its scene does not use the 3rd 
party control. However, a combobox list-cell (its button cell) is still 
using a preferred height of 24. IF I don't have that 3rd party control 
on the primary stage and open the dialog, the list cell is at pref 
height 17, as it should. This means the pure existence of that control 
on the primary stage makes a difference on the dialog stage.


Admittedly the selector above is not as specific as it should be. But 
how does that style "leak" into the dialog scene although the dialog 
does not use the 3rd party control with that stylesheet?


This is on 8u11 if it matters. Can't test it right now with 8u20+ 
because that has other implications.


Rgds
Werner


Re: openjfx-dev Digest, Vol 34, Issue 36

2014-09-22 Thread Werner Lehmann

Hi Daniel,

actually, as it turns out that code did not even compile with javac 8u11:


[mint.javac] [...] error: package sun.util.logging.PlatformLogger does not exist
[mint.javac] 
com.sun.javafx.binding.Logging.getLogger().setLevel(sun.util.logging.PlatformLogger.Level.OFF);


Eclipse's JDT did not have a problem. Looks to me as if javac actively 
"protects" that package. After exploring a few options to configure 
logging in code only it looks as if the only way is to really do this 
with a vm argument. Without WebStart it seems to be sufficient to use 
System.setProperty first thing in the main method but with WebStart 
there is no main method and it could be too late when doing it in 
Application.start.


So, until 8u20 I am doing this:

in JNLP or vmarg with -D:
java.util.logging.config.file=logging.properties

logging.properties:
beans.level = OFF

Also, I am not sure if "java.util.logging.config.file" is a trusted 
property for the jnlp file. I'll have to see about that.


Werner

On 22.09.2014 09:41, Daniel Fuchs wrote:

Hi,

I don't recommend using sun.* proprietary APIs.
The safest way to suppress the logger output would be to
switch it off in a logging.properties file.

-Djava.util.logging.config.file=

and inside:

.level = OFF

best regards,

-- daniel


Re: How to suppress platform logger output

2014-09-19 Thread Werner Lehmann

Hi Peter,

this one seems to work, based on your former suggestion:

com.sun.javafx.binding.Logging.getLogger().setLevel(sun.util.logging.PlatformLogger.Level.OFF);

Thanks for that. Of course I am not sure if that also kills other 
binding-related logs I might be interested in but generally I'd prefer a 
runtime exception anyway. And in this particular case of a select 
binding it is normal operation to come across null values.


About the slf4j bridge, I had shortly looked into it but it feels a bit 
extreme to add a jar file, modify logging, and pay the perfomance 
penalty mentioned on that site to get a selectString binding :)


Werner

On 19.09.2014 16:46, Peter Levart wrote:

Alternatively, you can have PlatformLogger output through Log4J. Use
jul-to-slf4j bridge and slf4j-Log4J backend.

See here:

http://www.slf4j.org/legacy.html#jul-to-slf4j




Re: How to suppress platform logger output

2014-09-19 Thread Werner Lehmann

Hi Nicolai,

On 19.09.2014 15:43, Nicolai Parlog wrote:

a little off topic but it might still be relevant for you.


thanks, I noticed that ticket and found Tomas' blog to be a very 
interesting read. However, this is for a Webstart application and we 
already have way too many dependencies for me to add another because it 
is convenient for one occassion. If it weren't so much boilerplate to do 
this I would probably quickly hack it up myself :)


Werner


How to suppress platform logger output

2014-09-19 Thread Werner Lehmann

Hi,

I'd like to use one of the Bindings.select* methods but can't really 
accept the tons of stderr output it generates for null steps. According 
to this ticket...


[#RT-35957] Bindings class spits out a lot of unneeded log messages
https://javafx-jira.kenai.com/browse/RT-35957

... 8u20 resolves this by logging on the FINE level. But how can I 
suppress this output then? As far as I know the platform logger logs to 
stderr if JDK logging is not used - and we are on log4j. Which means I 
get FINE logging on stderr which does not help much.


Rgds
Werner


Sep 19, 2014 1:33:32 PM 
com.sun.javafx.binding.SelectBinding$SelectBindingHelper getObservableValue
WARNING: Exception while evaluating select-binding [parent, value]
Sep 19, 2014 1:33:32 PM 
com.sun.javafx.binding.SelectBinding$SelectBindingHelper getObservableValue
INFO: Property 'value' in ReadOnlyObjectProperty [bean: TreeItem [ value: b ], 
name: parent, value: null] is null
java.lang.NullPointerException
at 
com.sun.javafx.binding.SelectBinding$SelectBindingHelper.getObservableValue(SelectBinding.java:481)
at 
com.sun.javafx.binding.SelectBinding$AsString.computeValue(SelectBinding.java:394)
at javafx.beans.binding.StringBinding.get(StringBinding.java:152)
at 
mint.javafx.report.design.model.elements.MintJRTextField.main(MintJRTextField.java:182)



//TreeItem t1 = new TreeItem("a");
TreeItem t2 = new TreeItem("b");
TreeItem t3 = new TreeItem("c");

//t1.getChildren().add(t2);
t2.getChildren().add(t3);

StringBinding binding = Bindings.selectString(t3, "parent", "parent", 
"value");
System.out.println(binding.get());




Re: Close all ContextMenu with mouse button

2014-09-18 Thread Werner Lehmann

On 18.09.2014 14:38, Anthony Petrov wrote:

If they don't, this is a bug in either Control, Scenegraph, or Glass.
Please file a JIRA and provide a small test case that reproduces the
problem.


...or a JFXPanel is involved: popups and contextmenus opened from a 
JFXPanel do not close when clicking in Swing (outside of the JFXPanel). 
At least it used to be like that in FX 2.2.


Werner


Re: Skin layoutChildren: when to get bounds of child nodes?

2014-07-31 Thread Werner Lehmann

Hi Martin,

On 30.07.2014 17:39, Martin Sladecek wrote:

I assume you don't change "child1" Nodes, so it should work.


I may add/insert such nodes but in that case I take the easy route and 
simply rebuild the complete hbox.



Yeah, one problem with layouts is when you want to do some layout that
is almost the same as some predefined layout, but you need to tweak it
somehow. Maybe in the future we could add some abstraction and extract
some (parts of) the algorithms we use in our layout containers so they
can be reused in custom layouts.


Right. I noticed some package private methods used internally by vbox 
etc. This prevents me from making a copy of vbox which I can tweak 
(often times removing many properties and lots of code not applicable to 
that usecase). I suppose they could also be useful for other layouts 
occasionally.


I figured if I would use translateX for the tweak I should be fine. For 
the width I might be able to use scaleX but that does not feel right.



If you reuse some predefined layout, you'll probably end up with some
hacky code since you'll usually mess up with the inputs for the layout.
The rule of thumb is to use some more complex (GridPane) or free form
(AnchorPane) layout instead of trying to slightly tweak some simple layout.
In your case, wouldn't GridPane do the job? Basically, you have a row of
text nodes and you need a second row where a single rectangle is in the
same column as currently selected (?) text node. The size of the
rectangle can be set to fillWidth the column, so GridPane will do all
the work for you.


AnchorPane might be applicable for this particular thing. The challenge 
here is then to figure out the heights of elements so that I can stack 
them to get a result similar to the vbox. For example, if I anchor the 
hbox to the top of the AnchorPane and I want to have my moving rectangle 
right below it I have to set static AnchorPane properties on that 
rectangle and have to know the height of the hbox. Again I need to 
position one element based on the default layouting of another. And if I 
am not mistaken it could be difficult to animate those static properties.


I try to avoid GridPane because inserting and removing stuff means to 
manually shift all subsequent indexes which is a bit tedious. Also, if I 
want to animate an element moving from one cell to another it seems to 
get in the way - or at least it does not offer any benefit over the 
current vbox/hbox approach.


Werner


Re: Skin layoutChildren: when to get bounds of child nodes?

2014-07-30 Thread Werner Lehmann

Martin,

thanks a lot for this elaborate explanation :)  Here's an image of what 
I am talking about.


http://postimg.org/image/t9a6esc71/

child1 is one of the labels in a hbox, e.g. "Query" or "Result"
child2 is the blueish region. It needs to be positioned under one of 
those labels. I am doing this with translateX and prefWidth.


On 28.07.2014 07:38, Martin Sladecek wrote:

The super.layoutChildren should size every child of the control (which
is VBox), but not child's children. The control must finish the layout
before children can do theirs. If you need to do layout on some child
before that, you can call .layout() on it. It will do it's layout using
it's current size. You should have all the bounds correct after that call.



But that would not work in your case anyway. You have both childs in a
HBox, which takes care of resizing the children. This means you need to
layout the HBox to get children size and in order to do that, you need
HBox to be at it's final size, which will happen during the VBox layout.
So your steps would be:
1) super.layoutChildren() - VBox is resized to Controls content size
2) now the VBox is resized, you can call vbox.layout()
3) now HBox is resized, so call hbox.layout()
4) children are resized. They have correct layout bounds now. But in
order to get correct boundsInParent (but maybe you really need layout
bounds?), you need to call .layout() on children too.


I my tests it was sufficient to do this:

layoutChildren() {
  ...
  bip = child1.getBoundsInParent()
  if (bip.getMinX() == 0 && bip.getWidth() == 0) {
vbox.layout();
bip = child1.getBoundsInParent();
  }
  ...
}

Might not be efficient (or pretty) but seems to work.


Even if you do all these steps, calling setPrefWidth() on child2 marks
the whole tree dirty again. Because HBox needs to resize child2 using
it's new PrefWidth. This also means, HBox prefwidth will be different,
so it's parent (VBox) must do the same. Ditto with the control. Also,
the HBox (VBox, control) may not have enough size to resize child2 to
it's pref width, so child1 might be shrinked as a result, which breaks
your invariant. You are basically changing the input for HBox's layout
(child2.pref size) based on it's output (child1 size), which makes this
a loop.


Makes sense.


So in order to really make this work, you need to manage the child nodes
directly and compute your layout by yourself. This can be done either by
using your own subclass of Pane and overriding it's layoutChildren. Or
if you want to do everything in Skin's layoutChildren, you can make the
children unmanaged, but then it doesn't really matter where they are in
the scenegraph, HBox won't be managing them.

Hope this helps!


It sure does. I have created pane-based controls with manual layouting 
before but it is some work to get it right, especially with the 
computeMinPrefMaxWidthHeight methods (sometimes +baseline), snapsize etc 
pp. I figured it is not worth the hassle here if a vbox and hbox do 95% 
of what I need :)  A cleaner approach would be to make child2 unmanaged 
as you suggest but then I need to reserve vertical space in its vbox 
container, currently done with css padding on the region itself. For the 
time being I have to stick with this and move on.


Thanks again.

Werner


Re: Skin layoutChildren: when to get bounds of child nodes?

2014-07-30 Thread Werner Lehmann

Richard,

since I need to get x and width of child1 (the one inside the hbox) I 
have to use boundsInParent. According to the docs layoutBounds.x/y are 
always zero for resizable nodes so it does not work here. As to the 
question whether the parent might be size 0: the HBox is indeed size 0 
after the initial call to super.layoutChildren. The containing VBox has 
some 800x400 px though.


I think the reason is probably in Martin's reply although I may not like 
it ;-)


Werner

On 25.07.2014 18:56, Richard Bair wrote:

Hmmm. The first question I have is whether boundsInParent is really
what you want to use, vs. layout bounds. But assuming it is what you
want, why are the bounds zero? This is during the layout pass, which
is the right place to be doing what you’re doing. The super
layoutChildren call will size everything based on the contentX,
contentY, contentWidth, contentHeight
(http://hg.openjdk.java.net/openjfx/8u-dev/rt/file/4b8d06211312/modules/controls/src/main/java/javafx/scene/control/SkinBase.java).
Is it possible that the parent itself is size 0? boundsInParent
should always be invalidated automatically whenever the
width/height/transforms/etc changes. If not that is definitely a bug
(that you can write a simple test case for to prove).

But my first guess is maybe the parent is size 0 as well, due to
something else (maybe the pref size of the control is 0 to start with
or something…)

Richard




Re: Double.MAX_VALUE in CSS -fx-max-width?

2014-07-28 Thread Werner Lehmann

Hi David,

thanks - here it is:

[#RT-38065] CSS -fx-pref-width et al do not accept "infinity" value

Werner

On 28.07.2014 05:31, David Grieve wrote:

Hi Werner,

Please file a bug. I'll have to update the parser to accept 'infinity'
as a value.


Double.MAX_VALUE in CSS -fx-max-width?

2014-07-24 Thread Werner Lehmann

Hi,

since FX8 we have a styleable property -fx-max-width on Region. I'd like 
to use this to replace the FXML attribute




with CSS

-fx-max-width: Infinity;

This is actually a notation to achieve the equivalent of this code:

  node.setMaxWidth(Double.MAX_VALUE);

Unfortunately it does not work like this in css. Normal values are 
accepted and seem to work but not this one. Maybe there is some special 
handing in the FXMLLoader to treat Infinity like MAX_VALUE? In any case, 
can this be done in css - maybe with a different workaround?


Rgds
Werner


Skin layoutChildren: when to get bounds of child nodes?

2014-07-24 Thread Werner Lehmann

Hi,

inside a control skin I have the following code pattern:

  protected void layoutChildren(...)
  {
super.layoutChildren(...);

Node child1 = ...
Bounds bip = child1.getBoundsInParent();

if (!animating) {
  Node child2 = ...
  child2.setTranslateX(bip.getMinX();
  child2.setPrefWidth(bip.getWidth());
}
  }

The skin scene graph looks roughly like this:

VBox
  HBox { ..., child1, ...}
  child2
  ...

Everything is layouted just fine but I want to adjust child2.translateX 
and prefWidth based child1 bounds. This does not work initially because 
boundsInParent returns zero components leading to incorrect initial 
display of the control.


Seems as if boundsInParent is not yet updated. I guess I could use a 
binding for that but it would conflict with an animation I also have on 
translateX and prefWidth.


Maybe there is a better time to make those adjustments on child2?

Rgds
Werner


Re: Mirrored observable collections

2014-07-24 Thread Werner Lehmann

Hi Mike,

well seems as if you can create such a method using StringBinding with 
4-5 lines of code. Personally I wished that StringConverter was a SAM 
interface so that I can just provide a lambda for it. In many cases - 
like yours - it is sufficient to implement the toString method...


Werner

On 23.07.2014 16:28, Mike Hearn wrote:

Yes createStringBinding helps but is verbose and repetitive. format()
requires the formatting to be specifiable with format codes, not Java.
What I want is basically

bindBidirectional(Property stringProperty, Property
otherProperty, StringConverter converter)

but with a signature of

bind(Property stringProperty, ReadOnlyProperty otherProperty,
StringConverter converter)

as in practice this is often what's wanted when converting data model
objects into labels.


Re: Mirrored observable collections

2014-07-23 Thread Werner Lehmann

Hi,

take a look at Bindings.format and Bindings.createStringBinding for 
that. I use it all the time.


Werner

On 23.07.2014 13:16, Mike Hearn wrote:

Incidentally the lack of a uni-directional string binding utility in JavaFX
is really annoying: converting a read only observable value into a string
is a really common thing to want to do!


Re: ComboBox: TestEditor to ListView binding

2014-07-07 Thread Werner Lehmann

Kirill,

ControlsFX has support for this if a 3rd party lib is ok. With 
TextFields.createClearableTextField() you create a search field with an 
"eraser" icon to clear the text. And the AutoCompletionBinding applied 
to the textfield implements the auto complete dropdown. You only have to 
provide a function to return search results for user input.


Werner

On 04.07.2014 23:48, Kirill Kirichenko wrote:

I'm implementing a searchbox.
In the textfield of the combobox I'm typing a search string.
textProperty of the editor has an onChange listener which forms a list
of strings that contain the text as a substring. Then I set this list of
strings as a content of the drop down list of the combobox.
The problem is when I start selecting items in the drop down list the
editor field gets updated making new substring search and updating the
list again.
I want to break this dependency. I don't want to update the text
property when I select an item in the drop down list OR I want to
distinguish in the textProperty listener what caused that event - real
editing the field or setting the field trough binding from the list view.

I hope I could make myself clear.
K


Re: New alias for hg commit notifications?

2014-06-24 Thread Werner Lehmann

+1

I was filtering these anyway to a separate mail folder.

Werner

On 24.06.2014 15:34, Kevin Rushforth wrote:

What do others think?


Re: ScrollPane.content moves with arrow keys

2014-06-10 Thread Werner Lehmann

It affects 8u5 as well:

[#RT-37491] ScrollPane content can be moved around with arrow keys
https://javafx-jira.kenai.com/browse/RT-37491

Werner

On 10.06.2014 18:30, Eric Le Ponner wrote:

Curious indeed :)
And probably not intended you’re right.

Note that Scene Builder 2.0 embeds its own jdk.
So it means the problem can be reproduced with FX8 GA release.

Eric




Re: New skinning in FX8 – where do the style classes go

2014-06-10 Thread Werner Lehmann

Hi Randahl,

see this wiki page...
https://wiki.openjdk.java.net/display/OpenJFX/UI+Controls+Architecture

and below:

On 10.06.2014 19:18, Randahl Fink Isaksen wrote:

Object ◀︎—— SkinBase ◀︎—— MySkin ——>  MySkinControl


The new SkinBase is returning a modifiable version of the control's 
children. The FX2 way was actually more convoluted with 
behind-the-scenes copying of properties but I think that is covered on 
the wiki.



One problem is, whenever I have a control MyControl using a skin
class MySkin I used to be able to change the style class of MyControl
and those changes would automatically be reflected by MySkin. Now
with FX8 when I change the style class of MyControl, nothing
happens.


This works for me. Maybe your css selectors need to be adjusted. After 
all the node hierarchy no longer has an extra skin node.



Am I supposed to bind the styleClass property of my MySkinControl
instance to the styleClass of my MyControl instance?


Certainly not.

In my opinion the control creation process is quite simple now. Create a 
new control class, set the style class, and provide the default skin by 
overriding createDefaultSkin(). Here you return an instance of your skin 
which extends SkinBase. Which is where you observe the control 
properties as usual. And use SkinBase.getChildren to add skin content.


Werner



ScrollPane.content moves with arrow keys

2014-06-10 Thread Werner Lehmann

Hi,

we came across a curious behavior of ScrollPane in 8u5: the scrollpane 
content can be moved around with arrow keys if it is smaller than the 
viewport. This can be reproduced in SceneBuilder with simple FXML:









http://javafx.com/javafx/8"; xmlns:fx="http://javafx.com/fxml/1";>
   
  
   



Just a scrollpane with a checkbox in it. It looks like a bug to me but 
maybe I am missing something?


Werner


Re: Label baseline offset with a graphic

2014-06-03 Thread Werner Lehmann

Hi Martin,

excellent - then I don't have to start looking for workarounds.

Werner

On 03.06.2014 14:25, Martin Sladecek wrote:

Hi Werner,
this has changed in 8u20. Seehttps://javafx-jira.kenai.com/browse/RT-36729

-Martin


Label baseline offset with a graphic

2014-06-03 Thread Werner Lehmann

Hi,

I am trying to align labels on their baseline in an hbox. This is 
surprisingly difficult if some of the labels have a graphic (on the 
left). Turns out that


   LabeledSkinBase.computeBaselineOffset()

simply uses the max of the text baseline and the height of the graphic:

   h = Math.max(textBaselineOffset, g.prefHeight(-1));

So, if the label has no graphic its height is 17 with baseline 13. With 
a 16x16 graphic the height is still 17 but the baseline changes to 16. 
Which of course messes up the baseline alignment to other controls.


Doesn't it make more sense to use the baseline of the actual text 
(possibly adjusted if the graphic is big)?


Screenshot: http://postimg.org/image/kv12r24z9/

Werner


Re: Resizing stage creates delays in platform.runLater pool?

2014-06-02 Thread Werner Lehmann
Probably not (that code is gone so I don't know for sure). For some 
other (Mac-related) reason, the software pipeline was already used for 
our internal testing. Didn't seem to make a difference.


FWIW, there was also an NPE occurring if someone was crazy enough to 
show that popup many times by clicking on the button which triggers it - 
while the previous animation did not yet finish. I think two animations 
were competing over the same animated properties if that is even 
possible. Anyway, not an issue anymore.


Werner

On 02.06.2014 17:16, Stephen F Northover wrote:

Does running with the software pipeline fix the problem as suggested in
https://javafx-jira.kenai.com/browse/RT-36796 ?

Steve


Re: Resizing stage creates delays in platform.runLater pool?

2014-06-02 Thread Werner Lehmann
We also experienced laggy animation with a "stage slide out/down" 
animation. The animation would change stage size and it appeared to have 
only 2 or 3 frames. Workaround was to use a different animation style: 
keep stage size but move it 20 px down while changing opacity from low 
to full, both animated. Maybe this is an option for you, too.


Werner

On 02.06.2014 16:20, Guillaume Anctil wrote:

Does anyone know what is at play here, what underlying system creates the
lag and how to avoid this?


Re: Integrating JFX Dialog/Stage in Swing application

2014-05-31 Thread Werner Lehmann

Hi Robert,

the problem with this is that the stage cannot have a swing window as 
its owner. If users misclick the stage will hide behind your main 
window. But if that is acceptable...


Werner

On 31.05.2014 14:27, Robert Krüger wrote:

have a Swing JMenuItem trigger the showing of a JFX stage




Re: Label prefHeight vs wrapText

2014-05-28 Thread Werner Lehmann

Martin,

thanks for the explanation. Feels good to finally understand this ;-)
And while I created a ticket as per your suggestion...

  [#RT-37309] VBox: vshrink layout hint similar to vgrow

...it seems I can use this as a workaround:


label1.minHeightProperty().bind(Bindings.createDoubleBinding(
() -> label1.prefHeight(vbox.getWidth()),
vbox.widthProperty()));


Maybe something similar could be made available per label boolean 
property. So basically the ability to ask a label to consider wrapping 
when calculating its minHeight... I can imagine that this might have 
made more sense as a default behavior: if people explicitly ask for 
wrapping text, they would probably accept a larger minHeight.


Werner

On 28.05.2014 16:17, Martin Sladecek wrote:

Hi Werner,
the important min/pref/max height is the one with width parameter as
Label is horizontally biased. So while minHeight(width) == 17,
prefHeight(width) == 34.
But in your case, with ListView's prefHeight == 1000, you'll overflow by
over 400px. VBox does evenly subtract these overflow pixels from
children until it gets to their minimum. Which happens in case of the Label.
Vgrow is ignored when shrinking (see javadoc for setVgrow). Currently,
neither VBox nor GridPane allow you define policy for children when the
pane is below it's pref size and children need to be shrunk. Seems like
a good candidate for a Tweak in JIRA. ;-)
If you need to keep your Label at some height, currently you can only
raise it's minHeight, but I understand that in this case it may be
tricky as it depends on the width.

-Martin


Label prefHeight vs wrapText

2014-05-28 Thread Werner Lehmann

Hi,

I am stumped. With a label and wrapText=true I am not getting wrapped 
text when I think I should. Consider this scene (code at bottom):


VBox
  - Label, long text, wrapText=true
  - ListView, prefHeight=1000 (too big to fit)

This will not wrap the label text. The VBox gives all room to the 
listview and keeps the label on a single line. VBox.vgrow does not 
change this.


Without the prefHeight on the listview I am getting wrapped text. Then, 
label height is 34 - while its min/pref/max height is all at 17 
according to ScenicView.


Why is the label not reporting a pref height of 34?
Why is the vbox sizing the label beyond its max height?

Appreciate any insight because I don't see what's going on.

Rgds
Werner




public class WrapTest extends Application
{
  public static void main(String[] args)
  {
Application.launch(args);
  }

  @Override
  public void start(Stage primaryStage) throws Exception
  {
Label label1 = new Label(Strings.repeat("bla ", 50));
label1.setWrapText(true);

ListView lv = new ListView();
lv.setPrefHeight(1000);

VBox vb = new VBox(label1, lv);
Scene scene = new Scene(vb, 800, 600);
primaryStage.setScene(scene);
primaryStage.show();
  }
}


Re: How to force pixels to hit the screen?

2014-05-21 Thread Werner Lehmann
Did you try to lower the priority of your thread(s)? Also, I the 
suggestion to wait a few frames, e.g. on the AnimationTimer, made a lot 
of sense to me. This will of course slow down total startup time but 
there is a better chance of having a complete splash screen.


I am also wondering if there could be some kind of trigger to know when 
the splash has hit the screen? Maybe SplashScreen.layoutChildren could 
spawn a worker thread (or use runLater) to initialize the rest of the 
application.


Werner

On 21.05.2014 09:43, Mike Hearn wrote:

if there was a way to make the render thread higher priority than the
rest, that might also work


Re: No split-cursor inside JFXPanel

2014-03-12 Thread Werner Lehmann

Hi Anthony,

I noticed the movement on the ticket ;-)  Very good news, thx for 
looking into this!


Werner

On 11.03.2014 18:28, Anthony Petrov wrote:

Hi Werner,

I've re-targeted this bug to 8u20.

--
best regards,
Anthony

On 3/7/2014 9:27 PM, Werner Lehmann wrote:

Hi,

inside a JFXPanel we don't see the split-cursors (e.g. east/west). This
is a known issue:

[#RT-26235] SplitPane in JFXPanel: Mouse cursor not changed
https://javafx-jira.kenai.com/browse/RT-26235

This affects regular splitpanes as well as custom nodes which just use
those cursors. The fix version for this is 9. This is going to be a
highly visible issue in our application when we convert more parts to
JFXPanels this year. Can this fix be done for one of the upcoming 8uXX
releases instead?

Thanks,
Werner


No split-cursor inside JFXPanel

2014-03-07 Thread Werner Lehmann

Hi,

inside a JFXPanel we don't see the split-cursors (e.g. east/west). This 
is a known issue:


[#RT-26235] SplitPane in JFXPanel: Mouse cursor not changed
https://javafx-jira.kenai.com/browse/RT-26235

This affects regular splitpanes as well as custom nodes which just use 
those cursors. The fix version for this is 9. This is going to be a 
highly visible issue in our application when we convert more parts to 
JFXPanels this year. Can this fix be done for one of the upcoming 8uXX 
releases instead?


Thanks,
Werner


Can't gc a node removed from its scene

2014-02-26 Thread Werner Lehmann

Hi,

I have removed a node from its scene. Node.scene and Node.parent both 
are null. However, inner classes of the Scene seem to keep a reference:


Scene.ClickGenerator.pressedTargets
Scene.ClickGenerator.releasedTargets
Scene.MouseHandler.pdrEventTargets

See http://imgur.com/L8dRQDW for a strong reference chain example. Any 
idea how I can have this cleaned up? Thx... (this is on J7 btw)


Werner


Re: Reloading stylesheets

2013-12-10 Thread Werner Lehmann

Makes sense. Thanks!

On 10.12.2013 17:09, David Grieve wrote:

The way it works in 8.0 is that there is a cache of loaded stylesheets. [...]


Re: Reloading stylesheets

2013-12-10 Thread Werner Lehmann
Interesting. Assuming the stylesheets are still cached, how would it 
know when to reload and not use the cached sheet? Or has sheet 
processing been optimized so much that caching is not necessary anymore...


On 10.12.2013 16:15, Tom Schindl wrote:

No on FX8 you need to remove and readd them! So the only thing different
is that you omit the reload-call on FX8.


Re: Reloading stylesheets

2013-12-10 Thread Werner Lehmann
Got it. The key was to move the stylesheets from the root node to the 
scene before reloading them:


scene.styleSheets.clear
scene.styleSheets.addAll(root.styleSheets)
root.styleSheets.clear
styleManager.reload(scene)

The hotkey also works now: shift+ctrl+7 reloads CSS while the scene is 
visible. This works by using a custom scene, overriding 
impl_processKeyEvent. Even better would be automatic change-detection 
(in debug mode only) but I don't have time to do this now. Previously 
you said that reloading is not needed on FX8... does this work out of 
the box then?


Werner

On 10.12.2013 14:10, Tom Schindl wrote:

My code does:


// Force CSS-Reloading
if( isJavaFX2() ) {
   ReflectiveInvoke.onStyleManagerClass(scene);
}

scene.getStylesheets().clear(); 
scene.getStylesheets().addAll(contentData.cssFiles);


A difference I see is that your stylesheets are on the Root-Container
whereas mine are directly on the Scene.

Tom


Re: Reloading stylesheets

2013-12-10 Thread Werner Lehmann

Thanks, Tom. Somehow it does not work for me. Any idea?

Basically this is what I am doing:

Parent root = ...
root.getStyleSheets().add(...stylesheets...)
Scene scene = new Scene(root)
StyleManager.getInstance().reloadStylesheets(scene)

Then I show the scene in a JFXPanel, change and save the stylesheet in 
Eclipse, and reopen the window which repeats all of the above. But the 
css changes are not reflected until I restart the application.


On 10.12.2013 13:30, Tom Schindl wrote:

com.sun.javafx.css.StyleManager.getInstance().reloadStylesheets(scene);


Reloading stylesheets

2013-12-10 Thread Werner Lehmann

Hi,

is there a way to reload previously loaded stylesheets (in FX2)?

Currently I have to restart the application each time I am changing the 
css. It would be nice to just close and reopen that window instead to 
see the new styles. I'd like to unload css automatically when closing a 
window - in debug mode - in order to avoid the application restart.


Or, even better, define a hotkey to update css immediately. Much like 
shift+ctrl+8 for ScenicView (only works in FX2 as far as I know).


Rgds
Werner


Re: Look and feel mechanism?

2013-12-09 Thread Werner Lehmann
By the way, platform order of dialog buttons is implemented by the 
ButtonBar control in ControlsFX. It is of course Java8 only but can 
easily be brought back to FX2.


Werner

On 09.12.2013 10:45, Hendrik Ebbers wrote:

Next to the skinning of controls additional features are needed. One
example that was already mentioned is the order of cancel and ok
buttons. Actually there is no support in JavaFX. If basic dialogs
would support this features a definition of the order etc. is needed.
This can be done by using a plugin for the L&F API, too.


Re: Focus handling on custom controls

2013-11-21 Thread Werner Lehmann
Interesting idea with those textfield insets. I have noticed that the 
FX2 combobox may not do this right because the cursor can be moved 
"behind" the combobox button. I'll give it a shot. Would still be nice 
to see how this would be done properly...


Werner

On 20.11.2013 13:57, Scott Palmer wrote:

I did this by putting a TextField and a button in a region, and
positioning the button manually in the layout method to be just
inside the right edge of the TextField. Simple manipulation of the
TextField's insets in the CSS prevents the text from going under the
button. I set the button so that it isn't focusable.  It isn't a
proper "skin", but it works for my purposes.

Scott


Focus handling on custom controls

2013-11-20 Thread Werner Lehmann

Hi,

I made a custom control and am trying to get the focus handling right. 
This is a textfield with some buttons on the right hand side, e.g. an 
ellipsis button:


http://i.imgur.com/naPzK1W.png

The control skin basically is an hbox with a textfield and a few 
stackpanes as its children. The question is now how can I have this 
control focused while user input goes into the embedded textfield?


I worked around this by removing focus style from the textfield and 
styling the outer control as focused when the textfield actually has the 
focus - that's a bit faked, of course since the actual focus owner is 
still the embedded textfield. Maybe input events need to be captured on 
the outer control and rerouted to the textfield? How would I adjust 
source/target on the events then?


BTW, this is on FX2 so I don't have layoutChildren(x,y,w,h) - but the 
question would apply to other custom control types, too.


Rgds
Werner


H/V resize cursors in a JFXPanel

2013-11-18 Thread Werner Lehmann

Hi,

still on FX2 I am plagued with a bug that prevents getting h-resize 
(split) cursor in a JFXPanel. This is a known and acknowledged issue, see


[#RT-26235] SplitPane in JFXPanel: Mouse cursor not changed

I have looked some more into this and noticed that this really seems to 
affect the h/v-resize cursors only, other cursors work fine, even on a 
JFXPanel. So I am wondering if this might be related to


[#RT-32507] Cursor.cursor does not accept cursor names with hyphens

which revolves around h-resize versus h_resize. This is contradicted 
though by the fact that RT-26235 is unresolved in 8 (and even scheduled 
only for 9) while RT-32507 is supposed to be fixed in 8.


The split cursor is missing everywhere: on a splitpane, on the columns 
of a tableview, on custom controls - all inside JFXPanel, of course. I 
tried to work around this by using "-fx-cursor: h_resize" instead of 
"-fx-cursor: h-resize" but that helps only outside of a JFXPanel (and 
will probably be broken with FX8). Also tried to work around by setting 
the cursor in code: setCursor(Cursor.H_RESIZE) - but even then only 
other cursors work, not the h/v resize ones.


Any ideas to make this work for FX2 (and maybe even for FX8 considering 
the fix version for RT-26235)?


Rgds
Werner


Re: bugfix mode

2013-10-20 Thread Werner Lehmann

Hi Tom,

I am also getting lots of these on 2.2.40. For example, running my 
otherwise unchanged backport of the ControlsFX property sheet creates 
those. There are some tickets filed not all of which are resolved. And 
of course this is resolved as in FX8+-resolved, so I don't really know 
what to do with it for 2.2. Fortunately, the situation is much much 
worse in my test application. On the real thing I get none, or only a few.


Just last week we got these warnings because CSS values could not be 
resolved although they were defined in the same stylesheet. I guess that 
is similar to caspian. This is how the stylesheet looked like:


.root {
  color1: ...
  ...
}

.somestyleclass {
  -fx-background-color: color1;
  ...
}

It would complain about not being able to resolve color1 - while still 
showing the correct result eventually. As a workaround we could move the 
.root section to another "default" stylesheet which was added earlier to 
the scene. I am still unsure about the official way to implement an 
application-wide default stylesheet on FX2. So I am just adding it 
manually to all my scenes.


Werner

On 19.10.2013 09:00, Tom Eugelink wrote:

I am seeing these warnings when starting JFXtras CalendarPicker using
JDK 1.7.0_45. There is not much information to go on. Is there any
way to git more information?


Re: Checkboxes in a combobox popup

2013-09-16 Thread Werner Lehmann

Jasper,

a listview does not seem to use a ScrollPane. That's what its 
virtualization effort is about, using the VirtualFlow instead. Or do you 
mean I should nest the popup listview in a scrollpane?


The MenuButton approach would be completely different and seems to have 
a few disadvantages of its own:


- no virtualization so all those checkboxes would have to be created in 
advance

- no scrolling through as few as 100 items... (and there can be more)
- it is also not really a multiselect control which would allow users to 
quickly toggle some items without having to open the menu again for each 
of them


Werner

On 16.09.2013 16:58, Jasper Potts wrote:

You could try
http://docs.oracle.com/javafx/2/api/javafx/scene/control/ScrollPane.html#setFitToWidth(boolean)


Or what about using MenuButton with check box menu items?


Re: Checkboxes in a combobox popup

2013-09-16 Thread Werner Lehmann
Never mind. I tried to cut some corners reusing a combobox for a 
"checkbox list popup" but this got too complicated. I am using a 
ComboBoxBase extending class now.


Unfortunately it is still quite hard to determine a useful listview size 
for the popup. The original combobox uses package private stuff and hard 
casts on the listview's virtual flow. Obviously I cannot do this.


http://i.imgur.com/5rNDCYT.png

Any idea how I can get rid of the horizontal scrollbar on the listview? 
Is there trick how to size the cells so that they always get the 
available horizontal space - but not more?


Rgds
Werner

On 14.09.2013 00:13, Werner Lehmann wrote:

Hi,

I am displaying checkboxes in the popup of a combobox via custom cell
factory. Only problem is that a click on the checkbox actually hides the
popup, even before that checkbox was selected. As I can see, the
combobox skin has a MOUSE_PRESSED event filter which hides the popup.

Current workaround is:
- get the listview from the combobox skin
- set a MOUSE_PRESSED filter on its parent
- in the filter detect a click on a checkbox (sets a flag)
- override combobox.hide, ignore the hide if the flag was set before

The other workaround is to make listview think that the click was on a
scrollbar by adding "track" to the styleclasses of all checkbox skin
nodes. Then the listview would ignore the click, too.

Both options seem to be... less optimal. Any other idea?

Rgds
Werner


Checkboxes in a combobox popup

2013-09-13 Thread Werner Lehmann

Hi,

I am displaying checkboxes in the popup of a combobox via custom cell 
factory. Only problem is that a click on the checkbox actually hides the 
popup, even before that checkbox was selected. As I can see, the 
combobox skin has a MOUSE_PRESSED event filter which hides the popup.


Current workaround is:
- get the listview from the combobox skin
- set a MOUSE_PRESSED filter on its parent
- in the filter detect a click on a checkbox (sets a flag)
- override combobox.hide, ignore the hide if the flag was set before

The other workaround is to make listview think that the click was on a 
scrollbar by adding "track" to the styleclasses of all checkbox skin 
nodes. Then the listview would ignore the click, too.


Both options seem to be... less optimal. Any other idea?

Rgds
Werner


Re: FocusModel too restricted?

2013-09-02 Thread Werner Lehmann

Jonathan,

appreciate your elaborate answer. I arrived at the same conlusion, not 
to use the "official" FocusModel. There wasn't any hope to get changes 
for 2.2 anyway. It just felt as if it could have been a good match 
because a subset of it would fit perfectly, namely the focused item 
property and methods to focus the next/prev item. I wouldn't have 
supported a pluggable focusmodel anyway, there's not much to gain from that.


In the end I guess my point is that TreeView and TreeTableView would 
have benefitted from the above mentioned subset with item-based focusing 
as well. In a treeview you don't really care about the focused index. I 
think. Especially if it changes everytime something is expanded or 
collapsed. And ListView etc. would extend that simple focusmodel to add 
index-based focus operations.


As to the "fake" focus inside a listview vs this property sheet 
component: currently I am supporting something like a focused row with 
property name and editor. This row is highlighted and can be 
(fake-)focused even if the property editor is disabled. So it is similar 
to a Listview. Basically, having a fake focus does not mean I cannot 
have a "real" focus on a property editor, too ;-)


Werner


FocusModel too restricted?

2013-09-01 Thread Werner Lehmann

Hi,

I am trying to use FocusModel in a custom property sheet component - it 
is probably a good idea to reuse as much API as possible and make 
components work similar to each other. However, the focus model makes 
this more difficult than it should be:


1. Why is it index-based? With methods like focusNext and focusPrevious 
it should not really require an ordered, index-based list. The TreeView 
focus model shows how this requires non-trivial extra effort if the data 
model is not similar to a plain list.


2. Why is setFocusedItem package private and final? With this I cannot 
even provide a new method "focus(item)" because I cannot call 
setFocusedItem internally. My users would have to translate their item 
into an index to be able to focus it. The TableViewFocusModel seems to 
have the same problem - but it is in the same package and can simply 
cheat on package private methods!


To make this still work I'd have to provide index-based access to a 
tree-like data model. And to allow operations like focus(item) I'd have 
to translate the item to an index to call focus(index) instead - 
although I don't even need that index, and providing it is extra effort.


Does it make sense to lift some of these restrictions?
- no index-based requirement
- less final/package-private methods

Similar things can be said about the selection model...

Werner


Re: Exception in one JFXPanel kills other JFXPanels, too

2013-08-13 Thread Werner Lehmann

Sure: https://javafx-jira.kenai.com/browse/RT-32304

On 13.08.2013 15:10, Artem Ananiev wrote:

it looks like a bug in JFXPanel, could you file it to JIRA with a test
case, please?


Re: Swing and JavaFX thread merge

2013-08-13 Thread Werner Lehmann

Artem,

we already tested with 7u40 b35 - same thing:


Java Web Start 10.40.2.35
Using JRE version 1.7.0_40-ea-b35 Java HotSpot(TM) 64-Bit Server VM

...

runTest in AWT-EventQueue-2
jfx button click in JavaFX Application Thread
invokeLater from jfx button click in AWT-EventQueue-0
jbutton click in AWT-EventQueue-2
jfx button click in JavaFX Application Thread
invokeLater from jfx button click in AWT-EventQueue-0
jbutton click in AWT-EventQueue-2


Werner

On 13.08.2013 16:31, Artem Ananiev wrote:

Jeff, Werner,

thank you very much for detailed evaluation. The issues you observe may
be related to recent changes in AWT/Swing in 7u25. If my guess is
correct, they should be fixed in the latest 7u40 builds. I know it's not
released yet, but early access builds are available at java.net. Could
you run your apps with 7u40 and check if the problems are gone, please?

Thanks,

Artem


Exception in one JFXPanel kills other JFXPanels, too

2013-08-13 Thread Werner Lehmann

Hi,

I have noticed the following problem with exception handling and 
multiple JFXPanels (FX 2.2):


1. Two JFXPanels, J1 and J2
2. Throw NPE in layoutChildren of a control inside J1

This would print a stacktrace (see below). Then J2 is blocked: mouse 
clicks have no effect anymore. I think I have seen something similar 
with invalid FXML but did not check again now. On the other hand, if a 
button action-event handler throws an exception everything is fine: 
stacktrace is printed but the JFXPanels stay alive.


What is the deal here? When are exceptions "lethal", and what can I do 
to protect against this, preferably without adding a try..catch to each 
layoutChildren (and whereever else this might be needed)...


Werner


java.lang.NullPointerException: kaboom
at 
mint.javafx.scene.layout.designerpane.MintDesignerPane.layoutChildren(MintDesignerPane.java:192)
at javafx.scene.Parent.layout(Parent.java:1018)
at javafx.scene.Parent.layout(Parent.java:1028)
at javafx.scene.Scene.layoutDirtyRoots(Scene.java:513)
at javafx.scene.Scene.doLayoutPass(Scene.java:484)
at javafx.scene.Scene.access$3900(Scene.java:169)
at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2199)
at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:363)
at 
com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:460)
at 
com.sun.javafx.tk.quantum.QuantumToolkit$9.run(QuantumToolkit.java:329)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at 
com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
at java.lang.Thread.run(Unknown Source)




Re: Swing and JavaFX thread merge

2013-08-12 Thread Werner Lehmann

Hi,

coincidentally we were experiencing the exact same problem with the 
combination 7u25, OSX, Webstart. Also, we arrived at pretty much the 
same workaround.


Investigation showed that multiple Swing eventqueues were created in the 
above configuration. This would cause threading issues (NPE), paint 
issues (flicker etc), drag-drop issues.


See below for a testcase: JFrame with a JButton and an fx button. When 
clicked, the former prints its current thread, while the later switches 
to EDT first (invokeLater) and then also prints the thread. On Windows, 
this turns out to be the same thread as expected. On WebStart 7u25 OSX 
we are getting different AWT-EventQueue-X threads.


Werner


public class TestSwingEDT extends JFrame{

  public static void main(final String[] args){
SwingUtilities.invokeLater(new Runnable() {
  @Override
  public void run() {
new TestSwingEDT().runTest(args);
  }
});
  }

  private void runTest(String[] args){

System.out.println("runTest in " + Thread.currentThread().getName());

this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setSize(300, 200);

final JFXPanel jfxPanel = new JFXPanel();
Platform.runLater(new Runnable(){
  @Override
  public void run() {
Button btn = new Button("click me");
btn.onActionProperty().set(new EventHandler() {
  @Override public void handle(ActionEvent ae) {
System.out.println("jfx button click in " + 
Thread.currentThread().getName());
SwingUtilities.invokeLater(new Runnable() {
  @Override public void run() {
System.out.println("invokeLater from jfx button click in " + 
Thread.currentThread().getName());
  }
});
  }
});
HBox hbox = new HBox();
hbox.getChildren().add(btn);
jfxPanel.setScene(new Scene(hbox));
  }
});

JButton jbutton = new JButton("click me");
jbutton.addActionListener(new ActionListener() {
  @Override public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("jbutton click in " + 
Thread.currentThread().getName());
  }
});

JPanel rootPanel = new JPanel();
rootPanel.add(jbutton);

this.getContentPane().add(jfxPanel, BorderLayout.NORTH);
this.getContentPane().add(rootPanel, BorderLayout.CENTER);

this.setVisible(true);

Platform.runLater(new Runnable(){
  @Override
  public void run() {
SwingUtilities.invokeLater(new Runnable() {
  @Override
  public void run() {
System.out.println("invokeLater in Platform.runLater in " + 
Thread.currentThread().getName());
  }
});
  }
});

  }
}


Re: Missed "pulse"?

2013-07-31 Thread Werner Lehmann
Easy trap with invalidation listeners. If you don't get the property 
value after invalidation, the property remains invalidated and 
subsequent changes won't trigger another invalidation. To fix this, 
simply get the value (for nothing), or switch to change listeners...


You probably know this by now but maybe somebody else didn't...

Werner

On 31.07.2013 10:47, Diego Cirujano-Cuesta wrote:

One of the problems was, I was using invalidation listeners and I
wasn't getting always the value


Re: Can JavaFX do CAD?

2013-07-29 Thread Werner Lehmann
Good questions. I've had experience with some of these, building a GUI 
designer. At this stage customers will use it to build input forms. 
Later it is supposed to grow into sort of a report designer.


The core is a custom component containing a ScrollPane containing a 
content pane. And that pane has several transparent layers spanning the 
whole (scrolled) content area. There are layers for a grid, the content 
items, selection, decoration, and hints. There've been rough edges and 
workarounds but I am quite happy with the result. This would have been 
more difficult in Swing.


On 24.07.2013 01:21, Daniel Zwolenski wrote:

- How best to represent large numbers of complex shapes efficiently, and when 
to add shapes to the scene (add all and let jfx clip, or manually work out what 
should be showing, etc)


Fortunately my scenes are usually not that complex. A few 10k nodes can 
be expected.



- How best to handle font scaling and image scaling when rendered in a zoomed 
in/out viewport


I have not looked into this. I guess it would be relevant for us to 
support touch.



- How best to do panning and zooming with dynamic level of detail


Dynamic level of detail is another important one. We may need to address 
this for a different component, showing tons of data which can be zoomed 
in/out.



- How best to do the top level display in terms of panes vs regions vs canvas, 
vs whatever, how to manage overlays and layers (sharing same coordinate space, 
etc)
- How best to do picking, mouse overs, dragging across the 'display'
- How best to do infinite or dynamic  bounds so you can add and move shapes and 
the scrolling adjusts accordingly.


As described above, several pane/region based layers in a scrollpane 
work satisfactorily for us. Bounds are already dynamic, simply resize 
the ScrollPane content node. Mouse picking, dragging, etc. works with 
mouse event filters on the scrolled content node.


Werner


Re: Can JavaFX do CAD?

2013-07-29 Thread Werner Lehmann
Wouldn't this be covered by Shape.union? Obviously it depends on how 
union is implemented under the sheets, but it seems to me as if there 
was an opportunity to optimize it like that.


Werner

On 24.07.2013 21:06, Richard Bair wrote:

I filed an RFE a little while ago for a "LineGroup" or something like
that (I don't remember what I called it). But basically it is
supposed to be a Shape which is just a bunch of independent lines.
You could draw them much like a path with line-to's, but instead of
generating a single path. But you'd still have problems when it comes
to performance if we end up having to send down multiple textures for
lines of different orientations / lengths.


Re: Disabling JavaFX minimise/maximise/etc buttons

2013-07-24 Thread Werner Lehmann
I'd like this the most, assuming that a "trim button" is the same as a 
button on the window decoration (not familiar with the term trim 
button). Other than that, I'd also like the ability to minimize a modal 
dialog if that actually minimizes the main window... It is not common on 
Windows but makes a lot of sense.


Werner

On 23.07.2013 23:18, Tom Schindl wrote:

* disable iconification / maxification through trimbar buttons
   =>  then I'd vote for the possibility to set the buttons enabled on
  stage through a list-property and an enum

   In code this would be:
   Stage s = new Stage();
   s.setTrimButtons(TrimButton... buttons)




Re: Disabling JavaFX minimise/maximise/etc buttons

2013-07-23 Thread Werner Lehmann

On 23.07.2013 12:39, Artem Ananiev wrote:

To me, making a window non-resizable is a good way to make the window
unmaximizable. Do you see any cases, when a window should be resizable,
but not maximizable?


I create resizable modal dialogs on a frequent basis. To me, sizability 
is a convenience for the user. At the same time, modal dialogs should 
not be maximized. My opinion.



Unminimizable windows are annoying. If we disable that, we'll likely get
some weirdness, e.g. Win+M or Win+D on Windows will leave the window on
the desktop, which is not what users expect.


Minimizing a modal dialog does not achieve much because the owning 
window is still blocked. Unless that window is minimized along. At least 
Windows usually disables the window decoration buttons of the owning 
window though.


Werner


Re: Thread checks in Glass

2013-07-22 Thread Werner Lehmann

Seems as if the ticket isn't public...

On 22.07.2013 11:06, Petr Pchelko wrote:

You can follow progress inhttps://javafx-jira.kenai.com/browse/RT-26891


Re: Validate cell, or request a cell update

2013-07-09 Thread Werner Lehmann
Ok - this means that in Cell.updateItem I would have to add a (weak?) 
listener to the item's state property. If the cell is reused for another 
item I would have to remove the old listener first. My only concern is 
that this will be done a lot when scrolling through the list. Thanks...



If the data item isn't observable, then you need a way to manually poke it.


Basically I can only talk from the Cell to the item, not vice versa. 
Unless I would store the cell reference in the item, not a good idea. 
So if item state changes, it must be observable from the cell, in some way.


Werner

On 09.07.2013 19:28, Richard Bair wrote:

I think this is different. The idea was that you would bind state on
the cell to the item it is representing, so that it is automatically
updated when needed and then there is no need to manually poke it. If
the data item isn't observable, then you need a way to manually poke
it.


Validate cell, or request a cell update

2013-07-09 Thread Werner Lehmann

Hi,

Jonathan's question about Cell.updateItem rang a bell. Earlier this year 
I used a listview with a cell factory and had to resort to a dirty trick 
to get individual items to update in the SG if the underlying data had 
changed. I am hoping for a non-dirty solution - otherwise I might create 
an improvement ticket.


In this usecase, the listview items show a status icon, e.g. a checkmark 
or warning icon. Now, if that state changes there does not seem to be a 
way to ask the listview to update the visuals of a particular item in 
the listview. I ended up keeping weakreferences of all cells when they 
are created in (my) factory, and then using cell.validationStateChanged 
on each of the cells, in hopes that we don't have many cells and that 
one of them would represent the item in the SG.


The main problem here is that listview has no means to request an update 
of individual items, and references to cells are not available publicly 
(which is ok).


Would this be related to the current "node validation" thread? I.e., 
revalidate the whole listview to have one icon replaced in one item...


Werner


Re: [API Review]: Add 'fxml.version' to System Properties (Was: FXML version number)

2013-07-09 Thread Werner Lehmann

Hi,

I don't particularly prefer one way or another but the first thing which 
came to my mind is to use a processing instruction. Especially because 
it can be "used by tools somehow". XML itself shows this:




My 2c.

Werner

On 09.07.2013 09:06, Milan Kubec wrote:

This information can be then used by tools somehow.


Re: Stroke-border issues

2013-06-20 Thread Werner Lehmann

On 20.06.2013 19:49, Richard Bair wrote:

It might only be for shapes, would have to look into the code for
region to see if there is a way to manipulate the strokes, Generally
we don't use strokes on regions ourselves, since they go down a
slower code path than fills.


True... but I need to support dashed, dotted, etc and that node also 
cannot be opaque. I believe this won't work with stacked background fills...


On 20.06.2013 20:01, David Grieve wrote:

Try '-fx-border-style solid inside;'


Tried it already. See 5th stackpane in my screenshot. Some "interesting" 
result.


http://s13.postimg.org/ujcl7lxt3/borders_and_bounds.png

Werner


Re: Stroke-border issues

2013-06-20 Thread Werner Lehmann
Sounds interesting - but isn't this only for shapes? How would I apply 
this to a Region border...


On 20.06.2013 19:26, Richard Bair wrote:

I think what you're looking for is 
StrokeType:http://docs.oracle.com/javafx/2/api/javafx/scene/shape/StrokeType.html


Stroke-border issues

2013-06-20 Thread Werner Lehmann

Hi,

I am experiencing some difficulties with border css. Not sure if those 
are bugs or "I am holding it wrong". The main problem is that I don't 
get a border to grow inside while keeping the bounds-in-parent 
unchanged. Maybe fx-border-insets is part of the solution but then I am 
not sure how this works (and the documentation does not say).


http://s13.postimg.org/ujcl7lxt3/borders_and_bounds.png

On this screenshot we have 5 StackPanes with prefSize 800x120 and 
different border css. The bottom three are highlighted by ScenicView to 
visualize their bounds.


Observations:

1. fx-border-width changes bounds-in-parent. This may be normal if no 
other styles are set. But why is there some "empty margin" outside of 
the visible border? This can be seen very clearly in no.3: there is some 
space between the outside of the border and the outside of the yellow 
marked area.


This is a problem because I am using bounds-in-parent to add some 
decoration to the node which obviously includes the empty space because 
of this.


2. An attempt to use -fx-border-insets can be seen in no.4. There is 
still some "margin" - and I already used insets 10 for a border-width 20 
(with insets 20 the effect is even worse). How are those insets supposed 
to work?


3. An attempt to use an inside border does not really help either, see no.5.

Rgds
Werner



public class FxBorderIssues extends Application
{
  public static void main(String[] args) { Application.launch(args); }

  public void start(Stage stage)
  {
stage.setScene(SceneBuilder.create()
.width(1024)
.height(800)
.root(VBoxBuilder.create()
.spacing(30)
.fillWidth(false)
.alignment(Pos.CENTER)
.children(
createStackPane("-fx-border-width:  1; -fx-border-style: solid; 
-fx-border-color: #808080;"),
createStackPane("-fx-border-width: 10; -fx-border-style: solid; 
-fx-border-color: #808080;"),
createStackPane("-fx-border-width: 40; -fx-border-style: solid; 
-fx-border-color: #808080;"),
createStackPane("-fx-border-width: 20; -fx-border-style: solid; 
-fx-border-insets: 10; -fx-border-color: #808080;"),
createStackPane("-fx-border-width: 20; -fx-border-style: solid 
inside; -fx-border-color: #808080;"))
.build())
.build());
stage.show();
  }

  private StackPane createStackPane(String style)
  {
LabelBuilder builder = LabelBuilder.create().style("-fx-font-size: 16;");
Label labelStyle = builder.build();
StackPane.setAlignment(labelStyle, Pos.TOP_LEFT);
Label labelBounds = builder.build();
StackPane.setAlignment(labelBounds, Pos.BOTTOM_RIGHT);

final StackPane stackPane = StackPaneBuilder.create()
  .style(style)
  .prefWidth(800)
  .prefHeight(120)
  .children(labelStyle, labelBounds)
  .build();

labelStyle.textProperty().bind(stackPane.styleProperty());
labelBounds.textProperty().bind(Bindings.createStringBinding(new 
Callable() {
  public String call() throws Exception
  {
Bounds inLayout = stackPane.getLayoutBounds();
Bounds inParent = stackPane.getBoundsInParent();
return String.format(
"layout = (%.1f x %.1f), inParent = (%.1f x %.1f)",
inLayout.getWidth(), inLayout.getHeight(), inParent.getWidth(), 
inParent.getHeight());
  }
}, stackPane.boundsInParentProperty(), stackPane.layoutBoundsProperty()));

return stackPane;
  }
}






  1   2   >