[Geoserver-devel] Organizing reusable Wicket classes

Hi,
trying to write out more panels for the new Wicket
UI it's evident I'm growin a (small) number of reusable
classes, in terms of:
- UI components
- models (as in IModel), especially loadable catalog object wrappers
- validators
- converters (not right now, but I was about to develop one today)

At the moment we have the org.geoserver.web.wicket package hosting
the reusable components, but nothing specific for the others.
What about the following structure instead:
   org.geoserver.web
       component
       model
       validator
       converter

One package for each?
Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

+1, the organization makes sense to me.

Andrea Aime wrote:

Hi,
trying to write out more panels for the new Wicket
UI it's evident I'm growin a (small) number of reusable
classes, in terms of:
- UI components
- models (as in IModel), especially loadable catalog object wrappers

I noticed this too... a nice convenient base class would be nice for loadable detachable models for catalog objects. Could look up the id reflectively, and then just call a subclass hook to do the actual lookup. Is that what you had in mind?

- validators
- converters (not right now, but I was about to develop one today)

At the moment we have the org.geoserver.web.wicket package hosting
the reusable components, but nothing specific for the others.
What about the following structure instead:
   org.geoserver.web
       component
       model
       validator
       converter

One package for each?
Cheers
Andrea

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Justin Deoliveira ha scritto:

+1, the organization makes sense to me.

Andrea Aime wrote:

Hi,
trying to write out more panels for the new Wicket
UI it's evident I'm growin a (small) number of reusable
classes, in terms of:
- UI components
- models (as in IModel), especially loadable catalog object wrappers

I noticed this too... a nice convenient base class would be nice for loadable detachable models for catalog objects. Could look up the id reflectively, and then just call a subclass hook to do the actual lookup. Is that what you had in mind?

Actually, I was just thinking about a base class that has a getCatalog() method, did not consider the reflective lookup. Wondering if it makes
more sense to have a CatalogObject interface with a getId() method?
(as opposed to using reflection which is not refactoring safe).

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Actually, I was just thinking about a base class that has a getCatalog() method, did not consider the reflective lookup. Wondering if it makes
more sense to have a CatalogObject interface with a getId() method?
(as opposed to using reflection which is not refactoring safe).

Yeah, I have thought about this before too but never ended up implementing it. I have no good argument against it so yeah, I could go for it.

Cheers
Andrea

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Justin Deoliveira ha scritto:

+1, the organization makes sense to me.

Andrea Aime wrote:

Hi,
trying to write out more panels for the new Wicket
UI it's evident I'm growin a (small) number of reusable
classes, in terms of:
- UI components
- models (as in IModel), especially loadable catalog object wrappers

I noticed this too... a nice convenient base class would be nice for loadable detachable models for catalog objects. Could look up the id reflectively, and then just call a subclass hook to do the actual lookup. Is that what you had in mind?

- validators
- converters (not right now, but I was about to develop one today)

At the moment we have the org.geoserver.web.wicket package hosting
the reusable components, but nothing specific for the others.
What about the following structure instead:
   org.geoserver.web
       component
       model
       validator
       converter

I was about to make this change and realized this proposed change
would split the 4 packages across the package tree, instead of keeping
them close.

What about:
     org.geoserver.web.wicket
         component
         model
         validator
         converter

One more nesting level, but also a single place for Wicket reusable
stuff. Better?

Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

On Monday 16 March 2009 09:13:40 Andrea Aime wrote:

Justin Deoliveira ha scritto:

+1, the organization makes sense to me.

Andrea Aime wrote:

Hi,
trying to write out more panels for the new Wicket
UI it’s evident I’m growin a (small) number of reusable
classes, in terms of:

  • UI components
  • models (as in IModel), especially loadable catalog object wrappers

I noticed this too… a nice convenient base class would be nice for
loadable detachable models for catalog objects. Could look up the id
reflectively, and then just call a subclass hook to do the actual
lookup. Is that what you had in mind?

  • validators
  • converters (not right now, but I was about to develop one today)

At the moment we have the org.geoserver.web.wicket package hosting
the reusable components, but nothing specific for the others.
What about the following structure instead:
org.geoserver.web
component
model
validator
converter

I was about to make this change and realized this proposed change
would split the 4 packages across the package tree, instead of keeping
them close.

What about:
org.geoserver.web.wicket
component
model
validator
converter

One more nesting level, but also a single place for Wicket reusable
stuff. Better?

sounds good to me

Gabriel.

Cheers
Andrea


Gabriel Roldan
http://www.opengeo.org

What about:
     org.geoserver.web.wicket
         component
         model
         validator
         converter

One more nesting level, but also a single place for Wicket reusable
stuff. Better?

+1

Cheers
Andrea

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Question. Is everything under org.geoserver.web.wicket intended to be totally generic? Or just any component used in more than once place? The reason i ask is because browsing through the directory I see the class "WorkspaceChoice", which makes me think that common widgets/controls for the catalog will go under this structure.

I wonder if this this wise. My first impression would be to keep widgets specific to the catalog under "web.data". The reason being that i can see the common widget directory quickly exploding with classes if we start putting everything that is reusable in there.

My preference would be to draw the line at re-usable widgets which "cross cut" sub systems. ie widgets that will probably be used for catalog pages, configuration pages, service pages, etc...

Andrea Aime wrote:

Justin Deoliveira ha scritto:

+1, the organization makes sense to me.

Andrea Aime wrote:

Hi,
trying to write out more panels for the new Wicket
UI it's evident I'm growin a (small) number of reusable
classes, in terms of:
- UI components
- models (as in IModel), especially loadable catalog object wrappers

I noticed this too... a nice convenient base class would be nice for loadable detachable models for catalog objects. Could look up the id reflectively, and then just call a subclass hook to do the actual lookup. Is that what you had in mind?

- validators
- converters (not right now, but I was about to develop one today)

At the moment we have the org.geoserver.web.wicket package hosting
the reusable components, but nothing specific for the others.
What about the following structure instead:
   org.geoserver.web
       component
       model
       validator
       converter

I was about to make this change and realized this proposed change
would split the 4 packages across the package tree, instead of keeping
them close.

What about:
    org.geoserver.web.wicket
        component
        model
        validator
        converter

One more nesting level, but also a single place for Wicket reusable
stuff. Better?

Cheers
Andrea

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Justin Deoliveira ha scritto:

Question. Is everything under org.geoserver.web.wicket intended to be totally generic? Or just any component used in more than once place? The reason i ask is because browsing through the directory I see the class "WorkspaceChoice", which makes me think that common widgets/controls for the catalog will go under this structure.

Well, isn't the UI meant to deal mostly with catalog configuration?
All the models I can think of that would go in wicket/models are
wrappers of catalog elements as well.
Whilst there are a few classes that can be totally generic, I think
most of them would be GeoServer and catalog specific, and there
are classes that can be in a gray area.
For example, a bbox editor, is that catalog specific?
We'd use it only in catalog pages so far, but maybe some new demo page
could use it as well. But the same could happen to a layer chooser.
What I mean is, it's usage is specific today, but tomorrow a demo
or a new service configuration could make the component used outside
of the catalog "space".
So I would have trouble deciding where to put each component.
If we follow you lead we'd start having a component/model/converter
set of packages under wicket, but also one under data, and maybe
some under the services? And what triggers the creation of a new
subset of those packages?
I don't really have good grips on this kind of classification,
and would probably put everything in that generic package until
some sort of evident pattern emerges, but if you feel strongly
about it, we could go for it anyways, and I'll ask you where
to put components/modules/converters I'm not sure about.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime wrote:

Justin Deoliveira ha scritto:

Question. Is everything under org.geoserver.web.wicket intended to be totally generic? Or just any component used in more than once place? The reason i ask is because browsing through the directory I see the class "WorkspaceChoice", which makes me think that common widgets/controls for the catalog will go under this structure.

Well, isn't the UI meant to deal mostly with catalog configuration?
All the models I can think of that would go in wicket/models are
wrappers of catalog elements as well.

I agree that catalog is the majority, but service configuration, global configuration, etc... are orthogonal. And since we are building the UI in an extensible way who knows what is coming down the pipe.

Whilst there are a few classes that can be totally generic, I think
most of them would be GeoServer and catalog specific, and there
are classes that can be in a gray area.
For example, a bbox editor, is that catalog specific?
We'd use it only in catalog pages so far, but maybe some new demo page
could use it as well. But the same could happen to a layer chooser.
What I mean is, it's usage is specific today, but tomorrow a demo
or a new service configuration could make the component used outside
of the catalog "space".
So I would have trouble deciding where to put each component.
If we follow you lead we'd start having a component/model/converter
set of packages under wicket, but also one under data, and maybe
some under the services? And what triggers the creation of a new
subset of those packages?

Well we could adopt just a single reusable wicket package as opposed to four. Indeed at the moment it seems as if component is the only one with classes in it? With model soon to have some classes in it. That would reduce the proliferation of packages and we could have one for true reusable, one for catalog reusuable, etc... It does make sense imo from a package point of view. If the only user of a component is under the "data" hierarchy why not leave the component in the "data" hierarchy.

I don't really have good grips on this kind of classification,
and would probably put everything in that generic package until
some sort of evident pattern emerges, but if you feel strongly
about it, we could go for it anyways, and I'll ask you where
to put components/modules/converters I'm not sure about.

Well the line is pretty clear in my mind: If you take the catalog away does the component still function? Given this criteria the bounding box widget would make the cut.

Anyways, while I do feel strongly about how we organize classes and packages I am willing to wait and see what happens and re-organize later if it is deemed necessary. I just ask that such things are kept in mind and people remain open minded to a reorganization of the classes down the road. What worries me is that it is a lot easier to mash things together than to pull them apart. So trying to reorganize down the road could prove difficult.

Cheers
Andrea

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Justin Deoliveira ha scritto:

Andrea Aime wrote:

Anyways, while I do feel strongly about how we organize classes and packages I am willing to wait and see what happens and re-organize later if it is deemed necessary. I just ask that such things are kept in mind and people remain open minded to a reorganization of the classes down the road. What worries me is that it is a lot easier to mash things together than to pull them apart. So trying to reorganize down the road could prove difficult.

Ok, let's try the "one package per area" thing. What would it look like?
- org.geoserver.web.wicket
- org.geoserver.web.data.wicket

and so on?
Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Ok, let's try the "one package per area" thing. What would it look like?
- org.geoserver.web.wicket
- org.geoserver.web.data.wicket

Works for me.

and so on?
Cheers
Andrea

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.