Add support for FXML (again)#654
Add support for FXML (again)#654JordanMartinez merged 12 commits intoFXMisc:masterfrom Jugen:patch-1
Conversation
Fixed regression part of #653
|
Looks like you'll need to revert the default methods back to regular interface method declarations Could you add a test in this PR, too, that initializes an area with all the FXML configurations? That should insure this doesn't get broken in the future. I'm not sure whether such a test should go in the regular |
|
I've never submitted a test before, so need some guidance:
|
|
Mm... yeah I guess this should go in the So, create a new class that extends In case you're wondering, some test classes are annotated with |
There was a problem hiding this comment.
Your work is almost done. Good job so far.
Were you planning to change the Consumer objects to EventHandler objects, too?
When the PR is complete, I'll ask you to reduce the commit history to the smallest amount of commits that is sensible and to reword some of their messages to better explain what you did in each one. Don't worry about this step until everything else has been taken care of, so that you don't waste your time on it.
| // FxmlTest.fxml is located in resources folder: | ||
| // src/integrationTest/resources/org/fxmisc/richtext/api/ | ||
| try { obj = FXMLLoader.load( getClass().getResource( "FxmlTest.fxml" ) ); } | ||
| catch ( Exception EX ) { EX.printStackTrace(); } |
There was a problem hiding this comment.
There shouldn't be a catch here. Rather, the test method should propagate the thrown exception:
@Test
public void testSomething() throws IOException {
// no longer need the try or catch statements
// try {
FXMLLoader.load();
// } catch (IOException EX) {}Also, it should throw the exception that FXMLLoader.load will throw, not the base Exception class upon which all other exceptions are based.
| <?import javafx.scene.control.ContextMenu?> | ||
| <?import javafx.scene.control.MenuItem?> | ||
|
|
||
| <VBox xmlns:fx="http://javafx.com/fxml/1"> |
There was a problem hiding this comment.
To prevent noise, it should return a single area, not a VBox of two areas.
|
|
||
| <VBox xmlns:fx="http://javafx.com/fxml/1"> | ||
| <StyleClassedTextArea editable="true" wrapText="true" autoScrollOnDragDesired="true" /> | ||
| <StyleClassedTextArea contextMenuXOffset="12.0" contextMenuYOffset="34.0" > |
There was a problem hiding this comment.
These two sets of properties should be combined into the same area
There was a problem hiding this comment.
I can do that, I did it this way because I thought its easier to read than having one long line of properties :-)
There was a problem hiding this comment.
Does it need to be a one-liner? Could you do something like
<StyleClassedTextArea
editable="true"
wrapText=true"
...
<contextMenu>...</contextMenu>
</StyleClassedTextArea>| Object obj = null; | ||
| // FxmlTest.fxml is located in resources folder: | ||
| // src/integrationTest/resources/org/fxmisc/richtext/api/ | ||
| try { obj = FXMLLoader.load( getClass().getResource( "FxmlTest.fxml" ) ); } |
There was a problem hiding this comment.
This should return an area (you'll need to cast the returned object into what it actually is) so we can assert that its properties are what they were specified to be in the FXML document.
| // src/integrationTest/resources/org/fxmisc/richtext/api/ | ||
| try { obj = FXMLLoader.load( getClass().getResource( "FxmlTest.fxml" ) ); } | ||
| catch ( Exception EX ) { EX.printStackTrace(); } | ||
| org.junit.Assert.assertNotNull( obj ); |
There was a problem hiding this comment.
We should assert that the properties values are what we specified them to be.
There was a problem hiding this comment.
If FXMLLoader cannot set a property it will throw an exception, so if no exception is thrown then it's guaranteed to have been set :-)
There was a problem hiding this comment.
Good to know. Mind writing that in as a comment for those of us who don't use it that often?
Yes, I've done that in a separate branch. I was going to do a PR once this one is done ? |
Ok. Yeah, I guess that falls into a slightly different scope that this one despite still being FXML related. We should open a separate issue for that, too, so that it shows up in the generated changelog. |
|
Is there a reason for wrapping the area in a VBox? |
|
It could have been any Bear in mind that the FXML file is still going to change in order to accommodate testing the |
|
Looks good! Thank you for your work. |
|
I just realized that I forgot to ask you to squash your commits into as few as possible before merging... My bad. |
Fixed regression part of #653