Re: Dynamic Simple (html) Components
Hi Ernesto, Yes, thanks for your input, I guess the way to go is to wrap components into combined Wicket Panels, and then use repeaters. Thanks again! reiern70 wrote: > > Hi, > >> Component: TextField >> Required: True >> Type: String >> Length:30 >> Order: 2 (The order in which it needs to be displayed on >> the >> form) >> Defaul Value: "some value" >> and so on. >> >> An entry can also define a compound component (like a Wicket panel >> component >> made up of simple components). >> >> So for each entry in the array,the Swing app instantiates, configures, >> and >> adds each component on a Swing Panel. >> >> So I'm sure this can be done in Wicket but I would need to wrap every >> possible component (and compound component) on a Wicket panel in order to >> be >> able to do that. (AFAIK WicketWebBeans does exactly that). >> >> > Yes, there are a few projects out there you could use for a start. But > providing your own solution should be that difficult either. >> I could also use a RepeatingView I guess, but a RepeatingView expects to >> have a pre-defined html file with the html elements (or compound >> components) >> that you're going to be repeating, no? Thing is that in my case we don't >> know up ahead what kind of components we are goingt to get from the >> backend >> service, nor the number of them, or the order for that matter. >> > Use some repeater(s) combined with your own compound panels, > DateFieldPanel, ComboPanel, etc. > > If I were you I would try to define something abstract at the service > level and then bind these abstractions with some kind of component > factory that knows how to read your abstractions. That way the same > definitions could be used for swing. E.g. instead of > >> Component: TextField > > Type: simple-text| compund-text,... > > > > That way you don't bind your definition to a certain kind of component > but delegate this to the factory... So, you could replace it with > something different if need be. >> I will keep on researching the ideas you guys have provided so far. >> >> Thanks again...and Happy Holidays! >> > You are welcome > > Best, > > Ernesto >> >> >> >> > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > -- View this message in context: http://www.nabble.com/Dynamic-Simple-%28html%29-Components-tp21108904p21128229.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamic Simple (html) Components
Hi, > Component: TextField > Required: True > Type: String > Length:30 > Order: 2 (The order in which it needs to be displayed on the > form) > Defaul Value: "some value" > and so on. > > An entry can also define a compound component (like a Wicket panel component > made up of simple components). > > So for each entry in the array,the Swing app instantiates, configures, and > adds each component on a Swing Panel. > > So I'm sure this can be done in Wicket but I would need to wrap every > possible component (and compound component) on a Wicket panel in order to be > able to do that. (AFAIK WicketWebBeans does exactly that). > > Yes, there are a few projects out there you could use for a start. But providing your own solution should be that difficult either. > I could also use a RepeatingView I guess, but a RepeatingView expects to > have a pre-defined html file with the html elements (or compound components) > that you're going to be repeating, no? Thing is that in my case we don't > know up ahead what kind of components we are goingt to get from the backend > service, nor the number of them, or the order for that matter. > Use some repeater(s) combined with your own compound panels, DateFieldPanel, ComboPanel, etc. If I were you I would try to define something abstract at the service level and then bind these abstractions with some kind of component factory that knows how to read your abstractions. That way the same definitions could be used for swing. E.g. instead of > Component: TextField Type: simple-text| compund-text,... That way you don't bind your definition to a certain kind of component but delegate this to the factory... So, you could replace it with something different if need be. > I will keep on researching the ideas you guys have provided so far. > > Thanks again...and Happy Holidays! > You are welcome Best, Ernesto > > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamic Simple (html) Components
Thanks for the answers guys, getting some ideas here that might be helpful. In a way what our backend allows us to do is define a (specific) form and store it in our database. So, when you call the backend service, it returns and array declaring all the components that will make up the final form. A single entry on this array would be something like: Component: TextField Required: True Type: String Length:30 Order: 2 (The order in which it needs to be displayed on the form) Defaul Value: "some value" and so on. An entry can also define a compound component (like a Wicket panel component made up of simple components). So for each entry in the array,the Swing app instantiates, configures, and adds each component on a Swing Panel. So I'm sure this can be done in Wicket but I would need to wrap every possible component (and compound component) on a Wicket panel in order to be able to do that. (AFAIK WicketWebBeans does exactly that). I could also use a RepeatingView I guess, but a RepeatingView expects to have a pre-defined html file with the html elements (or compound components) that you're going to be repeating, no? Thing is that in my case we don't know up ahead what kind of components we are goingt to get from the backend service, nor the number of them, or the order for that matter. I will keep on researching the ideas you guys have provided so far. Thanks again...and Happy Holidays! -- View this message in context: http://www.nabble.com/Dynamic-Simple-%28html%29-Components-tp21108904p21119250.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamic Simple (html) Components
Hi, I see no contradiction in having your UI (declaratively) defined by a service and having panels (with associated HTML markup): that markup could "match" what you wanted on your "definition". As you also suggest, you could use repeaters to create META-components that read your definition and produce the UI. For instance, an field group component, a grid, that reads the definition and generates a form and the form components out of it. The same for tables, tabs, etc. I wouldn't try to generate HTML directly (e.g using Labels), then what would be the advantage of using wicket? If your abstract definition of the UI is "pure enough" then it shouldn't be a problem to produce similar UIs for Wicket and a Swing application. Ernesto mito wrote: > Hi, > > I've been using Wicket at home for quite a while. The company I work for has > an old Swing application and we've been trying to figure out how to migrate > it and make it web based. > > Even though I've been pitching in for Wicket since day one, the team lead > decided to go with "standard" stack > (jsf,facelets,richfaces,webflow2...ughh). > > Anyways, the thing is that this Swing app generates panels dynamically based > on info that is retrieved from a back-end service. This data contains all > about which components to add to the panel, validations, drop-down data, > order, how they are grouped together, etc... > Our team is having a hard time figuring out how to add this same behaviour > with the technology stack THEY picked :-) > > So my question is...Can I create dynamic components with Wicket that have no > assoicated html markup? > > This would allow me to make a service call and retrieve all the data I need > to generate a page on the fly by iterating through all the data and creating > instances of Wicket components dynamically. > > I know this functionality can be done more easily using Wicket, but have a > problem with it. > > AFAIK Wicket always expects to have associated html markup for a simple html > component (DropDownChoice for example), so I searched around the forums and > found several solutions: > > 1. Wrap every single Wicket html component with a Panel. I think it's a > little bit overkill no? > > 2. Use a RepeatingView and when I want to add a specific Wicket html > component, override its onComponentTag() so that Wicket doesn't complain > about the actual html tag being missing in the html markup. Like this: > > RepeatingView rv = new RepeatingView("dynamic"); > add(rv); > for (int i = 0; i < 5; i++) { > rv.add(new Label(String.valueOf(i), "label_ " + i)); > rv.add(new DropDownChoice("dropDown_" + i, > categories) { > @Override > protected void onComponentTag(ComponentTag tag) { > tag.setName("select"); > super.onComponentTag(tag); > > } > }); > } > > Would this be a good approach? I've done an extensive search in this forum > but that's all I got. > Does anybody have any other ideas? > > I would be so happy if we ended up using Wicket where I work and in order to > do that it would definitely help if it were possible to generate these > dynamic panels. I'm sure it would be easier that doing it with jsf, for > sure! > > Thanks! > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamic Simple (html) Components
Hi Mito Behaviors can also add stuff (like encapsulating your tag in to new tags) to the component, Like I describe here: http://ninomartinez.wordpress.com/2008/12/11/wicket-never-stops-to-impress-me/ mito wrote: Hi, I've been using Wicket at home for quite a while. The company I work for has an old Swing application and we've been trying to figure out how to migrate it and make it web based. Even though I've been pitching in for Wicket since day one, the team lead decided to go with "standard" stack (jsf,facelets,richfaces,webflow2...ughh). Anyways, the thing is that this Swing app generates panels dynamically based on info that is retrieved from a back-end service. This data contains all about which components to add to the panel, validations, drop-down data, order, how they are grouped together, etc... Our team is having a hard time figuring out how to add this same behaviour with the technology stack THEY picked :-) So my question is...Can I create dynamic components with Wicket that have no assoicated html markup? This would allow me to make a service call and retrieve all the data I need to generate a page on the fly by iterating through all the data and creating instances of Wicket components dynamically. I know this functionality can be done more easily using Wicket, but have a problem with it. AFAIK Wicket always expects to have associated html markup for a simple html component (DropDownChoice for example), so I searched around the forums and found several solutions: 1. Wrap every single Wicket html component with a Panel. I think it's a little bit overkill no? 2. Use a RepeatingView and when I want to add a specific Wicket html component, override its onComponentTag() so that Wicket doesn't complain about the actual html tag being missing in the html markup. Like this: RepeatingView rv = new RepeatingView("dynamic"); add(rv); for (int i = 0; i < 5; i++) { rv.add(new Label(String.valueOf(i), "label_ " + i)); rv.add(new DropDownChoice("dropDown_" + i, categories) { @Override protected void onComponentTag(ComponentTag tag) { tag.setName("select"); super.onComponentTag(tag); } }); } Would this be a good approach? I've done an extensive search in this forum but that's all I got. Does anybody have any other ideas? I would be so happy if we ended up using Wicket where I work and in order to do that it would definitely help if it were possible to generate these dynamic panels. I'm sure it would be easier that doing it with jsf, for sure! Thanks! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamic Simple (html) Components
Hi Mito, Basically you are asking for Label. Label can generate anything you want. Look at the source of Label for inspiration if you need more customization.1 Also take a look at TextTemplate. There is also a FreeMarker version, I think its in wicketq-extra. Regards, Erik. mito wrote: So my question is...Can I create dynamic components with Wicket that have no assoicated html markup? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org