Danh mục

Creating Applications with Mozilla-Chapter 9. XUL Templates- P2

Số trang: 19      Loại file: pdf      Dung lượng: 66.42 KB      Lượt xem: 1      Lượt tải: 0    
10.10.2023

Hỗ trợ phí lưu trữ khi tải xuống: 8,000 VND Tải xuống file đầy đủ (19 trang) 0
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu creating applications with mozilla-chapter 9. xul templates- p2, công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Creating Applications with Mozilla-Chapter 9. XUL Templates- P2 Chapter 9. XUL Templates- P2Example 9-6. Tree template code of Figure 9-3 object=?location/> One major difference between this example and earlier ones is that Example9-6 has three columns. The color data cannot be used for style in this treescenario because trees do not support CSS data styling.All generated data can be sorted automatically by clicking on the columnheaders. Besides the tree parent element in the XUL, the other maindifference between this template and the one used with a listbox in Example9-4 is the structure directly beneath , where is replaced by .9.2.4. Multiple Rules TreeIn Example 9-6, empty cells were left blank. Sometimes situations demandthat missing data be represented by something other than whitespace, suchas a special character or marker. Fortunately, multiple tags canexist in a template, as shown in Example 9-7. Alternate rule tags allow thedisplay of missing data with other, more general rules. Using alternate tags,you can set up templates that look like conditional blocks; if the first rule isnot satisfied, then the second rule is tried, followed by the third, and so on.Example 9-7 shows this structure of multiple rules.Example 9-7. Tree template with rules predicate=http://xfly.mozdev.org/fly-rdf#color object=?color/> predicate=http://xfly.mozdev.org/fly-rdf#label object=?label/> In contrast to Example 9-6, Example 9-7 moves ?location from to in the first in the template,making it a required match. To avoid breaking the template -- because notall objects in the RDF file have a ?location value -- you need to make abackup plan for generating this template when it encounters an objectwithout a ?location. This backup can be a second set of more broadlydefined conditions, so that objects that fall out of the first condition arepicked up by the next. See the next section for an example of using differentsets of rules.The most important inclusions to Example 9-7 are thecontainer=?uri and child=?listitem attributes on the. These attributes specify which container you should applymultiple rules to, and the child is for the objects in a container that mustbe checked. Adding these attributes keeps the template from dying when thedata doesnt meet the first rule. The second rule, which doesnt have a or to identify it, is used only when a ?locationisnt present. Instead, it automatically fills in that cell with a hyphen (Figure9-4).Figure 9-4. Tree template with hyphen ruleAs you can see at the top of Example 9-7, the template datasource is a filecalled 10-4.rdf, which contains all the data listed in Example 10-4 (in thenext chapter). If you save the template listed in Example 9-7 and the RDFlisted in Example 10-4, you can display the tree shown in Figure 9-4.9.2.5. Multiple Rules MenubarExample 9-7 is a template that contains three rules. In Example 9-8, where a is shown with three rules, all possible menuscenarios must be covered. Table 9-2 provides a list of these scenarios. Usescenarios like this to make sure you have content that can be created for allthe data you need represented.Table 9-2. Scenarios used for building template rulesScenario Description A has a label and contains a . Inside it are two s:Scenario 1 ?location and ?color. The Horn Fly, Carrion Fly, and Office Fly fall into this category. A has a label and contains a . Inside itScenario 2 is one : ?color. The Common House Fly, Stable Fly,Scenario Description and Face Fly fall into this category. A has a label and contains a . Inside there is no (onlyScenario 3 ). Horse and House fall into this category.The scenarios in Table 9-2 can be translated dire ...

Tài liệu được xem nhiều: