本文整理汇总了Java中com.sun.javafx.application.PlatformImpl.runAndWait方法的典型用法代码示例。如果您正苦于以下问题:Java PlatformImpl.runAndWait方法的具体用法?Java PlatformImpl.runAndWait怎么用?Java PlatformImpl.runAndWait使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.javafx.application.PlatformImpl
的用法示例。
在下文中一共展示了PlatformImpl.runAndWait方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
public void show(final Object frame, final Object panel) {
SwingAWTUtils.setJFrameTitle(frame, title);
final CountDownLatch sync = new CountDownLatch(1);
PlatformImpl.runAndWait(new Runnable() {
public void run() {
fillScene();
SwingAWTUtils.setJFXPanelScene(panel, scene);
SwingAWTUtils.setJFXPanelSize(panel, (int)scene.getWidth(), (int)scene.getHeight());
sync.countDown();
}
});
try {
sync.await();
} catch (InterruptedException ex) {
Logger.getLogger(CombinedTestChooserPresenter.class.getName()).log(Level.SEVERE, null, ex);
}
SwingAWTUtils.finishShow(frame);
}
示例2: emptyPropertyShouldChangeWhenAllPanelsRemovedAndAdded
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Test public void emptyPropertyShouldChangeWhenAllPanelsRemovedAndAdded(){
assertThat( systemUnderTest.emptyProperty().get(), is( false ) );
@SuppressWarnings("unchecked")//mockito mocking
ChangeListener< Boolean > emptyListener = mock( ChangeListener.class );
systemUnderTest.emptyProperty().addListener( emptyListener );
configuration.jobPolicies().entrySet().iterator().next().setValue( BuildWallJobPolicy.NeverShow );
PlatformImpl.runAndWait( () -> {} );
verify( emptyListener, times( 0 ) ).changed( systemUnderTest.emptyProperty(), false, true );
configuration.jobPolicies().entrySet().forEach( entry -> entry.setValue( BuildWallJobPolicy.NeverShow ) );
PlatformImpl.runAndWait( () -> {} );
verify( emptyListener ).changed( systemUnderTest.emptyProperty(), false, true );
configuration.jobPolicies().entrySet().iterator().next().setValue( BuildWallJobPolicy.AlwaysShow );
PlatformImpl.runAndWait( () -> {} );
verify( emptyListener ).changed( systemUnderTest.emptyProperty(), true, false );
configuration.jobPolicies().entrySet().forEach( entry -> entry.setValue( BuildWallJobPolicy.AlwaysShow ) );
PlatformImpl.runAndWait( () -> {} );
verify( emptyListener ).changed( systemUnderTest.emptyProperty(), true, false );
}
示例3: createHtmlPane
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
private Tuple<JFXPanel, WebView> createHtmlPane() {
final JFXPanel fxpanel = new JFXPanel();
final AtomicReference<JFXPanel> panelRef = new AtomicReference<JFXPanel>(fxpanel);
final AtomicReference<WebView> viewRef = new AtomicReference<WebView>();
PlatformImpl.runAndWait( () -> {
final WebView webView = new WebView();
fxpanel.setScene(new Scene(webView));
webView.getEngine().setOnError( (evt) -> {
LOGGER.log(Level.WARNING, evt.toString());
});
panelRef.set(fxpanel);
viewRef.set(webView);
});
contentPanel.add(panelRef.get(), HTML_VIEW_ID);
return new Tuple<>(panelRef.get(), viewRef.get());
}
示例4: executeInFXUIThread
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@FromAnyThread
private void executeInFXUIThread() {
while (true) {
try {
PlatformImpl.runAndWait(fxTask);
break;
} catch (final IllegalStateException e) {
LOGGER.warning(this, e);
ThreadUtils.sleep(1000);
}
}
}
示例5: createApplication
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Override
protected void createApplication(Class<Application> appClass) {
PlatformImpl.runAndWait(() ->
{
try {
app = appClass.newInstance();
} catch (Throwable t) {
reportError("Error creating app class", t);
}
});
}
示例6: showNotification
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
/**
* Method to show a notification using {@link Notifications} in the correct style.
* @param notification the {@link BuildResultStatusNotification} to show.
* @param notifications the {@link Notifications} to use.
* @param duration the duration to display for.
*/
public void showNotification( BuildResultStatusNotification notification, Notifications notifications, int duration ) {
PlatformImpl.runAndWait( () -> {
notifications
.darkStyle()
.hideAfter( new Duration( duration ) )
.position( Pos.BOTTOM_RIGHT )
.title( NEW_BUILD )
.text( createText( notification ) )
.graphic( createGraphic( notification ) )
.show();
} );
}
示例7: shoudlHideHeaderWhenTriggered
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Test public void shoudlHideHeaderWhenTriggered() {
systemUnderTest.hideColumnHeaders( table );
table.setWidth( 100 );
PlatformImpl.runAndWait( () -> {} );
assertThat( header.getMaxHeight(), is( ColumnHeaderHider.ZERO_DIMENSION ) );
assertThat( header.getMinHeight(), is( ColumnHeaderHider.ZERO_DIMENSION ) );
assertThat( header.getPrefHeight(), is( ColumnHeaderHider.ZERO_DIMENSION ) );
assertThat( header.isVisible(), is( false ) );
assertThat( header.isManaged(), is( false ) );
}
示例8: select
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
/**
* Method to select the item associated with the given {@link ConfigurationTreeItems}.
* @param item the {@link ConfigurationTreeItems} to select.
*/
public void select( ConfigurationTreeItems item ) {
TreeItem< ConfigurationItem > treeItem = itemMapping.get( item );
if ( treeItem == null ) {
return;
}
PlatformImpl.runAndWait( () -> getSelectionModel().select( treeItem ) );
}
示例9: initialiseSystemUnderTest
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Before public void initialiseSystemUnderTest(){
TestApplication.startPlatform();
PlatformImpl.runAndWait( () -> {
systemUnderTest = new DoublePropertySpinner();
systemUnderTest.setValueFactory( new DoubleSpinnerValueFactory( 0, 100 ) );
} );
}
示例10: initialiseSystemUnderTest
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Before public void initialiseSystemUnderTest(){
TestApplication.startPlatform();
PlatformImpl.runAndWait( () -> {
property = new SimpleObjectProperty<>();
systemUnderTest = new SimplePropertyBox<>();
systemUnderTest.bindProperty( property );
} );
}
示例11: launchBox
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
/**
* Method to launch the {@link FontFamilyPropertyBox} on the JavaFx {@link Thread}.
*/
private void launchBox(){
TestApplication.startPlatform();
PlatformImpl.runAndWait( () -> {
systemUnderTest = new FontFamilyPropertyBox( property );
} );
}
示例12: shouldHideWhenCancelled
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Test public void shouldHideWhenCancelled() throws InterruptedException {
BorderPane pane = new BorderPane();
TestApplication.launch( () -> pane );
PlatformImpl.runAndWait( () -> systemUnderTest.show( pane, 0, 0 ) );
assertThat( systemUnderTest.isShowing(), is( true ) );
PlatformImpl.runAndWait( () -> systemUnderTest.getItems().get( 2 ).fire() );
assertThat( systemUnderTest.isShowing(), is( false ) );
}
示例13: stageShouldHideWhenTold
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Test public void stageShouldHideWhenTold(){
stageShouldShowWhenTold();
assertThat( systemUnderTest.stage().isShowing(), is( true ) );
systemUnderTest.hideConfigurationWindow();
PlatformImpl.runAndWait( () -> {} );
assertThat( systemUnderTest.stage().isShowing(), is( false ) );
assertThat( systemUnderTest.isConfigurationWindowShowing(), is( false ) );
}
示例14: shouldProvideEnvironmentWindow
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Test public void shouldProvideEnvironmentWindow() {
when( connector.connect( digest ) ).thenReturn( true );
systemUnderTest = new JttSceneConstructor( Scene::new, digestController, connector );
PlatformImpl.runAndWait( () -> {
Scene scene = systemUnderTest.makeScene();
assertThat( scene.getRoot(), instanceOf( EnvironmentWindow.class ) );
assertThat( scene.getAccelerators().isEmpty(), is( true ) );
} );
assertThat( systemUnderTest.initializer(), is( notNullValue() ) );
}
示例15: initialiseSystemUnderTest
import com.sun.javafx.application.PlatformImpl; //导入方法依赖的package包/类
@Before public void initialiseSystemUnderTest(){
MockitoAnnotations.initMocks( this );
database = new TestJenkinsDatabaseImpl();
database.store( new JenkinsJobImpl( "Project Build" ) );
database.store( new JenkinsJobImpl( "Subset A" ) );
database.store( new JenkinsJobImpl( "Subset B" ) );
database.store( new JenkinsJobImpl( "Subset C" ) );
database.store( new JenkinsJobImpl( "Units (Legacy)" ) );
database.store( new JenkinsJobImpl( "Long Tests" ) );
database.store( new JenkinsJobImpl( "Capacity Tests" ) );
database.store( new JenkinsJobImpl( "Integration Tests" ) );
database.store( new JenkinsJobImpl( "Configurable Build1" ) );
database.store( new JenkinsJobImpl( "Configurable Build2" ) );
database.store( new JenkinsJobImpl( "Configurable Build3" ) );
database.store( new JenkinsJobImpl( "Configurable Build4" ) );
database.store( new JenkinsJobImpl( "Configurable Build5" ) );
database.store( new JenkinsJobImpl( "Configurable Build6" ) );
database.store( new JenkinsJobImpl( "Configurable Build7" ) );
Random random = new Random();
for ( JenkinsJob job : database.jenkinsJobs() ) {
int userCount = random.nextInt( 20 );
for ( int i = 0; i < userCount; i++ ) {
job.setBuildStatus( BuildResultStatus.values()[ i %BuildResultStatus.values().length ] );
job.culprits().add( new JenkinsUserImpl( "User " + userCount + "_" + i ) );
}
}
TestApplication.startPlatform();
systemConfiguration = new SystemConfiguration();
systemUnderTest = new DualBuildWallDisplayImpl( database, systemConfiguration );
systemConfiguration.getLeftConfiguration().jobPolicies().entrySet().forEach( entry -> entry.setValue( BuildWallJobPolicy.AlwaysShow ) );
systemConfiguration.getRightConfiguration().jobPolicies().entrySet().forEach( entry -> entry.setValue( BuildWallJobPolicy.AlwaysShow ) );
PlatformImpl.runAndWait( () -> {} );
}