| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.print.ServiceUIFactory
public abstract class ServiceUIFactory
     服务可以可选地提供 UI,这些 UI 允许以不同的角色进行不同风格的交互。一种角色可以是浏览并设置打印选项的终端用户。另一种角色可以是管理 PrintService。
虽然 PrintService API 目前不提供对管理 PrintService 的标准化支持,但是可以监视 PrintService 并且可以为专用的更新机制提供 UI。
基本的设计目的是允许应用程序仅在需要时以延迟方式查找并初始化服务,而不依赖任何 API(但使用 API 的环境除外)。
首选使用 Swing UI,因为它提供了更为一致的 L&F 并且可支持可访问性 API。
用例:
  ServiceUIFactory factory = printService.getServiceUIFactory();
  if (factory != null) {
      JComponent swingui = (JComponent)factory.getUI(
                                         ServiceUIFactory.MAIN_UIROLE,
                                         ServiceUIFactory.JCOMPONENT_UI);
      if (swingui != null) {
          tabbedpane.add("Custom UI", swingui);
      }
  }
  
  
| 字段摘要 | |
|---|---|
| static int | ABOUT_UIROLE表示一个充当提供 "About" 信息角色的 UI。 | 
| static int | ADMIN_UIROLE表示一个充当管理角色的 UI。 | 
| static String | DIALOG_UI表示一个作为 AWT 对话框实现的 UI。 | 
| static String | JCOMPONENT_UI表示一个作为 Swing 组件实现的 UI。 | 
| static String | JDIALOG_UI表示一个作为 Swing 对话框实现的 UI。 | 
| static int | MAIN_UIROLE表示一个充当普通终端用户角色的 UI。 | 
| static String | PANEL_UI表示一个作为 AWT 面板实现的 UI。 | 
| static int | RESERVED_UIROLE不是有效的角色,但是可将大于此的角色 ID 用于服务支持的专用角色。 | 
| 构造方法摘要 | |
|---|---|
| ServiceUIFactory() | |
| 方法摘要 | |
|---|---|
| abstract  Object | getUI(int role, String ui)获得一个 UI 对象,它可能被应用程序强制转换为所请求的 UI 类型并在该应用程序的用户界面中使用。 | 
| abstract  String[] | getUIClassNamesForRole(int role)给定从此工厂获取的 UI 角色,获取实现此角色的此工厂可提供的 UI 类型。 | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 字段详细信息 | 
|---|
public static final String JCOMPONENT_UI
public static final String PANEL_UI
public static final String DIALOG_UI
public static final String JDIALOG_UI
public static final int ABOUT_UIROLE
public static final int ADMIN_UIROLE
public static final int MAIN_UIROLE
public static final int RESERVED_UIROLE
| 构造方法详细信息 | 
|---|
public ServiceUIFactory()
| 方法详细信息 | 
|---|
public abstract Object getUI(int role,
                             String ui) 
  
role - 所请求的角色。必须是此工厂支持的标准角色或某个专用角色。
     ui - 所请求的角色的类型。 
     IllegalArgumentException - 如果 role 或 ui 既不是标准的角色或 UI,也不是该工厂支持的专用角色或 UI。
     public abstract String[] getUIClassNamesForRole(int role)
role - 要被查找的角色。 
     IllegalArgumentException - 如果该 role 是非标准的角色,或者此工厂不支持该 role。
     | 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。