Develop and Download Open Source Software

Browse CVS Repository

Contents of /exerb/exerb-studio/model/group.rb

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Tue Jun 17 04:25:16 2003 UTC (20 years, 9 months ago) by yuya
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +8 -0 lines
* XMLの保存処理を試験的に実装

1
2 module Model
3
4 class Group < Base
5
6 def initialize
7 @name = nil
8 @files = []
9 end
10
11 attr_accessor :name, :files
12
13 def self.new_from_xmlnode(node)
14 model = self.new
15 model.name = node.attributes['name']
16 model.files = node.collect { |filenode|
17 if filenode.kind_of?(REXML::Element)
18 case filenode.name
19 when 'script' then File.new_from_xmlnode(filenode)
20 when 'binary' then File.new_from_xmlnode(filenode)
21 when 'library' then File.new_from_xmlnode(filenode)
22 when 'group' then Group.new_from_xmlnode(filenode)
23 end
24 end
25 }.compact
26
27 return model
28 end
29
30 def create_node(tree, parent)
31 node = tree.insertItem(parent, WConst::TVI_LAST, @name, Store.set(self))
32 tree.setItemIconOf(node, 0, 1)
33 @files.each { |file|
34 file.create_node(tree, node)
35 }
36 end
37
38 def savexml(io)
39 io.puts(%|<group name="#{@name}">|)
40 @files.each { |child|
41 child.savexml(io)
42 }
43 io.puts(%|</group>|)
44 end
45
46 end
47
48 end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26