【dorado7】技术
1.在js方法内直接输入需要控件的id,在方法内可直接使用此控件
OnSuccess(self, arg, labelMemInfo, progressBarMemInfo, buttonGetMemInfo)
2.在view文件下用同名的js写javaScript文件,用@Bind 注解。#号表示id,^号表示批量id
/** @Bind #button1.onClick */ !function(editor1) { editor1.set("text", "您单击了button1aaaaaaaaaaaaaaaa"); }
@View将方法绑定到view对象中,可以用view对象调用;@Global设为全局方法
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
/** * @View * @Global */ function showMessage(text) { dorado.widget.NotifyTipManager.notify(text); }
3.动态El $${}
4.导入 <Import src="com.bstek.dorado.sample.basic.ShardComponents#buttons" /> ,如需导入多个控件,可用groupStart, groupEnd包含起来
5.动态视图:View节点listener= spring:beanId#method
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
@Component public class DynaView { public void onViewInit(Panel panelButtons) { panelButtons.setCaption("此标题是通过视图拦截器设置的"); for (int i = 1; i <= 8; i++) { Button button = new Button(); button.setCaption("Button " + i); AnchorLayoutConstraint layoutConstraint = new AnchorLayoutConstraint(); layoutConstraint.setAnchorLeft(AnchorMode.previous); layoutConstraint.setLeft("5"); layoutConstraint.setTop("10"); button.setLayoutConstraint(layoutConstraint); button.addClientEventListener( "onClick", new DefaultClientEvent( "dorado.MessageBox.alert('You clicked ' + self.get('caption'));")); panelButtons.addChild(button); } } }
6.视图上下文:客户端和服务器端可以共同使用
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
@Expose public void testAjax(DoradoContext context) { context.setAttribute(DoradoContext.VIEW, "attr1", "value2"); String attr2 = (String) context.getAttribute(DoradoContext.VIEW, "attr2"); context.setAttribute(DoradoContext.VIEW, "attr2", attr2.toUpperCase()); context.setAttribute(DoradoContext.VIEW, "attr3", "New ViewContext Attribute."); }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
// @Bind view.onReady !function() { view.set("context.attr2", "some text"); refreshFormViewContext(); }
7.i18n
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
@Component public class MyBean { @DataProvider public Collection<Employee> findEmployeesByNamePattern(String pattern) throws Exception { if (StringUtils.isEmpty(pattern)) { // 获得当前Class的私有国际化资源束 ResourceManager resourceManager = ResourceManagerUtils.get(getClass()); throw new IllegalArgumentException(resourceManager.getString("PatternUndefined")); } ... ... } }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
\#buttonSave.tip=保存当前记录 <-- 注入到id为buttonSave的按钮的tip属性 \#view=代码维护 <-- 注入到View的title属性 \#Employee.#address=地址 <-- 查找名为Employee的DataType,并注入到其中address属性描述的caption属性中 \#Employee.#address.tip=请输入您的地址 <-- 注入到上面属性描述的tip属性中 \#gridEmployee.#comment=备注 <-- 查找id为gridEmployee的DataGrid,并注入到其中comment列的caption属性中
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<bean parent="dorado.globalResourceSearchPathRegister"> <property name="searchPath" value="home:resources/" /> </bean>
可以将国际化资源存入数据库
http://wiki.bsdn.org/pages/viewpage.action?pageId=9928829
8.主从表懒加载, 在主DateType下添加Refrence控件,并指定其DataProvider和parameter如:$${this.id}
9.递归树http://wiki.bsdn.org/pages/viewpage.action?pageId=2326589
10.MapValue
将某个字段 的MapValue属性${dorado.getDataProvider("employeeInterceptor#getTitlesOfCourtesy").getResult()}
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
@DataProvider public Map<String, String> getTitlesOfCourtesy() { Map<String, String> mapValue = new LinkedHashMap<String, String>(); mapValue.put("Mr.", "Mister"); mapValue.put("Mrs.", "Mistress"); mapValue.put("Ms.", "Miss"); mapValue.put("Dr.", "Doctor"); return mapValue; }
11.