JarekToro / responsive-layout

The layout to beat them all!
https://vaadin.com/directory#!addon/responsive-layout
57 stars 24 forks source link

Make classes more expandable #24

Open Telefonmann1024 opened 7 years ago

Telefonmann1024 commented 7 years ago

Hi, can you please define some (or most of) classes and properties as proteced? In my case, I want to change the rules at runtime to realize a column maximize feature. But the current rules are not available to me (even in a derived class) and I have to save them twice.

Oliver

hofmanndavid commented 7 years ago

Hi Telefonman

Can you point out what specific thing you want to change and in which class specifically?

At first it sounds interesting to allow users of this API to alter the behavior of the layout by extending its classes. However, I would rather first suggest what is the specific use case you want to cover so we try to include your needs in the core API.

The reason for this is that allowing all classes to be extendable the right way is pretty hard and once allowed we can are tied to backwards compatibility.

hofmanndavid commented 7 years ago

In fact. I will suggest to make all classes final while this is not considered production ready yet.

This way we will be able to know faster what people are doing with the API that we are not covering by default.

Telefonmann1024 commented 7 years ago

Hi David,

sorry for my late reply.

The backwards compatibility is an important point, but the extensibility as well. When developing a component, the developer has certain ideas about their function and focuses on their implementation. Other developers use these functions to create new solutions. This makes sense, of course, when the basic functionality is finished - but when is that? The responsive-layout component is now in version 1.3.2 and for more than a month, nothing has changed on the source.

In my particular case, I wanted to maximize and restore a ResponsiveColumn at runtime. The first approach was that the getRuleForDisplaySize function always returns 12 in the maximized state, but the function is private. The 2nd approach was, I remember the old rule and set a temporary 12,12,12,12 rule - but the rules are private and there is no function to query them. So the 3rd approach is now, to save the rule outside the component, which is not so correct the component thought.

I think other developers have great ideas on how to use responsive-layout in their projects, but they are severely restricted by their private and final definitions - and in some cases, perhaps even so much that they prefer other solutions.

JarekToro commented 7 years ago

Thank you @Telefonmann1024 & @hofmanndavid I appreciate the feedback and insight. What I would really like is for responsiveLayout to be used creatively and I want to make the ResponsiveLayout have a more robust API. So to see what features and methods need to be added to make it very flexible on its own I want to know more about this.

I'm particularly curious about your 2nd approach. You remember the old rule. Then with (12,12,12,12) you set the rules for each display size to 12. Could you use getRuleForDisplaySize() for each display size to query them?

JarekToro commented 7 years ago

Thank you again @Telefonmann1024 for the insight into its use. After talking with @hofmannDavid. We will be Adding the protected methods and clean up the public and private definitions and he will be handling this issue.

Telefonmann1024 commented 7 years ago

That sounds good - more next year. Happy New Year