WorkbenchFX
WorkbenchFX copied to clipboard
New behavior: No AddModule
Hi,
I'd like to "not use" these assets: AddModulePage
, Add button
and X Button
of Tab
.
Use case:
I'd like to steer the user over the different WorkbenchModule
s. The user shall start in the first module, for example upload some files, and use general file features like validation. User can decide to use a file for defined functions, which are available in a different WorkbenchModule
. So I open the related WorkbenchModule
directly (and provide the selected file).
A first code analysis shows that in current version 1.0.0 the Add button
(contained in ToolbarView
) is not available for outside of WorkbenchSkin
.
My intention are these propositions (instead of a fork):
- Just provide access to the initially named assets, to enable free behavior changes
- Add a framework behavior, which provides the expected behavior (to be designed if you agree) What's your suggestion? Thank you in advance
Hi @ryppo!
Thanks for being so specific and including the use case! This makes it much easier for us to understand the issue better.
You already have access to the AddModulePage
via the WorkbenchBuilder.pageFactory()
/workbench.setPageFactory()
, but I guess this is not very important to you anyways, since you don't want to make use of it at all.
You also already have access to the control displaying the Tab
. For that, implement your own CustomTab extends Tab
, with which you can reuse almost everything of the existing Tab
and TabSkin
classes, with the only exception being that you would remove the x
button. You can then define the Workbench
to use your custom tab by specifying WorkbenchBuilder.tabFactory()
/workbench.setTabFactory()
.
But you are right that we currently don't enable to hide the Add button
in the TabBar
(which is the one you meant, I assume?). I can definitely understand your use case and could see something like a BooleanProperty addButtonVisibility
in the Workbench
class, which the ToolbarPresenter
could listen on, removing or adding the Add button
from the ToolbarView
depending on the state.
What do you think? If you agree, feel free to implement it and submit a pull request, and we will happily merge it.
it seems can hidden the add button by set the css:
#toolbar #bottom-box #add-button {
visibility: hidden;
}
write above code in the customTheme.css,detail see the offical workbenchfx-demo CustomDemo