-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Simplify FXML files #231 #356
Simplify FXML files #231 #356
Conversation
@MightyCupcakes, thanks for your PR! By analyzing the history of the files in this pull request, we identified @yl-coder, @m133225 and @pyokagan to be potential reviewers. |
v1@MightyCupcakes submitted v1 for review.
Checkout this PR version locallygit fetch https://github.com/se-edu/addressbook-level4.git refs/pr/356/1/head:BRANCHNAME where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 1/6]
FXML files tends to have rather deep nesting and arrowhead style code.
Having 4 spaces as indentation makes the code rather hard to read as
most elements are aligned to the right.
tends -> tend
rather hard -> harder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 2/6]
The imports in the FXML files are arranged in a haphazard order and contains
star imports.
contains -> contain
Let's refactor the imports in all FXML files to follow the project's coding
standards
missing period in the end of sentence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 3/6] commit title can be changed to remove unnecessary children tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 3/6]
The FXML file wraps all its children between a pair of children tags.
Some FXML files wrap the contents between a pair of children tags.
This is unnecessary in the JavaFX as all panes has a default property of
children.
in the JavaFx -> in JavaFx
all panes has -> all panes have
Let's remove the children tags and remove the unnecessary nesting in the files
Let's remove those unnecessary children tags.
</children> | ||
|
||
<StatusBar styleClass="anchor-pane" fx:id="syncStatus" /> | ||
<StatusBar styleClass="anchor-pane" fx:id="saveLocationStatus" GridPane.columnIndex="1" nodeOrientation="RIGHT_TO_LEFT" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minWidth="0.0" is removed, but seems like it is not related to this commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 4/6]
commit title can be changed to just:
PersonListCard.fxml: remove unnecessary nesting
PersonListCard.fxml contains deep nesting with unnecessary parent elements.
with -> due to
Let's refactor PersonListCard.fxml with the following changes:
* Remove unnecessary parent elements to reduce nesting
* Add white spaces between siblings to increase readability
Some white spaces are unnecessary imo. Maybe try not to do two things in one commit. Let's make this commit only remove unnecessary nesting. Do refactor in a separate commit if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 5/6]: Similar suggestions to [v1 4/6].
[v1 6/6] see below.
@@ -1,15 +1,10 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
|
|||
<?import java.net.URL?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this removal be done in [v1 2/6] or is this caused by removing stylesheet tag? As I saw `personlistcard.fxml" actually gets rid of this import before removing the stylesheet tag in [v1 5/6]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 3/6] Commit message:
Missing period at end of last sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 4/6]
It makes more sense to get rid of the unnecessary tags in the previous commit. This commit can focus on improving readability using whitespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 5/6]
Same as previous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 6/6] Commit message:
The various UiParts FXML files import the same DarkTheme and extension CSS files.
at runtime
<padding> | ||
<Insets top="5.0" bottom="5.0" left="10.0" right="10.0"/> | ||
<Insets top="10" bottom="10" left="10" right="10" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change unrelated to [v1 5/6] commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[v1 2/6] Commit message:
Coding style could be in list form (short, easier to read)
This is not compliant with the coding style used in the rest of the project:
* Imports should be arranged in alphabetical order.
* Avoid using star imports as they load more modules than necessary.
580e9e5
to
ffd64bd
Compare
v2@MightyCupcakes submitted v2 for review.
(📚 Archive) (📈 Interdiff between v1 and v2) Checkout this PR version locallygit fetch https://github.com/se-edu/addressbook-level4.git refs/pr/356/2/head:BRANCHNAME where |
@yl-coder any inputs? |
@MightyCupcakes can you propose a merge commit message too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. No objection on the extra space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. A few minor nits only.
<AnchorPane VBox.vgrow="NEVER" fx:id="resultDisplayPlaceholder" styleClass="anchor-pane-with-border" minHeight="100" prefHeight="100" maxHeight="100"> | ||
|
||
<AnchorPane VBox.vgrow="NEVER" fx:id="resultDisplayPlaceholder" styleClass="anchor-pane-with-border" | ||
minHeight="100" prefHeight="100" maxHeight="100"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When line wrapping, indentation should be twice the normal? e.g. Java uses 8 spaces when line wrapping.
@@ -1,7 +1,8 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit 2 message:
Let's refactor the imports in all FXML files to follow the project's
coding standards.
This statement promises too much. How about this?
Let's refactor ... to fix the two problems given above.
@@ -9,7 +9,6 @@ | |||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | |||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | |||
</columnConstraints> | |||
<StatusBar styleClass="anchor-pane" fx:id="syncStatus" minWidth="0.0"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit 6 message:
Both StatusBar
-> Both StatusBar elements
?
both status bar will
> both status bars will
9cea693
to
8380bc8
Compare
v6@MightyCupcakes submitted v6 for review.
(📚 Archive) (📈 Interdiff between v5 and v6) Checkout this PR version locallygit fetch https://github.com/se-edu/addressbook-level4.git refs/pr/356/6/head:BRANCHNAME where |
<AnchorPane fx:id="mainPane"> | ||
<TextArea fx:id="resultDisplay" editable="false" styleClass="result-display"/> | ||
</AnchorPane> | ||
xmlns:fx="http://javafx.com/fxml/1"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double indentation for line wrapping here too
FXML files tend to have rather deep nesting and arrowhead style code. Having 4 spaces as indentation makes the code harder to read as most elements are aligned to the right. Let's modify the FXML files to use 2 spaces instead.
The imports in the FXML files are arranged in a haphazard order and contain star imports. This is not compliant with the coding style used in the rest of the project that states: * Imports should be arranged in alphabetical order. * Avoid using star imports as they load more modules than necessary. Let's refactor the imports in all FXML files to fix the two problems given above.
Some FXML files wrap the contents between a pair of children tags. This is unnecessary in JavaFX as all panes has a default property of children. Let's remove these unnecessary children tags.
The various UiParts FXML files import the same DarkTheme and extension CSS files. This is not necessary as MainWindow loads all UiParts by adding their various components as a child of the AnchorPane placeholders. Since the AnchorPane placeholder is part of MainWindow, all its children will also be styled by the stylesheets declared in MainWindow. Let's remove the stylesheets declarations from the various UiParts FXML files.
MainWindow consists of multiple placeholders contained in a VBox all clumped together. Furthermore, some elements have multiple attributes, causing it to exceed the character limit for a line. This makes the file very hard to read. Lets refactor MainWindow.fxml as follows: * Add white spaces between sibling elements to improve readability. * Wrap long elements to a new line.
Both StatusBar elements sets their minimum width to zero. This is unnecessary as both status bars will have some content in runtime. Let's remove this unneeded attribute.
The id and name label in PersonListCard is wrapped around two parent HBoxes. This is not necessary. Let's remove the unneeded child HBox.
The various FXML files use insets declarations in order to add inner padding within elements. The declaration is not consistent as some elements declare the padding size using integer values while others use declare using double values. Let's standardize all insets declarations as follows: * Insets should declare paddings using the CSS convention (i.e top right bottom left) * All padding sizes are declared in integer values.
The various FXML files contains self closing tags that are closed by appending a slash at the end of the element. Some of these tags prepend a space before the slash while others do not. Let's standardize all self closing tags to prepend a space before the closing slash.
The various FXML elements declares their height and width using both integer and double values. Let's standardize all height and width declarations to use integer values
8380bc8
to
b91565e
Compare
v7@MightyCupcakes submitted v7 for review.
(📚 Archive) (📈 Interdiff between v6 and v7) Checkout this PR version locallygit fetch https://github.com/se-edu/addressbook-level4.git refs/pr/356/7/head:BRANCHNAME where |
Regarding the proposed commit message:
|
@damithc update proposed merge commit message |
Closes #231
Propsed merge commit message: