• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UIService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.scijava.ui.UIService的典型用法代码示例。如果您正苦于以下问题:Java UIService类的具体用法?Java UIService怎么用?Java UIService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UIService类属于org.scijava.ui包,在下文中一共展示了UIService类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testOpenHelpPageOpensDialogWhenPlatformServiceNull

import org.scijava.ui.UIService; //导入依赖的package包/类
@Test
public void testOpenHelpPageOpensDialogWhenPlatformServiceNull()
	throws Exception
{
	final UIService uiService = mock(UIService.class);
	final LogService logService = mock(LogService.class);

	Help.openHelpPage("http://bone.org", null, uiService, logService);

	// verify that showDialog was called
	verify(uiService).showDialog(
		"Help page could not be opened: no platform service", ERROR_MESSAGE);

	// verify that the exception was logged
	verify(logService).error("Platform service is null");
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:17,代码来源:HelpTest.java


示例2: testOpenHelpPageOpensDialogWhenURLMalformed

import org.scijava.ui.UIService; //导入依赖的package包/类
@Test
public void testOpenHelpPageOpensDialogWhenURLMalformed() throws Exception {
	final String badAddress = "htp://bone.org";
	final PlatformService platformService = mock(PlatformService.class);
	final UIService uiService = mock(UIService.class);
	final LogService logService = mock(LogService.class);

	Help.openHelpPage(badAddress, platformService, uiService, logService);

	// verify that showDialog was called
	verify(uiService).showDialog(
		"Help page could not be opened: invalid address (" + badAddress + ")",
		ERROR_MESSAGE);

	// verify that the exception was logged
	verify(logService).error(any(MalformedURLException.class));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:18,代码来源:HelpTest.java


示例3: testOpenHelpPageOpensDialogWhenIOException

import org.scijava.ui.UIService; //导入依赖的package包/类
@Test
public void testOpenHelpPageOpensDialogWhenIOException() throws Exception {
	final PlatformService platformService = mock(PlatformService.class);
	doThrow(new IOException()).when(platformService).open(any(URL.class));
	final UIService uiService = mock(UIService.class);
	final LogService logService = mock(LogService.class);

	Help.openHelpPage("http://bone.org", platformService, uiService,
		logService);

	// verify that showDialog was called
	verify(uiService).showDialog(
		"An unexpected error occurred while trying to open the help page",
		ERROR_MESSAGE);

	// verify that the exception was logged
	verify(logService).error(any(IOException.class));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:19,代码来源:HelpTest.java


示例4: testWarnAnisotropyReturnsTrueIfAnisotropicImageAndUserOK

import org.scijava.ui.UIService; //导入依赖的package包/类
@Test
   @Category(org.bonej.wrapperPlugins.SlowWrapperTest.class)
public void testWarnAnisotropyReturnsTrueIfAnisotropicImageAndUserOK()
	throws Exception
{
	final ImagePlus imagePlus = mock(ImagePlus.class);
	final Calibration anisotropicCalibration = new Calibration();
	anisotropicCalibration.pixelWidth = 0.5;
	when(imagePlus.getCalibration()).thenReturn(anisotropicCalibration);
	final UIService uiService = mock(UIService.class);
	when(uiService.showDialog(anyString(), any(MessageType.class), any()))
		.thenReturn(OK_OPTION);

	assertTrue(Common.warnAnisotropy(imagePlus, uiService));
       verify(uiService, timeout(1000)).showDialog(anyString(), any(
               MessageType.class), any());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:18,代码来源:CommonTest.java


示例5: testWarnAnisotropyReturnsFalseIfAnisotropicImageAndUserCancels

import org.scijava.ui.UIService; //导入依赖的package包/类
@Test
public void testWarnAnisotropyReturnsFalseIfAnisotropicImageAndUserCancels()
	throws Exception
{
	final ImagePlus imagePlus = mock(ImagePlus.class);
	final Calibration anisotropicCalibration = new Calibration();
	anisotropicCalibration.pixelWidth = 0.5;
	when(imagePlus.getCalibration()).thenReturn(anisotropicCalibration);
	final UIService uiService = mock(UIService.class);
	when(uiService.showDialog(anyString(), any(MessageType.class), any()))
		.thenReturn(CANCEL_OPTION);

       assertFalse(Common.warnAnisotropy(imagePlus, uiService));
       verify(uiService, timeout(1000)).showDialog(anyString(), any(
               MessageType.class), any());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:17,代码来源:CommonTest.java


示例6: testWarnAnisotropyReturnsFalseIfAnisotropicImageAndUserCloses

import org.scijava.ui.UIService; //导入依赖的package包/类
@Test
   @Category(org.bonej.wrapperPlugins.SlowWrapperTest.class)
public void testWarnAnisotropyReturnsFalseIfAnisotropicImageAndUserCloses()
	throws Exception
{
	final ImagePlus imagePlus = mock(ImagePlus.class);
	final Calibration anisotropicCalibration = new Calibration();
	anisotropicCalibration.pixelWidth = 0.5;
	when(imagePlus.getCalibration()).thenReturn(anisotropicCalibration);
	final UIService uiService = mock(UIService.class);
	when(uiService.showDialog(anyString(), any(MessageType.class), any()))
		.thenReturn(CLOSED_OPTION);

       assertFalse(Common.warnAnisotropy(imagePlus, uiService));
       verify(uiService, timeout(1000)).showDialog(anyString(), any(
               MessageType.class), any());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:18,代码来源:CommonTest.java


示例7: openHelpPage

import org.scijava.ui.UIService; //导入依赖的package包/类
/**
 * Opens the given help page using the PlatformService
 *
 * @see PlatformService#open(URL)
 * @param url The address of the help page
 * @param platformService PlatformService of the context
 * @param uiService UIService to show potential error messages
 * @param logService LogService to log potential exceptions, e.g.
 *          MalformedURLException
 */
public static void openHelpPage(final String url,
	final PlatformService platformService,
	final UIService uiService,
	final LogService logService)
{
	if (platformService == null) {
		showErrorSafely(uiService,
			"Help page could not be opened: no platform service");
		if (logService != null) {
			logService.error("Platform service is null");
		}
		return;
	}

	try {
		URL helpUrl = new URL(url);
		platformService.open(helpUrl);
	}
	catch (final MalformedURLException mue) {
		showErrorSafely(uiService,
			"Help page could not be opened: invalid address (" + url + ")");
		if (logService != null) {
			logService.error(mue);
		}
	}
	catch (final IOException e) {
		showErrorSafely(uiService,
			"An unexpected error occurred while trying to open the help page");
		if (logService != null) {
			logService.error(e);
		}
	}
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:44,代码来源:Help.java


示例8: showErrorSafely

import org.scijava.ui.UIService; //导入依赖的package包/类
private static void showErrorSafely(final UIService uiService,
	final String message)
{
	if (uiService == null) {
		return;
	}

	uiService.showDialog(message, DialogPrompt.MessageType.ERROR_MESSAGE);
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:10,代码来源:Help.java


示例9: warnAnisotropy

import org.scijava.ui.UIService; //导入依赖的package包/类
/**
 * Shows a warning dialog about image anisotropy, and asks if the user wants
 * to continue.
 *
 * @param image the current image open in ImageJ.
 * @param uiService used to display the warning dialog.
 * @return true if user chose OK_OPTION, or image is not anisotropic. False if
 *         user chose 'cancel' or they closed the dialog.
 */
public static boolean warnAnisotropy(final ImagePlus image,
	final UIService uiService)
{
	final double anisotropy = ImagePlusUtil.anisotropy(image);
	if (anisotropy < 1E-3) {
		return true;
	}
	final String anisotropyPercent = String.format("(%.1f %%)", anisotropy *
		100.0);
	return uiService.showDialog("The image is anisotropic " +
		anisotropyPercent + ". Continue anyway?", WARNING_MESSAGE,
		OK_CANCEL_OPTION) == OK_OPTION;
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:23,代码来源:Common.java


示例10: testWarnAnisotropyReturnsTrueIfIsotropicImage

import org.scijava.ui.UIService; //导入依赖的package包/类
@Test
   @Category(org.bonej.wrapperPlugins.SlowWrapperTest.class)
public void testWarnAnisotropyReturnsTrueIfIsotropicImage() throws Exception {
	final ImagePlus imagePlus = mock(ImagePlus.class);
	final Calibration calibration = new Calibration();
	when(imagePlus.getCalibration()).thenReturn(calibration);
	final UIService uiService = mock(UIService.class);

	assertTrue(Common.warnAnisotropy(imagePlus, uiService));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:11,代码来源:CommonTest.java


示例11: GuiUtils

import org.scijava.ui.UIService; //导入依赖的package包/类
public GuiUtils(final UIService uiService) {
	this.uiService = uiService;
}
 
开发者ID:tferr,项目名称:Scripts,代码行数:4,代码来源:GuiUtils.java


示例12: main

import org.scijava.ui.UIService; //导入依赖的package包/类
public static void main(final String... args) {
	final Context c = new Context();
	c.service(UIService.class).showUI();
	c.service(CommandService.class).run(OpenImageFromOMERO.class, true);
}
 
开发者ID:imagej,项目名称:imagej-omero,代码行数:6,代码来源:Main.java



注:本文中的org.scijava.ui.UIService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ItemInfo类代码示例发布时间:2022-05-22
下一篇:
Java InvoiceItem类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap