Revision 26824 trunk/extensions/extSymbology/src/org/gvsig/symbology/gui/styling/PictureFill.java

View differences:

PictureFill.java
116 116
	private JSymbolPreviewButton btnOutline;
117 117
	private JCheckBox useBorder;
118 118

  
119
	private JButton btnBrowseFile;
120
    private JButton btnBrowseFileSelected;
121

  
122

  
119 123
	private ActionListener chooseAction = new ActionListener() {
120 124
		public void actionPerformed(ActionEvent e) {
121 125
			boolean isSelection;
......
128 132
				targetLbl = lblSelFileName;
129 133
				isSelection = true;
130 134
			}
131
			
135

  
132 136
			FileFilter ff = new FileFilter() {
133 137
				public boolean accept(File f) {
134 138
					if (f.isDirectory()) return true;
......
163 167
//						picFile = myFile;
164 168
//					}
165 169
//					else{
166
//						selPicFile = myFile;	
170
//						selPicFile = myFile;
167 171
//					}
168 172
//					try {
169 173
//						targetLbl.setText(myFile.toURL().toString());
......
176 180
			if(returnVal == JFileChooser.APPROVE_OPTION) {
177 181

  
178 182
				URL url = jfc.getSelectedURL();
179
				if (url == null) return; 
183
				if (url == null) return;
180 184
				targetLbl.setText(url.toString());
181 185
				fireSymbolChangedEvent();
182 186
			}
187
			btnBrowseFileSelected.setEnabled(lblFileName.getText()!="");
183 188
		}
184

  
185 189
	};
186 190

  
187
	private JButton btnBrowseFile;
188
    private JButton btnBrowseFileSelected; 
189
    
190 191
	/**
191 192
	 * Constructor method
192 193
	 * @param owner
......
209 210
		btnBrowseFile = new JButton(PluginServices.getText(this, "browse"));
210 211
		btnBrowseFile.addActionListener(chooseAction);
211 212

  
212
		btnBrowseFileSelected = new JButton(PluginServices.getText(this,"browse")); 
213
		btnBrowseFileSelected = new JButton(PluginServices.getText(this,"browse"));
213 214
		btnBrowseFileSelected.addActionListener(chooseAction);
215
		btnBrowseFileSelected.setEnabled(false);
214 216

  
215 217
		JPanel aux2 = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
216 218

  
......
294 296
		jccFillColor.addActionListener(this);
295 297
		btnOutline.addActionListener(this);
296 298
		useBorder.addActionListener(this);
297
		
299

  
298 300
		tabs.add(myTab);
299 301
		tabs.add(fillProperties);
300
		
302

  
301 303
	}
302 304

  
303 305
	public EditorTool[] getEditorTools() {
......
337 339
				sym.setYScale(incrScaleY.getDouble());
338 340
				sym.setMarkerFillProperties(fillProperties.getMarkerFillProperties());
339 341
			}
340
			
342

  
341 343
		} catch (IOException e) {
342 344
			return SymbologyFactory.getWarningSymbol
343 345
				(PluginServices.getText(this, "failed_acessing_files"), null, SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS);
......
354 356
			setOptionsEnabled(tabs.get(i), enabled);
355 357
		}
356 358
	}
357
	
358
	
359 359

  
360

  
361

  
360 362
	private void setOptionsEnabled(Component c, boolean b) {
361 363
		if (!(c.equals(btnBrowseFile) || tabs.contains(c)))
362 364
			c.setEnabled(b);
363
		
365

  
364 366
		System.out.println(c.getClass().getName()+", "+c.getName());
365 367
		if (c instanceof Container) {
366 368
			Container cont = (Container) c;
367 369
			for(int j = 0; j < cont.getComponentCount(); j++) {
368 370
				setOptionsEnabled(cont.getComponent(j), b);
369
			}	
371
			}
370 372
		}
371
		
373

  
372 374
	}
373
	
374
	
375 375

  
376

  
377

  
376 378
	public String getName() {
377 379
		return PluginServices.getText(this, "picture_fill_symbol");
378 380
	}
......
387 389

  
388 390
	public void refreshControls(ISymbol layer) {
389 391
		PictureFillSymbol sym = (PictureFillSymbol) layer;
390
		
392

  
391 393
		File imageFile = new File(sym.getImagePath());
392 394
		File selImageFile =  new File (sym.getSelImagePath());
393 395

  
......
408 410
		incrScaleY.setDouble(sym.getYScale());
409 411
		fillProperties.setModel(sym.getMarkerFillProperties());
410 412

  
411
		
412
		
413
		btnBrowseFileSelected.setEnabled(lblFileName.getText()!="");
414

  
413 415
	}
414 416

  
415 417
	public void actionPerformed(ActionEvent e) {
416 418
		Object s = e.getSource();
417 419

  
418 420
		if(s.equals(jccFillColor)) {
419
			jccFillColor.getColor().getAlpha(); 
421
			jccFillColor.getColor().getAlpha();
420 422
		}
421 423
		outline = (ILineSymbol) btnOutline.getSymbol();
422 424
		fireSymbolChangedEvent();

Also available in: Unified diff