Revision 38604

View differences:

branches/v2_0_0_prep/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/tools/CompoundBehavior.java
81 81
	 * @param tools atomic behaviors that will compound this one</code>
82 82
	 */
83 83
	public CompoundBehavior(Behavior[] behaviors){
84
	    
85
        for (int i = 0; i < behaviors.length; i++) {
86
            if (behaviors[i] == null) {
87
                throw new IllegalArgumentException("behaviors");
88
            }
89
        }
90

  
84 91
		for (int i = 0; i < behaviors.length; i++) {
92
		    
85 93
			this.behaviors.add(behaviors[i]);
86 94

  
87 95
			if (i == 0)
......
101 109
	 * @param draw flag determining if will be real-time drawn or no
102 110
	 */
103 111
	public void addMapBehavior(Behavior mt, boolean draw){
112
	    
113
	    if (mt == null) {
114
	        throw new IllegalArgumentException("mt");
115
	    }
116
	    
104 117
		behaviors.add(mt);
105 118
		draws.add(new Boolean(draw));
106 119
	}
......
182 195
	 */
183 196
	public Image getImageCursor() {
184 197
		if (behaviors.size() > 0) {
185
			return ((Behavior) behaviors.get(0)).getImageCursor();
198
		    Behavior beh = (Behavior) behaviors.get(0);
199
			return beh.getImageCursor();
186 200
		} else {
187 201
			return null;
188 202
		}
......
307 321
	public void paintComponent(MapControlDrawer renderer) {
308 322
		for (int i = 0; i < behaviors.size(); i++) {
309 323
			Behavior mapTool = (Behavior) behaviors.get(i);
310

  
311 324
			if (((Boolean) draws.get(i)).booleanValue())
312 325
				mapTool.paintComponent(renderer);
313 326
		}
......
320 333
	 */
321 334
	public void setListener(ToolListener listener) {
322 335
		if (listener != null) {
323
			throw new RuntimeException(
336
			throw new UnsupportedOperationException(
324 337
				"CompoundBehavior does not have listeners");
325 338
		}
326 339
	}

Also available in: Unified diff