当前位置: 首页>>代码示例>>Java>>正文


Java PlatformImpl.runAndWait方法代码示例

本文整理汇总了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);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:CombinedTestChooserPresenter.java

示例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 );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:25,代码来源:GridWallImplTest.java

示例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());
}
 
开发者ID:phon-ca,项目名称:phon,代码行数:21,代码来源:BufferPanel.java

示例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);
        }
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:13,代码来源:FXEditorTaskExecutor.java

示例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);
        }
    });
}
 
开发者ID:edvin,项目名称:fxlauncher,代码行数:12,代码来源:Launcher.java

示例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();
   } );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:19,代码来源:BuildResultStatusDesktopNotification.java

示例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 ) );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:12,代码来源:ColumnHeaderHiderTest.java

示例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 ) );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:13,代码来源:ConfigurationTree.java

示例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 ) );
   } );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:8,代码来源:DoublePropertySpinnerTest.java

示例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 );
   } );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:9,代码来源:SimplePropertyBoxTest.java

示例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 );
   } );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:10,代码来源:FontFamilyPropertyBoxTest.java

示例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 ) );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:10,代码来源:JobProgressTreeContextMenuTest.java

示例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 ) );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:9,代码来源:PreferenceWindowControllerTest.java

示例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() ) );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:12,代码来源:JttSceneConstructorTest.java

示例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( () -> {} );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:40,代码来源:DualBuildWallDisplayImplTest.java


注:本文中的com.sun.javafx.application.PlatformImpl.runAndWait方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。