Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Adding an option to make drawer with horizontal text #1283

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Huy-Ngo
Copy link

@Huy-Ngo Huy-Ngo commented Oct 4, 2020

Resolve #1267

This PR isn't done yet - I haven't written a Kotlin library before and moreover I'm not familiar with maven, so I don't know how to test and write test and was struggling to do so in the past month. Hopefully you can help me finishing this PR.

This is a temporary solution. The size of each button is fixed to
150px, which can be too wide or too narrow for someone else.

Preferable solutions would be:
- Make the drawer resizable and the items to fill the drawer
- Make the drawer items' width to always be equal to the widest one

Either solution sounds good to me, though for now I can't think of
a way to implement either
Copy link
Contributor

@SchweinchenFuntik SchweinchenFuntik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not yet understood what problem you are trying to solve, you have not referred to the issue

@@ -321,7 +326,10 @@ class DrawerItem(val drawer: Drawer, title: ObservableValue<String?>? = null, ic
if (change.wasAdded()) {
change.addedSubList.asSequence()
.filter { VBox.getVgrow(it) == null }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no check HBox.getHgrow(it) == null

@@ -23,7 +24,7 @@ fun EventTarget.drawer(
op: Drawer.() -> Unit
) = Drawer(side, multiselect, floatingContent).attachTo(this, op)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the old constructor is not used here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

append default value

@@ -321,7 +326,10 @@ class DrawerItem(val drawer: Drawer, title: ObservableValue<String?>? = null, ic
if (change.wasAdded()) {
change.addedSubList.asSequence()
.filter { VBox.getVgrow(it) == null }
.forEach { VBox.setVgrow(it, Priority.ALWAYS) }
.forEach {
VBox.setVgrow(it, Priority.ALWAYS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a potential increase in memory. You need to think about how to check which type of Panel is used

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add a check for horizontal item here? In that case, I think I need to add a parameter for DrawerItem in order to check.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth redesigning ExpandedDrawerContentArea itself

@@ -23,7 +24,7 @@ fun EventTarget.drawer(
op: Drawer.() -> Unit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

append parameter horizontalItem

@@ -23,7 +24,7 @@ fun EventTarget.drawer(
op: Drawer.() -> Unit
) = Drawer(side, multiselect, floatingContent).attachTo(this, op)

class Drawer(side: Side, multiselect: Boolean, floatingContent: Boolean) : BorderPane() {
class Drawer(side: Side, multiselect: Boolean, floatingContent: Boolean, horizontalItem: Boolean) : BorderPane() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be worth renaming. For example, by adding the prefix ʻis, it is possible to remove ʻItem.

@Huy-Ngo
Copy link
Author

Huy-Ngo commented Oct 5, 2020

you have not referred to the issue

I thought I already linked it by mentioning in the title, but for some reason GitHub didn't link it. I was trying to resolve #1267. I just edited my comment to show what I expect.

@cilki
Copy link

cilki commented Nov 21, 2020

Update on this?

@ThraaxSession
Copy link

@edvin any idea when this comes into the upstream? I am eager to use it. :)

@Huy-Ngo Huy-Ngo changed the title Adding an option to make drawer with horizontal text resolve #1267 Adding an option to make drawer with horizontal text Mar 19, 2021
@Huy-Ngo
Copy link
Author

Huy-Ngo commented Mar 19, 2021

Sorry, as I didn't have any experience writing a Kotlin library so I don't know how to make sure my patch works (It'd be nice if there's some automated CI tests/builds to verify it or an instruction in README). Also, there are some code issues as Funtik pointed out.

@SchweinchenFuntik
Copy link
Contributor

@Huy-Ngo you can run tests directly in the IDE. Using task test

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] Add option to not rotate the sidebar in Drawer view
4 participants