Re: Design of components utilizing JS, was: Wicket and JQuery - lavalamp
Uwe Schäfer-2 wrote: nice. why not on wicketstuff? I'll be glad putting it there. It's my intention. I've checked out wicketstuff. Should I just add my code and check in? Who should I contact to about this? Uwe Schäfer-2 wrote: 1st: afaik you should not use $(document).ready(... as it would break compatibility with other JS frameworks redefining the $ jQuery(document).ready(... or (function($) { /* some code that uses $ */ })(jQuery) would be better. please keep in mind, you only contribute one component to the page, so there might be a bunch of others ;) I am a totally newbie in the JS domain so your ramark really helps me learning this stuff. Uwe Schäfer-2 wrote: as it is a good practice to add functions (aka plugins) to the jQuery object, including the jQuery script more than once in a page is not only useless waste of bandwidth and lowers user experience, but does severel harm (last wins). I think that when I add it to the wicketstuff-jquery module, this problem will vanish. I've noticed that the parent behavior of the Wicket-JQuery checks (in the responseHead method) checks if it's already been added. My behavior will extend this one so it shouldn't harm anything. Or am I wrong? Uwe Schäfer-2 wrote: oh, and PS: i don´t get LockButton/ResetButton/validate in the global namespace?! (see jquery.lavalamp.js) :) I'll look into that as well. And many thanks. I'll tell you the truth, I'm pretty exited adding a (even as small as it is) module and to contribute something I picked up... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - Eyal Golan egola...@gmail.com Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Wicket-and-JQuery---lavalamp-tp24985566p24993063.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
Reading an attribute that is set in a CSS file as a class
Hello, Suppose I have a CSS file that is used in our application (HeaderContributer etc.) In this file I have many classes. Suppose I want to get an attribute that is in one of these classes. Example: In my CSS file I have: ... .colored-table { border: thin; background-color: #BB ... } I want in Wicket code something like: getClassAttributeFromCss(CSS_File, attributeName). And, putting in CSS file the location of that file (same methods as in the HeaderContributor.forCss). Putting background-color in the second parameter. Result: #BB Is it possible? - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20523855.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reading an attribute that is set in a CSS file as a class
Steve Swinsburg-2 wrote: On your component attach an AttributeAppender or AttributeModifier, set the class attribute to be the name of your class. Done :) Thanks Steve but this is not what I meant. Adding a class as an attribute to a component is a pretty basic stuff. What I want is, getting a value of an attribute of a class in a CSS file. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/Reading-an-attribute-that-is-set-in-a-CSS-file-as-a-class-tp20523855p20524044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DataTable - tfoot before tbody?
Hi, I have a customized DataTable. Here's what we have in the constructor: super(id, columns, dataProvider, rowsPerPage); add(HeaderContributor.forCss(/eurekify/style/EurekifyDataTable.css)); add(new AttributeAppender(class, true, new Model(eurekifyTable), )); addTopToolbar(newNavigationToolbar()); addTopToolbar(newHeadersToolbar(dataProvider)); addBottomToolbar(new NoRecordsToolbar(this)); addBottomToolbar(new EurekifyBottomTableToolbar(this, rowsPerPage, modalWindows, showSelectRecordsPerPage)); add(new AttributeAppender(class, true, new Model(emptyTable), ) { private static final long serialVersionUID = 1L; @Override public boolean isEnabled(Component component) { return dataProvider.size() == 0; } }); More info: newHeadersToolbar(...) returns AjaxFallbackHeadersToolbar (which is HeadersToolbar) newNavigationToolbar(...) returns StyledAjaxNavigationToolbar which inherits from AjaxNavigationToolbar (which is NavigationToolbar). EurekifyBottomTableToolbar inherits from AbstractToolbar. When I look at FireBug, I see that the tfoot section of the table is BEFORE the tbody. Has anyone encountered this? Do I do something wrong? - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ JVDrums LinkedIn: http://www.linkedin.com/in/egolan74 LinkedIn -- View this message in context: http://www.nabble.com/DataTable---tfoot-before-tbody--tp19241603p19241603.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Confused
Hi, I have a page that holds a list (of Strings). In the constructor, I initialize the list. Then I call a Panel with this list to create a ListView of something. In a Modal window I set the list to have data in. The problem is that the list is initialized whenever I refresh the page (F5) (the Page's constructor is called). How can I pass this problem. Where should I keep a model that holds the list data? Some code: ... Class members: private ListString linksIds; private final LinksPanel linksPanel; ... In the constructor: super(id); setOutputMarkupId(true); linksIds = new LinkedListString(); ... linksPanel = new LinksPanel(links, getLinksIds()); ... The getters and setters: public ListString getLinksIds() { return linksIds; } public void setLinksIds(ListString linksIds) { this.linksIds = linksIds; linksPanel.setLinksByIds(linksIds); } The setter is called when the user press OK in a Modal window. The list is changed and the UI changes Ajax-ly. So this is OK. The only problem is refreshing the Page. Thanks for any help, - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 http://www.linkedin.com/in/egolan74 -- View this message in context: http://www.nabble.com/Confused-tp18064846p18064846.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Confused
Thanks Martin, That really helped. Though I did something else and now I have a new problem. It's an Ajax problem now. Here's what I did: In the constructor: idsModel = new LoadableDetachableModel() { private static final long serialVersionUID = 1L; @Override protected Object load() { ListString ids = new ArrayListString(); ListProperty properties = sageDal.getPreference(userId, SETTINGS_GROUP, HomePageSectionPanel.this.sectionId); for (Property property : properties) { ids.add(property.getValue()); } return ids; } }; linksPanel = new LinksPanel(links, idsModel); I am adding the ListView in LinksPanel: private void init(final ListLinkContainer links) { add(new LinksListView(listview, new AbstractReadOnlyModel() { private static final long serialVersionUID = 1L; @Override public Object getObject() { return links; } })); } (I have a method that changes the String ids to the LinkContainer). My problem is when setting new list. Here is my code: public void setLinksIds(ListString linksIds) { sageDal.setPreference(userId, SETTINGS_GROUP, sectionId, linksIds.toArray(new String[0])); } It works and I actually see the change in the database. When refreshing (or checking in the DB) I see changes. BUT, it doesn't change automatically. I use a ModalWindow and here's where I add my panel to the modal: setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 1L; public void onClose(AjaxRequestTarget target) { target.addComponent(homePageSectionPanel); } }); I'm sure I need to add something else somewhere. But what? and where ? Thanks, Eyal Martin Makundi wrote: Hi! Here is a good example of a list model: public abstract class AbstractListChoiceModelS extends AbstractReadOnlyModelList? extends S { @Override public final ListS getObject() { return getChoices(); } public abstract ListS getChoices(); } Now change your code as follows: linksPanel = new LinksPanel(links, new AbstractListChoiceModelString() { @Override public ListString getChoices() { // Where did you get your choices in the first place? } } ); - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 href=http://www.linkedin.com/in/egolan74 -- View this message in context: http://www.nabble.com/Confused-tp18064846p18066913.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Palette within a ModalWindow
Hi, Can you send a code example of how you have used the setContent , ModalWindow and Pallete all together? I used the same as the examples of ModalWindow with a Page. And the Page has the Pallete. There aren't many examples of Palette. Thanks, Eyal Kai Mütz (Old) wrote: Hi, I want to realize a palette within a ModalWindow. I have subclassed the ModalWindow and added a palette with the setContent() method. This works actually, the model is updated with the selected choices after closing the modal window and submitting the form. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 href=http://www.linkedin.com/in/egolan74 -- View this message in context: http://www.nabble.com/Palette-within-a-ModalWindow-tp15829096p18071792.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: isVisible vs. setVisible
Yes but ... isVisible may be triggered several times, while setVisible should only be called once (say if I do it only once after creating the component). Usually I prefer the state driven way, but what if the logic has a lot of overhead? Jonathan Locke wrote: isVisible is generally better imo because it is state driven. if you push instead of pull, the state can get stale. - Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 http://www.linkedin.com/in/egolan74 -- View this message in context: http://www.nabble.com/isVisible-vs.-setVisible-tp17860615p17860930.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]