Revision 44810

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1437 1437
_Data_type_selection=Selecci\u00f3n de tipo de datos
1438 1438
_Select_the_data_type=Seleccione el tipo de dato
1439 1439
_The_expression_has_undefined_symbols_at_this_moment=La expresion tiene simbolos no definidos en este momento.
1440
_This_may_not_be_a_mistake=Esto puede no ser un error.
1440
_This_may_not_be_a_mistake=Esto puede no ser un error.
1441
_Size=Tama\u00f1o
1442
_Precision=Precision
1443
_Scale=Escala
1444
_More=M\u00e1s
1445
_Apply_changes=Aplicar cambios
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1356 1356
_Data_type_selection=Data type selection
1357 1357
_Select_the_data_type=Select the data type
1358 1358
_The_expression_has_undefined_symbols_at_this_moment=The expression has undefined symbols at this moment.
1359
_This_may_not_be_a_mistake=This may not be a mistake.
1359
_This_may_not_be_a_mistake=This may not be a mistake.
1360
_Size=Size
1361
_Precision=Precision
1362
_Scale=Scale
1363
_More=More
1364
_Apply_changes=Apply changes
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/export/impl/service/DefaultExportAttributes.java
149 149
            this.fixAttributeNames();
150 150
            LOGGER.warn("An extra fix attributes names in the feature type has been made");
151 151
        }
152
        EditableFeatureType targetFeatureType = this.getSourceFeatureType().getCopy().getEditable();
153
        for (FeatureAttributeDescriptor attrSource : this.getSourceFeatureType()) {
154
            FeatureAttributeDescriptor attr = targetFeatureType.getAttributeDescriptor(attrSource.getName());
155
            String name = attr.getName();
156
            ExportAttribute exportAttr = this.getExportAttribute(name);
157
            if (!exportAttr.isExported()) {
158
                targetFeatureType.remove(name);
152
        EditableFeatureType targetFeatureType = DALLocator.getDataManager().createFeatureType();
153
        for (ExportAttribute exportAttribute : this.exportAttributes) {
154
            if (!exportAttribute.isExported()) {
159 155
                continue;
160 156
            }
161
            EditableFeatureAttributeDescriptor eAttr = targetFeatureType.getEditableAttributeDescriptor(name);
162
            if( eAttr.isComputed() && !exportAttr.isComputed() ) {
163
                eAttr.setFeatureAttributeEmulator((FeatureAttributeEmulator)null);
157
            FeatureAttributeDescriptor descriptor = exportAttribute.getDescriptor().getCopy();
158
            EditableFeatureAttributeDescriptor targetDescriptor = DALLocator.getDataManager().createFeatureAttributeDescriptor();
159
            targetDescriptor.copyFrom(descriptor);
160
            
161
            targetDescriptor.setName(exportAttribute.getNewName());
162
            if( targetDescriptor.isComputed() && !exportAttribute.isComputed() ) {
163
                targetDescriptor.setFeatureAttributeEmulator((FeatureAttributeEmulator)null);
164 164
            }
165
            if (this.getTargetName(name) == null && name != null && !this.getTargetName(name).equals(name)) {
166
                eAttr.setName(this.getTargetName(name));
165
            if (targetDescriptor.getType()!=exportAttribute.getNewDataType()) {
166
                targetDescriptor.setDefaultValue(null);
167 167
            }
168
            int type = attr.getDataType().getType();
169
            if (type != this.getTargetType(name)) {
170
                eAttr.setDataType(this.getTargetType(name));
171
                eAttr.setDefaultValue(null); // TODO: delete default value
172
            }
173
            int size = exportAttr.getSize();
174
            eAttr.setSize(size);
168
            targetDescriptor.setDataType(exportAttribute.getNewDataType());
169
            
170
            targetDescriptor.setSize(exportAttribute.getSize());
171
            
172
            targetFeatureType.addLike(targetDescriptor);
175 173
        }
176
        if (this.query!=null && this.query.getExtraColumn().getColumns()!=null && !this.query.getExtraColumn().getColumns().isEmpty()) {
177
            for (EditableFeatureAttributeDescriptor attrExtraOriginal : this.query.getExtraColumn().getColumns()) {
178
                EditableFeatureAttributeDescriptor attrExtra = DALLocator.getDataManager().createFeatureAttributeDescriptor();
179
                attrExtra.copyFrom(attrExtraOriginal);
180
                String name = attrExtra.getName();
181
                ExportAttribute exportAttr = this.getExportAttribute(name);
182
                if (!exportAttr.isExported()) {
183
                    //targetFeatureType.remove(name);
184
                    continue;
185
                }                
186
                if (this.getTargetName(name) == null && name != null && !this.getTargetName(name).equals(name)) {
187
                    attrExtra.setName(this.getTargetName(name));
188
                }
189
                int type = attrExtra.getDataType().getType();
190
                if (type != this.getTargetType(name)) {
191
                    attrExtra.setDataType(this.getTargetType(name));
192
                    attrExtra.setDefaultValue(null); // TODO: delete default value
193
                }
194
                int size = exportAttr.getSize();
195
                attrExtra.setSize(size);
196
                if (!exportAttr.isComputed()) {
197
                    attrExtra.setFeatureAttributeEmulator((FeatureAttributeEmulator)null);
198
                    if (size==0) {
199
                        attrExtra.setSize(50);//TODO default value para valor 0 de size
200
                    }
201
                }
202
                EditableFeatureAttributeDescriptor addedAttributeDescriptor = 
203
                        targetFeatureType.add(attrExtra.getName(), attrExtra.getType());
204
                addedAttributeDescriptor.copyFrom(attrExtra);
205
            }        
206
        }
207 174
        
208 175
        return targetFeatureType.getNotEditableCopy();
209 176
    }
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featurequery/DefaultFeatureQueryCalculatedColumnsPanelView.xml
77 77
            <at name="scrollableTracksViewportHeight">true</at>
78 78
            <at name="scrollableTracksViewportWidth">true</at>
79 79
            <at name="name">lstAttributes</at>
80
            <at name="width">350</at>
80
            <at name="width">612</at>
81 81
            <at name="items">
82 82
             <object classname="com.jeta.forms.store.properties.ItemsProperty">
83 83
              <at name="name">items</at>
......
110 110
              </at>
111 111
             </object>
112 112
            </at>
113
            <at name="height">592</at>
113
            <at name="height">799</at>
114 114
           </object>
115 115
          </at>
116 116
         </object>
......
135 135
         </at>
136 136
         <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
137 137
        </super>
138
        <at name="id">embedded.458069304</at>
138
        <at name="id">embedded.1763633365</at>
139 139
        <at name="rowspecs">CENTER:DEFAULT:NONE</at>
140 140
        <at name="colspecs">FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE</at>
141 141
        <at name="components">
......
511 511
         </at>
512 512
         <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
513 513
        </super>
514
        <at name="id">embedded.546438932</at>
515
        <at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at>
514
        <at name="id">embedded.72367086</at>
515
        <at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at>
516 516
        <at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE</at>
517 517
        <at name="components">
518 518
         <object classname="java.util.LinkedList">
......
702 702
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
703 703
              <at name="cellconstraints">
704 704
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
705
                <at name="column">3</at>
706
                <at name="row">5</at>
707
                <at name="colspan">1</at>
708
                <at name="rowspan">1</at>
709
                <at name="halign">default</at>
710
                <at name="valign">default</at>
711
                <at name="insets" object="insets">0,0,0,0</at>
712
               </object>
713
              </at>
714
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
715
             </super>
716
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
717
             <at name="beanclass">javax.swing.JTextField</at>
718
             <at name="beanproperties">
719
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
720
               <at name="classname">javax.swing.JTextField</at>
721
               <at name="properties">
722
                <object classname="com.jeta.forms.store.support.PropertyMap">
723
                 <at name="border">
724
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
725
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
726
                    <at name="name">border</at>
727
                   </super>
728
                   <at name="borders">
729
                    <object classname="java.util.LinkedList">
730
                     <item >
731
                      <at name="value">
732
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
733
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
734
                         <at name="name">border</at>
735
                        </super>
736
                       </object>
737
                      </at>
738
                     </item>
739
                    </object>
740
                   </at>
741
                  </object>
742
                 </at>
743
                 <at name="name">txtColumnExpression</at>
744
                 <at name="width">354</at>
745
                 <at name="height">20</at>
746
                </object>
747
               </at>
748
              </object>
749
             </at>
750
            </object>
751
           </at>
752
          </item>
753
          <item >
754
           <at name="value">
755
            <object classname="com.jeta.forms.store.memento.BeanMemento">
756
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
757
              <at name="cellconstraints">
758
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
759 705
                <at name="column">5</at>
760 706
                <at name="row">5</at>
761 707
                <at name="colspan">1</at>
......
975 921
                  </object>
976 922
                 </at>
977 923
                 <at name="name">txtColumnName</at>
978
                 <at name="width">439</at>
924
                 <at name="width">832</at>
979 925
                 <at name="height">20</at>
980 926
                </object>
981 927
               </at>
......
1097 1043
                  </object>
1098 1044
                 </at>
1099 1045
                 <at name="name">cboColumnDataType</at>
1100
                 <at name="width">408</at>
1046
                 <at name="width">801</at>
1101 1047
                 <at name="items">
1102 1048
                  <object classname="com.jeta.forms.store.properties.ItemsProperty">
1103 1049
                   <at name="name">items</at>
......
1118 1064
              <at name="cellconstraints">
1119 1065
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
1120 1066
                <at name="column">1</at>
1121
                <at name="row">7</at>
1067
                <at name="row">12</at>
1122 1068
                <at name="colspan">9</at>
1123 1069
                <at name="rowspan">1</at>
1124 1070
                <at name="halign">default</at>
......
1128 1074
              </at>
1129 1075
              <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
1130 1076
             </super>
1131
             <at name="id">embedded.1312999856</at>
1077
             <at name="id">embedded.790744944</at>
1132 1078
             <at name="rowspecs">CENTER:DEFAULT:NONE</at>
1133 1079
             <at name="colspecs">FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE</at>
1134 1080
             <at name="components">
......
1288 1234
                   </at>
1289 1235
                  </object>
1290 1236
                 </at>
1291
                 <at name="name"/>
1237
                 <at name="name"></at>
1292 1238
                 <at name="fill">
1293 1239
                  <object classname="com.jeta.forms.store.properties.effects.PaintProperty">
1294 1240
                   <at name="name">fill</at>
......
1353 1299
            </object>
1354 1300
           </at>
1355 1301
          </item>
1302
          <item >
1303
           <at name="value">
1304
            <object classname="com.jeta.forms.store.memento.BeanMemento">
1305
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
1306
              <at name="cellconstraints">
1307
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
1308
                <at name="column">1</at>
1309
                <at name="row">7</at>
1310
                <at name="colspan">1</at>
1311
                <at name="rowspan">1</at>
1312
                <at name="halign">default</at>
1313
                <at name="valign">default</at>
1314
                <at name="insets" object="insets">0,0,0,0</at>
1315
               </object>
1316
              </at>
1317
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
1318
             </super>
1319
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
1320
             <at name="beanclass">com.jeta.forms.components.label.JETALabel</at>
1321
             <at name="beanproperties">
1322
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
1323
               <at name="classname">com.jeta.forms.components.label.JETALabel</at>
1324
               <at name="properties">
1325
                <object classname="com.jeta.forms.store.support.PropertyMap">
1326
                 <at name="border">
1327
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
1328
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
1329
                    <at name="name">border</at>
1330
                   </super>
1331
                   <at name="borders">
1332
                    <object classname="java.util.LinkedList">
1333
                     <item >
1334
                      <at name="value">
1335
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
1336
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
1337
                         <at name="name">border</at>
1338
                        </super>
1339
                       </object>
1340
                      </at>
1341
                     </item>
1342
                    </object>
1343
                   </at>
1344
                  </object>
1345
                 </at>
1346
                 <at name="name">lblSize</at>
1347
                 <at name="width">69</at>
1348
                 <at name="text">_Size</at>
1349
                 <at name="fill">
1350
                  <object classname="com.jeta.forms.store.properties.effects.PaintProperty">
1351
                   <at name="name">fill</at>
1352
                  </object>
1353
                 </at>
1354
                 <at name="height">14</at>
1355
                </object>
1356
               </at>
1357
              </object>
1358
             </at>
1359
            </object>
1360
           </at>
1361
          </item>
1362
          <item >
1363
           <at name="value">
1364
            <object classname="com.jeta.forms.store.memento.BeanMemento">
1365
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
1366
              <at name="cellconstraints">
1367
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
1368
                <at name="column">1</at>
1369
                <at name="row">9</at>
1370
                <at name="colspan">1</at>
1371
                <at name="rowspan">1</at>
1372
                <at name="halign">default</at>
1373
                <at name="valign">default</at>
1374
                <at name="insets" object="insets">0,0,0,0</at>
1375
               </object>
1376
              </at>
1377
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
1378
             </super>
1379
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
1380
             <at name="beanclass">com.jeta.forms.components.label.JETALabel</at>
1381
             <at name="beanproperties">
1382
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
1383
               <at name="classname">com.jeta.forms.components.label.JETALabel</at>
1384
               <at name="properties">
1385
                <object classname="com.jeta.forms.store.support.PropertyMap">
1386
                 <at name="border">
1387
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
1388
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
1389
                    <at name="name">border</at>
1390
                   </super>
1391
                   <at name="borders">
1392
                    <object classname="java.util.LinkedList">
1393
                     <item >
1394
                      <at name="value">
1395
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
1396
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
1397
                         <at name="name">border</at>
1398
                        </super>
1399
                       </object>
1400
                      </at>
1401
                     </item>
1402
                    </object>
1403
                   </at>
1404
                  </object>
1405
                 </at>
1406
                 <at name="name">lblPrecision</at>
1407
                 <at name="width">69</at>
1408
                 <at name="text">_Precision</at>
1409
                 <at name="fill">
1410
                  <object classname="com.jeta.forms.store.properties.effects.PaintProperty">
1411
                   <at name="name">fill</at>
1412
                  </object>
1413
                 </at>
1414
                 <at name="height">14</at>
1415
                </object>
1416
               </at>
1417
              </object>
1418
             </at>
1419
            </object>
1420
           </at>
1421
          </item>
1422
          <item >
1423
           <at name="value">
1424
            <object classname="com.jeta.forms.store.memento.BeanMemento">
1425
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
1426
              <at name="cellconstraints">
1427
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
1428
                <at name="column">1</at>
1429
                <at name="row">11</at>
1430
                <at name="colspan">1</at>
1431
                <at name="rowspan">1</at>
1432
                <at name="halign">default</at>
1433
                <at name="valign">default</at>
1434
                <at name="insets" object="insets">0,0,0,0</at>
1435
               </object>
1436
              </at>
1437
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
1438
             </super>
1439
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
1440
             <at name="beanclass">com.jeta.forms.components.label.JETALabel</at>
1441
             <at name="beanproperties">
1442
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
1443
               <at name="classname">com.jeta.forms.components.label.JETALabel</at>
1444
               <at name="properties">
1445
                <object classname="com.jeta.forms.store.support.PropertyMap">
1446
                 <at name="border">
1447
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
1448
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
1449
                    <at name="name">border</at>
1450
                   </super>
1451
                   <at name="borders">
1452
                    <object classname="java.util.LinkedList">
1453
                     <item >
1454
                      <at name="value">
1455
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
1456
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
1457
                         <at name="name">border</at>
1458
                        </super>
1459
                       </object>
1460
                      </at>
1461
                     </item>
1462
                    </object>
1463
                   </at>
1464
                  </object>
1465
                 </at>
1466
                 <at name="name">lblScale</at>
1467
                 <at name="width">69</at>
1468
                 <at name="text">_Scale</at>
1469
                 <at name="fill">
1470
                  <object classname="com.jeta.forms.store.properties.effects.PaintProperty">
1471
                   <at name="name">fill</at>
1472
                  </object>
1473
                 </at>
1474
                 <at name="height">14</at>
1475
                </object>
1476
               </at>
1477
              </object>
1478
             </at>
1479
            </object>
1480
           </at>
1481
          </item>
1482
          <item >
1483
           <at name="value">
1484
            <object classname="com.jeta.forms.store.memento.BeanMemento">
1485
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
1486
              <at name="cellconstraints">
1487
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
1488
                <at name="column">3</at>
1489
                <at name="row">5</at>
1490
                <at name="colspan">1</at>
1491
                <at name="rowspan">1</at>
1492
                <at name="halign">default</at>
1493
                <at name="valign">default</at>
1494
                <at name="insets" object="insets">0,0,0,0</at>
1495
               </object>
1496
              </at>
1497
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
1498
             </super>
1499
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
1500
             <at name="beanclass">javax.swing.JTextField</at>
1501
             <at name="beanproperties">
1502
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
1503
               <at name="classname">javax.swing.JTextField</at>
1504
               <at name="properties">
1505
                <object classname="com.jeta.forms.store.support.PropertyMap">
1506
                 <at name="border">
1507
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
1508
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
1509
                    <at name="name">border</at>
1510
                   </super>
1511
                   <at name="borders">
1512
                    <object classname="java.util.LinkedList">
1513
                     <item >
1514
                      <at name="value">
1515
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
1516
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
1517
                         <at name="name">border</at>
1518
                        </super>
1519
                       </object>
1520
                      </at>
1521
                     </item>
1522
                    </object>
1523
                   </at>
1524
                  </object>
1525
                 </at>
1526
                 <at name="name">txtColumnExpression</at>
1527
                 <at name="width">747</at>
1528
                 <at name="height">20</at>
1529
                </object>
1530
               </at>
1531
              </object>
1532
             </at>
1533
            </object>
1534
           </at>
1535
          </item>
1536
          <item >
1537
           <at name="value">
1538
            <object classname="com.jeta.forms.store.memento.BeanMemento">
1539
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
1540
              <at name="cellconstraints">
1541
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
1542
                <at name="column">3</at>
1543
                <at name="row">7</at>
1544
                <at name="colspan">7</at>
1545
                <at name="rowspan">1</at>
1546
                <at name="halign">default</at>
1547
                <at name="valign">default</at>
1548
                <at name="insets" object="insets">0,0,0,0</at>
1549
               </object>
1550
              </at>
1551
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
1552
             </super>
1553
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
1554
             <at name="beanclass">javax.swing.JTextField</at>
1555
             <at name="beanproperties">
1556
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
1557
               <at name="classname">javax.swing.JTextField</at>
1558
               <at name="properties">
1559
                <object classname="com.jeta.forms.store.support.PropertyMap">
1560
                 <at name="border">
1561
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
1562
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
1563
                    <at name="name">border</at>
1564
                   </super>
1565
                   <at name="borders">
1566
                    <object classname="java.util.LinkedList">
1567
                     <item >
1568
                      <at name="value">
1569
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
1570
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
1571
                         <at name="name">border</at>
1572
                        </super>
1573
                       </object>
1574
                      </at>
1575
                     </item>
1576
                    </object>
1577
                   </at>
1578
                  </object>
1579
                 </at>
1580
                 <at name="name">txtColumnSize</at>
1581
                 <at name="width">832</at>
1582
                 <at name="height">20</at>
1583
                </object>
1584
               </at>
1585
              </object>
1586
             </at>
1587
            </object>
1588
           </at>
1589
          </item>
1590
          <item >
1591
           <at name="value">
1592
            <object classname="com.jeta.forms.store.memento.BeanMemento">
1593
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
1594
              <at name="cellconstraints">
1595
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
1596
                <at name="column">3</at>
1597
                <at name="row">9</at>
1598
                <at name="colspan">7</at>
1599
                <at name="rowspan">1</at>
1600
                <at name="halign">default</at>
1601
                <at name="valign">default</at>
1602
                <at name="insets" object="insets">0,0,0,0</at>
1603
               </object>
1604
              </at>
1605
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
1606
             </super>
1607
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
1608
             <at name="beanclass">javax.swing.JTextField</at>
1609
             <at name="beanproperties">
1610
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
1611
               <at name="classname">javax.swing.JTextField</at>
1612
               <at name="properties">
1613
                <object classname="com.jeta.forms.store.support.PropertyMap">
1614
                 <at name="border">
1615
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
1616
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
1617
                    <at name="name">border</at>
1618
                   </super>
1619
                   <at name="borders">
1620
                    <object classname="java.util.LinkedList">
1621
                     <item >
1622
                      <at name="value">
1623
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
1624
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
1625
                         <at name="name">border</at>
1626
                        </super>
1627
                       </object>
1628
                      </at>
1629
                     </item>
1630
                    </object>
1631
                   </at>
1632
                  </object>
1633
                 </at>
1634
                 <at name="name">txtColumnPrecision</at>
1635
                 <at name="width">832</at>
1636
                 <at name="height">20</at>
1637
                </object>
1638
               </at>
1639
              </object>
1640
             </at>
1641
            </object>
1642
           </at>
1643
          </item>
1644
          <item >
1645
           <at name="value">
1646
            <object classname="com.jeta.forms.store.memento.BeanMemento">
1647
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
1648
              <at name="cellconstraints">
1649
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
1650
                <at name="column">3</at>
1651
                <at name="row">11</at>
1652
                <at name="colspan">7</at>
1653
                <at name="rowspan">1</at>
1654
                <at name="halign">default</at>
1655
                <at name="valign">default</at>
1656
                <at name="insets" object="insets">0,0,0,0</at>
1657
               </object>
1658
              </at>
1659
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
1660
             </super>
1661
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
1662
             <at name="beanclass">javax.swing.JTextField</at>
1663
             <at name="beanproperties">
1664
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
1665
               <at name="classname">javax.swing.JTextField</at>
1666
               <at name="properties">
1667
                <object classname="com.jeta.forms.store.support.PropertyMap">
1668
                 <at name="border">
1669
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
1670
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
1671
                    <at name="name">border</at>
1672
                   </super>
1673
                   <at name="borders">
1674
                    <object classname="java.util.LinkedList">
1675
                     <item >
1676
                      <at name="value">
1677
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
1678
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
1679
                         <at name="name">border</at>
1680
                        </super>
1681
                       </object>
1682
                      </at>
1683
                     </item>
1684
                    </object>
1685
                   </at>
1686
                  </object>
1687
                 </at>
1688
                 <at name="name">txtColumnScale</at>
1689
                 <at name="width">832</at>
1690
                 <at name="height">20</at>
1691
                </object>
1692
               </at>
1693
              </object>
1694
             </at>
1695
            </object>
1696
           </at>
1697
          </item>
1356 1698
         </object>
1357 1699
        </at>
1358 1700
        <at name="properties">
......
1410 1752
        <at name="cellpainters">
1411 1753
         <object classname="com.jeta.forms.store.support.Matrix">
1412 1754
          <at name="rows">
1413
           <object classname="[Ljava.lang.Object;" size="7">
1755
           <object classname="[Ljava.lang.Object;" size="12">
1414 1756
            <at name="item" index="0">
1415 1757
             <object classname="[Ljava.lang.Object;" size="9"/>
1416 1758
            </at>
......
1432 1774
            <at name="item" index="6">
1433 1775
             <object classname="[Ljava.lang.Object;" size="9"/>
1434 1776
            </at>
1777
            <at name="item" index="7">
1778
             <object classname="[Ljava.lang.Object;" size="9"/>
1779
            </at>
1780
            <at name="item" index="8">
1781
             <object classname="[Ljava.lang.Object;" size="9"/>
1782
            </at>
1783
            <at name="item" index="9">
1784
             <object classname="[Ljava.lang.Object;" size="9"/>
1785
            </at>
1786
            <at name="item" index="10">
1787
             <object classname="[Ljava.lang.Object;" size="9"/>
1788
            </at>
1789
            <at name="item" index="11">
1790
             <object classname="[Ljava.lang.Object;" size="9"/>
1791
            </at>
1435 1792
           </object>
1436 1793
          </at>
1437 1794
         </object>
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featurequery/DefaultFeatureQueryCalculatedColumnsPanelView.java
1 1
package org.gvsig.fmap.dal.swing.impl.featurequery;
2

  
3 2
import com.jeta.open.i18n.I18NUtils;
4 3
import com.jgoodies.forms.layout.CellConstraints;
5 4
import com.jgoodies.forms.layout.FormLayout;
......
32 31
   JLabel lblName = new JLabel();
33 32
   JLabel lblType = new JLabel();
34 33
   JLabel lblExpression = new JLabel();
35
   JTextField txtColumnExpression = new JTextField();
36 34
   JButton btnColumnExpression = new JButton();
37 35
   JButton btnColumnExpressionHistory = new JButton();
38 36
   JButton btnColumnExpressionBookmarks = new JButton();
......
41 39
   JComboBox cboColumnDataType = new JComboBox();
42 40
   JButton btnApplyChanges = new JButton();
43 41
   JButton btnColumnMore = new JButton();
42
   JLabel lblSize = new JLabel();
43
   JLabel lblPrecision = new JLabel();
44
   JLabel lblScale = new JLabel();
45
   JTextField txtColumnExpression = new JTextField();
46
   JTextField txtColumnSize = new JTextField();
47
   JTextField txtColumnPrecision = new JTextField();
48
   JTextField txtColumnScale = new JTextField();
44 49

  
45 50
   /**
46 51
    * Default constructor
......
211 216
   public JPanel createPanel2()
212 217
   {
213 218
      JPanel jpanel1 = new JPanel();
214
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE");
219
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE");
215 220
      CellConstraints cc = new CellConstraints();
216 221
      jpanel1.setLayout(formlayout1);
217 222

  
......
227 232
      lblExpression.setText("_Expression");
228 233
      jpanel1.add(lblExpression,cc.xy(1,5));
229 234

  
230
      txtColumnExpression.setName("txtColumnExpression");
231
      jpanel1.add(txtColumnExpression,cc.xy(3,5));
232

  
233 235
      btnColumnExpression.setActionCommand("...");
234 236
      btnColumnExpression.setName("btnColumnExpression");
235 237
      btnColumnExpression.setText("...");
......
264 266
      cboColumnDataType.setName("cboColumnDataType");
265 267
      jpanel1.add(cboColumnDataType,cc.xywh(3,3,5,1));
266 268

  
267
      jpanel1.add(createPanel3(),cc.xywh(1,7,9,1));
268
      addFillComponents(jpanel1,new int[]{ 2,4,5,6,7,8,9 },new int[]{ 2,4,6,7 });
269
      jpanel1.add(createPanel3(),cc.xywh(1,12,9,1));
270
      lblSize.setName("lblSize");
271
      lblSize.setText("_Size");
272
      jpanel1.add(lblSize,cc.xy(1,7));
273

  
274
      lblPrecision.setName("lblPrecision");
275
      lblPrecision.setText("_Precision");
276
      jpanel1.add(lblPrecision,cc.xy(1,9));
277

  
278
      lblScale.setName("lblScale");
279
      lblScale.setText("_Scale");
280
      jpanel1.add(lblScale,cc.xy(1,11));
281

  
282
      txtColumnExpression.setName("txtColumnExpression");
283
      jpanel1.add(txtColumnExpression,cc.xy(3,5));
284

  
285
      txtColumnSize.setName("txtColumnSize");
286
      jpanel1.add(txtColumnSize,cc.xywh(3,7,7,1));
287

  
288
      txtColumnPrecision.setName("txtColumnPrecision");
289
      jpanel1.add(txtColumnPrecision,cc.xywh(3,9,7,1));
290

  
291
      txtColumnScale.setName("txtColumnScale");
292
      jpanel1.add(txtColumnScale,cc.xywh(3,11,7,1));
293

  
294
      addFillComponents(jpanel1,new int[]{ 2,4,5,6,7,8,9 },new int[]{ 2,4,6,8,10,12 });
269 295
      return jpanel1;
270 296
   }
271 297

  
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featurequery/DefaultFeatureQueryCalculatedColumnsPanel.java
5 5
import java.awt.event.ActionListener;
6 6
import java.net.URL;
7 7
import java.util.List;
8
import java.util.logging.Level;
9
import javax.swing.DefaultComboBoxModel;
8 10
import javax.swing.DefaultListModel;
9 11
import javax.swing.DefaultListSelectionModel;
10 12
import javax.swing.ImageIcon;
......
40 42
import org.gvsig.fmap.dal.swing.featurequery.FeatureQueryCalculatedColumnsPanel;
41 43
import org.gvsig.fmap.dal.swing.featuretype.FeatureTypeAttributePanel;
42 44
import org.gvsig.fmap.dal.swing.featuretype.FeatureTypePanel;
45
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchPanel;
43 46
import org.gvsig.tools.ToolsLocator;
47
import org.gvsig.tools.dataTypes.Coercion;
48
import org.gvsig.tools.dataTypes.CoercionException;
49
import org.gvsig.tools.dataTypes.DataType;
44 50
import org.gvsig.tools.dataTypes.DataTypes;
45 51
import org.gvsig.tools.i18n.I18nManager;
46 52
import org.gvsig.tools.swing.api.ListElement;
......
74 80
        private ExpressionPickerController expPicker;
75 81
        private DataTypePickerController pickerDataType;
76 82
        private boolean hasChanges;
83
        private final JTextComponent txtSize;
84
        private final JTextComponent txtPrecision;
85
        private final JTextComponent txtScale;
86
        
87
        private final Logger LOGGER = LoggerFactory.getLogger(ColumnController.class);
77 88

  
78 89
        public ColumnController(
79 90
                JTextComponent txtName,
......
82 93
                JTextComponent txtExpression,
83 94
                JButton btnExpression,
84 95
                JButton btnExpressionHistory,
85
                JButton btnExpressionBookmarks
96
                JButton btnExpressionBookmarks,
97
                JTextComponent txtSize,
98
                JTextComponent txtPrecision,
99
                JTextComponent txtScale
86 100
        ) {
87 101
            this.txtName = txtName;
88 102
            this.cboDataType = cboDataType;
......
91 105
            this.btnExpression = btnExpression;
92 106
            this.btnExpressionHistory = btnExpressionHistory;
93 107
            this.btnExpressionBookmarks = btnExpressionBookmarks;
108
            this.txtSize = txtSize;
109
            this.txtPrecision = txtPrecision;
110
            this.txtScale = txtScale;
94 111
            this.hasChanges = false;
95 112
            this.initComponents();
96 113
            this.setEnabled(false);
......
111 128
            this.txtName.getDocument().addDocumentListener(this);
112 129
            this.cboDataType.addActionListener(this);
113 130
            this.txtExpression.getDocument().addDocumentListener(this);
131
            this.txtSize.getDocument().addDocumentListener(this);
132
            this.txtPrecision.getDocument().addDocumentListener(this);
133
            this.txtScale.getDocument().addDocumentListener(this);
114 134
            //Todo: que el listener expresion lo gestion el picker
135
            
136
            this.cboDataType.addActionListener(new ActionListener() {
137
                @Override
138
                public void actionPerformed(ActionEvent ae) {
139
                    doSetDefaultValuesForDataType();
140
                    doEnabledByDataType();
141
                }
142
            });
115 143

  
116 144
        }
145
        
146
        public void doEnabledByDataType() {
147
            JComboBox comboBox = cboDataType;
148
            DataType dataType = (DataType) comboBox.getSelectedItem();
149
            txtSize.setEnabled(dataType.supportSize());
150
            txtPrecision.setEnabled(dataType.supportPrecision());
151
            txtScale.setEnabled(dataType.supportScale());
152
        }
153
        
154
        public void doSetDefaultValuesForDataType() {
155
            DataType dataType = (DataType) this.cboDataType.getSelectedItem();
156
            if (dataType.supportSize() && txtSize.getText().isEmpty()) {
157
                txtSize.setText(String.valueOf(dataType.getDefaultSize()));
158
            } else if (!dataType.supportSize()) {
159
                txtSize.setText("");
160
            }
117 161

  
162
            if (dataType.supportPrecision() && txtPrecision.getText().isEmpty()) {
163
                txtPrecision.setText(String.valueOf(dataType.getDefaultPrecision()));
164
            } else if (!dataType.supportPrecision()) {
165
                txtPrecision.setText("");
166
            }
167

  
168
            if (dataType.supportScale() && txtScale.getText().isEmpty()) {
169
                txtScale.setText(String.valueOf(dataType.getDefaultScale()));
170
            } else if (!dataType.supportScale()) {
171
                txtScale.setText("");
172
            }
173
        }
174

  
118 175
        public boolean hasChanges() {
119 176
            return this.hasChanges;
120 177
        }
......
123 180
            this.txtName.setEnabled(enabled);
124 181
            this.expPicker.setEnabled(enabled);
125 182
            this.cboDataType.setEnabled(enabled);
126

  
183
            this.txtSize.setEnabled(enabled);
184
            this.txtPrecision.setEnabled(enabled);
185
            this.txtScale.setEnabled(enabled);
127 186
        }
128 187

  
129 188
        public void clean() {
130 189
            this.txtName.setText("");
131 190
            this.expPicker.set(null);
132 191
            this.cboDataType.setSelectedIndex(0);
192
            this.txtSize.setText("");
193
            this.txtPrecision.setText("");
194
            this.txtScale.setText("");
133 195

  
134 196
        }
135 197

  
......
141 203
                this.expPicker.set(emu.getExpression());
142 204
            }
143 205
            ListElement.setSelected(cboDataType, attr.getDataType());
206
            Coercion coerceString = ToolsLocator.getDataTypesManager().get(DataTypes.STRING).getCoercion();
207
            txtSize.setEnabled(attr.getDataType().supportSize());
208
            if (attr.getDataType().supportSize()) {
209
                try {
210
                    this.txtSize.setText((String) coerceString.coerce(attr.getSize()));
211
                } catch (CoercionException ex) {
212
                    LOGGER.warn("Not able to coerce text to integer from size box.", ex);
213
                }
214
            }
215
            txtPrecision.setEnabled(attr.getDataType().supportPrecision());
216
            if (attr.getDataType().supportPrecision()) {
217
                try {
218
                    this.txtPrecision.setText((String) coerceString.coerce(attr.getPrecision()));
219
                } catch (CoercionException ex) {
220
                    LOGGER.warn("Not able to coerce text to integer from precision box.", ex);
221
                }
222
            }
223
            txtScale.setEnabled(attr.getDataType().supportScale());
224
            if (attr.getDataType().supportScale()) {
225
                try {
226
                    this.txtScale.setText((String) coerceString.coerce(attr.getScale()));
227
                } catch (CoercionException ex) {
228
                    LOGGER.warn("Not able to coerce text to integer from scale box.", ex);
229
                }
230
            }
231
//            doEnabledByDataType();
144 232
            this.hasChanges = false;
145 233
        }
146 234

  
......
148 236
            attr.setName(this.txtName.getText());
149 237
            attr.setFeatureAttributeEmulator(this.expPicker.get());
150 238
            attr.setDataType(this.pickerDataType.get());
239
            Coercion coerceInteger = ToolsLocator.getDataTypesManager().get(DataTypes.INTEGER).getCoercion();
240
            try {
241
                if (attr.getDataType().supportSize()) {
242
                    attr.setSize((int) coerceInteger.coerce(this.txtSize.getText()));
243
                }
244
            } catch (CoercionException ex) {
245
                LOGGER.warn("Not able to coerce text to integer from size box.", ex);
246
            }
247
            try {
248
                if (attr.getDataType().supportPrecision()) {
249
                    attr.setPrecision((int) coerceInteger.coerce(this.txtPrecision.getText()));
250
                }
251
            } catch (CoercionException ex) {
252
                LOGGER.warn("Not able to coerce text to integer from precision box.", ex);
253
            }
254
            try {
255
                if (attr.getDataType().supportScale()) {
256
                    attr.setScale((int) coerceInteger.coerce(this.txtScale.getText()));
257
                }
258
            } catch (CoercionException ex) {
259
                LOGGER.warn("Not able to coerce text to integer from scale box.", ex);
260
            }
151 261
            this.hasChanges = false;
152 262
            return attr;
153 263
        }
......
246 356
        toolsSwingManager.translate(this.lblExpression);
247 357
        toolsSwingManager.translate(this.lblName);
248 358
        toolsSwingManager.translate(this.lblType);
359
        toolsSwingManager.translate(this.lblSize);
360
        toolsSwingManager.translate(this.lblPrecision);
361
        toolsSwingManager.translate(this.lblScale);
362
        toolsSwingManager.translate(this.btnApplyChanges);
363
        toolsSwingManager.translate(this.btnColumnMore);
249 364

  
250 365
        this.columnController = new ColumnController(
251 366
                this.txtColumnName,
......
254 369
                this.txtColumnExpression,
255 370
                this.btnColumnExpression,
256 371
                this.btnColumnExpressionHistory,
257
                this.btnColumnExpressionBookmarks
372
                this.btnColumnExpressionBookmarks,
373
                this.txtColumnSize,
374
                this.txtColumnPrecision,
375
                this.txtColumnScale
258 376
        );
259 377
//        this.lstAttributes.setCellRenderer(new FeatureAttributeListCellRenderer());
260 378

  
......
405 523
        } else {
406 524
            //EditableFeatureAttributeDescriptor value = node.getValue();
407 525
            this.actualEditableAttribute = value;
526
            columnController.setEnabled(true);
408 527
            columnController.put(value);
409
            columnController.setEnabled(true);
410 528
        }
411 529
    }
412 530

  
......
472 590
        EditableFeatureAttributeDescriptor newAttr = DALLocator.getDataManager().createFeatureAttributeDescriptor();
473 591
        newAttr.setName(COLUMN_DEFAULT_NAME);
474 592
        newAttr.setDataType(DataTypes.STRING);
593
        if (newAttr.getDataType().supportSize()) {
594
            newAttr.setSize(newAttr.getDataType().getDefaultSize());
595
        }
475 596
        int id = 0;
476 597
        while (checkIfValueExistInModel(newAttr.getName(), this.lstAttributesModel)) {
477 598
            String newName = COLUMN_DEFAULT_NAME + "_" + id;

Also available in: Unified diff