OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 74 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 74 Rev 181
Line 62... Line 62...
62
            return;
62
            return;
63
        }
63
        }
64
        depth++;
64
        depth++;
65
        final ActivableMutableTreeNode newChild = new ActivableMutableTreeNode(item);
65
        final ActivableMutableTreeNode newChild = new ActivableMutableTreeNode(item);
66
        newChild.setActive(isActive(item.getId()));
66
        newChild.setActive(isActive(item.getId()));
67
        if (showAll || newChild.isActive()) {
67
        if (this.showAll || newChild.isActive()) {
68
            node.add(newChild);
68
            node.add(newChild);
69
        }
69
        }
70
        if (item instanceof Group) {
70
        if (item instanceof Group) {
71
            final Group gr = (Group) item;
71
            final Group gr = (Group) item;
72
            final int childCount = gr.getSize();
72
            final int childCount = gr.getSize();
Line 79... Line 79...
79
            newChild.setAllowsChildren(false);
79
            newChild.setAllowsChildren(false);
80
        }
80
        }
81
    }
81
    }
82
 
82
 
83
    private boolean isActive(String id) {
83
    private boolean isActive(String id) {
84
        List<MenuDescriptor> l = extension.getRemoveMenuList();
84
        List<MenuDescriptor> l = this.extension.getRemoveMenuList();
85
        for (MenuDescriptor menuDescriptor : l) {
85
        for (MenuDescriptor menuDescriptor : l) {
86
            if (menuDescriptor.getId().equals(id)) {
86
            if (menuDescriptor.getId().equals(id)) {
87
                return false;
87
                return false;
88
            }
88
            }
89
        }
89
        }
Line 106... Line 106...
106
        setActive(n.isActive(), id);
106
        setActive(n.isActive(), id);
107
    }
107
    }
108
 
108
 
109
    public void setActive(boolean active, String id) {
109
    public void setActive(boolean active, String id) {
110
        if (active) {
110
        if (active) {
111
            extension.removeRemoveMenuForId(id);
111
            this.extension.removeRemoveMenuForId(id);
112
        } else {
112
        } else {
113
            extension.addRemoveMenu(new MenuDescriptor(id));
113
            this.extension.addRemoveMenu(new MenuDescriptor(id));
114
        }
114
        }
115
        extension.setChanged();
115
        this.extension.setChanged();
116
 
116
 
117
        DefaultMutableTreeNode n = getNode(id);
117
        DefaultMutableTreeNode n = getNode(id);
118
        if (n != null) {
118
        if (n != null) {
119
            if (n instanceof ActivableMutableTreeNode) {
119
            if (n instanceof ActivableMutableTreeNode) {
120
                ((ActivableMutableTreeNode) n).setActive(active);
120
                ((ActivableMutableTreeNode) n).setActive(active);
Line 135... Line 135...
135
 
135
 
136
    @Override
136
    @Override
137
    public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index) {
137
    public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index) {
138
        Item it = (Item) ((DefaultMutableTreeNode) newChild).getUserObject();
138
        Item it = (Item) ((DefaultMutableTreeNode) newChild).getUserObject();
139
        Group g = (Group) ((DefaultMutableTreeNode) parent).getUserObject();
139
        Group g = (Group) ((DefaultMutableTreeNode) parent).getUserObject();
140
        extension.moveMenuItem(it.getId(), g.getId());
140
        this.extension.moveMenuItem(it.getId(), g.getId());
141
        super.insertNodeInto(newChild, parent, index);
141
        super.insertNodeInto(newChild, parent, index);
142
        extension.setChanged();
142
        this.extension.setChanged();
143
    }
143
    }
144
 
144
 
145
    @SuppressWarnings("rawtypes")
145
    @SuppressWarnings("rawtypes")
146
    public void renameMenuItem(String previousId, String newId) {
146
    public void renameMenuItem(String previousId, String newId) {
147
        DefaultMutableTreeNode root = (DefaultMutableTreeNode) this.getRoot();
147
        DefaultMutableTreeNode root = (DefaultMutableTreeNode) this.getRoot();
Line 156... Line 156...
156
                reload(current);
156
                reload(current);
157
 
157
 
158
            }
158
            }
159
        }
159
        }
160
 
160
 
161
        extension.renameMenuItem(previousId, newId);
161
        this.extension.renameMenuItem(previousId, newId);
162
        extension.setChanged();
162
        this.extension.setChanged();
163
 
163
 
164
    }
164
    }
165
 
165
 
166
    private void setId(DefaultMutableTreeNode node, String newId) {
166
    private void setId(DefaultMutableTreeNode node, String newId) {
167
        Object o = node.getUserObject();
167
        Object o = node.getUserObject();