the knowledge about wicket
-- Sam 07:38 10/08/2014

wicket tree
dateTreeState有什么作用?现在只知道不能不加。如:
TableTree<BonusRestrictionTreeNode> dateTree = new TableTree<BonusRestrictionTreeNode>("bonusCodes", createColumns(), dateTreeProvider, 10000, new PropertyModel<Set<BonusRestrictionTreeNode>>(this, "dateTreeState")) {
---------------------------------------
  •  What does the PropertyModel do, how does it work?
  • Tree need 4 params to construct:  1, "wicket:Id" string.  2.IColumn[ ]   3.TreeProvider 4.row perpage [5. property model]
  • Tree need to implement only one method: newContentComponent(String id, IModel<PPTreeNode> model)
About PPTreeProvider
  • initialized the roots when constructor being called. and the root is the 14 months' PP.
  • implemented the getChildren method. when getChildren method is called, call load method to add a tree node to the node.(actually, we added only one node into the top level.)

-- Sam 06:37 29/06/2014
 IndicatingAjaxLink vs IndicatingAjaxButton:
IndicatingAjaxLink 要重写onclick 方法  改方法能触发任意次
IndicatingAjaxButton 要重写 onSubmit方法 该方法只能触发一次, 而且如果form里要有错误,则不触发
(可能总结的不对)

遇到的provider增加节点后,树没有更新的问题,(而另一个树貌似是自动更新的,为什么?)
-----because of the different button type, the "另一个“ used normal button, when clicked, it's submit method called, then the form actually refreshed!
the new one don't want to trigger the refresh of form, so it used indicattingAjax button, so when it's onclicked method triggered, should remenber to do the target.addCompoenent(treeContainer).
(the tree Contianner should not be the big form, should be a WebMarkupContainer, in html, it can be a <span> 但是要注意,这个span一定要把indicatingAjaxButton包含进去。
-- Sam 09:19 25/06/2014
 
  1. there's a magic model called CompoundPropertyModel, it uses the component's name as the property expression to retrieve properties on the nested model object. that's why I didn't find where the value was set.
  2. about confirm dialog: I used IndicatingAjaxLink as the button, then I overwroted two method of it: onclick and getAjaxCallDecorator. I found that when debugging,1) it show comfirm dialog first(there is a break point before showing the confirm dialog, but dosen't stop the comform dialog show up!!) 2) if I click OK,  then it stopped in onclicked method first, then stop in the getAjaxCallDecorator method. (which contains the javascripts for showing confirm dialog). while if select cancel, no break point will be stopped at. why??? why not stoped at the showing the confirm dialog line first? why the onclick method is stopped first?
the wicket tree--------------------------------------------------------
  1. new a provider
  2. new a render use the provider as constracture parameter. (the render can contain a list to save the selected nodes).
  3. new a HashSet<HHDateTreeNode>: dateTreeState            (maybe it's not necessary)
  4. new a TableTree. user the parameters (besides the first one : string-->wicket:id)  IColumns, treeProvider, page perRow are needed by both the TableTree constructors, and the second constructor support an extra parameter--->IModel. here we used 
    1. dateTree = new TableTree<HHDateTreeNode>("dateTree", createColumns(), dateTreeProvider, 10000, new PropertyModel<Set<HHDateTreeNode>>(this, "dateTreeState")) {
    2. @Override
    3. protected Component newContentComponent(String id, IModel<HHDateTreeNode> model) {
    4. return dateTreeRenderer.newContentComponent(id, this, model);
    5. };
    6. @Override
    7. protected Item<HHDateTreeNode> newRowItem(String id, int index, IModel<HHDateTreeNode> model){
    8. return new OddEvenItem<HHDateTreeNode>(id, index, model);
    9. }
    10. };
  5. (don't know if it's necessary) give it a theme to make it not looks too wired :dateTree.add(CSSPackageResource.getHeaderContribution(new WindowsTheme()));
  6. (don't know if it's necessary) dateTree.setOutputMarkupId(true);
  7. add to page: form.add(dateTree);
when addNewDates------------------------------------------------------
  1. call lpmBean.getDateTreeRoots() to get the months node.
  2. find the right root,
  3. call the load(root) to do the magic.
HHDateTreeNode has a boolean property--isMonthNode
  1. in it's to String mehod, it check the isMonthNode property, if it's true, then return the simple string, else, return the complex string.
-- Sam 07:34 19/06/2014
  1. IndicatingAjaxButton will trigger the check of the form fields, but will not refresh the feedbackPanel. ajaxButton and Button will trigger the check of the form fields.
  2. when IndicatingAjaxButton's submit triggered, the form bean model hasn't been changed yet, use the get value to get the selected value on page, like:
rewardType.getValue(); 
(rewardType = new DropDownChoice<BonusPayoutTypeEnum>("rewardType", Arrays.asList(BonusPayoutTypeEnum.values()));)

-- Sam 12:01 20/06/2014

Please click here to login and add comments! || automatically refresh content every seconds