1 / 15

信威核心网网管培训 -- Rich Client Platform

信威核心网网管培训 -- Rich Client Platform. 主讲:胡俊 部门:核心网支撑技术部 项目组: MMI. 几个重要的概念. Applications Workbenches Workbench Windows. Application. Application 是一个你创建的作为 RCP 主程序的类。你可以认为它是程序的控制器。就象 MVC 架构中的控制器一样,它很短小,并且在不同的项目中都差不多。它所做的就是创建一个 Workbench, 并交给 Workbench 一个 Workbench Advisor. Workbench.

tamal
Download Presentation

信威核心网网管培训 -- Rich Client Platform

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 信威核心网网管培训--Rich Client Platform 主讲:胡俊 部门:核心网支撑技术部 项目组:MMI

  2. 几个重要的概念 • Applications • Workbenches • Workbench Windows

  3. Application • Application是一个你创建的作为RCP主程序的类。你可以认为它是程序的控制器。就象MVC架构中的控制器一样,它很短小,并且在不同的项目中都差不多。它所做的就是创建一个Workbench,并交给Workbench一个Workbench Advisor

  4. Workbench • Workbench是作为RCP框架的一部分被声明和维护的。一个Application只有一个Workbench,但是一个Workbench可以有超过一个可见的顶层Workbench Window。例如,在Eclipse IDE中,当你第一次启动Eclipse时,你会看到一个Workbench Window,但是如果你选择Window > New Window,就会出现第二个窗口,这样就有两个Workbench Window,而还是单独一个Workbench

  5. 关系 一个RCP程序有一个用户定义的Application类,和一个框架提供的Workbench类。一般只有一个Workbench Window,但是框架支持多个Workbench Window

  6. 相关代码 public class Application implements IPlatformRunnable { public Object run(Object args) throws Exception { Display display = PlatformUI.createDisplay(); try { Int returnCode =PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); . .

  7. 生命周期

  8. 深入WorkbenchAdvisor WorkbenchAdvisor子类中可以重写来处理Workbench生命周期事件的所有方法

  9. 在WorkbenchAdvisor子类中可以重写来处理Workbench Window生命周期事件的方法

  10. 可以实现一些方法供Platform调用,使得Platform获取关于你应用的信息可以实现一些方法供Platform调用,使得Platform获取关于你应用的信息

  11. 在某些情况,RCP又提供了两个方法来控制你的应用窗口和控件如何被创建在某些情况,RCP又提供了两个方法来控制你的应用窗口和控件如何被创建

  12. 几种类型的workbenchAdvisor • application-level • WorkbenchAdvisor start up and shut down of the Workbench itself; there is one running Workbench per running Eclipse application. • window-level • WorkbenchWindowAdvisor showing or hiding the menu, toolbar, and status line, and in configuring the controls shown in the window. There is one WorkbenchWindowAdvisor instance for each window • ActionBarAdvisor helps define the actions that appear in the menu, toolbar, and status line of each window. There is one ActionBarAdvisor instance for each window.

  13. 准备国际化 • 文字(Eclipse IDE提供了一个不错的Externalization的向导来使工作变得容易些)

  14. 开始编码-登录 public class Application implements IPlatformRunnable { public static final String PLUGIN_ID = “com.xinwei.cnms"; public Object run(Object args) throws Exception { Display display = PlatformUI.createDisplay(); try { Platform.endSplash(); if (!login()) return IPlatformRunnable.EXIT_OK; int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IPlatformRunnable.EXIT_RESTART; } return IPlatformRunnable.EXIT_OK; } finally { display.dispose(); } }

More Related