OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 180
Line 19... Line 19...
19
import java.util.Collection;
19
import java.util.Collection;
20
import java.util.Collections;
20
import java.util.Collections;
21
import java.util.Comparator;
21
import java.util.Comparator;
22
import java.util.List;
22
import java.util.List;
23
 
23
 
-
 
24
/**
-
 
25
 * Allow to customize UI layout.
-
 
26
 * 
-
 
27
 * @author guillaume
-
 
28
 */
24
public class Group extends Item {
29
public class Group extends Item {
25
 
30
 
26
    public static Group copy(final Group g, final Group newParent) {
31
    public static Group copy(final Group g, final Group newParent) {
27
        return new Group(g, newParent);
32
        return new Group(g, newParent);
28
    }
33
    }
Line 61... Line 66...
61
            final Item copy = Item.copy(t.get0(), this);
66
            final Item copy = Item.copy(t.get0(), this);
62
            this.list.add(new Tuple2<Item, Integer>(copy, t.get1()));
67
            this.list.add(new Tuple2<Item, Integer>(copy, t.get1()));
63
        }
68
        }
64
    }
69
    }
65
 
70
 
-
 
71
    public final Group toImmutable() {
-
 
72
        return this.toImmutable(true);
-
 
73
    }
-
 
74
 
-
 
75
    public final Group toImmutable(final boolean onlyDesc) {
-
 
76
        if (this.isFrozen())
-
 
77
            return this;
-
 
78
 
-
 
79
        final Group res;
-
 
80
        if (onlyDesc) {
-
 
81
            res = copy(this, null);
-
 
82
            res.freeze();
-
 
83
        } else {
-
 
84
            final List<String> p = this.getAbsolutePath();
-
 
85
            final Group copy = copy(this.getRoot(), null);
-
 
86
            copy.freeze();
-
 
87
            res = copy.followPath(p, false);
-
 
88
        }
-
 
89
        assert res.isFrozen();
-
 
90
        return res;
-
 
91
    }
-
 
92
 
66
    @Override
93
    @Override
67
    public synchronized void freeze() {
94
    protected synchronized void _freeze() {
68
        super.freeze();
95
        super._freeze();
69
        for (final Tuple2<Item, Integer> child : this.list) {
96
        for (final Tuple2<Item, Integer> child : this.list) {
70
            child.get0().freeze();
97
            child.get0()._freeze();
71
        }
98
        }
72
    }
99
    }
73
 
100
 
74
    public Item addItem(final String string) {
101
    public Item addItem(final String string) {
75
        final Item res = new Item(string);
102
        final Item res = new Item(string);