I use geoserver 2.0.1, I used textsymbolizer to labeling features on the map. It is likely geoserver not support '' tag because event I try to change font-size, font-family or .. it deosn't effect. How can I do labeling on the feature with different style?
If you insert this into your <rule>...</rule> section, you should get something.
Just make sure that you provide the right property name (in the example blow: InfoMessage), which is the field that you want to display.
If the example below doesn't help, then please post your style, and describe what you're trying to achieve, so I can see what's going wrong.
<TextSymbolizer>
<Label>
<ogc:PropertyName>InfoMessage</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-weight">Bold</CssParameter>
<CssParameter name="font-size">14</CssParameter>
</Font>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
<Displacement>
<DisplacementX>0</DisplacementX>
<DisplacementY>-15</DisplacementY>
</Displacement>
</PointPlacement>
</LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>2</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
</TextSymbolizer>
Related
First of all, let me apologize for not including code. I tried to reproduce this issue with a smaller project but was unsuccessful. The issue itself is sporadic as well, so it is difficult for me to nail down the culprit.
Basically, what is happening: I have my UI defined in FXML and it includes several labels throughout, some of which I have set the font to "Bold."
<Label text="Appetite Info:">
<font>
<Font name="System Bold" size="12.0"/>
</font>
</Label>
The problem is that, as the user clicks around the UI, all of these labels will be reset to "Normal" font weight. Sometimes it is giving focus to a text field or scroll pane, other times it happens just when the main UI window loses focus.
I do have the application styled with CSS, but this happens even with a Default.css that doesn't override any formatting:
.root {
}
Has anyone else noticed this behavior or know where I should look for a solution?
I'll mark this as answered. Styling all my nodes with CSS instead of through the FXML markup solves this issue.
I am having a weird problem with JavaFX and Font Awesome, which I'm having trouble pin-pointing the cause of. The problem is further complicated because I can't really share the code, and no matter how much I've tried to replicate the problem in a simpler case - I couldn't.
The problem is as follows - I have a TableView, in which every column has a Hyperlink as a graphic, with a Font Awesome glyph. This all works well, except for one stage - in this stage, the first time it is shown everything is fine, but the second time three of the columns' glyphs revert to squares. This is weird, as all columns use the same glyph of the same font.
Here are before and after pictures - notice the glyphs are all the same, but the left ones become squares:
The glyphs and font are set through FXML, and are the same for all columns:
<TableColumn fx:id="col1" prefWidth="83.0" text="Column 1"><graphic>
<Hyperlink onAction="#requestFilter" text="" visited="true">
<font>
<Font name="FontAwesome Regular" size="13.0" />
</font></Hyperlink>
</graphic>
</TableColumn>
<TableColumn fx:id="col2" prefWidth="138.0" text="Column 2"><graphic>
<Hyperlink onAction="#requestFilter" text="" visited="true">
<font>
<Font name="FontAwesome Regular" size="13.0" />
</font></Hyperlink>
</graphic>
</TableColumn>
<TableColumn fx:id="col3" prefWidth="59.0" text="Column 3"><graphic>
<Hyperlink onAction="#requestFilter" text="" visited="true">
<font>
<Font name="FontAwesome Regular" size="13.0" />
</font></Hyperlink>
</graphic>
</TableColumn>
<TableColumn fx:id="col4" prefWidth="103.0" text="Column 4"><graphic>
<Hyperlink onAction="#requestFilter" text="" visited="true">
<font>
<Font name="FontAwesome Regular" size="13.0" />
</font></Hyperlink>
</graphic>
</TableColumn>
Here the last two columns are the ones who lose their glyph (the scene is in right-to-left orientation).
Furthermore - it is always the last three columns that lose their glyph, that is - if on the first showing I reorder the column, the columns I leave last in the table (to the left, again - the scene is right-to-left) will lose their glyph the next time the stage is shown. Subsequent hiding/showing won't lost any more glyphs.
I show the stage with Stage#showAndWait, and I keep a reference to the stage, so it is only created once.
I realize it is hard to help when I can't share any code (client confidentiality), so what I'm asking is - where can I look to see what is happening? How come some instances of the same glyph disappear and others don't? Did anyone else encounter something like this? What was the underlying reason?
Edit: I have added debug prints of the hyperlinks' properties, and indeed with the second showing the font reverts to "System" for the last three columns. Looking for the source of the change, I have added a change listener, and put breakpoint inside it. The stack shows that the change happens inside applyCSS, after a lot of internal calls following showAndWait, non of them in my own code (i.e. - all in the JavaFX library code). It seems for some reason JavaFX decides to reset the font definition of some of the controls, although they are all defined exactly the same! This is corroborated by the fact that it doesn't matter which table-column it is, but where it is in the TableView.
So it seems like some erroneous JavaFX behavior is resetting the font to the default ("-fx-font") instead of the one defined on the node itself. Anyone know enough about the JavaFX CSS logic to help find the bug?
All hyperlinks have no custom styles or classes set, and only the 'visited' pseud-class set.
Edit 2: Adding a font name to the CSS fixes the issue. I would still love to find the source of the bug (which, I am certain, is in the JavaFX CSS handling), but it is too messy for me to go through it now. The CSS I use is:
.table-column .hyperlink {
-fx-font-family: "FontAwesome";
}
My bet that some code or css styling somewhere is changing Hyperlink font or style or css class. You can use some debugging. For example, you can add button near your TableView to print some debug information, something like this:
Button b = new Button("Debug");
b.setOnAction(e->{
TableView<?> tv = (TableView) scene.lookup("#tableView");
for(TableColumn<?,?> tc : tv.getColumns()) {
Hyperlink link = (Hyperlink)tc.getGraphic();
System.out.println("Column "+tc.getText());
System.out.println("link text: "+link.getText());
System.out.println("link Style: "+link.getStyle());
System.out.println("link CSS Classes: " + link.getStyleClass());
System.out.println("link CSS Pseudo Classes: " + link.getPseudoClassStates());
System.out.println("link Font: " + link.getFont());
}
});
Then click this button when table looks normal and save debug info somewhere. Click again when squares appear and compare the output with first one. Also inspect your css files and code that can access TableColumns, if any of those can affect Hyperlink styling.
EDIT
Well, it seems pretty strange to me, that JavaFX all by itself internal logic decided to recalculate and reapply css styles only for specific columns and not for the whole scene (EDIT: according to JavaFX CSS Reference it actually can reapply css only on specific branches in scene graph). I still think that the root cause somewhere in your styling or code. I doubt anyone could point you to a place to look at, as it seems very specific problem and, as you said, can't be reproduced in simple scenario. Maybe you perform some specific layouting logic, recreating/replacing table nodes or somthing similar, hard to say not seeing the code.
Anyway, if you just want to solve the problem, I would suggest to set hyperlink font style in css file, not in fxml. This way you ensure that even in case of css recalculation or any layout manipulations style will be the same. It would be the right way to do it anyway.
If you want to dig up the real cause of a problem, I afraid you have to spend some happy hours with your debugger:) I would start from searching the differences between normal column and column with broken font. Why do they treated in different ways?
I am using Primefaces graphicImage inside a p:tooltip and would like to set the width and height for the images individually.
<p:remoteCommand....update="myImage" />
<p:tooltip beforeShow="remoteCommand()">
<p:graphicImage id="myImage"... style="#{myBean.myStyle}" />
....
Update:
Bean.myStyle is triggered correctly and the style parameter is updated in the page source, but not in the dom tree.
If I set style="width:100px" directly it works, but if the value comes from the bean, it is ignored.
It seems like the style-attribute of graphicImage gets updated but not the component itself.
What am I missing here?
I think style value is setted when the document is loaded and its never reloaded, when its visible just its display:none value is changing. So I would give an id to p:graphicImage then I would add a p:ajax using onShow or similar event (I dont know which one is available for tooltip) then I would use update attribute to render graphic image. If I remember right even it should work just with <p:ajax /> without any attribute but I am not sure
So it should look like that:
<p:graphicImage id="x" style="#{bean.value}">
<p:ajax event="show" update"x"/>
</p:graphicImage>
use this
<p:graphicImage width="#{bean.widthValue}" height="#{bean.heightValue}" >
</p:graphicImage>
I am having issues getting setCursor() to work properly in TextArea. I am not seeing any other search results at all for issues with this, and might be doing something silly because no one else has addressed this yet. I have tried different options, with no luck. Here are a few attempts below:
Coding this below makes it so only the outer edges are effected by the setCursor.
textArea.setCursor(Cursor.DEFAULT);
In FXML, I get the following if I add it in with Scene Builder.
<TextArea fx:id="textArea" prefHeight="458.0" prefWidth="766.0">
<font>
<Font name="System Bold" size="12.0" />
</font>
<cursor>
<Cursor fx:constant="DEFAULT" />
</cursor>
</TextArea>
It gives me an error, so I add the import...
<?import javafx.scene.Cursor?>
Then it gives me an error, saying "Instances of javafx.scene.Cursor cannot be created by FXML loader." with no hints provided.
I know for ComboBoxes, I have to do the following:
comboBox.getEditor().setCursor(Cursor.DEFAULT);
Is there some way I have to do this for TextArea to work as well?
Thanks!
Your FXML parsed just fine for me, though it didn't have the desired effect. I'm not sure why it gave you errors.
The reason it doesn't generate the desired cursor is that the Text node is placed as the content of a ScrollPane. The cursor is set by default on that Text node, so it isn't inherited if you set the cursor directly on the TextArea.
The easiest way to do this is to use an external CSS file:
.text-area .content {
-fx-cursor: DEFAULT ;
}
I have my own toolbar with toolbox and toolbarpalette.
I have followed this https://developer.mozilla.org/en/Skinning_XUL_Files_by_Hand
and background image for toolbar is not displaying, what can be wrong?
Cannot found any debug message in Error console
Note that Image #logoimage is displaying correctly
XUL
<toolbox id="navigator-toolbox" class="nav-box" crop="end">
<toolbarpalette id="BrowserToolbarPalette">
<image id="logoimage"/>
<toolbarbutton type="menu" label="&toolbar.quicklinks.label;" id="quicklinks">
<menupopup>
<menuitem class="menuitem-iconic" label="&toolbar.quicklinks.quicklink1;" image="chrome://tbar/skin/icon.png"/>
</menupopup>
</toolbarbutton>
</toolbarpalette>
<toolbar id="test-toolbar"
class="nav-bar"
mode="full"
iconsize="small"
customizable="true"
context="toolbar-context-menu"
toolbarname="Toolbar"
crop="end"
defaultset="logoimage,toolbarseparator,quicklinks">
</toolbar>
</toolbox>
CSS
toolbar.nav-bar {
background-image: url("chrome://tbar/skin/tbg.png");
}
#logoimage {
list-style-image: url("chrome://tbar/skin/logo.png");
}
As nobody could help, I asked in mozilla.dev.tech.xul Google group, and got an answer
Try adding "-moz-appearance: none;" to your CSS stanza. This turns off
OS-defined theming.
And that thing simply worked ! It also removes all OS specific look and feel effects
see: https://groups.google.com/group/mozilla.dev.tech.xul/browse_thread/thread/a4cd4452a72b9151#
Given that there are no issues in the code you show here I only see one explanation: the background image is being set to a different value elsewhere, maybe in some built-in CSS file. You can check the CSS rules applying to a particular UI element using DOM Inspector.
Does your toolbar have a height and width? I can't remember if they're block by default, but it might not be showing because it has no dimensions?