Revision 1782 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/File/JDynFormFieldFile.java

View differences:

JDynFormFieldFile.java
102 102

  
103 103
    public void onClickBrowse() {
104 104
        fireFieldEnterEvent();
105
        File previous = this.currentValue;
106
        
105 107
        this.problemIndicator().restore();
106 108

  
107 109
        File initialPath = null;
......
132 134
        }
133 135
        this.currentValue = x[0];
134 136
        this.jtext.setText(x[0].getPath());
135
        this.fireFieldChangedEvent();
137
        this.fireFieldChangedEventIfChanged(previous);
136 138
    }
139
    
140
    private void fireFieldChangedEventIfChanged(File previous) {
141
        if( previous==null ) {
142
            if( this.currentValue==null ) {
143
                return;
144
            }
145
            this.fireFieldChangedEvent();
146
            return;
147
        } 
148
        if( this.currentValue==null ) {
149
            this.fireFieldChangedEvent();
150
            return;
151
        }
152
        if( previous.getPath().equals(this.currentValue.getPath()) ) {
153
            this.fireFieldChangedEvent();
154
        }
155
    }
137 156

  
157

  
138 158
    public void setValue(Object value) {
159
        File previous = this.currentValue;
139 160
        if (value == null) {
140 161
            this.jtext.setText("");
141 162
        } else {
......
147 168
        }
148 169
        this.assignedValue = (File) value;
149 170
        this.currentValue = this.assignedValue;
171
        this.fireFieldChangedEventIfChanged(previous);
150 172
    }
151 173

  
152 174
    public Object getValue() {

Also available in: Unified diff