Revision 1947 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormField.java
AbstractJDynFormField.java | ||
---|---|---|
50 | 50 |
import org.gvsig.tools.dynform.JDynFormField; |
51 | 51 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
52 | 52 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager.ComponentsFactory; |
53 |
import org.gvsig.tools.dynobject.DynClass; |
|
54 |
import org.gvsig.tools.dynobject.DynField; |
|
53 | 55 |
import org.gvsig.tools.dynobject.DynField_v2; |
54 | 56 |
import org.gvsig.tools.dynobject.DynObject; |
55 | 57 |
import org.gvsig.tools.dynobject.Tags; |
... | ... | |
69 | 71 |
|
70 | 72 |
private JDynForm form; |
71 | 73 |
|
72 |
private JLabel jlabel = null;
|
|
74 |
protected JLabel jlabel = null;
|
|
73 | 75 |
private JPanel jlabelpanel = null; |
74 | 76 |
private Set listeners = null; |
75 | 77 |
private JProblemIndicator problemIndicator = null; |
76 | 78 |
|
77 | 79 |
protected JComponent contents = null; |
78 | 80 |
|
79 |
private boolean readOnly = false;
|
|
81 |
protected boolean readOnly = false;
|
|
80 | 82 |
private final List customActions; |
81 | 83 |
protected boolean emptyToNull = false; |
82 | 84 |
|
... | ... | |
267 | 269 |
public boolean isReadOnly() { |
268 | 270 |
return this.readOnly; |
269 | 271 |
} |
272 |
|
|
273 |
protected boolean isForcedReadOnly() { |
|
274 |
return this.getTagValueAsBoolean(DynFormSPIManager.TAG_DYNFORM_READONLY, false); |
|
275 |
} |
|
270 | 276 |
|
271 | 277 |
@Override |
272 | 278 |
public void setReadOnly(boolean readonly) { |
273 | 279 |
// FIXME: Implememtacion por defecto, sobreescribirla en las subclases |
274 | 280 |
// segun convenga para cada componente. |
281 |
if( !readonly && this.isForcedReadOnly() ) { |
|
282 |
readonly = true; |
|
283 |
} |
|
275 | 284 |
this.readOnly = readonly; |
276 | 285 |
if (jlabel != null) { |
277 | 286 |
this.jlabel.setEnabled(!readonly); |
... | ... | |
442 | 451 |
|
443 | 452 |
@Override |
444 | 453 |
public void fetch(DynObject container) { |
454 |
if( this.isReadOnly() ) { |
|
455 |
return; |
|
456 |
} |
|
445 | 457 |
Object value = this.getValue(); |
458 |
DynClass dynclass = container.getDynClass(); |
|
459 |
if( dynclass!=null ) { |
|
460 |
DynField dynfield = dynclass.getDynField(this.getName()); |
|
461 |
if( dynfield!=null && dynfield.isReadOnly() ) { |
|
462 |
return; |
|
463 |
} |
|
464 |
} |
|
446 | 465 |
container.setDynValue(this.getName(), value); |
447 | 466 |
} |
448 | 467 |
|
Also available in: Unified diff