How to create a path object in FXML? - javafx-2

In javafx2 I am trying to create a object in fxml. I want to then be able to reference it from the controller?
<BorderPane>
<center>
<Path id="ad"/>
</center>
</BorderPane>
Is not working? Any ideas?

Whoops needed to import Path in the fxml file.
<?import javafx.scene.shape.Path?>

Also need to add an fx:id in the opening markup. e.g.:
<BorderPane>
<center>
<Path id="ad" fx:id="ad1"/>
</center>
</BorderPane>

Related

How to send property values to svg files using ember-inline-svg?

I am using ember-inline-svg, there is a logo.svg file, I'm calling it with
{{inline-svg 'logo' class="logo" }}
in my hbs file.
It works fine. I just need to send one more data param to it and access that in the svg file so that I can dynamically generate svgs. How would I go about doing that?
what you want is not possible, because svg itself has no dynamic parts.
however you probably don't need ember-inline-svg at all. Could it be a possibility to put your svg inline into a component?
Just create a component Logo and put the svg inside the logo.hbs:
<svg height="60" width="200" ...attributes>
<text y=20 >I love {{#name}}</text>
</svg>
Then set tagName: '' (or use a template-only-glimmer-component). Then you can just use it as a component:
<Logo class="logo" #name="Ember" />

Displaying PDF , Richfaces

How can I display a PDF document on a rich:popupPanel. I am trying to display PDF document in a popup from a view scoped JSF page.
Issue faced : Parent page stops working when I click on the h:commandLink which fires a new view to display the PDF
The simplest way I know is to use HTML directly. You can use IFRAME or OBJECT.
So just put something like this in your rich:popupPanel:
<rich:panel>
<iframe src="path_to_your_file/sample.pdf"
class="pdfFrame" width="800" height="1000" scrolling="no" />
</rich:panel>
I don't think there's a way to do this with pure JSF tags. The same way is presented on PrimeFaces's showcase:
<h3>PDF</h3>
<object type="application/pdf"
data="/showcase/resources/demo/media/guide.pdf?pfdrid_c=true"
height="300px" width="100%" internalinstanceid="3">
Your browser can't display pdf,
click
to download pdf instead.
</object>

FXML Loader can't create FXMLCollections

I'm trying to create a ComboBox using fxml. and there is this error that says : Instances of javafx.collctions.FXCollections cannot be created by FXMLLoader. And here is the code:
<ComboBox fx:id="setBeginWidth" blendMode="DIFFERENCE" layoutX="325.0" layoutY="262.0"prefHeight="21.0" prefWidth="196.0" promptText="Set the Width of the Map">
<items>
<FXCollections fx:factory="observableArrayList">
<Integer fx:value="4" />
<Integer fx:value="5" />
<Integer fx:value="6" />
<Integer fx:value="7" />
<Integer fx:value="8" />
<Integer fx:value="9" />
<Integer fx:value="10" />
</FXCollections>
</items>
</ComboBox>
Thanks for your help.
I built a small demo application around your FXML snippet. The first thing that failed me is that the part
layoutY="262.0"prefHeight="21.0"
is missing a space.
When I fixed that, it worked for me after importing
<?import javafx.collections.*?>
<?import java.lang.*?>
The first is for FXCollections, the second for constructing Integer.
Did you add those imports?
You must declare the namespace for the shorthand fx. Add
xmlns:fx="http://javafx.com/fxml"
to the xml root node.
layoutY="262.0"prefHeight="21.0"
this line giving error so please give space between "262.0" and prefHeight.
It will be layoutY="262.0" prefHeight="21.0"
Hope it will help you

Is it possible to add styling to the HTML body tag in a XPage?

I would like to add styling to the body tag, currently I end up with this code:
<body class="xspView tundra">
<div style="margin: 0px">
but I would like to achieve this:
<body class="xspView tundra" style="margin: 0px">
Is this possible without removing existing functionality (i.e. without removing dojo and default xpages functionality)?
Yes you can,
if you have for example one xpage called 'home'. You can add your style definitions to the tag in the xpage. For instance:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" styleClass="ddd" style="margin: 20px;">
// your content goes here
</xp:view>
If you have a multiple xpage design and you dont want to add these lines of code to every xpage you could use Themes to automaticaly add the styles to the body tag:
<control override="false">
<name>ViewRoot</name>
<property mode="concat">
<name>styleClass</name>
<value>xspView tundra</value>
</property>
<property mode="concat">
<name>style</name>
<value>margin: 20px</value>
</property>
</control>
You don't have to use a theme to add a style to the XPages body tag. You can do it right on the Page itself under the style property. The source looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
styleClass="myBodyStyle">
</xp:view>
Which renders to the browser as:
<body class="myBodyStyle">
Add a css file that has a BODY entry. Put your margin there. Add the css to a theme if u want to use it globally
Why don't you do it in a css file? Include this:
body {
margin: 0px;
}
Just like any HTML styling...
Or, maybe I don't exactly understand what do you mean...

How can i include an applet in JSF

<jsp plugin> no works for me? anyway to include applet in JSF ?
Just using object tag:
<object width="400" height="300" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" archive="applet.jar"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0">
<param name="code" value="com.mypackage.Main"/>
<object width="700" height="500" type="application/x-java-applet" archive="applet.jar">
<param name="code" value="com.mypackage.Main"/>
</object>
</object>
There is nothing like this in JSF. I think you will have to add the required HTML tags to the page yourself.
Simple Html tag will do.. if you going to use applet in many place... you can write a taglip and minimize values to add in your jsp file.
Tablig which gets some values and renders the valuse as tag.

Resources