Revision 5787

View differences:

org.gvsig.legend.vectorfilterexpression.app.mainplugin/tags/org.gvsig.legend.vectorfilterexpression.app.mainplugin-1.0.150/src/main/assembly/gvsig-plugin-package.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<assembly>
27
  <id>gvsig-plugin-package</id>
28
  <formats>
29
    <format>zip</format>
30
  </formats>
31
  <baseDirectory>${project.artifactId}</baseDirectory>
32
  <includeBaseDirectory>true</includeBaseDirectory>
33
  <files>
34
    <file>
35
      <source>target/${project.artifactId}-${project.version}.jar</source>
36
      <outputDirectory>lib</outputDirectory>
37
    </file>
38
    <file>
39
      <source>target/package.info</source>
40
    </file>
41
  </files>
42

  
43
  <fileSets>
44
    <fileSet>
45
      <directory>src/main/resources-plugin</directory>
46
      <outputDirectory>.</outputDirectory>
47
    </fileSet>
48
  </fileSets>
49

  
50
<!-- No dependencies
51
  <dependencySets>
52
    <dependencySet>
53
      <useProjectArtifact>false</useProjectArtifact>
54
      <useTransitiveDependencies>false</useTransitiveDependencies>
55
      <outputDirectory>lib</outputDirectory>
56
      <includes>
57
		<include>...</include>
58
      </includes>
59
    </dependencySet>
60
  </dependencySets>
61
-->
62

  
63
</assembly>
64

  
org.gvsig.legend.vectorfilterexpression.app.mainplugin/tags/org.gvsig.legend.vectorfilterexpression.app.mainplugin-1.0.150/src/main/java/org/gvsig/symbology/fmap/rendering/VectorFilterExpressionLegend.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2020 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.symbology.fmap.rendering;
25

  
26

  
27
import java.util.ArrayList;
28
import org.gvsig.fmap.dal.DALLocator;
29
import org.gvsig.fmap.dal.DataManager;
30
import org.gvsig.fmap.dal.exception.InitializeException;
31

  
32
import org.slf4j.Logger;
33
import org.slf4j.LoggerFactory;
34

  
35
import org.gvsig.fmap.dal.feature.Feature;
36
import org.gvsig.fmap.geom.Geometry;
37
import org.gvsig.fmap.geom.GeometryLocator;
38
import org.gvsig.fmap.geom.GeometryManager;
39
import org.gvsig.fmap.mapcontext.MapContextLocator;
40
import org.gvsig.fmap.mapcontext.MapContextManager;
41
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
42
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
43
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
44
import org.gvsig.i18n.Messages;
45
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.driver.impl.PersistenceBasedLegendWriter;
46
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractClassifiedVectorLegend;
47
import org.gvsig.tools.ToolsLocator;
48
import org.gvsig.tools.dynobject.DynStruct;
49
import org.gvsig.tools.evaluator.Evaluator;
50
import org.gvsig.tools.evaluator.EvaluatorData;
51
import org.gvsig.tools.persistence.PersistenceManager;
52
import org.gvsig.tools.persistence.PersistentState;
53
import org.gvsig.tools.persistence.exception.PersistenceException;
54
import org.gvsig.tools.util.Callable;
55
import org.gvsig.tools.util.Caller;
56
import org.gvsig.tools.util.impl.DefaultCaller;
57

  
58

  
59
/**
60
 *
61
 * Implements a vector legend which represents the elements of a layer
62
 * depending on the value of an expression. That is, if the expression is
63
 * evaluated to true, then the symbol associated to the expression is painted.
64
 * In other case it is not showed.
65
 *
66
 * If the expression result is a string, it is considered false if
67
 * it is the empty string "", true otherwise.
68
 *
69
 * If the expression result is numeric, it is considered false
70
 * if it is zero, and true otherwise.
71
 *
72
 * In other cases, it is considered false if the result is null and true
73
 * otherwise.
74
 *
75
 * @author gvSIG Team
76
 */
77
public class VectorFilterExpressionLegend
78
extends AbstractClassifiedVectorLegend  {
79

  
80
    private static final Logger logger = LoggerFactory.getLogger(
81
        VectorFilterExpressionLegend.class);
82

  
83
    public static final String
84
    FILTER_EXPRESSION_LEGEND_PERSISTENCE_DEFINITION_NAME =
85
    "FILTER_EXPRESSION_LEGEND_PERSISTENCE_DEFINITION_NAME";
86

  
87
    public static final String
88
    FILTER_EXPRESSION_LEGEND_NAME = "FILTER_EXPRESSION_LEGEND_NAME";
89

  
90
    public static final String I18N_DEFAULT = Messages.getText("default_value");
91
    public static final String NON_I18N_DEFAULT = Messages.getText("Default");
92

  
93
	private int shapeType;
94
	private ISymbol defaultSymbol;
95

  
96
	private boolean useDefaultSymbol = false;
97

  
98
	private long error_msg_count = 0;
99

  
100
	private ArrayList<Item> newSymbols = new ArrayList<Item>() {
101
		private static final long serialVersionUID = 1L;
102

  
103
		public int indexOf(String expr) {
104
			return super.indexOf(new Item(expr, null));
105
		}
106
	};
107

  
108

  
109
	private class Item implements Cloneable {
110

  
111
		private ISymbol sym;
112
		private Evaluator evaluator;
113

  
114
		public Item(String expression, ISymbol sym) {
115
			this.sym = sym;
116
      DataManager dataManager = DALLocator.getDataManager();
117
      try {
118
        evaluator = dataManager.createFilter(expression);
119
      } catch (InitializeException ex) {
120
        evaluator = null;
121
      }
122
		}
123

  
124
		public boolean equals(Object obj) {
125
			if (obj == null) return false;
126
			if (!obj.getClass().equals(Item.class)) return false;
127
			return this.evaluator.getSQL().equals(
128
			    ((Item) obj).evaluator.getSQL()
129
			    );
130
		}
131

  
132
		public String getStringExpression() {
133
			return evaluator.getSQL();
134
		}
135

  
136
		public Evaluator getEvaluator() {
137
			return evaluator;
138
		}
139

  
140
		public Object clone() {
141

  
142
		    ISymbol clonesym = null;
143
		    try {
144
                clonesym = (ISymbol) this.sym.clone();
145
            } catch (CloneNotSupportedException e) {
146
                logger.info("Error: unable to clone symbol.", e);
147
                clonesym = this.sym;
148
            }
149
		    return new Item(getStringExpression(), clonesym);
150
		}
151
	}
152

  
153
    public VectorFilterExpressionLegend() {
154
        this.setClassifyingFieldNames(new String[0]);
155
        this.setClassifyingFieldTypes(new int[0]);
156
    }
157

  
158
	public ISymbol getSymbolByFeature(Feature featu) {
159

  
160
	    EvaluatorData evda = featu.getEvaluatorData();
161

  
162
		ISymbol returnSymbol = null;
163
		Object result = null;
164
		String expr = null;
165

  
166
		try {
167

  
168
			for (int i = 0; i < newSymbols.size(); i++) {
169

  
170
				Evaluator eval = newSymbols.get(i).getEvaluator();
171
				expr = eval.getSQL();
172

  
173
                if (expr.equalsIgnoreCase(VectorFilterExpressionLegend.I18N_DEFAULT)){
174
                    /*
175
                     * Skip default item
176
                     */
177
                    continue;
178
                }
179

  
180
				result = eval.evaluate(evda);
181
				if (isConsideredTrue(result)) {
182
                    returnSymbol = newSymbols.get(i).sym;
183
                    if (returnSymbol != null) {
184
                        return returnSymbol;
185
                    }
186
				}
187
			}
188
		} catch (Exception e) {
189

  
190
		    if (error_msg_count % 1000 == 0) {
191
		        logger.info("Error (msg every 1000 occurrences) while getting symbol in VectorFilterExpressionLegend", e);
192
		        error_msg_count = 0;
193
		    }
194
		    error_msg_count++;
195
		}
196

  
197
		if (useDefaultSymbol)
198
			return getDefaultSymbol();
199

  
200
		return null;
201
	}
202

  
203
	/**
204
	 * Tells whether the input object is considered true.
205
	 * Basically, it is false if it has an empty value
206
	 * (FALSE, null, 0, "")
207
	 *
208
     * @param result
209
     * @return
210
     */
211
    private boolean isConsideredTrue(Object res) {
212

  
213
        if (res == null) {
214
            return false;
215
        }
216

  
217
        if (res instanceof Boolean) {
218
            return ((Boolean) res).booleanValue();
219
        }
220

  
221
        if (res instanceof Number) {
222
            return ((Number) res).doubleValue() != 0d;
223
        }
224

  
225
        if (res instanceof String) {
226
            return ((String) res).length() > 0;
227
        }
228

  
229
        // Because it is not null
230
        return true;
231
    }
232

  
233
	public void addSymbol(Object key, ISymbol symbol) {
234
		newSymbols.add(new Item((String)key.toString(),
235
				symbol));
236
	}
237

  
238
	public void clear() {
239
		newSymbols.clear();
240
	}
241

  
242
	public void resetItems() {
243
	    newSymbols = new ArrayList<Item>() {
244
            private static final long serialVersionUID = 1L;
245

  
246
            public int indexOf(String expr) {
247
                return super.indexOf(new Item(expr, null));
248
            }
249
	    };
250
	}
251

  
252
	public void delSymbol(Object key) {
253
		ISymbol mySymbol = null;
254
		for (int i = 0; i < newSymbols.size(); i++) {
255
			if (newSymbols.get(i).evaluator.getSQL().equals(key))
256
				newSymbols.remove(i);
257
		}
258
		fireClassifiedSymbolChangeEvent(new SymbolLegendEvent(mySymbol,null));
259
	}
260

  
261

  
262
	public void replace(ISymbol oldSymbol, ISymbol newSymbol) {
263

  
264
		for (int i = 0; i < newSymbols.size(); i++) {
265
			if (newSymbols.get(i).sym.equals(oldSymbol))
266
				newSymbols.get(i).sym = newSymbol;
267
		}
268

  
269
		fireClassifiedSymbolChangeEvent(new SymbolLegendEvent(oldSymbol,newSymbol));
270
	}
271

  
272

  
273
	public String[] getDescriptions() {
274
		String[] descriptions = new String[newSymbols.size()];
275
		ISymbol[] auxSym = getSymbols();
276

  
277
		for (int i = 0; i < descriptions.length; i++)
278
			descriptions[i] = auxSym[i].getDescription();
279

  
280
		return descriptions;
281
	}
282

  
283
	public ISymbol[] getSymbols() {
284

  
285
		if (newSymbols != null) {
286
			ISymbol[] mySymbols = new ISymbol[newSymbols.size()];
287
			for (int i = 0; i < newSymbols.size(); i++) {
288
				mySymbols[i] = newSymbols.get(i).sym;
289
			}
290
			return mySymbols;
291
		}
292
		return null;
293
	}
294

  
295

  
296

  
297
	public ISymbol getDefaultSymbol() {
298
		if(defaultSymbol==null) {
299

  
300
		    defaultSymbol = MapContextLocator.getSymbolManager(
301
		        ).createSymbol(shapeType);
302
			fireDefaultSymbolChangedEvent(new SymbolLegendEvent(null, defaultSymbol));
303
		}
304
		return defaultSymbol;
305
	}
306

  
307

  
308
	public String getClassName() {
309
		return getClass().getName();
310
	}
311

  
312

  
313
	public int getShapeType() {
314
		return shapeType;
315
	}
316

  
317
	public boolean isUseDefaultSymbol() {
318
		return useDefaultSymbol;
319
	}
320

  
321
	public void setDefaultSymbol(ISymbol s) throws IllegalArgumentException {
322
		if (s == null) throw new NullPointerException("Default symbol cannot be null");
323
		ISymbol old = defaultSymbol;
324
		defaultSymbol = s;
325
		fireDefaultSymbolChangedEvent(new SymbolLegendEvent(old, defaultSymbol));
326
	}
327

  
328
	public void setShapeType(int shapeType) {
329
		if (this.shapeType != shapeType) {
330

  
331
		    ISymbol sym = MapContextLocator.getSymbolManager(
332
		        ).createSymbol(shapeType);
333
			setDefaultSymbol(sym);
334
			this.shapeType = shapeType;
335
		}
336
	}
337

  
338
	public void useDefaultSymbol(boolean b) {
339
		useDefaultSymbol = b;
340
	}
341

  
342
	public Object[] getValues() {
343
		if (newSymbols != null) {
344
			Object[] myObjects = new Object[newSymbols.size()];
345
			for (int i = 0; i < newSymbols.size(); i++) {
346
				myObjects[i] = newSymbols.get(i).getStringExpression();
347
			}
348
			return myObjects;
349
		}
350
		return null;
351
	}
352

  
353
    public static boolean isPolygonal(int ty) {
354
        GeometryManager geomManager = GeometryLocator.getGeometryManager();
355
        return geomManager.isSubtype(Geometry.TYPES.MULTISURFACE, ty) || 
356
            geomManager.isSubtype(Geometry.TYPES.SURFACE, ty);
357
    }
358

  
359

  
360
    public static boolean isLinear(int ty) {
361
        GeometryManager geomManager = GeometryLocator.getGeometryManager();
362
        return geomManager.isSubtype(Geometry.TYPES.MULTICURVE, ty) || 
363
            geomManager.isSubtype(Geometry.TYPES.CURVE, ty);
364
    }
365
    
366
    public static boolean isPoint(int ty) {
367
        GeometryManager geomManager = GeometryLocator.getGeometryManager();
368
        return geomManager.isSubtype(Geometry.TYPES.MULTIPOINT, ty) || 
369
            geomManager.isSubtype(Geometry.TYPES.POINT, ty);
370
    }
371
    
372
    public void removeDefaultSymbol() {
373

  
374
    }
375

  
376
    // =============================
377

  
378
    public static class RegisterPersistence implements Callable {
379

  
380
        public Object call() throws Exception {
381

  
382
            PersistenceManager manager = ToolsLocator.getPersistenceManager();
383
            if (manager.getDefinition(
384
                FILTER_EXPRESSION_LEGEND_PERSISTENCE_DEFINITION_NAME) == null) {
385
                DynStruct definition = manager
386
                    .addDefinition(VectorFilterExpressionLegend.class,
387
                        FILTER_EXPRESSION_LEGEND_PERSISTENCE_DEFINITION_NAME,
388
                        FILTER_EXPRESSION_LEGEND_PERSISTENCE_DEFINITION_NAME
389
                        + " Persistence definition", null, null);
390

  
391
                definition.extend(manager.getDefinition(
392
                    AbstractClassifiedVectorLegend
393
                    .CLASSIFIED_VECTOR_LEGEND_PERSISTENCE_DEFINITION_NAME));
394

  
395
                definition.addDynFieldBoolean("useDefaultSymbol")
396
                .setMandatory(true);
397
                definition.addDynFieldObject("defaultSymbol")
398
                .setClassOfValue(ISymbol.class).setMandatory(true);
399
                definition.addDynFieldInt("shapeType")
400
                .setMandatory(true);
401

  
402
                definition.addDynFieldArray("itemSymbolArray")
403
                .setClassOfItems(ISymbol.class);
404
                definition.addDynFieldArray("itemStringArray")
405
                .setClassOfItems(String.class);
406

  
407
            }
408
            return Boolean.TRUE;
409
        }
410

  
411
    }
412

  
413
    public static class RegisterLegend implements Callable {
414

  
415
        public Object call() throws Exception {
416
            MapContextManager manager =
417
                MapContextLocator.getMapContextManager();
418

  
419
            manager.registerLegend(
420
                FILTER_EXPRESSION_LEGEND_NAME,
421
                VectorFilterExpressionLegend.class);
422

  
423
            return Boolean.TRUE;
424
        }
425

  
426
    }
427

  
428
    public void saveToState(PersistentState state) throws PersistenceException {
429

  
430
        super.saveToState(state);
431
        state.set("useDefaultSymbol", this.isUseDefaultSymbol());
432
        state.set("defaultSymbol", this.getDefaultSymbol());
433
        state.set("shapeType", this.getShapeType());
434

  
435
        ISymbol[] syms = this.getSymbols();
436
        if (syms == null) {
437
            syms = new ISymbol[0];
438
        }
439
        Object[] vals = this.getValues();
440
        String[] vals_str = null;
441
        if (vals == null) {
442
            vals_str = new String[0];
443
        } else {
444
            vals_str = new String[vals.length];
445
            for (int i=0; i<vals.length; i++) {
446
                String aux = ((vals[i] == null) ? null : vals[i].toString());
447
                // Prevents saving localized version of 'Default'
448
                aux = translateDefault(aux, false);
449
                vals_str[i] = aux;
450
            }
451
        }
452

  
453
        state.set("itemSymbolArray", syms);
454
        state.set("itemStringArray", vals_str);
455

  
456
    }
457

  
458
    public void loadFromState(PersistentState state)
459
        throws PersistenceException {
460

  
461
        super.loadFromState(state);
462

  
463
        this.setShapeType(state.getInt("shapeType"));
464
        Boolean b = state.getBoolean("useDefaultSymbol");
465
        this.useDefaultSymbol(b);
466
        ISymbol defsym = (ISymbol) state.get("defaultSymbol");
467
        this.setDefaultSymbol(defsym);
468

  
469
        String[] strs = state.getStringArray("itemStringArray");
470
        ISymbol[] syms = (ISymbol[]) state.getArray("itemSymbolArray",
471
            ISymbol.class);
472

  
473
        if (strs.length != syms.length) {
474
            logger.info("VectorFilterExpressionLegend - load state - Different size in arrays: " + strs.length + ", " + syms.length);
475
        }
476
        int nmin = Math.min(strs.length, syms.length);
477
        for (int i=0; i<nmin; i++) {
478
            String aux = strs[i];
479
            aux = translateDefault(aux, true);
480
            this.addSymbol(aux, syms[i]);
481
        }
482
    }
483

  
484
    /**
485
     * Utility method to (un)translate the word 'Default'
486
     * @param aux
487
     * @param forward
488
     * If TRUE, then translate (Default -> Por defecto)
489
     * If FALSE then untranslate (Por defecto -> Default)
490
     * @return
491
     */
492
    private String translateDefault(String aux, boolean forward) {
493

  
494
        if (aux == null) {
495
            return null;
496
        }
497
        if (forward && aux.compareTo(NON_I18N_DEFAULT) == 0) {
498
            return I18N_DEFAULT;
499
        }
500
        if (!forward && aux.compareTo(I18N_DEFAULT) == 0) {
501
            return NON_I18N_DEFAULT;
502
        }
503
        return aux;
504
    }
505

  
506

  
507
    public Object clone() throws CloneNotSupportedException {
508

  
509
        VectorFilterExpressionLegend resp =
510
            (VectorFilterExpressionLegend) super.clone();
511

  
512
        Object[] vals = this.getValues();
513
        ISymbol[] syms = this.getSymbols();
514
        if (vals != null && syms != null) {
515

  
516
            resp.resetItems();
517

  
518
            int n = Math.min(vals.length, syms.length);
519
            for (int i=0; i<n; i++) {
520
                resp.addSymbol(
521
                    vals[i],
522
                    (ISymbol) syms[i].clone());
523
            }
524
        }
525
        ISymbol sym = this.getDefaultSymbol();
526
        sym = (ISymbol) sym.clone();
527
        resp.setDefaultSymbol(sym);
528
        return resp;
529
    }
530

  
531

  
532
  public static void selfRegister() {
533
    Caller caller = new DefaultCaller();
534

  
535
    caller.add(new VectorFilterExpressionLegend.RegisterLegend());
536
    caller.add(new VectorFilterExpressionLegend.RegisterPersistence());
537

  
538
    if (!caller.call()) {
539
      throw new RuntimeException(
540
              "Can't register VectorFilterExpressionLegend",
541
              caller.getException()
542
      );
543
    }
544
    MapContextManager mcoman = MapContextLocator.getMapContextManager();
545
    mcoman.registerLegendWriter(
546
        VectorFilterExpressionLegend.class,
547
            SymbolManager.LEGEND_FILE_EXTENSION.substring(1),
548
            PersistenceBasedLegendWriter.class);
549
    
550
    
551
  }
552

  
553
}
org.gvsig.legend.vectorfilterexpression.app.mainplugin/tags/org.gvsig.legend.vectorfilterexpression.app.mainplugin-1.0.150/src/main/java/org/gvsig/symbology/gui/layerproperties/ExpressionFieldCellEditor.java
1
/* gvSIG. Sistema de Informaci๏ฟฝn Geogr๏ฟฝfica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This progra/**
11
 * gvSIG. Desktop Geographic Information System.
12
 *
13
 * Copyright (C) 2007-2020 gvSIG Association.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 3
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
28
 * MA  02110-1301, USA.
29
 *
30
 * For any additional information, do not hesitate to contact us
31
 * at info AT gvsig.com, or visit our website www.gvsig.com.
32
 */
33
package org.gvsig.symbology.gui.layerproperties;
34

  
35
import java.awt.Component;
36
import javax.swing.AbstractCellEditor;
37

  
38
import javax.swing.JTable;
39
import javax.swing.table.TableCellEditor;
40
import org.gvsig.expressionevaluator.Expression;
41
import org.gvsig.expressionevaluator.ExpressionUtils;
42
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator;
43
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager;
44
import org.gvsig.expressionevaluator.swing.JExpressionPicker;
45
import org.gvsig.fmap.dal.feature.FeatureStore;
46
import org.gvsig.fmap.dal.swing.DALSwingLocator;
47
import org.gvsig.fmap.dal.swing.DataSwingManager;
48

  
49
/**
50
 * Cell Editor for expressions. It controls the edition events in an expression
51
 * column of the table
52
 *
53
 * @author gvSIG Team
54
 */
55
public class ExpressionFieldCellEditor 
56
        extends AbstractCellEditor
57
        implements TableCellEditor 
58
  {
59

  
60
  private final JExpressionPicker picker;
61

  
62
	public ExpressionFieldCellEditor(FeatureStore store) {
63
    ExpressionEvaluatorSwingManager manager = ExpressionEvaluatorSwingLocator.getManager();
64
    this.picker = manager.createJExpressionPicker();
65
    if( store != null ) {
66
      DataSwingManager dataSwingManager = DALSwingLocator.getManager();    
67
      dataSwingManager.configureExpressionBuilder(picker, store);  
68
    }
69
	}
70

  
71
  @Override
72
  public Object getCellEditorValue() {
73
    Expression value = this.picker.getExpression();
74
    if( value == null ) {
75
      return null;
76
    }
77
    return value.getPhrase();
78
  }
79

  
80
  @Override
81
  public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
82
    if( value instanceof String ) {
83
      this.picker.setExpression(ExpressionUtils.createExpression((String) value));
84
    } else {
85
      this.picker.setExpression(null);
86
    }
87
    return this.picker.asJComponent();
88
  }
89

  
90

  
91
}
org.gvsig.legend.vectorfilterexpression.app.mainplugin/tags/org.gvsig.legend.vectorfilterexpression.app.mainplugin-1.0.150/src/main/java/org/gvsig/symbology/gui/layerproperties/VectorFilterExpressionPanel2.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2020 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.symbology.gui.layerproperties;
25

  
26
import java.awt.event.ActionEvent;
27
import java.io.File;
28
import java.io.IOException;
29
import java.net.URL;
30
import java.util.ArrayList;
31
import java.util.Arrays;
32
import java.util.List;
33

  
34
import javax.swing.ImageIcon;
35
import javax.swing.JOptionPane;
36
import javax.swing.JPanel;
37
import org.apache.commons.lang3.StringUtils;
38

  
39
import org.slf4j.Logger;
40
import org.slf4j.LoggerFactory;
41

  
42
import org.gvsig.andami.IconThemeHelper;
43
import org.gvsig.app.ApplicationLocator;
44
import org.gvsig.app.project.documents.view.legend.gui.Categories;
45
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel;
46
import org.gvsig.app.project.documents.view.legend.gui.SymbolTable;
47
import org.gvsig.fmap.dal.exception.ReadException;
48
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
49
import org.gvsig.fmap.dal.feature.FeatureStore;
50
import org.gvsig.fmap.dal.feature.FeatureType;
51
import org.gvsig.fmap.mapcontext.layers.FLayer;
52
import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
53
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
54
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
55
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
56
import org.gvsig.i18n.Messages;
57
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.PictureFillSymbol;
58
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.IMarkerFillPropertiesStyle;
59
import org.gvsig.symbology.fmap.rendering.VectorFilterExpressionLegend;
60
import org.gvsig.tools.ToolsLocator;
61
import org.gvsig.tools.i18n.I18nManager;
62
import org.gvsig.tools.swing.api.ToolsSwingLocator;
63
import org.gvsig.tools.swing.api.ToolsSwingManager;
64
import org.gvsig.tools.swing.api.windowmanager.Dialog;
65
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
66
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2;
67

  
68
/**
69
 * Implements the JPanel that shows the properties of a
70
 * VectorialFilterExpressionLegend in order to allows the user to modify its
71
 * characteristics
72
 *
73
 * @author gvSIG Team
74
 *
75
 */
76
@SuppressWarnings("UseSpecificCatch")
77
public class VectorFilterExpressionPanel2
78
        extends VectorFilterExpressionPanelView
79
        implements ILegendPanel {
80

  
81
  private static final Logger LOGGER = LoggerFactory.getLogger(VectorFilterExpressionPanel2.class);
82

  
83
  private VectorFilterExpressionLegend theLegend;
84
  private VectorFilterExpressionLegend auxLegend;
85
  private ClassifiableVectorial layer;
86
  private PictureFillSymbol previewSymbol;
87
  private SymbolTable symbolTable;
88
  private int shapeType;
89
  private SymbolPickerController defaultSymbolPrev;
90

  
91
  /**
92
   * This is the default constructor
93
   */
94
  public VectorFilterExpressionPanel2() {
95
    super();
96
    initComponents();
97
  }
98

  
99
  /**
100
   * This method initializes this
101
   */
102
  private void initComponents() {
103
    ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager();
104
    
105
    toolsSwingManager.translate(this.btnAdd);
106
    toolsSwingManager.translate(this.btnRemove);
107
    toolsSwingManager.translate(this.btnRemoveAll);
108
    toolsSwingManager.translate(this.btnDown);
109
    toolsSwingManager.translate(this.btnUp);
110
    toolsSwingManager.translate(this.chkDefaultValues);
111
    
112
    this.defaultSymbolPrev = new SymbolPickerController(
113
            this.btnDefaultValuesPreview, 
114
            null, 
115
            shapeType, 
116
            null
117
    );
118

  
119
    this.btnUp.setIcon(IconThemeHelper.getImageIcon("symbol-layer-move-up"));
120
    this.btnDown.setIcon(IconThemeHelper.getImageIcon("symbol-layer-move-down"));
121

  
122
    this.btnUp.setText("");
123
    this.btnDown.setText("");
124
    
125
    this.btnUp.addActionListener((ActionEvent e) -> {
126
      doUp();
127
    });
128
    this.btnDown.addActionListener((ActionEvent e) -> {
129
      doDown();
130
    });
131
    this.btnAdd.addActionListener((ActionEvent e) -> {
132
      doAdd();
133
    });
134
    this.btnRemove.addActionListener((ActionEvent e) -> {
135
      doRemove();
136
    });
137
    this.btnRemoveAll.addActionListener((ActionEvent e) -> {
138
      doRemoveAll();
139
    });
140
  }
141

  
142
  @Override
143
  public String getDescription() {
144
    return Messages.getText(
145
            "shows_the_elements_of_the_layer_depending_on_the_value_of_a_filter_expression") + ".";
146
  }
147

  
148
  public ISymbol getIconSymbol() {
149
    if (previewSymbol == null) {
150
      try {
151
        previewSymbol = new PictureFillSymbol();
152
        URL resource = this.getClass().getClassLoader().getResource("images/legend/legend-overview-vectorial-unique-value.png");
153
        if( resource == null ) {
154
          return null;
155
        }
156
        previewSymbol.setImage(resource);
157
        previewSymbol.getMarkerFillProperties().setFillStyle(
158
                IMarkerFillPropertiesStyle.SINGLE_CENTERED_SYMBOL
159
        );
160
      } catch (IOException e) {
161
        return null;
162
      }
163
    }
164
    return previewSymbol;
165
  }
166

  
167
  @Override
168
  public ILegend getLegend() {
169
    auxLegend.clear();
170
    fillSymbolListFromTable();
171

  
172
    theLegend = (VectorFilterExpressionLegend) auxLegend.cloneLegend();
173
    if (defaultSymbolPrev.get() != null) {
174
      theLegend.setDefaultSymbol(defaultSymbolPrev.get());
175
    }
176
    theLegend.useDefaultSymbol(chkDefaultValues.isSelected());
177
    return theLegend;
178
  }
179

  
180
  /**
181
   * Fills the list of symbols of the legend
182
   */
183
  private void fillSymbolListFromTable() {
184
    Object clave;
185
    ISymbol theSymbol;
186

  
187
    FLyrVect m = (FLyrVect) layer;
188
    try {
189

  
190
      if (auxLegend.getClassifyingFieldNames() != null) {
191
        String[] fNames = auxLegend.getClassifyingFieldNames();
192
        int[] fieldTypes = new int[auxLegend.getClassifyingFieldNames().length];
193

  
194
        FeatureStore fsto = (FeatureStore) m.getDataStore();
195
        FeatureType fty = fsto.getDefaultFeatureType();
196

  
197
        for (int i = 0; i < fNames.length; i++) {
198
          fieldTypes[i] = fty.getAttributeDescriptor(fNames[i]).getType();
199
        }
200

  
201
        auxLegend.setClassifyingFieldTypes(fieldTypes);
202
      }
203
    } catch (Exception e) {
204

  
205
    }
206

  
207
    auxLegend.useDefaultSymbol(chkDefaultValues.isSelected());
208

  
209
    for (int row = 0; row < symbolTable.getRowCount(); row++) {
210
      clave = symbolTable.getFieldValue(row, 1);
211
      theSymbol = (ISymbol) symbolTable.getFieldValue(row, 0);
212
      theSymbol.setDescription((String) symbolTable.getFieldValue(row, 2));
213
      auxLegend.addSymbol(clave, theSymbol);
214
    }
215
    if (chkDefaultValues.isSelected()) {
216
      if (defaultSymbolPrev.get() != null) {
217
        String description = VectorFilterExpressionLegend.I18N_DEFAULT;
218
        defaultSymbolPrev.get().setDescription(description);
219
        auxLegend.addSymbol(
220
                description, defaultSymbolPrev.get());
221
      }
222
    }
223

  
224
  }
225

  
226
  @Override
227
  public Class<VectorFilterExpressionLegend> getLegendClass() {
228
    return VectorFilterExpressionLegend.class;
229
  }
230

  
231
  @Override
232
  public JPanel getPanel() {
233
    return this;
234
  }
235

  
236
  @Override
237
  public Class<Categories> getParentClass() {
238
    return Categories.class;
239
  }
240

  
241
  @Override
242
  public String getTitle() {
243
    return Messages.getText("expressions");
244
  }
245

  
246
  @Override
247
  public boolean isSuitableFor(FLayer layer) {
248
    FLyrVect lVect = (FLyrVect) layer;
249
    try {
250
      return VectorFilterExpressionLegend.isPoint(lVect.getShapeType())
251
              || VectorFilterExpressionLegend.isLinear(lVect.getShapeType())
252
              || VectorFilterExpressionLegend.isPolygonal(lVect.getShapeType());
253
    } catch (Exception e) {
254
      return false;
255
    }
256

  
257
  }
258

  
259
  @Override
260
  public void setData(FLayer lyr, ILegend legend) {
261
    this.layer = (ClassifiableVectorial) lyr;
262
    shapeType = 0;
263

  
264
    try {
265
      shapeType = this.layer.getGeometryType().getType();
266
    } catch (ReadException e) {
267
      LOGGER.warn("Error while getting layer shp type", e);
268
      ApplicationLocator.getManager().message(
269
              Messages.getText("generating_intervals"),
270
              JOptionPane.ERROR_MESSAGE);
271
    }
272

  
273
    this.defaultSymbolPrev = new SymbolPickerController(this.btnDefaultValuesPreview, null, shapeType, null);
274

  
275
    symbolTable = new SymbolTable(this.tblSymbols, this, "expressions", shapeType);
276
    doUpdateCellEditor();
277
    if (legend instanceof VectorFilterExpressionLegend) {
278

  
279
      auxLegend = (VectorFilterExpressionLegend) legend.cloneLegend();
280
      if (auxLegend.isUseDefaultSymbol()) {
281
        // Default must not be in table
282
        fillTableSkipDefault(auxLegend);
283
      } else {
284
        symbolTable.fillTableFromSymbolList(
285
                auxLegend.getSymbols(),
286
                auxLegend.getValues(),
287
                auxLegend.getDescriptions());
288
      }
289

  
290
    } else {
291
      auxLegend = new VectorFilterExpressionLegend();
292
      auxLegend.setShapeType(shapeType);
293
    }
294
    defaultSymbolPrev.set(auxLegend.getDefaultSymbol());
295
    this.chkDefaultValues.setSelected(auxLegend.isUseDefaultSymbol());
296
  }
297
  
298
  private void doUpdateCellEditor() {
299
      try {
300
        ExpressionFieldCellEditor cellEditor = new ExpressionFieldCellEditor(
301
                ((FLyrVect)layer).getFeatureStore()
302
        );
303
        symbolTable.setCellEditor(cellEditor);
304
      } catch(Exception ex) {
305
        LOGGER.debug("Can't update cell editors",ex);
306
      }    
307
  }
308

  
309

  
310
  private void doUp() {
311
    int[] indices = symbolTable.getSelectedRows();
312
    if (indices.length > 0) {
313
      int classIndex = indices[0];
314
      int targetPos = Math.max(0, classIndex - 1);
315
      symbolTable.moveUpRows(classIndex, targetPos, indices.length);
316
    }
317
  }
318

  
319
  private void doDown() {
320
    int[] indices = symbolTable.getSelectedRows();
321
    if (indices.length > 0) {
322
      int classIndex = indices[indices.length - 1];
323
      int targetPos = Math.min(symbolTable.getRowCount() - 1, classIndex + 1);
324
      symbolTable.moveDownRows(classIndex, targetPos, indices.length);
325
    }
326

  
327
  }
328

  
329
  private void doAdd() {
330
    FLyrVect vect = (FLyrVect) layer;
331
    final FeatureStore fsto = vect.getFeatureStore();
332
    final FeatureType fty = fsto.getDefaultFeatureTypeQuietly();
333
    final int shptype = fty.getDefaultGeometryAttribute().getGeomType().getType();
334
    final I18nManager i18n = ToolsLocator.getI18nManager();
335
    final ExpressionSymbolPanel esp = new ExpressionSymbolPanel(fsto, shptype, previewSymbol);
336
    final WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager();
337
    final Dialog dialog = windowManager.createDialog(
338
            esp,
339
            i18n.getTranslation("expression_creator"),
340
            "",
341
            WindowManager_v2.BUTTONS_OK_CANCEL
342
    );
343
    dialog.addActionListener((ActionEvent e1) -> {
344
      if (dialog.getAction() != WindowManager_v2.BUTTON_OK) {
345
        return;
346
      }
347
      String expr = esp.getExpression();
348
      if (StringUtils.isBlank(expr)) {
349
        ApplicationLocator.getManager().messageDialog(
350
                Messages.getText("error_validating_filter_query"),
351
                Messages.getText("error"),
352
                JOptionPane.ERROR_MESSAGE);
353
        return;
354
      }
355
      ISymbol sym = esp.getSymbol();
356
      this.addClassFieldNames(fty);
357

  
358
      auxLegend.addSymbol(expr, sym);
359
      symbolTable.removeAllItems();
360
      doUpdateCellEditor();
361
      fillTableSkipDefault(auxLegend);
362

  
363
      repaint();
364
    });
365
    dialog.show(WindowManager.MODE.DIALOG);
366
  }
367

  
368
  private void doRemove() {
369
    if (symbolTable.getSelectedRowElements() == null) {
370
      JOptionPane.showMessageDialog(this, Messages.getText("select_one_row"));
371
    } else {
372
      String my_expr = (String) symbolTable.getSelectedRowElements()[1];
373
      auxLegend.delSymbol(my_expr);
374
      symbolTable.removeAllItems();
375
      doUpdateCellEditor();
376
      fillTableSkipDefault(auxLegend);
377

  
378
      repaint();
379
    }
380
  }
381

  
382
  private void doRemoveAll() {
383
      auxLegend.clear();
384
      symbolTable.removeAllItems();
385
      doUpdateCellEditor();
386
      fillTableSkipDefault(auxLegend);
387

  
388
      repaint();
389
  }
390

  
391
  private void addClassFieldNames(FeatureType ft) {
392
    FeatureAttributeDescriptor[] atts = ft.getAttributeDescriptors();
393
    String[] nn = new String[atts.length];
394
    for (int i = 0; i < atts.length; i++) {
395
      nn[i] = atts[i].getName();
396
    }
397
    addClassFieldNames(nn);
398
  }
399

  
400
  /**
401
   * Adds new classifying field names to the legend when a new expression is
402
   * created or an existing one is modified
403
   *
404
   * @param fieldNamesExpression
405
   */
406
  private void addClassFieldNames(String[] fieldNamesExpression) {
407
    boolean appears;
408
    List<String> myFieldNames = new ArrayList<>();
409

  
410
    if (auxLegend.getClassifyingFieldNames() != null) {
411

  
412
      myFieldNames.addAll(Arrays.asList(auxLegend.getClassifyingFieldNames()));
413

  
414
      for (String fieldNamesExpression1 : fieldNamesExpression) {
415
        appears = false;
416
        for (String classifyingFieldName : auxLegend.getClassifyingFieldNames()) {
417
          if (classifyingFieldName.compareTo((String) fieldNamesExpression1) == 0) {
418
            appears = true;
419
          }
420
        }
421
        if (!appears) {
422
          myFieldNames.add((String) fieldNamesExpression1);
423
        }
424
      }
425
      auxLegend.setClassifyingFieldNames(
426
              myFieldNames.toArray(new String[myFieldNames.size()])
427
      );
428

  
429
    } else {
430
      for (String fieldNamesExpression1 : fieldNamesExpression) {
431
        myFieldNames.add((String) fieldNamesExpression1);
432
      }
433
      auxLegend.setClassifyingFieldNames(myFieldNames.toArray(new String[myFieldNames.size()]));
434
    }
435
  }
436

  
437
  @Override
438
  public ImageIcon getIcon() {
439
    ImageIcon icon = IconThemeHelper.getImageIcon("legend-overview-vector-filter-expression");
440
    return icon;
441
  }
442

  
443
  private void fillTableSkipDefault(VectorFilterExpressionLegend leg) {
444

  
445
    Object[] src_expr = leg.getValues();
446
    List<Integer> rem_ind = new ArrayList<>();
447
    for (int i = 0; i < src_expr.length; i++) {
448
      if (VectorFilterExpressionLegend.I18N_DEFAULT.
449
              compareToIgnoreCase((String) src_expr[i]) == 0) {
450
        rem_ind.add(i);
451
      }
452
    }
453
    ISymbol[] src_syms = leg.getSymbols();
454
    String[] src_descs = leg.getDescriptions();
455
    // Object[] src_expr
456

  
457
    List<ISymbol> syms = new ArrayList<>();
458
    List<Object> vals = new ArrayList<>();
459
    List<String> descs = new ArrayList<>();
460
    for (int i = 0; i < src_expr.length; i++) {
461
      if (!isIn(i, rem_ind)) {
462
        syms.add(src_syms[i]);
463
        vals.add(src_expr[i]);
464
        descs.add(src_descs[i]);
465
      }
466
    }
467
    symbolTable.fillTableFromSymbolList(
468
            syms.toArray(new ISymbol[0]),
469
            vals.toArray(new Object[0]),
470
            descs.toArray(new String[0]));
471
  }
472

  
473
  /**
474
   * @param i
475
   * @param rem_ind
476
   * @return
477
   */
478
  private boolean isIn(int n, List<Integer> list) {
479

  
480
    if (list == null || list.isEmpty()) {
481
      return false;
482
    }
483
    for (Integer item : list) {
484
      if( item!=null && item==n ) {
485
        return true;
486
      }
487
    }
488
    return false;
489
  }
490

  
491
}
org.gvsig.legend.vectorfilterexpression.app.mainplugin/tags/org.gvsig.legend.vectorfilterexpression.app.mainplugin-1.0.150/src/main/java/org/gvsig/symbology/gui/layerproperties/ExpressionSymbolPanelView.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<object classname="com.jeta.forms.store.memento.FormPackage">
4
 <at name="fileversion">
5
  <object classname="com.jeta.forms.store.memento.FormsVersion2">
6
   <at name="major">2</at>
7
   <at name="minor">0</at>
8
   <at name="sub">0</at>
9
  </object>
10
 </at>
11
 <at name="form">
12
  <object classname="com.jeta.forms.store.memento.FormMemento">
13
   <super classname="com.jeta.forms.store.memento.ComponentMemento">
14
    <at name="cellconstraints">
15
     <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
16
      <at name="column">1</at>
17
      <at name="row">1</at>
18
      <at name="colspan">1</at>
19
      <at name="rowspan">1</at>
20
      <at name="halign">default</at>
21
      <at name="valign">default</at>
22
      <at name="insets" object="insets">0,0,0,0</at>
23
     </object>
24
    </at>
25
    <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
26
   </super>
27
   <at name="id">/home/jjdelcerro/datos/devel/org.gvsig.legend.vectorfilterexpression.app.mainplugin/src/main/java/org/gvsig/symbology/gui/layerproperties/ExpressionSymbolPanelView.xml</at>
28
   <at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,FILL:50PX:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,FILL:DEFAULT:NONE,CENTER:2DLU:NONE</at>
29
   <at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at>
30
   <at name="components">
31
    <object classname="java.util.LinkedList">
32
     <item >
33
      <at name="value">
34
       <object classname="com.jeta.forms.store.memento.BeanMemento">
35
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
36
         <at name="cellconstraints">
37
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
38
           <at name="column">2</at>
39
           <at name="row">2</at>
40
           <at name="colspan">1</at>
41
           <at name="rowspan">1</at>
42
           <at name="halign">default</at>
43
           <at name="valign">default</at>
44
           <at name="insets" object="insets">0,0,0,0</at>
45
          </object>
46
         </at>
47
         <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
48
        </super>
49
        <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
50
        <at name="beanclass">com.jeta.forms.components.separator.TitledSeparator</at>
51
        <at name="beanproperties">
52
         <object classname="com.jeta.forms.store.memento.PropertiesMemento">
53
          <at name="classname">com.jeta.forms.components.separator.TitledSeparator</at>
54
          <at name="properties">
55
           <object classname="com.jeta.forms.store.support.PropertyMap">
56
            <at name="border">
57
             <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
58
              <super classname="com.jeta.forms.store.properties.BorderProperty">
59
               <at name="name">border</at>
60
              </super>
61
              <at name="borders">
62
               <object classname="java.util.LinkedList">
63
                <item >
64
                 <at name="value">
65
                  <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
66
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
67
                    <at name="name">border</at>
68
                   </super>
69
                  </object>
70
                 </at>
71
                </item>
72
               </object>
73
              </at>
74
             </object>
75
            </at>
76
            <at name="name">lblExpression</at>
77
            <at name="width">885</at>
78
            <at name="text">_Expression</at>
79
            <at name="height">15</at>
80
           </object>
81
          </at>
82
         </object>
83
        </at>
84
       </object>
85
      </at>
86
     </item>
87
     <item >
88
      <at name="value">
89
       <object classname="com.jeta.forms.store.memento.BeanMemento">
90
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
91
         <at name="cellconstraints">
92
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
93
           <at name="column">2</at>
94
           <at name="row">6</at>
95
           <at name="colspan">1</at>
96
           <at name="rowspan">1</at>
97
           <at name="halign">default</at>
98
           <at name="valign">default</at>
99
           <at name="insets" object="insets">0,0,0,0</at>
100
          </object>
101
         </at>
102
         <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
103
        </super>
104
        <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
105
        <at name="beanclass">com.jeta.forms.components.separator.TitledSeparator</at>
106
        <at name="beanproperties">
107
         <object classname="com.jeta.forms.store.memento.PropertiesMemento">
108
          <at name="classname">com.jeta.forms.components.separator.TitledSeparator</at>
109
          <at name="properties">
110
           <object classname="com.jeta.forms.store.support.PropertyMap">
111
            <at name="border">
112
             <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
113
              <super classname="com.jeta.forms.store.properties.BorderProperty">
114
               <at name="name">border</at>
115
              </super>
116
              <at name="borders">
117
               <object classname="java.util.LinkedList">
118
                <item >
119
                 <at name="value">
120
                  <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
121
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
122
                    <at name="name">border</at>
123
                   </super>
124
                  </object>
125
                 </at>
126
                </item>
127
               </object>
128
              </at>
129
             </object>
130
            </at>
131
            <at name="name">lblSymbolAndDescriptor</at>
132
            <at name="width">885</at>
133
            <at name="text">_Symbol_and_description</at>
134
            <at name="height">15</at>
135
           </object>
136
          </at>
137
         </object>
138
        </at>
139
       </object>
140
      </at>
141
     </item>
142
     <item >
143
      <at name="value">
144
       <object classname="com.jeta.forms.store.memento.BeanMemento">
145
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
146
         <at name="cellconstraints">
147
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
148
           <at name="column">2</at>
149
           <at name="row">4</at>
150
           <at name="colspan">1</at>
151
           <at name="rowspan">1</at>
152
           <at name="halign">default</at>
153
           <at name="valign">default</at>
154
           <at name="insets" object="insets">0,0,0,0</at>
155
          </object>
156
         </at>
157
         <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
158
        </super>
159
        <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
160
        <at name="beanclass">javax.swing.JPanel</at>
161
        <at name="beanproperties">
162
         <object classname="com.jeta.forms.store.memento.PropertiesMemento">
163
          <at name="classname">javax.swing.JPanel</at>
164
          <at name="properties">
165
           <object classname="com.jeta.forms.store.support.PropertyMap">
166
            <at name="name">pnlExpression</at>
167
            <at name="width">885</at>
168
            <at name="height">429</at>
169
           </object>
170
          </at>
171
         </object>
172
        </at>
173
       </object>
174
      </at>
175
     </item>
176
     <item >
177
      <at name="value">
178
       <object classname="com.jeta.forms.store.memento.FormMemento">
179
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
180
         <at name="cellconstraints">
181
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
182
           <at name="column">2</at>
183
           <at name="row">8</at>
184
           <at name="colspan">1</at>
185
           <at name="rowspan">1</at>
186
           <at name="halign">default</at>
187
           <at name="valign">default</at>
188
           <at name="insets" object="insets">0,0,0,0</at>
189
          </object>
190
         </at>
191
         <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
192
        </super>
193
        <at name="id">embedded.797425495</at>
194
        <at name="rowspecs">FILL:35PX:NONE</at>
195
        <at name="colspecs">FILL:35PX:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0)</at>
196
        <at name="components">
197
         <object classname="java.util.LinkedList">
198
          <item >
199
           <at name="value">
200
            <object classname="com.jeta.forms.store.memento.BeanMemento">
201
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
202
              <at name="cellconstraints">
203
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
204
                <at name="column">1</at>
205
                <at name="row">1</at>
206
                <at name="colspan">1</at>
207
                <at name="rowspan">1</at>
208
                <at name="halign">fill</at>
209
                <at name="valign">fill</at>
210
                <at name="insets" object="insets">0,0,0,0</at>
211
               </object>
212
              </at>
213
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
214
             </super>
215
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
216
             <at name="beanclass">javax.swing.JButton</at>
217
             <at name="beanproperties">
218
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
219
               <at name="classname">javax.swing.JButton</at>
220
               <at name="properties">
221
                <object classname="com.jeta.forms.store.support.PropertyMap">
222
                 <at name="border">
223
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
224
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
225
                    <at name="name">border</at>
226
                   </super>
227
                   <at name="borders">
228
                    <object classname="java.util.LinkedList">
229
                     <item >
230
                      <at name="value">
231
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
232
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
233
                         <at name="name">border</at>
234
                        </super>
235
                       </object>
236
                      </at>
237
                     </item>
238
                    </object>
239
                   </at>
240
                  </object>
241
                 </at>
242
                 <at name="name">btnSymbolPreview</at>
243
                 <at name="width">31</at>
244
                 <at name="height">31</at>
245
                </object>
246
               </at>
247
              </object>
248
             </at>
249
            </object>
250
           </at>
251
          </item>
252
          <item >
253
           <at name="value">
254
            <object classname="com.jeta.forms.store.memento.BeanMemento">
255
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
256
              <at name="cellconstraints">
257
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
258
                <at name="column">3</at>
259
                <at name="row">1</at>
260
                <at name="colspan">1</at>
261
                <at name="rowspan">1</at>
262
                <at name="halign">default</at>
263
                <at name="valign">default</at>
264
                <at name="insets" object="insets">0,0,0,0</at>
265
               </object>
266
              </at>
267
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
268
             </super>
269
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
270
             <at name="beanclass">javax.swing.JTextArea</at>
271
             <at name="beanproperties">
272
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
273
               <at name="classname">javax.swing.JTextArea</at>
274
               <at name="properties">
275
                <object classname="com.jeta.forms.store.support.PropertyMap">
276
                 <at name="border">
277
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff