- 浏览: 180513 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
Brooke:
啥时候分享一下源码呗 学习一下
基于eclipse RCP的文件夹管理工具 -
红耳飞鹏:
貌似懂了之后才能看的懂,个人看法
刷新 javaFX2.0 数据视图(TableView/ListView/TreeView) -
leaow567:
这个要支持啊
基于eclipse RCP的文件夹管理工具--FileTools -
yunchow:
luoyu-ds 写道我是来看博主的头像的+1
eclipse RCP 模仿win7资源管理器地址栏功能 -
luoyu-ds:
我是来看博主的头像的
eclipse RCP 模仿win7资源管理器地址栏功能
<!-- ======== START OF CLASS DATA ======== -->
org.jhotdraw.app
接口 Application
@NotNull
public interface Application
Application 用于控制View类的生命周期并提供一个窗口来显示View
类.
一个application拥有一个ApplicationModel
, ApplicationModel封装了关于应用程序 的信息(名称,版本,版权)以及创建View的模板方法.
application实现了基于文档界面的风格(document interface style), 一个application可以同时处理一个或者多个文档.
典型的文档界面有单文档界面(SDI, Single Document Interface), 多文档界面(MDI, Multiple Document Interface) 和Mac系统界面(OSX, Mac OS X Application Interface). 针对这些文档风格, JHotDraw已经提供了每种文档的默认实现. Application
exists.
一些应用程序需要对所有打开的窗口和对话窗进行特别的设置, 这就需要在打开JFrame, JDialog或JWindow时调用application的addWindow/Palette 或removeWindow/Palette 方法.(仅7.4之后的版本)
该类典型的使用方法:
public class MyMainClass { public static void main(String[] args) { Application app = new SDIApplication(); // or OSXApplication(), MDIApplication(). DefaultApplicationModel model = new DefaultApplicationModel(); model.setName("MyApplication"); model.setVersion("1.0"); model.setCopyright("Copyright 2006 (c) Werner Randelshofer. All Rights Reserved."); model.setViewClassName("org.jhotdraw.myapplication.MyView"); app.setModel(model); app.launch(args); }
设计模式
框架(Framework)
以下的接口和org.jhotdraw.app.action 包里所有类定义了面向文档应用程序的契约: ApplicationModel(org.jhotdraw.app), View(org.jhotdraw.app). Contract: Application
, ApplicationModel
, View
.
An application handles the lifecycle of View
objects and provides windows to present them on screen.
An application owns a ApplicationModel
which provides meta-data about the application, actions and factory methods for creating the views.
Depending on the document interface style used by the application, an application can handle multiple views at the same time, or only one.
Typical document interface styles are the Single Document Interface (SDI), the Multiple Document Interface (MDI) and the Mac OS X Application Interface (OSX). Typically, for each of these styles an implementation of Application
exists.
Some applications have to decorate all opened windows and dialogs with user interface elements and special behaviors. To make this work, it is essential that all code which opens JFrame's, JDialog's or JWindow's calls the addWindow/Palette and removeWindow/Palette methods on the application object.
Typical usage of this class:
public class MyMainClass { public static void main(String[] args) { Application app = new SDIApplication(); // or OSXApplication(), MDIApplication(). DefaultApplicationModel model = new DefaultApplicationModel(); model.setName("MyApplication"); model.setVersion("1.0"); model.setCopyright("Copyright 2006 (c) Werner Randelshofer. All Rights Reserved."); model.setViewClassName("org.jhotdraw.myapplication.MyView"); app.setModel(model); app.launch(args); }
Design Patterns
Framework
The interfaces and classes listed below together with the Action
classes in the org.jhotddraw.app.action package define the contracts of a framework for document oriented applications:
Contract: Application
, ApplicationModel
, View
.
<!-- =========== FIELD SUMMARY =========== --><!-- -->
static java.lang.String |
ACTIVE_VIEW_PROPERTY activeView 属性. |
static java.lang.String |
RECENT_URIS_PROPERTY recentURIs 属性. |
<!-- ========== METHOD SUMMARY =========== -->
void |
add(org.jhotdraw.app.View p) 为应用程序添加一个视图. |
void |
addPalette(java.awt.Window palette) 将一个浮动窗口添加至应用程序. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l) 将 PropertyChangeListener 添加到侦听器列表 Adds a property change listener. |
void |
addRecentURI(java.net.URI uri) 添加一个URI至最近打开列表. |
void |
addWindow(java.awt.Window window, org.jhotdraw.app.View view) 添加一个窗口(非浮动窗口)至应用程序. |
void |
clearRecentURIs() 清除最近打开的列表. |
void |
configure(java.lang.String[] args) 配置字符串数组args来配置应用程序. |
javax.swing.JMenu |
createEditMenu(org.jhotdraw.app.View v) 为应用程序或者指定的视图添加"编辑"菜单. |
javax.swing.JMenu |
createFileMenu(org.jhotdraw.app.View v) 为应用程序或者指定的视图添加"文件"菜单. |
javax.swing.JMenu |
createHelpMenu(org.jhotdraw.app.View v) 为应用程序或者指定的视图添加"帮助"菜单. |
org.jhotdraw.app.View |
createView() 常见一个应用程序的视图, 并通过调用 View.init() 对该视图进行初始化. |
javax.swing.JMenu |
createViewMenu(org.jhotdraw.app.View v) 为应用程序或者指定的视图添加"视图"菜单. |
javax.swing.JMenu |
createWindowMenu(org.jhotdraw.app.View v) 为应用程序或者指定的视图添加"窗口"菜单. |
void |
destroy() 终止应用程序,并调用System.exit(0). |
void |
dispose(org.jhotdraw.app.View p) 删除并隐藏一个视图. |
javax.swing.ActionMap |
getActionMap(org.jhotdraw.app.View v) 获取特定视图或者整个应用程序的动作表(ActionMap) Gets an action map for the specified view or for the entire application. |
org.jhotdraw.app.View |
getActiveView() 返回活动的视图. |
java.awt.Component |
getComponent() 返回应用程序组件. |
java.lang.String |
getCopyright() 返回应用程序的版权信息. |
org.jhotdraw.gui.URIChooser |
getExportChooser(org.jhotdraw.app.View v) 获取特定视图或者应用程序的"导出选择器". |
org.jhotdraw.gui.URIChooser |
getImportChooser(org.jhotdraw.app.View v) 获取特定视图或者应用程序的"导入选择器". |
org.jhotdraw.app.ApplicationModel |
getModel() 返回应用程序模型. |
java.lang.String |
getName() 返回应用程序的名称. |
org.jhotdraw.gui.URIChooser |
getOpenChooser(org.jhotdraw.app.View v) 获取特定视图或者应用程序的"打开选择器". |
java.util.List<java.net.URI> |
getRecentURIs() 返回最近打开的项目的URI列表, 该链表的内容是不可改变的. |
org.jhotdraw.gui.URIChooser |
getSaveChooser(org.jhotdraw.app.View v) 获取特定视图或者应用程序的"保存选择器". |
java.lang.String |
getVersion() 返回应用程序的版本号. |
void |
hide(org.jhotdraw.app.View p) 隐藏一个视图. |
void |
init() 初始化应用程序. |
boolean |
isEnabled() 确定应用程序是否启用. |
boolean |
isSharingToolsAmongViews() 若该应用程序在多个视图间共享工具则返回true. |
void |
launch(java.lang.String[] args) 启动应用程序, 通常在main方法中调用该方法. |
void |
remove(org.jhotdraw.app.View p) 从应用程序和用户视图中删除一个视图(p). |
void |
removePalette(java.awt.Window palette) 从应用程序中删除一个浮动窗口. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l) 将 PropertyChangeListener 从侦听器列表删除 Removes a property change listener. |
void |
removeWindow(java.awt.Window window) 从应用程序中删除一个窗口(非浮动窗口). |
void |
setEnabled(boolean newValue) 根据参数启用或者禁用应用程序. |
void |
setModel(org.jhotdraw.app.ApplicationModel newValue) 设置应用程序模型. |
void |
show(org.jhotdraw.app.View p) 显示一个视图. |
void |
start() 开始应用程序. |
void |
stop() 在没有做任何保存操作的情况下停止应用程序. |
java.util.Collection<org.jhotdraw.app.View> |
views() 以 collection 返回应用程序所有视图对象. |
<!-- ============ FIELD DETAIL =========== --><!-- -->
ACTIVE_VIEW_PROPERTY
static final java.lang.String ACTIVE_VIEW_PROPERTY
activeView 属性.
The property name of the activeView property.
RECENT_URIS_PROPERTY
static final java.lang.String RECENT_URIS_PROPERTY
recentURIs 属性.
The property name of the recentURIs property.
launch
void launch(java.lang.String[] args)
启动应用程序, 通常在main方法中调用该方法.
Launches the application from the main method. This method is typically invoked on the main Thread. This will invoke configure() on the current thread and then init() and start() on the AWT Event Dispatcher Thread.
configure
void configure(java.lang.String[] args)
配置字符串数组args来配置应用程序.
Configures the application using the provided arguments array.
init
void init()
初始化应用程序. 在初始化程序之前, 必须先调用configure()
. 配置应用程序可以调用对应的setter方法来完成.
configure()
should have been invoked before the application is inited. Alternatively an application can be configured using setter methods.
start
void start()
开始应用程序. 该方法创建一个新的视图, 并将该视图添加至应用程序中. 在开始应用程序之前, 必须先调用init()
方法.
init()
must have been invoked before the application is started.
stop
void stop()
在停止一个应用程序时, 必须保证该程序曾经调用过
init()
方法.Stops the application without saving any unsaved views.
init()
must have been invoked before the application is stopped.
destroy
void destroy()
Destroys the application and calls System.exit(0).
createView
org.jhotdraw.app.View createView()
View.init()
对该视图进行初始化.
Creates a new view for this application and initializes it, by calling View.init()
.
add
void add(org.jhotdraw.app.View p)
该方法将引起一个 "documentCount" 属性改变事件.
调用视图对象(p)的setApplication(this) 方法.
Adds a view to this application. Fires a "documentCount" property change event. Invokes method setApplication(this) on the view object.
remove
void remove(org.jhotdraw.app.View p)
该方法将引起一个 "documentCount" 属性改变事件.
调用视图对象(p)的setApplication(null) 方法.
Removes a view from this application and removes it from the users view. Fires a "documentCount" property change event. Invokes method setApplication(null) on the view object.
show
void show(org.jhotdraw.app.View p)
Shows a view.
hide
void hide(org.jhotdraw.app.View p)
Hides a view.
dispose
void dispose(org.jhotdraw.app.View p)
This is a convenience method for removing a view and disposing it.
views
java.util.Collection<org.jhotdraw.app.View> views()
Returns a read only collection view of the views of this application.
getActiveView
org.jhotdraw.app.View getActiveView()
Returns the active view. This is used for OSXApplication and MDIApplication which share actions among multiple View instances. Active view may be become null, if the application has no view.
This is a bound property.
isEnabled
boolean isEnabled()
Returns the enabled state of the application.
setEnabled
void setEnabled(boolean newValue)
设置启用状态是为了防止同时调用应用程序的多个动作. 如果一个动作由并行的和连续的两部分组成, 那么连续的部分必须禁用应用程序.
作用在应用程序上的动作在执行动作之前, 必须检查应用程序是否启用. 如果应用程序未禁用, 则先禁用该应用程序, 然后再执行该动作, 最后重新启用应用程序. 如果应用程序已经被禁用, 则该动作将不被执行.
Sets the enabled state of the application. The enabled state is used to prevent parallel invocation of actions on the application. If an action consists of a sequential part and a concurrent part, it must disable the application only for the sequential part. Actions that act on the application must check in their actionPerformed method whether the application is enabled. If the application is disabled, they must do nothing. If the application is enabled, they must disable the application, perform the action and then enable the application again. This is a bound property.
addPropertyChangeListener
void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a property change listener.
removePropertyChangeListener
void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a property change listener.
getName
java.lang.String getName()
Returns the name of the application.
getVersion
java.lang.String getVersion()
Returns the version of the application.
getCopyright
java.lang.String getCopyright()
Returns the copyright of the application.
setModel
void setModel(org.jhotdraw.app.ApplicationModel newValue)
Sets the application model.
getModel
org.jhotdraw.app.ApplicationModel getModel()
Returns the application model.
isSharingToolsAmongViews
boolean isSharingToolsAmongViews()
Returns true, if this application shares tools among multiple views.
getComponent
@Nullable
java.awt.Component getComponent()
Returns the application component. This may return null, if the application is not represented by a component of its own on the user interface.
addPalette
void addPalette(java.awt.Window palette)
Adds a palette window to the application.
removePalette
void removePalette(java.awt.Window palette)
Removes a palette window from the application.
addWindow
void addWindow(java.awt.Window window,
@Nullable
org.jhotdraw.app.View view)
Adds a (non-palette) window to the application.
window
- 要添加到窗口. The window. view
- 要添加窗口所属视图. 若view为null, 则该窗口将添加至应用程序层. The View to which this window is associated, or null if the window is associated to the application.removeWindow
void removeWindow(java.awt.Window window)
Removes a (non-palette) window from the application.
getRecentURIs
java.util.List<java.net.URI> getRecentURIs()
Returns the recently opened URIs. By convention, this is an immutable list.
addRecentURI
void addRecentURI(java.net.URI uri)
Appends a URI to the list of recent URIs. This fires a property change event for the property "recentURIs".
clearRecentURIs
void clearRecentURIs()
Clears the list of recent URIs. This fires a property change event for the property "recentURIs".
createFileMenu
@Nullable javax.swing.JMenu createFileMenu(@Nullable org.jhotdraw.app.View v)
Creates a file menu for the specified view or for the entire application.
v
- 一个视图或者null.
A view or null.
A JMenu or null, if the menu is empty.
createEditMenu
@Nullable javax.swing.JMenu createEditMenu(@Nullable org.jhotdraw.app.View v)
Creates an edit menu for the specified view or for the entire application.
v
- 一个视图或者null.
A view or null.
A JMenu or null, if the menu is empty.
createViewMenu
@Nullable javax.swing.JMenu createViewMenu(@Nullable org.jhotdraw.app.View v)
Creates a view menu for the specified view or for the entire application.
v
- 一个视图或者null.
A view or null.
A JMenu or null, if the menu is empty.
createWindowMenu
@Nullable javax.swing.JMenu createWindowMenu(@Nullable org.jhotdraw.app.View v)
Creates a window menu for the specified view or for the entire application.
v
- 一个视图或者null.
A view or null.
A JMenu or null, if the menu is empty.
createHelpMenu
@Nullable javax.swing.JMenu createHelpMenu(@Nullable org.jhotdraw.app.View v)
Creates a help menu for the specified view of for the entire application.
v
- 一个视图或者null.
A view or null.
A JMenu or null, if the menu is empty.
getOpenChooser
org.jhotdraw.gui.URIChooser getOpenChooser(@Nullable
org.jhotdraw.app.View v)
Gets an open chooser for the specified view or for the entire application.
v
- 一个视图或者null.
A view or null.
A chooser.
getSaveChooser
org.jhotdraw.gui.URIChooser getSaveChooser(@Nullable
org.jhotdraw.app.View v)
Gets a save chooser for the specified view or for the entire application.
v
- 一个视图或者null.
A view or null.
A chooser.
getExportChooser
org.jhotdraw.gui.URIChooser getExportChooser(@Nullable
org.jhotdraw.app.View v)
Gets an export chooser for the specified view or for the entire application.
v
- 一个视图或者null.
A view or null.
A chooser.
getImportChooser
org.jhotdraw.gui.URIChooser getImportChooser(@Nullable
org.jhotdraw.app.View v)
Gets an import chooser for the specified view or for the entire application.
v
- 一个视图或者null.
A view or null.
A chooser.
getActionMap
javax.swing.ActionMap getActionMap(@Nullable
org.jhotdraw.app.View v)
Gets an action map for the specified view or for the entire application.
v
- 一个视图或者null.
A view or null
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<!-- -->
|
发表评论
-
JHotDraw的IO问题
2011-04-08 14:41 1703您好!请教一个问题:jhotdraw7.6中samp ... -
【转】开源项目JHotDraw分析报告
2011-02-17 14:37 2121开源项目JHotDraw分析报告 (图片资源请参考附件) ... -
JHotDraw让你成为程序设计的毕加索
2010-12-20 00:29 1711原文地址:http://article.yeeyan.org/ ... -
Tool
2010-12-19 15:47 0包 org.jhotdraw.draw.tool 定义用于 ... -
JHotDraw之旅: 3.3 面向文档基本框架
2010-07-30 23:47 2361通过前文, 我们大概了解了JHotDraw的MVC架 ... -
JHotDraw之旅: 3.2 MVC架构
2010-07-28 18:59 13573.2 MVC架构 这里只介绍JHotDraw框架的MVC模 ... -
JHotDraw之旅: 3.1 MVC架构
2010-07-25 00:25 27321. JHotDraw框架概述 开发应用程序时, 大 ... -
JHotDraw之旅: 2.6 源码分析的准备
2010-07-23 13:44 24311. 获取JHotDraw 在http://so ... -
JHotDraw之旅: 2.5 JHotDraw初体验
2010-07-22 11:11 19062.5 Teddy Teddy 是一个应用在JHotD ... -
JHotDraw之旅: 2.4 JHotDraw初体验
2010-07-22 10:57 22712.4 SVG 原文链接: http://c-zhiwu. ... -
JHotDraw之旅:2.3 JHotDraw初体验
2010-07-21 17:30 16682.3 PERT PERT是一个基于JHotDra ... -
JHotDraw之旅:2.2 JHotDraw初体验
2010-07-21 17:01 17892.2 NET NET是由两种图形(节点图NodeF ... -
JHotDraw之旅: 2.1 JHotDraw初体验
2010-07-20 11:48 24061.下载JHotDraw 最新的JHotDraw ... -
JHotdraw之旅.1.jhotdraw简介
2010-07-19 20:58 2715JHotDraw之旅 JHotDra ...
相关推荐
#JHotDraw HTML 编辑器 第 39 组 - CSE 2102 组项目 该软件允许用户以 WYSIWYG(所见即所得)格式创建 HTML。 用户只需具备一定的 HTML 知识即可保存、导出、加载和修改文件。 用户将找到用于添加图像、视频和链接的...
java课程设计的一个题目。本程序可以画各种函数曲线,功能有: 1.新建、打开、保存画图 2.多种方式输入函数作图 3.可设置画笔颜色、大小 4.可以放大、缩小 5.可以移动坐标和图像 6.实时显示鼠标经过的坐标 ...
java软件,希有助于java学习者
NULL 博文链接:https://c-zhiwu.iteye.com/blog/846908
2004年下载的JHotDraw开源程序,一个学习设计模式、面向对象设计和开发、java的非常经典的例子。
NULL 博文链接:https://c-zhiwu.iteye.com/blog/908892
适用于画流程图的类,继承自swing。被广泛使用。
自己收集整理的Jhotdraw相关资料,对于了解和学习jhotdraw的同学会有所帮助。Jhotdraw是著名的设计模式教学用框架,软件设计的经典之作。
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...
Spring4GWT GWT Spring 使得在 Spring 框架下构造 GWT 应用变得很简单,提供一个易于理解的依赖注入和RPC机制。 Java扫雷游戏 JVMine JVMine用Applets开发的扫雷游戏,...使用了优秀的JHotDraw 5.2 框架。 activemq...