http post return page
Hello, Is it possible to get http POST variables which are send to Wicket page from external page? My case is similar to PayPal return url, but company which operate the payment, send some important data as POST variables, and I need to extract them in Wicket. When I tried to do it normal way as PageParameters I see that when Wicket recieves POST connection to the WebPage, it translates it to the GET, and throws away POST variables. -- Best regards, Adrian - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: http post return page
On Wed, Dec 8, 2010 at 2:18 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Did you try ((WebRequest) getRequest()).getParameters(key) Thanks, it's working and it's exactly what I need. -- Best regards, Adrian - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Form sending encoding problem 1.5-M3
Hello, I have migrated with a small project to Wicket 1.5-M3, and most of things work fine, but I have one problem with encodings. All my pages are UTF-8, the messages from properties, and database data is fetched fine, But problem appear when I try to send data from form, and it contains some country specific letters. The request isn't processed as it usually did for me in 1.4.9 version. I looked at the headers and see: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: pl,en-us;q=0.7,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7 Content-Type: multipart/form-data; boundary=---974127529778 Content-Length: 1459 it seems that Wicket use ISO-8859-2 as it's POST data encoding, even if I set encodings in markup to UTF-8 (which is prefered form me now). I have google for this issue but can't find solutions but this one: https://cwiki.apache.org/WICKET/how-to-change-the-character-encoding.html So far I tried: 1) in html: ?xml version=1.0 encoding=utf-8? and meta http-equiv=Content-Type content=text/html; charset=UTF-8 / 2) in Application configuration: getMarkupSettings().setDefaultMarkupEncoding(UTF-8); getRequestCycleSettings().setResponseRequestEncoding(UTF-8); 3) in Maven: plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId configuration source1.6/source target1.6/target encodingUTF-8/encoding /configuration /plugin in Jetty plugin: systemProperties systemProperty namefile.encoding/name valueUTF-8/value /systemProperty /systemProperties I look at my earlier projects in 1.4.9, and there was no such problems with encodings, so I guess something was added to 1.5. If someone can help with that I would be greatful, for now ideal solution for me would be even narrow encodings used by Wicket to UTF-8. -- Best regards, Adrian - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form sending encoding problem 1.5-M3
Hello again, I have checked one more thing - I have removed from code and html MultiFileUploadField, so the POST request wasn't multipart, and everything was fine this time (UTF-8 data send from form). Any ideas, what's wrong? A bug in multipart forms processing? -- Thanks in advance, Adrian - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form sending encoding problem 1.5-M3
Unfortunately it wouldn't help - in source: form wicket:id=addEvent accept-charset=UTF-8 id=addEvent9 method=post action=../wicket/page?2-2.IFormSubmitListener-addEvent enctype=multipart/form-data but still characters are messed up. -- Best regards, Adrian On Fri, Nov 26, 2010 at 10:57 AM, Martin Grigorov mgrigo...@apache.org wrote: try with form accept-charset=UTF-8 http://www.w3schools.com/tags/att_form_accept_charset.asp On Fri, Nov 26, 2010 at 10:40 AM, Java Programmer jprogrami...@gmail.comwrote: Hello again, I have checked one more thing - I have removed from code and html MultiFileUploadField, so the POST request wasn't multipart, and everything was fine this time (UTF-8 data send from form). Any ideas, what's wrong? A bug in multipart forms processing? -- Thanks in advance, Adrian - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket 1.5 and WebPageRenderer warn
Hello, I use wicket 1.5-M2.1 right now, and I get warn which I haven't on earlier versions: WARN 2010-10-17 17:45:55,425 WebPageRenderer: The Buffered response should be handled by BufferedResponseRequestHandler What could be the reason of this warn (the application was slightly migrated from 1.4 - 1.5, but I had solved all compilation issus and deprecations)? -- Best regards, Adrian http://www.codeappeal.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Palette model changing problem
Hello, I have a problem with Palette component - I try to retain model objects which were selected in Pallete, and update the list od choices same time (in other word you have one set of available choices takes 2, than press some ajax button and get different set of choices, than takes 3, so you should have 2+3 selected choices, but every time after updating Pallete I got empty selected list). Maybe you can look at the code: private void addKeywordPalette() { final IChoiceRenderer renderer = new IChoiceRenderer() { /not important/ }; keywordPallete = new Palette(Keyword.KEYWORDS, new Model(selectedKeywordCategories), new PropertyModel(this, categories), renderer, 10, true) { protected Recorder newRecorderComponent() { final Recorder recorder = super.newRecorderComponent(); recorder.add(new AjaxFormComponentUpdatingBehavior(onchange) { @Override protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) { // here I save model selectedKeywordCategories = (ArrayListKeywordCategory) keywordPallete.getModelCollection(); LOG.info(selectedKeywordCategories: + selectedKeywordCategories); } }); return recorder; } }; keywordPallete.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true); add(keywordPallete); } The button which updates Palette component looks like: private void addGetKeywordsButton() { final AjaxButton getKeywordsButton = new AjaxButton(GET_KEYWORDS_BUTTON) { @Override protected void onSubmit(AjaxRequestTarget ajaxRequestTarget, Form? form) { //this updates available choices which and renders palette component via ajax final SetKeywordCategory categorySet = keywordService.someServiceWhichReturnsKeywordAndCategory(); categories = new ArrayListKeywordCategory(categorySet); ajaxRequestTarget.addComponent(keywordPallete); } }; getKeywordsButton.add(new Image(IMAGE, ADD_IMAGE)); selectKeywordsForm.add(getKeywordsButton); } What could be wrong that new model isn't used (I use log4j and the selectedKeywordCategories have selected objects, but Palette doesn't use them)? Is there made a copy of that array, or something? -- Best regards, Adrian http://www.codeappeal.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
problem with two ListChoices connected each other
Hello, I need a solution if such component exists: 1) first ListChoice have categories about 1-2k options 2) second ListChoice is empty 3) there are arrows which can move elements from first to second ListChoice, and the way back Main problem in such scenario would be with sending lot of refreshing data through the Ajax, because there are a lot options in fist ListChoice, we need something much simpler, and we cannot find, maybe something pure JavaScript with Model connected. Do you have any idea what we can use for this? -- Thanks in advance, Adrian http://www.codeappeal.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
DataView component path in WicketTester
Hello, Is it possible in WicketTester to check the items which are inside DataView - an example: DataView dataView = new DataView (sampleDataView, provider, 10) { @Override protected void populateItem(Item sampleItem) { sampleItem.add(new Label(title, new Model())); } } and in WicketTester I want to: getWicketTester().assertComponent(sampleDataView: something :title, DataView.class); How can I get that 'something' for the test? Regards, Adr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DataView component path in WicketTester
2010/1/13 Java Programmer jprogrami...@gmail.com: and in WicketTester I want to: getWicketTester().assertComponent(sampleDataView: something :title, DataView.class); Of course should be: getWicketTester().assertComponent(sampleDataView: something :title, Label.class); Sorry for mistake, Adr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
YUI Menu how to remove CSS / skinning
Hi, I need to remove defaukt CSS from YUI menu, or replace it with skin - I search for solution in sources, but can't find - YuiHeaderContributor takes all files from inc catalog, but where is code for skins (there should be only one css than, with e.g. assets/skins/sam/button.css)? I read about http://developer.yahoo.com/yui/articles/skinning/, but don't see the way to use skins in wicket - are there any documentation? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: GMap2 problem with displaying in IE 6/7
On Wed, May 21, 2008 at 4:55 PM, Martin Funk [EMAIL PROTECTED] wrote: Just to make shure, do you still see a bug? Or are things fine now? mf We do not use current version of GMap2, but have older snapshot (we cannot change API right now), but as I see in sources that bug is now fixed. https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-contrib-gmap2/src/main/java/wicket/contrib/gmap/wicket-gmap.js Revision: 3784 Line: 125 - comma on end of JS array, but in next revision simplified JS code fix this error, so probably in new snapshots this bug will not appear. Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
GMap2 problem with displaying in IE 6/7
Hello, I have problem with GMap2 on IE 6/7 - in Firefox 2.x/3.x Maps are shown correctly, but in IE I have JS error lack of definition WicketMap2, and map was not shown. I'm pretty sure that maps were shown some time before maybe some Microsoft update caused problems? I use 1.3-SNAPSHOT build, and Wicket 1.3.2, I can't probably switch project to 1.4 now, because of it near to end state. Problem seems to appear near line: Wicket.Event.add(window, domready, function() { new WicketMap2('map4d'); ... which is followed by: script type=text/javascript src=../../../../resources/wicket.contrib.gmap.GMap2/wicket-gmap.js/script Anybody can help with that, or have same problem? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: GMap2 problem with displaying in IE 6/7
Found bug in that version comma after 'marker': overlayID, in addGOverlayListener click event, probably repaired in earlier versions, sorry for troubling you :(. Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with MultiFileUploadField and keeping rest of fields in model
Hello, I have use MultiFileUploadField for uploading pictures, everything works fine but when I use e.g. setMaxSize(Bytes.kilobytes(1024)) on the form and try to upload larger picture or pictures than limit, I got only one message about hitting limit size, and other fildes are not checked this time (e.g. required text fields). There is also problem with backuping fields from model after such sending, some fields are set up, and some remains empty. I have read about Notice that this component clears its model at the end of the request, so the uploaded files MUST be processed within the request they were uploaded., but I don't think it's the problem. I try to use 2 models one CompoundPropertyModel for texts on form, and one for new MultiFileUploadField(UPLOADS, new Model(new ArrayListFileUpload()), MAX_PICTURES_TO_UPLOAD); (earlier I had everything in CompoundPropertyModel). Anybody knows what could be wrong? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Messages with labels
I have solved it with maybe not elegant way but working: private String getComponentErrorMessage(String componentPath, String keyWithLabel, String label) { Component component = getTester().getComponentFromLastRenderedPage(componentPath); String labeledMessage = component.getString(keyWithLabel); if(label != null) { labeledMessage = labeledMessage.replaceAll(\\$\\{label\\}, component.getString(label)); } return labeledMessage; } On Mon, Apr 14, 2008 at 3:32 PM, Java Programmer [EMAIL PROTECTED] wrote: Hello, How can I in unit tests check if the messages with $label are displayed on page eg.: add_advert.street=Street add_advert.street.Required=Field '${label}' is required. in unit tests: getWicketTester().assertErrorMessages( new String[] { getWicketTester().getComponentFromLastRenderedPage(add_advert:subject).getString(add_advert.street.Required) }); That has not resolve message for component but expected still is Field '${label}' is required. not Field 'Street' is required. How can I change this? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
WicketTester not respecting required textfields
Hello, I'm using 1.3.2 version, I have form with several required elements: private TextField getSubjectTF(final Form form) { TextField subject = new TextField(SUBJECT); subject.setRequired(true); return subject; } private DropDownChoice getConditionDDC(Form form) { DropDownChoice _conditionDDC = new DropDownChoice(CONDITION, Arrays.asList(Condition.values())); _conditionDDC.setChoiceRenderer(new IChoiceRenderer() { public Object getDisplayValue(Object o) { Condition condition = (Condition) o; return getString(Condition.getKey(condition)); } public String getIdValue(Object o, int i) { Condition condition = (Condition) o; return condition.toString(); } }); _conditionDDC.setRequired(true); return _conditionDDC; } I have tests for this page: @Test public void testRequiredFieldsSubmit() { PageParameters parameters = new PageParameters(); parameters.put(category, 1000); getTester().startPage(AddAdvertisement.class, parameters); FormTester form = getTester().newFormTester(AddAdvertisement.ADD_ADVERT); form.submit(); getTester().assertNoInfoMessage(); getTester().assertErrorMessages( new String[] { getComponentErrorMessage(AddAdvertisement.ADD_ADVERT + :subject, add_advert.subject.Required, add_advert.subject), getComponentErrorMessage(AddAdvertisement.ADD_ADVERT + :condition, add_advert.condition.Required, add_advert.condition) }); } When launching this test I got all message errors for DropDownChoice elements which are required, but not for any element which is TextField. Strange because on live page the errors are also for TextField as it should be done. Anybody can explain this? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ajax DropDownChoice and null values
I added onError when Required failed, now works - closed: @Override protected void onError(AjaxRequestTarget target, RuntimeException e) { carPartsModel.setCarModel(null); carPartsModel.setCarModelType(null); carModelDDC.setChoices(Collections.EMPTY_LIST); carModelDDC.setEnabled(false); carModelTypeDDC.setEnabled(false); target.addComponent(carModelDDC); target.addComponent(carModelTypeDDC); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with serializing objects
On Wed, Apr 2, 2008 at 11:15 AM, Ayodeji Aladejebi [EMAIL PROTECTED] wrote: from JPA experience, eager loading of List of Entities is part of what hogs memory. I have profiles an application before that the memory usage just kept growing each time my page reference a particular entity that eager loads other collection of entities. As soon as I removed the eager load annotation, my memory usage became quite stable. Thanks but we tried also with LAZY @Entity @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) public class Category implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; private String name; private String description; @Enumerated(value = EnumType.STRING) private CategoryStatus categoryStatus; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name=parent_id, insertable=false, updatable=false, nullable=true) @Cascade(org.hibernate.annotations.CascadeType.ALL) @Fetch(value=FetchMode.SELECT) @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) private Category parent; @OneToMany(fetch=FetchType.LAZY) @JoinColumn(name=parent_id) @Cascade(org.hibernate.annotations.CascadeType.ALL) @IndexColumn(name=list_id) @Fetch(value=FetchMode.SELECT) @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) private ListCategory children = new ArrayListCategory (); @Index(name = categoryPathIndex) private String categoryPath = ; } and OpenSessionInView in webxml: filter filter-nameOpenSessionInViewFilter/filter-name filter-classcom.test.CarPartsOpenSessionInViewFilter/filter-class /filter filter-mapping filter-nameOpenSessionInViewFilter/filter-name url-pattern/*/url-pattern /filter-mapping but the results were quite same - large sesion file each request took about 100kB more in size, I tried also versioning compontent to false: categoryTreePanel = new CategoryTreePanel(CATEGORIES, categoryDAO.getRootCategories(), category); categoryTreePanel.setVersioned(false); nothing happens ... we are quite afraid of this behaviour ... Regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with serializing objects
Hello, We have problem with serializing webpages - the user session files growing rapidly (each request about 100KB), we don't know what we have did wrong - system is based on examples from wicket.apache.org, so it should work but this large files (10-20MB for some time, after many request) slows it down. We have tried to put transient in all fields which we are use as components on WebPages - it doesn't help. Maybe I put some code and little explain and you can tell us whay is wrong. The example will be consider LinkTree with 2000+ categories: Categories we have as Hibernate Entity cached whole in ehcache in memory: @Entity @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) public class Category implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; private String name; private String description; @Enumerated(value = EnumType.STRING) private CategoryStatus categoryStatus; @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name=parent_id, insertable=false, updatable=false, nullable=true) @Cascade(org.hibernate.annotations.CascadeType.ALL) @Fetch(value=FetchMode.SELECT) @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) private Category parent; @OneToMany(fetch=FetchType.EAGER) @JoinColumn(name=parent_id) @Cascade(org.hibernate.annotations.CascadeType.ALL) @IndexColumn(name=list_id) @Fetch(value=FetchMode.SELECT) @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) private ListCategory children = new ArrayListCategory (); @Index(name = categoryPathIndex) private String categoryPath = ; public Category addChild(Category child) { child.parent = this; children.add(child); return this; } //getters setters hashcode equals } Next we put the categories on panel as: public class CategoryTreePanel extends Panel { private final transient Log LOG = LogFactory.getLog(CategoryTreePanel.class); private transient Category activeCategory; private transient TreeNode treeNode; private transient LinkTree tree; public CategoryTreePanel(String id, ListCategory rootCategory) { this(id, rootCategory, null); } public CategoryTreePanel(String id, ListCategory rootCategory, Category activeCategory) { super(id); LOG.info(activeCategory: + activeCategory); this.activeCategory = activeCategory; tree = new CarPartsLinkTree(category_tree, createTreeModel(rootCategory)); tree.setRootLess(true); LOG.info(treeNode: + treeNode); if(treeNode != null) { expandAllParentNodes(tree, treeNode); tree.getTreeState().selectNode(treeNode, true); } else { tree.getTreeState().collapseAll(); } add(tree); } class CarPartsLinkTree extends LinkTree { public CarPartsLinkTree(String id, TreeModel model) { super(id, model); } @Override protected void onNodeLinkClicked(TreeNode node, BaseTree tree, AjaxRequestTarget target) { super.onNodeLinkClicked(node, tree, target); int catId = ((CategoryTreeNode) ((DefaultMutableTreeNode) node).getUserObject()).getCategory().getId(); setRedirect(true); Page page = getPage(); if(page instanceof AdvertismentsList || page instanceof AddAdvertisement) { setResponsePage(getPage().getClass(), new PageParameters(category= + catId)); } else { setResponsePage(AdvertismentsList.class, new PageParameters(category= + catId)); } } @Override protected ResourceReference getCSS() { return null; } protected Component newNodeComponent(String id, IModel model) { return new LinkIconPanel(id, model, CarPartsLinkTree.this) { private static final long serialVersionUID = 1L; protected void onNodeLinkClicked(TreeNode node, BaseTree tree, AjaxRequestTarget target) { super.onNodeLinkClicked(node, tree, target); CarPartsLinkTree.this.onNodeLinkClicked(node, tree, target); }
Re: Problem with serializing objects
On Wed, Apr 2, 2008 at 11:38 AM, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote: Are you really sure that your detachablemodels are being used all over? We create it in CarPartDataProvider from my first post, next we create DataView based on this provider we implement populate method as: @Override protected void populateItem(Item item) { final CarPart carPart = (CarPart) item.getModelObject(); if (carPart.getCarModel() != null) { item.add(carModel = new Label(CARMODEL, carPart.getCarModel().getModelName())); } else { item.add(carModel = new Label(CARMODEL, getString(ADVERT_LIST_NOMODEL_KEY))); } item.add(price = new Label(PRICE, carPart.getPrice().toString())); item.add(publishDate = new Label(PUBLISHDATE, carPart.getPublishDate().toString())); } Is this the correct way to obtain object from provider - item.getModelObject(); is it use LoadableDetachableModel from provider? We do not ask for CarParts objects in other places, only these 3 classes (provider, model and webpage view as data view), but still see large CarPart objects in session. Any idea? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with serializing objects
I'm little confused now about not using detachable model in places you have marked - I have in first place to pull the object from item: final CarPart carPart = (CarPart) item.getModelObject(); which is load() object correctly - i tested it by quickly putting: @Override protected Object load() { System.out.println(\n\n\n LOAD object: + this.carPartId + \n\n\n); return carPartService.getCarPartById(this.carPartId); } for 3 elements on the page I got in logs: LOAD object: 13 LOAD object: 12 LOAD object: 2 So I think deatachable model is used here? Am I wrong? If I want to use item.setModelObject(new CompoundPropertyModel(carPart)); how can I get netsted object in: carPart.getCarModel().getModelName() Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with serializing objects
I have narrowed my code to: protected void populateItem(Item item) { final CarPart carPart = (CarPart) item.getModelObject(); item.setModelObject(new CompoundPropertyModel(carPart)); item.add(description = new MultiLineLabel(DESCRIPTION)); } and get error about using read only model: java.lang.UnsupportedOperationException: Model class parts.car.wicket.models.CarPartDetachableModel does not support setObject(Object) at org.apache.wicket.model.AbstractReadOnlyModel.setObject(AbstractReadOnlyModel.java:52) What model could I use instead of LoadableDetachedModel? Regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with serializing objects
After all the answers, I start to think that maybe my question was a bit wrong. First I put all the hints you were provided into work eg: item.setModel(new CompoundPropertyModel(item.getModelObject())); item.add(description = new MultiLineLabel(DESCRIPTION)); but still have in session files (pm-null) the text which is provided to MultiLineLabel from model (detachable, and next compound) - I start to think that Wicket always will be keep states of it's components, so it's not kept the CarPart object but just a strings from MultiLineLabel. Am I right with that or not? The problem is that that files grows very fast (10MB is porobably a limit becuse at that size it stops), and also what happens if another user change the state of the object and write it into DB. Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Nice absolute urls - is this possible?
On Thu, Mar 20, 2008 at 4:39 PM, Johan Compagner [EMAIL PROTECTED] wrote: you are worried about what is in the source? so you dont really need it for something else like in an email? but wicket generates for itself relative urls if you need a full for yourself you can use RequestUtils.toAbsolutePath Hello, Thanks for answer, but I still have a problem with that links - I don't need them only for an email, I just don't understand why when I create bookmarkable link for the class/page i have to get an output as relative path. e.g. add(new BookmarkablePageLink(homepage, HomePage.class).setAutoEnable(true)); it render in HTML source as: a href=../../../../page/HomePage/Homepage/a but in this case should just: a href=/page/HomePage/Homepage/a because /page is a mount path for this package. Is it related to RelativePathPrefixHandler? Because it is appended in MarkupParser as appendMarkupFilter(new RelativePathPrefixHandler());, but where BookmarkabelPageLink use it (or Component itself)? Thanks for any help, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Nice absolute urls - is this possible?
Hello, I have question about generated urls e.g. in examples on http://wicketstuff.org/wicket13/niceurl/the/homepage/path we have really nice urls, but they are realtive: a href=../../my/mounted/package/Page4/ is there posiible to make them: a href=/my/mounted/package/Page4/ without ../../ but absolute for servlet mapped as: servlet-mapping servlet-namewicket/servlet-name url-pattern/*/url-pattern /servlet-mapping even if I make url-pattern/somepattern/*/url-pattern I don't recieve /somepattern/my/mounted/package/Page4/ without ../../ I have read about WICKET-1205, and similar people problems with not working relative urls, but mine consider only HTML source to be nicer for web spiders (SEO and such things, my boss won't be happy with trailings ../../, but I would understand if it's wicket feature and can't be changed). Any solution is possible in this matter? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is there any Color Picker ? like the calendar.DatePicker
On Feb 20, 2008 8:28 AM, laiqinyi [EMAIL PROTECTED] wrote: Is there Color Picker ? I can choice any color, than return the color code(like FF 00) thanks Mead I don't know if there are ready to use component but nice and functional JS could be found here http://www.dhtmlgoodies.com/index.html?whichScript=js_color_picker_v2 Making it Wicket component should be rather simple with provided examples ... Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where is wicket-contrib-tinymce ???
On Feb 20, 2008 10:42 PM, Maris Orbidans [EMAIL PROTECTED] wrote: where is wicket-contrib-tinymce project and svn repo ? it's not even mentioned in this page http://wicketstuff.org/confluence/display/STUFFWIKI/Wiki https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-contrib-tinymce Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IDataProvider and Hibernate Search
On Mon, Feb 18, 2008 at 4:29 PM, Ryan Gravener [EMAIL PROTECTED] wrote: You could keep an instance of the search results in the dataprovider. Then on size() and iterator() check to see if results is null. If it is perform the query and store the results Yes, I tried this before and I won't work because of querying size() before iterator() - to get results I need to know what is first result and how many of them to fetch, I don't know this in DataProvider because some other class (DataView?) manage the values provided to iterator (first and count). As I said size() is used BEFORE iterator() so size has to ask for results first, as I don't know where I am in result set (eg. I don't know getCurrentPage() for DataView), I cannot in size() ask for eg. SearchDAO.SearchResults searchedAdverts = searchDAO.getSearchedAdverts(this.query, 40, 20); As I would know or can pass getCurrentPage() to the DataProvider constructor I could fetch the result set in size() method and put them into field of SearchDataProvider. Maybe I should explain how Hibernate Search works here - when asking DAO for results first search is asked and it returns all the docsId which next are sliced based on first, count parameters - next same engine ask database for objects eg form Advertisement a where a.id in (1,23,45,67,77) - in one pass I can get 20 objects from whole results set and the exact number of documents which are proper for search criteria. Is it more clear now I'm not English specialist :) ? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IDataProvider and Hibernate Search
Finally I got it - I use such DataProvider: private class SearchDataProvider implements IDataProvider { private String query; private int resultsPerPage; private SearchDAO.SearchResults searchedAdverts; private Integer resultsCount; public SearchDataProvider(String query, int resultsPerPage) { this.query = query; this.resultsPerPage = resultsPerPage; } public Iterator iterator(int first, int count) { if(searchedAdverts == null) { searchedAdverts = searchDAO.getSearchedAdverts(this.query, first, count); } return searchedAdverts.getResults().iterator(); } public IModel model(Object object) { return new Model((Advertisement) object); } public int size() { if(resultsCount == null) { searchedAdverts = searchDAO.getSearchedAdverts(this.query, 0, this.resultsPerPage); resultsCount = searchedAdverts.getCount(); } return resultsCount; } public void detach() { searchedAdverts = null; } } Transient doesn't work in my case, but setting null on object in detach() makes what transient should. Size is asked only once for a search, and number of results is set as Integer (also could be added to iterator if some results appear in time of walking thru the search results), iterators() if size is known also would be queried once - this is what should be done. Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
panel doesn't see page which it create?
Hello, I have Panel on which in constructor I put nested Panel: public class RegisterUserPanel extends Panel { public RegisterUserPanel(String id) { ... final Panel addLocationPanel = new AddLocationPanel(addLocationPanel); addLocationPanel.add(new SimpleAttributeModifier(style, display:none;)); add(addLocationPanel); add(new CheckBox(openLocationPanelLink).add(new SimpleAttributeModifier(onclick, var panel=document.getElementById(' + addLocationPanel.getMarkupId() + ');panel.style.display=this.checked?'block':'none';))); .. } It's as you see another panel, and the exception is thrown: WicketMessage: This component is not (yet) coupled to a page. It has to be able to find the page it is supposed to operate in before you can call this method (Component#getMarkupId) It means for me that addLocationPanel.getMarkupId() is not setup yet (it could be quite obvious, because it's constructor and I haven't send any info about page to it, and probably it's send after creating instance). But what can i do in such situation? What is best pattern? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: panel doesn't see page which it create?
I have moved my objects in Pnale to fields eg.: public class RegisterUserPanel extends Panel { final CheckBox openClosePanelCheckBox; final Panel addLocationPanel; ... } and from Page I setup attributes: RegisterUserPanel registerUserPanel = new RegisterUserPanel(register_user_panel); add(registerUserPanel); registerUserPanel.openClosePanelCheckBox.add(new SimpleAttributeModifier(onclick, var panel=document.getElementById(' + registerUserPanel.addLocationPanel.getMarkupId() + ');panel.style.display=this.checked?'block':'none';)); But is this good way to follow? Any other pattern to use? best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with two FeedbackPanels on same page
Hello, I have 2 classes which extends Panel, and both have forms on them eg: public class AddAdvertisementPanel extends Panel { public AddAdvertisementPanel(String id) { super(id); feedback = new FeedbackPanel(feedback_add_advert).setOutputMarkupId(true); Form form = new Form(add_advert_form) { @Override protected void onSubmit() { ... } }; form.add(new TextField(title, new PropertyModel(this, title)).setRequired(true)); add(feedback); add(form); } } the other one looks similar but have other names: feedback = new FeedbackPanel(feedback_register_user).setOutputMarkupId(true); Form form = new Form(register_user_form); Both classes are instantiated on same page as panels - problem is when I submit the one form errors appears on both FeedbackPanels, but they only consider one form eg: Add new advertisement: * Field 'title' is required. * Field 'body' is required. [first form here] Register new user: * Field 'title' is required. * Field 'body' is required. [second form here] Why such situation have place? As I read about wicket nesting components should have been wired to their panels, but in my case I appear as they are global, and I could not have 2 FeedbackPanels on one page? Anyone can explain me that? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with two FeedbackPanels on same page
On Sun, Feb 10, 2008 at 9:24 PM, richardwilko [EMAIL PROTECTED] wrote: Ive not tried it myself but this might help you http://cwiki.apache.org/WICKET/using-more-than-one-feedbackpanel-per-page.html Richard It works perfectly thanks. BTW could there be any performance loss when using this filter? Maybe it would be better to stay away from such situations? Best regards and thx, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Any example of using DataView with Forms?
hello, I have problem with setting Forms on DataView. I have list of Consumer objects, each consumer has Set of attributes, I wanted to add DropDownChoice with all attributes, when pressing Add consumer would get new attribute to its Set, and will be saved in database. Quite simply but not form me :( Some ugly spike code: private class ConsumerDataView extends DataView { public ConsumerDataView(String id, ConsumerDataProvider dataProvider) { super(id, dataProvider); } protected void populateItem(Item item) { final Consumer consumer = (Consumer) item.getModelObject(); item.setModel(new CompoundPropertyModel(consumer)); item.add(new Label(name)); Form addAttributeForm = new Form(addAttributeForm) { protected void onSubmit() { System.out.println(getModel().getObject()); } }; /* AttributeDescriptorProvider attributeDescriptorProvider = new AttributeDescriptorProvider(); DropDownChoice attributeDescriptor = new DropDownChoice(attributeDescriptors, new PropertyModel(attributeDescriptorProvider, attributeDescriptor), getAttributeDAO().getAllAttributeDescriptors()); */ DropDownChoice attributeDescriptor = new DropDownChoice(attributeDescriptors, new Model(new AttributeDescriptor()), getAttributeDAO().getAllAttributeDescriptors()); addAttributeForm.add(attributeDescriptor); item.add(addAttributeForm); } } Submiting this form results in WicketMessage: No get method defined for class: class com.test.entities.Consumer expression: addAttributeForm I consider that addAttributeForm doesn't belongs to object, but does this mean that I cannot nest forms in data view? HTML code of form: tr wicket:id=consumers td form style=margin:0; wicket:id=addAttributeForm select wicket:id=attributeDescriptors option[option]/option /select input type=submit value=Add / /form /td td input type=checkbox wicket:id=selected / /td /tr Any idea what should be done to get it work? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Any example of using DataView with Forms?
Oh I did it ... The previous code need small changes: Model model = new Model(new AttributeDescriptor()); addAttributeForm.setModel(model); DropDownChoice attributeDescriptor = new DropDownChoice(attributeDescriptors, model, getAttributeDAO().getAllAttributeDescriptors()); and then we can use: protected void onSubmit() { AttributeDescriptor attributeDescriptor = (AttributeDescriptor) getModel().getObject(); consumer.getAttributeDescriptor().add(attributeDescriptor); try { getConsumerService().changeAttributesDescr(consumer.getName(), consumer.getAttributeDescriptor()); } catch (ConsumerException e) { e.printStackTrace(); } } consumer also was removed from model (removed line item.setModel(new CompoundPropertyModel(consumer)); ) so form could its own model ... Maybe there is better solution for this, but that is working so it maybe helps someone Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about JavaScript validation
Thank you for the answers, I agree that server side validation is more important, from e.g. security reasons, but if you make something we called now Web 2.0 application is nice to have also client side validations scripts. So I can check if login is free to use via Ajax, but checking if password confirmation match password I would prefer to do via normal JavaScript code (if there are huge number of requests, it'll be better solution). Such functionality offered Struts, so if there is no such functionality in Wicket it would be probably my first step to write one. Thanks again for answers, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Question about JavaScript validation
Hello, Is there any simple way to generate javascripts to validate forms against validation rules provided by Wicket Validators e.g. RequiredValidator? I have on mind client side validators to check is fields not empty, or provided passwords match. For now I see that Ajax support is great, but cant find any exaples for common client javascripts to prevalidate forms - if there are any ready to use, how can I write my own? Any working examples to see? Best regards, Adr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]