我有2个smartGWT buttonLayouts包含保存和取消按钮。一个位于UI的顶部,另一个位于底部以方便使用,因此用户无需一直向上/向下滚动以保存/取消表单。smartGWT复制按钮
当用户在任何地方选择保存/取消时,应该禁用所有按钮,直到后台操作完成。
处理这个问题的最佳方法是什么?
如果我这样做:
private Layout buildTopButtonBar() {
saveButton = new Button("Save");
saveButton.addClickHandler(...);
buttonLayout.addMember(saveButton);
}
private Layout buildBottomButtonBar() {
saveButton = new Button("Save");
saveButton.addClickHandler(...);
buttonLayout.addMember(saveButton);
}
saveButton动作(当用户选择保存时,saveButton应禁用)在我的clickHandler事件只在底栏的按钮来进行,但在其他所有后台操作工作。
如果我这样做:显示
saveButton = new Button("Save");
saveButton.addClickHandler(...);
buildTopButtonBar(); // adds saveButton to top bar
buildBottomButtonBar(); // adds saveButton to bottom bar
只有底部栏。
我可以创建4个单独的按钮:
topSaveButton = new Button("Save");
bottomSaveButton = new Button("Save");
... // add all required functionality and clickHandlers
但这只是感觉罪恶。 我有其他选择吗? 这是smartGWT 4.