01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: ElementIdModel.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.gui.model;
09:
10: import com.uwyn.rife.gui.model.exceptions.GuiModelException;
11:
12: public class ElementIdModel extends ElementPropertyModel {
13: ElementIdModel(ElementModel element, String name)
14: throws GuiModelException {
15: super (element, name);
16: }
17:
18: protected static ParticlePropertyModel findConflictingProperty(
19: ParticleModel particle, Class type, String name) {
20: assert particle != null;
21: assert type != null;
22: assert name != null;
23: assert name.length() > 0;
24:
25: ParticleModel parent_particle = particle.getParent();
26: if (parent_particle != null) {
27: ElementIdModel sibling_title = null;
28:
29: for (ParticleModel sibling : parent_particle.getChildren()) {
30: if (sibling instanceof ElementModel) {
31: sibling_title = ((ElementModel) sibling).getId();
32: if (sibling_title.getName().equals(name)) {
33: return sibling_title;
34: }
35: }
36: }
37: }
38:
39: return null;
40: }
41: }
|