8197549: Implement a new method similar to waitState() on Operator which run the check on event queue

Reviewed-by: serb
This commit is contained in:
Abdul Kolarkunnu 2018-02-16 18:27:35 +05:30
parent b6a2f5517e
commit 3715cbe450

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -718,6 +718,25 @@ public abstract class Operator
}
}
/**
* Waits a state specified by a ComponentChooser instance on EDT queue.
*
* @param state a ComponentChooser defining the state criteria.
* @throws TimeoutExpiredException if the state has not achieved in a value
* defined by {@code "ComponentOperator.WaitStateTimeout"}
*/
public void waitStateOnQueue(final ComponentChooser state) {
waitState((comp) -> {
return (boolean) (queueTool.invokeSmoothly(
new QueueTool.QueueAction<Object>("checkComponent") {
@Override
public final Object launch() throws Exception {
return state.checkComponent(comp);
}
}));
});
}
////////////////////////////////////////////////////////
//Mapping //
////////////////////////////////////////////////////////