Revision 46876 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretype/tags/TagsModel.java

View differences:

TagsModel.java
8 8
import org.gvsig.fmap.dal.swing.impl.featuretype.AggregateController;
9 9
import org.gvsig.tools.ToolsLocator;
10 10
import org.gvsig.tools.dynobject.Tags;
11
import org.gvsig.tools.dynobject.impl.DefaultTags;
11 12
import org.gvsig.tools.i18n.I18nManager;
12 13

  
13 14
/**
......
19 20
    implements AggregateController.AggregateModel<Tag>
20 21
    {
21 22

  
22
    private List<Tag> tags;
23
    private List<Tag> tagList;
23 24
    private final String[] columnNames;
24 25
    
25 26
    public TagsModel(Tags tags) {
......
31 32
        };
32 33
    }
33 34
    
35
    public final Tags getTags() {
36
        Tags theTags = new DefaultTags();
37
        for (Tag tag : this.tagList) {
38
            theTags.set(tag.getName(), tag.getValue());
39
        }
40
        return theTags;
41
    }
42
    
34 43
    public final void setTags(Tags tags) {
35
        this.tags = new ArrayList<>();
44
        this.tagList = new ArrayList<>();
36 45
        if( tags == null ) {
37 46
            return;
38 47
        }
......
40 49
            Tag tag = new Tag();
41 50
            tag.setName(tagName);
42 51
            tag.setValue(tags.get(tagName));
43
            this.tags.add(tag);
52
            this.tagList.add(tag);
44 53
        }
45 54
    }
46 55
    
......
48 57
    public void fetch(Object container) {
49 58
        Tags theTags = (Tags) container;
50 59
        theTags.removeAll();
51
        for (Tag tag : this.tags) {
60
        for (Tag tag : this.tagList) {
52 61
            theTags.set(tag.getName(), tag.getValue());
53 62
        }
54 63
    }
55 64
    
56 65
    @Override
57 66
    public int getRowCount() {
58
        return this.tags.size();
67
        return this.tagList.size();
59 68
    }
60 69

  
61 70
    @Override
......
70 79
    
71 80
    @Override
72 81
    public Object getValueAt(int rowIndex, int columnIndex) {
73
        Tag tag = this.tags.get(rowIndex);
82
        Tag tag = this.tagList.get(rowIndex);
74 83
        switch(columnIndex) {
75 84
            case 0:
76 85
                return tag.getName();
......
88 97

  
89 98
    @Override
90 99
    public int addItem(Tag item) {
91
        this.tags.add(item);
100
        this.tagList.add(item);
92 101
        this.fireTableDataChanged();
93
        return this.tags.size()-1;
102
        return this.tagList.size()-1;
94 103
    }
95 104

  
96 105
    @Override
......
100 109

  
101 110
    @Override
102 111
    public Tag get(int position) {
103
        return tags.get(position);
112
        return tagList.get(position);
104 113
    }
105 114

  
106 115
    @Override
107 116
    public Iterator<Tag> iterator() {
108
        return tags.iterator();
117
        return tagList.iterator();
109 118
    }
110 119

  
111 120
}

Also available in: Unified diff