John Damien Smith

Ranch Hand
+ Follow
since Jan 26, 2012
Cows and Likes
Cows
Total received
22
In last 30 days
0
Total given
0
Likes
Total received
93
Received in last 30 days
0
Total given
30
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by John Damien Smith

> Yes I know with scene.Text and TextBoundsType.VISUAL but i need some css propertys that is not supported by scene.text control

There is no such thing, you need to do it in code.

> I don't understand your tip with text property listener, because i think scene.Text doesn't support TextBoundsTypes respectively nothing found in code javafx.scene.control.Labeled and javafx.scene.control.Label

Yeah, that wasn't very clear, sorry about that.

Here is some sample code.  It probably doesn't do exactly what you want, but it should demonstrate what I meant:
1 month ago
Perhaps try using Text instead of Label and set the TextBoundsType on the Text to VISUAL.
  https://docs.oracle.com/javase/9/docs/api/javafx/scene/text/TextBoundsType.html
You also might be able to stick with a label, add a listener on its text property and set the TextBoundsType appropriately whenever the text property changes (not sure, I didn't try that).
1 month ago
I don't understand your question well enough to offer a solution.

Perhaps an application of the Mediator may help you solve your issues:
Review the code from the Java implementation from the link.
Though, as you are just beginning programming UI stuff, I would caution against some of the abstract design patterns like Mediator as it may just confuse you more than it would help you . . . still, it may be an a reasonable approach to your problem.

As an aside, go to grammarly.com, set up a free account there and copy and paste your text into it, correct any errors it flags before you post it, then post the corrected text. 
It will make your writing much more professional and you will be able to communicate more clearly and have a better chance of getting good responses (just my opinion).
2 months ago
> Why wouldn't it do that? HtmlUnit supports quite a few JavaScript libraries, especially jQuery, and has no principal problems executing JavaScript.

I probably should have looked into HtmlUnit a bit more closely before posting earlier, as I didn't know that :-).  Based upon what you write, HtmlUnit would likely suffice for many tasks.  My guess (and it is only a guess) is that WebView might be a bit more functional and compatible  than HtmlUnit as far as implementation of html5 style features, because WebView is based upon a WebKit implementation which has likely undergone more extensive compatibility testing against the html5 specs and various websites than HtmlUnit.  But yes, both approaches would probably be fine depending upon the actual application required.  HtmlUnit would probably be preferred if you wanted to do evaluation and testing of the page load results because I think it was created to directly support those kind of scenarios.  WebView would be good if you want an actual rendering that you can snapshot to an image or something like that.
2 months ago
One reason something like WebView may be better than something like HtmlUnit is that WebView is a full browser environment, so it will execute any javascript or stuff related to html5 extensions to Java which something like HtmlUnit will not do.  If the page is loading stuff with Ajax or dynamically adding stuff to the HTML DOM using JavaScript, which is pretty common nowadays for a lot of sites, then WebView would correctly render this to create the DOM, but HtmlUnit would not.  If the purpose is to create something like a library of reasonably accurate screenshots of rendered pages, the WebView would be reasonable for that, but HtmlUnit would not.  However... I have no idea what Niti is really trying to do, so I couldn't say whether one approach or the other would be helpful for Niti or not...
2 months ago
Change to the directory where the jar is located.

In your log message that is:
  C:/Users/Removed/Documents/NetBeansProjects/SoftwareOneProject/dist/run102474145/SoftwareOneProject.jar
But, I guess it could change between runs depending upon what NetBeans is doing.

Run jar tvf SoftwareOneProject.jar

Post the output of to this forum.

See if the css file is actually where you expect it to be in the jar.
2 months ago
How did a question titled "how to create and control a modular ui with javafx?" morph into "Well, I don't know Spring Boot -- the last time I used Spring was about five years ago.  Maybe someone from the Spring forum can help."?

That's just crazy...
2 months ago
The best thing I know of in terms of a native rich text editor for JavaFX is the third party RichTextFX control:
  https://github.com/FXMisc/RichTextFX
There is some info on that here:
  http://fxexperience.com/2013/02/interview-with-tom-schindl-2/
I think the original developer stopped developing it, but it is possible that somebody else from the community picked it up.
I'm sure your research would have brought up RichTextFX, so I'm not sure why you didn't mention it in your posts.

As alternatives you could consider:
  A markdown based editor (there are numerous JavaFX projects for that).
  Use a SwingNode and embed a Swing based editor (such as one of the ones found in the open source Intellij or NetBeans projects), or event a SWT editor (such as the one found in Eclipse).
  A WebView based solution using either the in-built JavaFX HTML editor or a third party JavaScript based rich text editor (of which there are many, many open source projects of varying quality).

I understand that WebView or JavaFX HTMLEditor based is not really what you want based upon your previously posted concerns about that.
My suggestion would be first to investigate RichTextFX and see if it would be a useful solution for you, and, if not consider either the Markdown or embedded Swing based solutions.

----

>Since the "rich text editing control" was due to be released in 8, I have to bleieve that yeah, this is it.

I've been following JavaFX for a while, and I never heard before that such a control was due to be released in 8.  I guess it may have been on some ancient roadmap somewhere, but I doubt its been in the roadmap for the core JavaFX libraries for many years (there is no published roadmap anymore as far as I know).  Pretty much anything which might be on what would resemble a roadmap is likely in Jira.  So you could work out a roadmap by looking at what new features are planned to be implemented in upcoming versions based upon querying Jira.  I looked up rich text editor for JavaFX in jira and it came up with:
   https://bugs.openjdk.java.net/browse/JDK-8091043
That feature request is not targeted for any upcoming release, so it would be unlikely to be implemented within the core JavaFX libraries at any time soon (if indeed ever).
If you have questions about it you can ask on http://mail.openjdk.java.net/mailman/listinfo/openjfx-dev.

-----

> My limited understanding of the fate of JNLP is it is to be replaced with Java devs packaging the unique closure (profile) of Java 9 modules which is particular to their app. The app and those modules are expected to be bundled and there will be no more general runtime (jre). I am not sure how the literal launching of the app's main method will be achieved.

I don't really think there is (or will be) a real replacement for JNLP.  And IMO I think that is OK, as JNLP never IMO provided a good application delivery experience and never was going to ever become a good experience.

I think instead the closest thing (and it is not the same, it is different), is the self-contained application packaging:
  https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html
This uses native tools to bundle together an app and a runtime as a native installer package, so that the user installs your app exactly as they would any other app they install on their OS.
Or the third party Gluon mobile which (I am guessing) provides the same capabilities for mobile environments:
  http://gluonhq.com/products/mobile/

----

> Now I am starting to realize that what Oracle wants is for us to use HTMLEditor as the base for all rich editor controls.

They provide the HTMLEditor but I don't think they care much what is used by others as the basis for their rich editor controls.  I'm not sure it is something they should care much about anyway unless they are able to devote the appropriate resources to support it (which I'm guessing they have decided that they cannot at the current moment).  But, I think the greater issue is whether or not the APIs currently exposed by the core JavaFX libraries in Java 9 is sufficient for somebody else to build and maintain such an editor (assuming that that other entity can also support that effort).  I don't know the answer to that question, I'm guessing that it might be either difficult or not possible, though RichTextFX does currently exist and (if that thing runs on Java 9), then it may prove that such an editor may be possible.

----

> Will they bring back the capabilities found in Swing?

Unlikely (IMO).

----

> But am I just wrong or am I looking at it the wrong way? 

No and perhaps yes.  Certainly waiting "for a rich text editor ala Swing's JEditorPane to surface in Java 8 and now Java 9" is the wrong way...

----

> The thing is, with Java 9, Oracle has effectively cut us off from access to the libraries we need to write a text editor from, more or less, scratch. I am talking about the libraries which were in Swing like LineBreakMeasurer and access to the native libraries for (mouse event) hit testing (upon characters) and many many others.
> Previously, in Swing there was something approaching a 1:1 correspondence between Java classes and the native libraries needed. Now it's more like a curated view to those native libraries indirectly through HTMLEditor, Text and TextFlow (a read only view of text).

Yeah, I don't know, this could be a genuine issue.  I'm guessing you could get around it by packaging as a self-contained app and custom hacking the core JavaFX libs to expose the APIs you need, but that doesn't really sound like a recommended approach ;-)

----

> if I want to write a rich text editor, I can turn my back on my years of Java programming, go native, make friends again with C++, and develop the needed UIs with each platform's respective UI toolkits.

I don't think you really need to do that. That would only really be something that you would do if it was something that you wanted to do.  Technically, there are already ways to get rich editors under the JVM, even if it may mean using a Swing or SWT based solution to get what you want (if RichTextFX or HTMLEditor or WebView based javascript coded editors are not for you).
2 months ago
It's hard to know what is going wrong here as there is no real way to replicate it locally, which I guess is OK and would be difficult with a full Spring+JavaFX+DB project.

So I'll just take some random guesses at stuff you have probably already looked at or already tried.

1. After this line:
   
either print out the full member list to system out or examine it in a debugger.  Check that bDay field is actually populated with the data you expect.  If it's not, the problem is with you converter/spring code/db access code and not anything related to JavaFX.


2. Provide a cellFactory which displays the bDay date, (probably by using an appropriate date formatter to convert the date to a string which is used to set the text of the cell).
    See https://stackoverflow.com/questions/11412360/javafx-table-cell-formatting (ignore most of the answers to those questions and look at the one from R3ing, which I'll reproduce here):

For your code you would take a Member and a LocalDate as input rather than a Auditoria  and a Timestamp.

As an aside, you don't need to (really shouldn't) configure the table in the search method.  A controller has an initialize() method which is a better place for this code:

That stuff never changes (same with the cell factory if you add one).
2 months ago
Thanks for sharing your code. 
When you have quite a lot of code to share like this, I advise going over to https://github.com and creating a project there.
I think you will find it is a great tool for such things.
3 months ago
When you use a PropertyValue factory like this:

your corresponding java bean data class needs to follow Java camel case naming conventions for methods.

To see these conventions read:
Java naming conventions on Wikipedia.

For a more in depth explanation read:
https://stackoverflow.com/questions/18971109/javafx-tableview-not-showing-data-in-all-columns

In your case, change the method name and return type from:

to:

Note that, when setting the property you don't create a new property in the setter, you just create a new property once when the bean is initialized (all properties can generally be declared final even though the value inside them changes, because the property holding the value never changes).

Similarly, update your definitions for any other getters and setters you have and any other properties whose accessors do not follow the correct naming convention.

Also, read the PropertyValueFactory documentation which outlines all of the rules which I explained above:
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/cell/PropertyValueFactory.html

And also note that the title of your question refers to a StringBuilderProperty.  Such a class does not exist, so I guess that was just a typo and you really meant just StringProperty.
5 months ago
Note that the columns in a TableView should also be injected via the @FXML annotation and a matching id in the FXML file for each column.
See the Makery JavaFX tutorial PersonOverviewController java and fxml files for examples:
  https://community.oracle.com/community/java/java_desktop/javafx_2.0_and_later

In general, anything you annotate with @FXML is created and injected by the FXMLLoader and you should never directly assign the reference to a new object or any other object created by your application.

And yes, you are correct, the main Application class should never be also be a Controller class.  The Java/JavaFX launchers create an instance of an Application class.  Any given application should only have a single Application class instance.  The FXMLLoader creates instances of the Controller classes.  So if you make an Application class also a controller, two instances of it will be created, one by the Java/JavaFX launcher and another by the FXMLLoader, this will almost certainly lead to confusion and bugs.
5 months ago
Define cell factories for the list cells and the button cell.  In the cell factory, display the image as a graphic and the string as a text.

5 months ago
I have to admit I didn't read all your posts and follow all your links Niti.

But responding to one of the comments you made...
   "i have to use a condition like if url contains target than it should stop the navigation and open that page in another webview"

The following code will intercept clicks on a bing search engine link, cancel the navigation in the WebView in which the link was clicked and instead open the link in another WebView.  It uses the HTML DOM APIs that I referenced in an earlier post and stated was my preferred recommendation of how to solve this problem.  The lookup is done based upon a id defined for a href element, if you don't have an id and cannot control the source webpage to add one in, then you could still use the java HTML dom APIs to determine if the href string of the clicked element contains your target string, it would just be a bit more complicated to do so (and I haven't provided code for that).

Also, note that if you actually have a target attribute, like the following link:
  <a href="https://www.w3schools.com" target="_blank">Visit W3Schools</a>
The target attributes tells a html browser to open a URL in a new window or tab.
WebView has a handler for that:
  https://docs.oracle.com/javase/8/javafx/api/javafx/scene/web/WebEngine.html#setCreatePopupHandler-javafx.util.Callback-
Within the popuphandler you can open the url in a new WebEngine instance (or another existing WebEngine instance).
That may be a very clean way of accomplishing what you want if the scenario works for you.
5 months ago