JavaFX TextFlow set default text color - javafx-8

As the title, it's possible to to apply a default color to all text of a TextFlow component?
TextFlow textFlow = new TextFlow();
textFlow.setId("supertextflow");
// Somewhere else in the code
textFlow.getChildren()
.add(new Text("Dynamic added text! OMG!"));
I tryed different solution but none of them works
#supertextflow {
-fx-text-fill: red;
}
#supertextflow * .text{
-fx-fill: red;
}
#supertextflow > * > .text {
-fx-fill: red;
}
I know that Text is another component, but why i can't style it from it's parent?

Well you can't do that with Text cause it's style class doesn't have fill css rule if you look at the JavaFX CSS Reference Guide. So I would suggest to leave the Text and use Label instead. If you do then you could use the css rule below :
#supertextflow > .label {
-fx-text-fill: blue;
-fx-font-size : 20px;
}
In case you want to keep using Text you will have to set each element (Text) inside the FlowPane a specific id (ex. #customText) and then use it to set the CSS rule like below :
#supertextflow > #customText {
-fx-fill: red;
-fx-font-size : 20px;
}
Edit : As James_D mentioned on the commends below you should use Type Selector (I am guessing that's the correct term) on the CSS rule in order to style all the Text nodes inside your TextFlow without needed to set any ids on them :
#supertextflow > Text {
-fx-fill: red;
-fx-font-size : 20px;
}

Related

change font in ionic input

In an ionic app, I am trying to change the font family of input.
in global.css i'm specifing the global font
* {
font-family: 'FFMalmoom' !important;
}
I want the ion-input text in specific page to take another family
i tried:
ion-input {
font-family: 'verdana' !important;
}
ion-input {
--ion-font-family: 'verdana' !important;
}
with no success , It still takes 'FFMalmoom'.
Instead of specifying the global font in the global.scss move it to the :root selector in the variables.scss file with the --ion-font-family css variable
:root {
--ion-font-family: 'FFMalmoom';
}
After that the font will still be applied globally as ionic uses this as the base font for the entire app. You can then set the ion-input font-family as you normally would with
ion-input{
font-family: 'verdana';
}

In ag-Grid when I change the row background, there is no color for selected row (blue by default)

In ag-Grid when I change the row background color, it is working fine, but when I select the row, the color doesn't change to the blue color so I can recognize that the row is selected.
I'm using gridOptions.getRowStyle to change the row background color:
gridOptions.getRowStyle = function(params) {
return { background: "#3a3a3a" }
}
The way I would approach it, would be to use the rowClass option in ag-grid.
rowClass: 'my-row'
And then in your css you can define:
.ag-root .my-row:not(.ag-row-selected) {
background-color: #3a3a3a;
}
https://embed.plnkr.co/fTENsl/
Another option, if you want a custom selected color, would be to use this:
.ag-root .my-row {
background-color: #3a3a3a;
}
.ag-root .my-row.ag-row-selected {
background-color: blue;
}
if you want to change style of selected row use class in css
.ag-row-selected {
background-color: black;
color: white ;
border-color: gray;
}

Set name/label for custom links in TYPO3 RTE

I added a new link class to the TYPO3 (6.2.14) RTE like shown below
RTE {
classesAnchor {
myNewClass {
class = very-long-class additional-class
type = page
}
}
default {
proc.allowedClasses := addToList(very-long-class additional-class)
buttons {
link.properties.class.allowedClasses := addToList(very-long-class additional-class)
}
}
}
Everything works fine and the editor can choose the new link style when he selects some text in the RTE and creates a link (shown below).
My problem is, that the link name is not really understandable. Is it possible to define a name or label for the link (changing the class-name is not an option), so the "Style" field will show a more understandable name?
The names are set in "classes" of the RTE object. The value are any CSS-styles to give a hint, how it looks like.
RTE.classes {
your-class-name {
name = Your Awesome Class Name
value = margin: 2px; padding: 2px; background: #00b5dc; color: #fff; border: 1px solid #3a6674;
}
}

How to disable default 'Click to edit' on Jeditable?

I'm using the jeditable plugin for making some values editable. I noticed that when a value is empty the default text 'Click top edit' appears which I don't want. But I still want to make that field editable too. How to manage this?
I noticed a suggestion at http://www.datatables.net/forums/discussion/5865/jeditable-and-default-click-to-edit/p1, but that does not seem to work - at least not for me; when using the placeholder : "" the field is not editable anymore.
My related code:
$('.edit').editable('edit_save.php', {
cancel : 'Cancel',
submit : 'OK'
});//$('.edit').editable('jeditable_save.php', {
Without any text to fill it, the editable element needs to be an inline block with height and width like this:
.edit {
border: 1px solid red;
display: inline-block;
min-height: 20px;
min-width: 100px;
}
and set a blank placeholder like you mentioned:
$('.edit').editable(function (value, settings) {
return value;
}, {
cssclass: 'editing',
placeholder: '',
});
See this fiddle http://jsfiddle.net/chrisdillon/37JqF/
I tried add this row: placeholder:'
&
nbsp;' and it works.
If you can add this row, you see your input is empty.
$('.edit').editable('Something', {
something,...
placeholder:' ',
})

class overrule when two classes assigned to one div

I was creating a <div> tag in which I wanted to apply two classes for a <div> tag which would be a thumbnail gallery. One class for its position and the other class for its style. This way I could apply the style, I was having some strange results which brought me to a question.
Can two classes be assigned to a <div> tag? If so, which one overrules the other one or which one has priority?
Multiple classes can be assigned to a div. Just separate them in the class name with spaces like this:
<div class="rule1 rule2 rule3">Content</div>
This div will then match any style rules for three different class selectors: .rule1, .rule2 and .rule3.
CSS rules are applied to objects in the page that match their selectors in the order they are encountered in the style sheet and if there is a conflict between two rules (more than one rule trying to set the same attribute), then CSS specificity determines which rule takes precedence.
If the CSS specificity is the same for the conflicting rules, then the later one (the one defined later in the stylesheet or in the later stylesheet) takes precedence. The order of the class names on the object itself does not matter. It is the order of the style rules in the style sheet that matters if the CSS specificity is the same.
So, if you had styles like this:
.rule1 {
background-color: green;
}
.rule2 {
background-color: red;
}
Then, since both rules match the div and have exactly the same CSS specificity, then the second rule comes later so it would have precedence and the background would be red.
If one rule had a higher CSS specificity (div.rule1 scores higher than .rule2):
div.rule1 {
background-color: green;
}
.rule2 {
background-color: red;
}
Then, it would take precedence and the background color here would be green.
If the two rules don't conflict:
.rule1 {
background-color: green;
}
.rule2 {
margin-top: 50px;
}
Then, both rules will be applied.
Actually, the class that defined last in the css - is applied on your div.
check it out:
red last in css
.blue{ color: blue; }
.red { color: red; }
<div class="blue red">blue red</div>
<div class="red blue">red blue</div>
vs
blue last in css
.red { color: red; }
.blue{ color: blue; }
<div class="blue red">blue red</div>
<div class="red blue">red blue</div>
If you asking about they have same property then as per the CSS rule it's take the last statement.
<div class="red green"></div>
CSS
.red{
color:red;
}
.green{
color:green;
}
As per the above example it's take the last statement as per css tree which is .green.
The class that is defined last in the CSS have priority, if nothing else applies.
Read up on CSS priority to see how it works.
Many classes can be assigned to an element, you just separate them with a space
<div class="myClass aSecondClass keepOnClassing stayClassySanDiego"></div>
Because of the cascade in CSS, the overwriting rules closest the to bottom of the document will be applied to the element.
So if you have
.myClass
{
background: white;
color: blue;
}
.keepOnClassing
{
color: red;
}
The red color will be used, but not the background color as it was not overwritten.
You must also take into account CSS specificity, if you have a more specific selector, this one will be used:
.myClass
{
background: white;
color: blue;
}
div.myClass.keepOnClassing
{
background: purple;
color: red;
}
.stayClassySanDiego
{
background: black;
}
The second selector here will be used as it is more specific.
You can take a look at it all here.