Skip to content
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

Provide methods for setting only width or height undefined. #5036

Closed
vaadin-bot opened this issue Apr 4, 2014 · 4 comments
Closed

Provide methods for setting only width or height undefined. #5036

vaadin-bot opened this issue Apr 4, 2014 · 4 comments

Comments

@vaadin-bot
Copy link
Collaborator

Originally by @johndevs


How many times have you only wanted to set the width of a component as undefined and not the both the width and height as undefined?

We should add setWidthUndefined() and setHeightUndefined() methods to AbstractComponent.


Imported from https://dev.vaadin.com/ issue #13546

@vaadin-bot
Copy link
Collaborator Author

Originally by @jdahlstrom


I disagree. setWidth/Height(null) already does this. setSizeUndefined() is simply a shortcut and IMO poor API; I don't like bloating the interface with even more special-case methods. It could be argued that setWidth(null) is hard to understand, but a better solution would be to add a SIZE_UNDEFINED constant somewhere.

@vaadin-bot
Copy link
Collaborator Author

Originally by @jdahlstrom


Actually, there's already SIZE_UNDEFINED in Sizeable but it's a float so it can only be used with the two-parameter setWidth and setHeight... :/

@vaadin-bot
Copy link
Collaborator Author

Originally by @johndevs


I again disagree :)

I don't think that setWidth(null) or setWidth("-1px") makes any sense to anyone, what does width = null actually mean? It looks like something that you are doing wrong, and lets not go into the "-1px" hack either.

Using a constant is better, but it doesn't solve the issue either. For one it already exists but more importantly you have to know it exist to use it. And it is non-obvious as you yourself discovered.

That is why two methods, which actually says what the do and can be found with autocomplete, I think is very needed and would make the code much more readable.

@vaadin-bot
Copy link
Collaborator Author

Originally by @jdahlstrom


Should at least add setWidthFull and setHeightFull as well then, for symmetry :/

@vaadin-bot vaadin-bot added this to the Vaadin 7.3.0.alpha3 milestone Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant