New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a simple single module layout #77
Implement a simple single module layout #77
Conversation
if there is only one module in the workbench, the tab bar and the add module button are not displayed and the module is opened by default
Codecov Report
@@ Coverage Diff @@
## master #77 +/- ##
============================================
+ Coverage 94.51% 94.56% +0.04%
- Complexity 447 454 +7
============================================
Files 20 20
Lines 1332 1342 +10
Branches 82 85 +3
============================================
+ Hits 1259 1269 +10
Misses 57 57
Partials 16 16
Continue to review full report at Codecov.
|
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.
Thanks for the contribution! I added some comments regarding the structure of the implementation, everything else is fine. Please have a look and report back once you made the changes for us to have a look again!
workbenchfx-core/src/main/java/com/dlsc/workbenchfx/WorkbenchSkin.java
Outdated
Show resolved
Hide resolved
/** | ||
* Tests for {@link Workbench} in case only a single module is used | ||
*/ | ||
public class SingleModuleWorkbenchTest extends ApplicationTest { |
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.
Good job on the test! 👍
workbenchfx-core/src/test/java/com/dlsc/workbenchfx/SingleModuleWorkbenchTest.java
Outdated
Show resolved
Hide resolved
Thanks for the feedback and your suggestions regarding the implementation! |
fixes mvc violation of previos commits
workbenchfx-core/src/main/java/com/dlsc/workbenchfx/WorkbenchSkin.java
Outdated
Show resolved
Hide resolved
I implemented your suggested approach, @martinfrancois. The codeclimate check seems to fail because the |
I just noticed, we have 2 listeners on |
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.
Thanks a lot for the changes! I added some small comments, please have a look, afterwards it should be good to merge!
workbenchfx-core/src/main/java/com/dlsc/workbenchfx/view/ToolbarPresenter.java
Show resolved
Hide resolved
@@ -51,6 +52,11 @@ public ToolbarPresenter(Workbench model, ToolbarView view) { | |||
init(); | |||
// Adds initially a menuButton if necessary (size of items > 0) | |||
setupMenuBtn(); | |||
|
|||
// check initially whether to use the single module layout (size of modules = 1) | |||
if (model.getModules().size() == 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.
To make intention clearer and reduce duplicated code, we could refactor this check into a method on the model isSingleModuleLayout()
, which we could also use it below in the listener and in the WorkbenchSkin
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.
Don't forget to refractor this check as well! 😉 Afterwards it should be good to go! @s-schoen
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.
Oops, I missed that. Thanks for pointing it out. Fixed it.
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.
@s-schoen See my comment from before ;)
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.
Sorry, just noticed a small thing. Afterwards it should be good to go!
|
||
// check initially whether to use the single module layout (size of modules = 1) | ||
if (model.isSingleModuleLayout()) { | ||
view.bottomBox.setVisible(false); |
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.
just tested the changes and I noticed the bottomBox
is still there, even after setting it to invisible. Can you please add view.bottomBox.setManaged(...);
here and below, where you set the value to the same you set the visibility to? (so here it would be false
as well for example).
This will hide the empty bar.
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.
Alright, thanks a lot for the patience and the great PR! 🎉
PR Checklist
What is the current behavior?
The tab bar is displayed in any case, even when only a single module is used in the workbench, see #23 .
What is the new behavior?
If only a single module is defined for a workbench, the tab bar and the add module button are not visible and the module is automatically opened at startup.
Closes #23