Listing 12: Moving methods into a widget class.
列表12:将方法移至小窗口(widget)类。
To see the ListBox widget class, view this sidefile.
要查看ListBox窗口小部件类,请参阅this sidefile。
Listing 14: Code for script to use with widget class.
列表14:脚本所使用的小窗口代码。
Implementing the widget-specific template and the widget class.
实现特定于小部件的模板和小部件类。
In fact, our Widget class above could have been declared to be a trait.
实际上,我们的Widget类也可以被声明为一个trait。
A script can now use this widget class by including code similar to the following.
脚本可按照如下代码使用小窗口类。
The superclass of pretty much everything you can render in a GWT UI is the Widget class.
Widget类是可以呈现在GWTUI中的几乎所有类的超类。
I want to discover this as soon as possible, before wasting time writing even more code that calls the Widget class.
在花费更多时间编写其他调用Widget类的代码前,我希望尽早发现类似问题。
Let's say that as a user of the Widget class, you don't know whether the accessors have value or reference semantics.
假设您是Widget类的一个使用者,您并不知道存取器具有值语义还是引用语义。
Much easier would be to use a widget class that wraps this functionality into easy-to-remember methods, like this.
使用窗口小部件类要容易得多,可以将这项功能封装到易于记住的方法中,如下所示。
In this section, we'll show you how the widget-specific template and the widget class are implemented using the following files.
在这一小节,我们将向您展示特定于小部件的模板以及使用下列文件实现的小部件类。
As previously seen, widgets must inherit from the dijit._Widget class, which defines and provides the basic behavior for a Dojo widget.
如前面看到的,小部件必须继承自dijit . _ widget类,它定义并提供了Dojo小部件的基本行为。
To accomplish this, create a ListBox widget class similar to the one created earlier for TextField, and then add select() and find() methods to it.
要完成这项操作,需要创建ListBox 窗口小部件类,创建过程与前面创建TextField的相似,然后将select()和find()方法添加到该类中。
As you'll see, there are a lot of them, so this class should show you where you can get some real bang for your buck from creating widget classes.
正如您将看到的,这类方法有很多,因此,ListBox窗口小部件类显示了从创建窗口小部件类中可以获得的一些实际的好处。
This technique of wrapping invoke() calls inside the methods of a widget class enabled us to much more easily code automation that manipulated these SWT controls.
通过使用将invoke()调用封装到窗口小部件类的方法中这项技术,可以更容易地对这些 SWT 控件的自动化操作进行编码。
The base widget class has been designed to take advantage of the inheritance feature provided by Dojo. Following are some of the functions the the base widget implements.
基本小部件类的设计利用了Dojo提供的继承特性,以下是基本小部件实现的一些功能。
What if I'm happily writing code that calls the Widget class. What I don't know is that my team member Jim removed the Widget class one hour ago, in conjunction with a refactoring.
假设我正在兴高采烈地编写调用Widget类的代码,我却不知道团队成员Jim在一个小时之前进行重构时移除了Widget类。
When you face such a situation, wrap the custom control in its own widget class, inheriting other standard widgets when appropriate, and then wrap the invoke call in a method of this class.
遇到这种情况时,可以将定制控件封装到其自己的窗口小部件类中,根据需要继承其他标准窗口小部件,然后将invoke调用封装到该类的方法中。
We show you our entire ListBox widget class (cleaned up for presentation purposes, of course). This gives you an idea of the many methods we've found useful for manipulating list boxes.
我们向您显示了完整的ListBox窗口小部件类(当然,为了便于显示,这些类已经清除了),这使您可以了解我们已经发现的对操作列表框有用的许多方法。
This may well be confusing both to the caller (because the first Widget got moved unexpectedly) and to the Widget class (because its location changed without the Widget code being involved).
这可能对于调用者(因为第一个Widget意外地移动了)和Widget类(因为它的位置改变了,而与Widget代码无关)来说都会产生混淆。
We researched the characteristics of the OOP language. In view of the characteristics of GUI application programming, definitions of widget structure and widget class have been abstracted.
对面向对象编程语言的特性进行了一定的研究,针对GUI应用编程的特点,抽象出了组件结构和组件类的定义。
Widget是一个抽象类。
This class member will contain the application object that stores employee data or organizational data depending on what the TreeItem widget represents.
根据TreeIte m部件代表的内容不同,这个类成员将包含存储职员数据或组织数据的应用程序对象。
The intention of class Scrollable is that it embeds the functionality necessary for adding scrollability to a GUI widget.
类Scrollable的目的是要向GUI 窗口小部件嵌入添加可滚动性所必需的功能性。
Postscript drives the Dojo widget life cycle methods, but provides no benefit to a standard Dojo class.
postscript产生了Dojo小部件生命周期方法,但对标准dojo类没有什么用处。
This is really the goal of any widget you design, to make the addition and removal of the widget as simple as adding a class to it.
这是小部件设计的目标,让添加和删除小部件就像向小部件添加类一样简单。
This step involves putting a wrapping around the widget and giving it the class lotusDialogBorder and max-width and width attributes.
这一步涉及到在小部件周围放置一个包装的,为其提供lotusdialogborder类与max -width和width属性。
For each unique type of widget manufactured by WidgetCo, the it department's programmers write a class that implements the widget interface.
对于通过WidgetCo生产的每一种独特类型的部件,IT部门的编程人员编写了实现Widget接口的类。
Dojo provides a powerful abstraction that decouples the widget rendering definition from the widget behavior implementation: the dijit -._templated mix-in class.
Dojo提供了一个强大的抽象,即dijit - . _Templated混入类,可以将小部件呈现定义与小部件行为实现分离开来。
Each widget is a div element of class type widget, which has a header (widget-head) and content area (widget-content).
每个小部件都是类类型为widget的一个div元素,具有头部(widget -head)和内容区(widget - content)。
应用推荐