我在我的课程中使用TableViewer
EditorPart
TableViewer
,ComboBoxCellEditor
有一个
可编辑的列,其中包含ComboBoxCellEditor
。当我修改列以从ComboBoxCellEditor
中选择值时,在按下Tab键或将焦点移动到其他项目之前,保存按钮不会启用。有什么方法可以在我修改EditingSupport
的值时启用保存。我正在扩展var earlyBirds = document.getElementById("earlyBirds");
var block = document.getElementById("block");
var appearenceEB = function(){
block.style.visibility = visible;
}
var dissappearenceEB = function(){
block.style.visibility = hidden;
}
earlyBirds.addEventListener("mouseover", appearenceEB);
earlyBirds.addEventListener("mouseout", dissappearenceEB);
类以使该列可编辑。在焦点偏离此列之前,不会调用此类中重写的方法。我有什么方法可以得到这项工作吗?
答案 0 :(得分:1)
这就是@TestFor(DatabaseService)
@TestMixin(DomainClassUnitTestMixin)
class MyServiceSpec extends Specification {
def setup() { }
def cleanup() { }
void "test myAction"(){
setup:
mockDomain( Role,[ [authority:"ROLE_ADMIN"], [authority:"ROLE_USER"] ] )
mockDomain( User,[ [username:"test1",password:"1234"] ] )
mockDomain( UserRole )
def userQuery = User.where{username == "test1"}.get()
def roleQuery = Role.where{authority == "ROLE_ADMIN"}.get()
def mockUserRoleService = Mock(UserRoleService){
1 * saveUserRole(userQuery, roleQuery) >> new UserRole(role: roleQuery, user:userQuery).save(flush: true)
}
service.userRoleService = mockUserRoleService
when: "call the action"
service.myAction()
then:
UserRole.count() == 1
}
}
的设计方式。内部方法ComboBoxCellEditor
仅在Tab,Enter和焦点丢失时调用。
除了编写自己的类版本(不大)之外,这些行为看起来都不容易修改。