Maicha / lanterna

Automatically exported from code.google.com/p/lanterna
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Make LayoutParameter constructor public #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If I try to write a new LayoutManager I want to define it's own 
LayoutParameter. But this is impossible since the constructor is set to Package 
access. Please make it public.

Original issue reported on code.google.com by f.bant...@axon-e.eu on 24 Nov 2013 at 11:03

GoogleCodeExporter commented 9 years ago
Just saw that this changed to 'protected' in source. Doesn't help. Please 
'public' :)

Original comment by f.bant...@axon-e.eu on 24 Nov 2013 at 12:01

GoogleCodeExporter commented 9 years ago
I'm not sure I follow... Are you trying to extend LayoutParameter?

Original comment by mab...@gmail.com on 1 Dec 2013 at 1:58

GoogleCodeExporter commented 9 years ago
No. I just want to use it in my LayoutManager like that:

public static final LayoutParameter FIRST = new LayoutParameter( 
"SplitLayout.FIRST" );

which I currently can't because:

    protected LayoutParameter(String description) {
        this.description = description;
    }

I could subclass it. But this is somewhat needless. Currently I'm reusing 
another LayoutManagers parameters like: public static final LayoutParameter 
FIRST = BorderLayout.LEFT; But this isn't nice, too. Or you could make the 
constructor public :)

Original comment by f.bant...@axon-e.eu on 2 Dec 2013 at 11:31

GoogleCodeExporter commented 9 years ago
Okay, I've updated the code now on 2.1.x branch. I think the original idea for 
the protected constructor was to prevent people from creating new instances of 
the class when passing in parameters to the layout managers, but yes, when 
writing new layout managers that would require you to subclass LayoutParameter 
(or make the package name the same, which isn't very elegant). Anyhow, this 
isn't such a big deal and I think the documentation on each layout manager 
should be clear enough on what to pass in.

Original comment by mab...@gmail.com on 8 Dec 2013 at 9:31