Re: CSS id selector with embedded dot

2017-05-10 Thread David Grieve

Fair enough.

The CSS Reference Guide says " While the JavaFX CSS parser will parse 
valid CSS syntax, it is not a fully compliant CSS parser." Escaped 
characters is a case in point.



On 5/10/17 11:10 AM, Doswald Michael wrote:

On 5/10/17 2:02 PM, David Grieve wrote:

Having an id with a dot is not valid CSS syntax.

 From the spec: " An ID selector contains a "number sign" (U+0023, #)
immediately followed by the ID value, which must be an CSS identifiers."

An identifier is defined here:
https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier. The tldr;
is that an identifier cannot contain a dot.

But in the link you referenced it says:

"Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For 
instance, the identifier "B?" may be written as "B\\?" or "B\26 W\3F"."

Wouldn't that include an escaped dot as a valid character for a CSS identifier?










Re: CSS id selector with embedded dot

2017-05-10 Thread Doswald Michael
On 5/10/17 2:02 PM, David Grieve wrote:
> Having an id with a dot is not valid CSS syntax.
>
> From the spec: " An ID selector contains a "number sign" (U+0023, #) 
> immediately followed by the ID value, which must be an CSS identifiers."
>
> An identifier is defined here: 
> https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier. The tldr; 
> is that an identifier cannot contain a dot.

But in the link you referenced it says:

"Identifiers can also contain escaped characters and any ISO 10646 character as 
a numeric code (see next item). For instance, the identifier "B?" may be 
written as "B\\?" or "B\26 W\3F"."

Wouldn't that include an escaped dot as a valid character for a CSS identifier?








Re: CSS id selector with embedded dot

2017-05-10 Thread Tom Schindl
Infact '#the.button1' means id = the, cssclass = button1

So it would match 

Button b ...;
b.setId("the");
b.getClassNames().add("button1");

Tom

Von meinem iPhone gesendet

> Am 10.05.2017 um 16:02 schrieb David Grieve :
> 
> Having an id with a dot is not valid CSS syntax.
> 
> From the spec: " An ID selector contains a "number sign" (U+0023, #) 
> immediately followed by the ID value, which must be an CSS identifiers."
> 
> An identifier is defined here: 
> https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier. The tldr; is 
> that an identifier cannot contain a dot.
> 
> 
>> On 5/10/17 9:23 AM, Jens Auer wrote:
>> Hi,
>> 
>> I am working on a project which enforces unique FX Id by using a naming 
>> convention mirroring the hierarchical structure of the controls in the name, 
>> delimited by dots. So for example, we have a button "myPane.button1". I am 
>> not able to select this button in a css file. Here is an example program and 
>> the css file:
>> 
>> import javafx.application.Application;
>> import javafx.scene.Scene;
>> import javafx.scene.control.Button;
>> import javafx.scene.layout.VBox;
>> import javafx.stage.Stage;
>> 
>> public class CssTest extends Application {
>> 
>> public static void main(final String[] args) {
>> Application.launch(args);
>> }
>> 
>> @Override
>> public void start(final Stage stage) {
>> VBox vbox = new VBox();
>> Button b1 = new Button();
>> b1.setId("the.button");
>> b1.setText("BUTTON1");
>> 
>> Button b2 = new Button();
>> b2.setId("thebutton");
>> b2.setText("BUTTON2");
>> 
>> vbox.getChildren().addAll(b1, b2);
>> vbox.getStylesheets().add("stylesheet.css");
>> 
>> final Scene scene = new Scene(vbox);
>> 
>> stage.setScene(scene);
>> stage.show();
>> }
>> }
>> The css file is
>> 
>> #the\.button {
>> -fx-graphic: url("Keyboard.png");
>> }
>> 
>> #thebutton {
>> -fx-graphic: url("Keyboard.png");
>> }
>> 
>> As far as I understand the CSS definition the names are valid ids and 
>> escaping should work here. Is this a limitation in the JavaFX CSS parser?
>> 
>> Best wishes,
>> Jens
>> 
>> Jens Auer
>> (Softwareentwicklung)
>> ___
>> Unternehmensberatung H & D GmbH
>> Niederlassung Weißenthurm
>> Werftstr. 5 - 56575 Weißenthurm
>> Tel.:02637/94238 -110
>> Fax:02637/94238 -149
>> jens.a...@h-d-gmbh.de
>> http://www.h-d-gmbh.de
>> http://www.h-d-gmbh.de/impressum.html
>> ___
>> 
> 



Re: CSS id selector with embedded dot

2017-05-10 Thread David Grieve

Having an id with a dot is not valid CSS syntax.

From the spec: " An ID selector contains a "number sign" (U+0023, #) 
immediately followed by the ID value, which must be an CSS identifiers."


An identifier is defined here: 
https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier. The tldr; 
is that an identifier cannot contain a dot.



On 5/10/17 9:23 AM, Jens Auer wrote:

Hi,

I am working on a project which enforces unique FX Id by using a naming convention 
mirroring the hierarchical structure of the controls in the name, delimited by dots. So 
for example, we have a button "myPane.button1". I am not able to select this 
button in a css file. Here is an example program and the css file:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class CssTest extends Application {

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

 @Override
 public void start(final Stage stage) {
 VBox vbox = new VBox();
 Button b1 = new Button();
 b1.setId("the.button");
 b1.setText("BUTTON1");

 Button b2 = new Button();
 b2.setId("thebutton");
 b2.setText("BUTTON2");

 vbox.getChildren().addAll(b1, b2);
 vbox.getStylesheets().add("stylesheet.css");

 final Scene scene = new Scene(vbox);

 stage.setScene(scene);
 stage.show();
 }
}
The css file is

#the\.button {
 -fx-graphic: url("Keyboard.png");
}

#thebutton {
 -fx-graphic: url("Keyboard.png");
}

As far as I understand the CSS definition the names are valid ids and escaping 
should work here. Is this a limitation in the JavaFX CSS parser?

Best wishes,
Jens

Jens Auer
(Softwareentwicklung)
___
Unternehmensberatung H & D GmbH
Niederlassung Weißenthurm
Werftstr. 5 - 56575 Weißenthurm
Tel.:02637/94238 -110
Fax:02637/94238 -149
jens.a...@h-d-gmbh.de
http://www.h-d-gmbh.de
http://www.h-d-gmbh.de/impressum.html
___





CSS id selector with embedded dot

2017-05-10 Thread Jens Auer
Hi,

I am working on a project which enforces unique FX Id by using a naming 
convention mirroring the hierarchical structure of the controls in the name, 
delimited by dots. So for example, we have a button "myPane.button1". I am not 
able to select this button in a css file. Here is an example program and the 
css file:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class CssTest extends Application {

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

@Override
public void start(final Stage stage) {
VBox vbox = new VBox();
Button b1 = new Button();
b1.setId("the.button");
b1.setText("BUTTON1");

Button b2 = new Button();
b2.setId("thebutton");
b2.setText("BUTTON2");

vbox.getChildren().addAll(b1, b2);
vbox.getStylesheets().add("stylesheet.css");

final Scene scene = new Scene(vbox);

stage.setScene(scene);
stage.show();
}
}
The css file is

#the\.button {
-fx-graphic: url("Keyboard.png");
}

#thebutton {
-fx-graphic: url("Keyboard.png");
}

As far as I understand the CSS definition the names are valid ids and escaping 
should work here. Is this a limitation in the JavaFX CSS parser?

Best wishes,
Jens

Jens Auer
(Softwareentwicklung)
___
Unternehmensberatung H & D GmbH
Niederlassung Weißenthurm
Werftstr. 5 - 56575 Weißenthurm
Tel.:            02637/94238 -110
Fax:            02637/94238 -149
jens.a...@h-d-gmbh.de
http://www.h-d-gmbh.de
http://www.h-d-gmbh.de/impressum.html
___