Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / ProjectTable.java @ 3981

History | View | Annotate | Download (23 KB)

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 program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.project;
42

    
43
import java.io.IOException;
44
import java.text.DateFormat;
45
import java.util.Date;
46

    
47
import javax.swing.JOptionPane;
48

    
49
import com.hardcode.driverManager.DriverLoadException;
50
import com.hardcode.gdbms.engine.data.DataSource;
51
import com.hardcode.gdbms.engine.data.DataSourceFactory;
52
import com.hardcode.gdbms.engine.data.NoSuchTableException;
53
import com.hardcode.gdbms.engine.data.driver.ObjectDriver;
54
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException;
55
import com.hardcode.gdbms.engine.instruction.SemanticException;
56
import com.hardcode.gdbms.parser.ParseException;
57
import com.iver.andami.PluginServices;
58
import com.iver.cit.gvsig.fmap.DriverException;
59
import com.iver.cit.gvsig.fmap.edition.EditableAdapter;
60
import com.iver.cit.gvsig.fmap.edition.IEditableSource;
61
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
62
import com.iver.cit.gvsig.fmap.layers.FLayer;
63
import com.iver.cit.gvsig.fmap.layers.FLayers;
64
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
65
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
66
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
67
import com.iver.cit.gvsig.fmap.layers.XMLException;
68
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
69
import com.iver.cit.gvsig.fmap.layers.layerOperations.SingleLayer;
70
import com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend;
71
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend;
72
import com.iver.cit.gvsig.gui.project.OpenException;
73
import com.iver.cit.gvsig.gui.project.SaveException;
74
import com.iver.utiles.XMLEntity;
75

    
76

    
77
/**
78
 * Tabla del proyecto
79
 *
80
 * @author Fernando Gonz?lez Cort?s
81
 */
82
public class ProjectTable extends ProjectElement {
83
    private static int numTables = 0;
84
    private IEditableSource esModel;
85
    private IEditableSource original;
86
    private String linkTable;
87
    private String field1;
88
    private String field2;
89

    
90
    /* No es necesaria para operar, s?lo para guardar el proyecto */
91
    private AlphanumericData associatedTable;
92

    
93
        private int[] mapping;
94
        private String[] alias;
95

    
96
    /**
97
     * Establece a true el bit index-?simo del bitmap de campos visibles. Los
98
     * campos cuyos bits est?n a true se considerar?n visibles y viceversa
99
     *
100
     * @param index indice del bit que se quiere establecer a true
101
     */
102
    public void set(int index) {
103
        //TODO implementar bien
104
        //        modelo.set(index);
105

    
106
        change.firePropertyChange("visibles", true, true);
107
    }
108

    
109
    /**
110
     * Obtiene el valor del bit index-?simo del bitmap de campos visibles
111
     *
112
     * @param index indice del bit que se quiere obtener
113
     *
114
     * @return devuelve true si el campo index-?simo es visible y false en caso
115
     *         contrario
116
     */
117
    public boolean get(int index) {
118
        //TODO implementar bien
119
        //        return modelo.get(index);
120
        return false;
121
    }
122

    
123
    /**
124
     * Obtiene el modelo de la Tabla. Es decir, una clase con capacidad para
125
     * leer la informaci?n de la tabla
126
     *
127
     * @return
128
     */
129
    public IEditableSource getModelo() {
130
        return esModel;
131
    }
132

    
133
    /**
134
     * Establece el valor del bit index-?simo al valor  'value'
135
     *
136
     * @param bitIndex indice del bit que se quiere tocar
137
     * @param value valor que se quiere establecer en el bit indicado
138
     */
139
    public void set(int bitIndex, boolean value) {
140
        //TODO implementar bien
141
        //        modelo.set(bitIndex, value);
142
        change.firePropertyChange("visibles", value, value);
143
    }
144

    
145
    /**
146
     * DOCUMENT ME!
147
     *
148
     * @param name DOCUMENT ME!
149
     * @param sds DOCUMENT ME!
150
     *
151
     * @return
152
     * @throws com.hardcode.gdbms.engine.data.driver.DriverException
153
     */
154
    public static ProjectTable createTable(String name, IEditableSource es) throws com.hardcode.gdbms.engine.data.driver.DriverException {
155
        ProjectTable t = new ProjectTable();
156
        t.esModel = es;
157

    
158
        try {
159
                        t.createAlias();
160
                } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
161
                        // TODO Auto-generated catch block
162
                        e.printStackTrace();
163
                } catch (DriverLoadException e) {
164
                        // TODO Auto-generated catch block
165
                        e.printStackTrace();
166
                }
167

    
168
        t.setName(name);
169
        t.setCreationDate(DateFormat.getInstance().format(new Date()));
170
        numTables++;
171

    
172
        return t;
173
    }
174

    
175
    private void createAlias() throws com.hardcode.gdbms.engine.data.driver.DriverException, DriverLoadException {
176
        mapping = new int[esModel.getRecordset().getFieldCount()];
177
                alias = new String[esModel.getRecordset().getFieldCount()];
178
                for (int i = 0; i < esModel.getRecordset().getFieldCount(); i++) {
179
            mapping[i] = i;
180
            alias[i] = esModel.getRecordset().getFieldName(i);
181
        }
182
    }
183

    
184
    /**
185
     * DOCUMENT ME!
186
     *
187
     * @param sds DOCUMENT ME!
188
     * @throws DriverLoadException
189
     */
190
    public void setDataSource(IEditableSource es) throws DriverLoadException {
191
        esModel = es;
192

    
193
        setName(esModel.getRecordset().getName());
194
        setCreationDate(DateFormat.getInstance().format(new Date()));
195
        change.firePropertyChange("model", esModel, esModel);
196
    }
197

    
198
    /**
199
     * DOCUMENT ME!
200
     *
201
     * @param ds DOCUMENT ME!
202
     * @throws com.hardcode.gdbms.engine.data.driver.DriverException
203
     */
204
    public void replaceDataSource(IEditableSource es) throws com.hardcode.gdbms.engine.data.driver.DriverException {
205
        if (original == null){
206
            original = esModel;
207
        }
208
        esModel = es;
209
        try {
210
                ((SelectableDataSource)es.getRecordset()).setSelectionSupport(((SelectableDataSource)original.getRecordset()).getSelectionSupport());
211

    
212
        createAlias();
213
        } catch (DriverLoadException e1) {
214
                        // TODO Auto-generated catch block
215
                        e1.printStackTrace();
216
                }
217
        // FJP:
218
        // Si la tabla proviene de un layer, cambiamos su recordset
219
        if (associatedTable != null)
220
        {
221
            if (associatedTable instanceof FLyrVect)
222
            {
223
                    try {
224
                                                ((EditableAdapter)((FLyrVect) associatedTable).getSource()).setRecordSet((SelectableDataSource)es.getRecordset());
225
                                        } catch (DriverLoadException e) {
226
                                                // TODO Auto-generated catch block
227
                                                e.printStackTrace();
228
                                        }
229

    
230
                ((FLyrVect) associatedTable).setIsJoined(true);
231
            }
232
        }
233

    
234
        change.firePropertyChange("model", original, esModel);
235
    }
236

    
237
    /**
238
     * DOCUMENT ME!
239
     * @throws com.hardcode.gdbms.engine.data.driver.DriverException
240
     * @throws DriverLoadException
241
     */
242
    public void restoreDataSource() throws com.hardcode.gdbms.engine.data.driver.DriverException, DriverLoadException {
243
        // FJP:
244
        // Si la tabla proviene de un layer, cambiamos su recordset
245
        if (associatedTable != null)
246
        {
247
            if (associatedTable instanceof FLyrVect)
248
            {
249
                // Miramos si la leyenda que est? usando es una
250
                // leyenda basada en un campo de los de la uni?n.
251
                // Si lo es, no dejamos pegarle el cambiazo al recordset
252
                FLyrVect lyr = ((FLyrVect) associatedTable);
253
                if (lyr.getLegend() instanceof ClassifiedLegend)
254
                {
255
                    ClassifiedLegend legend = (ClassifiedLegend) lyr.getLegend();
256
                    VectorialLegend aux = (VectorialLegend) legend;
257
                    String fieldName = legend.getFieldName();
258
                    int idField = original.getRecordset().getFieldIndexByName(fieldName);
259
                    int idLabelField = -2;
260
                    if (aux.getLabelField() != null)
261
                    {
262
                        idLabelField = original.getRecordset().getFieldIndexByName(aux.getLabelField());
263
                    }
264
                    if ((idField == -1) || (idLabelField == -1))
265
                    {
266
                        // No se ha encontrado ese campo, o se est? etiquetando por ese campo
267
                        JOptionPane.showMessageDialog(null,
268
                                PluginServices.getText(this, "leyenda_campo_unido")
269
                                );
270

    
271
                        return;
272
                    }
273
                }
274

    
275

    
276
                    ((EditableAdapter)lyr.getSource()).setRecordSet((SelectableDataSource)original.getRecordset());
277

    
278
                lyr.setIsJoined(false);
279
            }
280
        }
281

    
282

    
283
        esModel = original;
284
        original = null;
285
        createAlias();
286

    
287

    
288
        change.firePropertyChange("model", original, esModel);
289
    }
290

    
291
    /**
292
     * DOCUMENT ME!
293
     *
294
     * @return DOCUMENT ME!
295
     * @throws SaveException
296
     *
297
     * @throws XMLException
298
     */
299
    public XMLEntity getXMLEntity() throws SaveException {
300
        XMLEntity xml = super.getXMLEntity();
301
        try {
302
        //xml.putProperty("nameClass", this.getClass().getName());
303
        xml.putProperty("numTables", numTables);
304

    
305
        if (getLinkTable() != null) {
306
            xml.putProperty("linkTable", linkTable);
307
            xml.putProperty("field1", field1);
308
            xml.putProperty("field2", field2);
309
        }
310

    
311
        if (getOriginal() != null) {
312
            xml.addChild(getOriginal().getRecordset().getXMLEntity());
313
        }
314

    
315
        xml.addChild(esModel.getRecordset().getXMLEntity());
316

    
317
        Object di = LayerFactory.getDataSourceFactory().getDriverInfo(esModel.getRecordset().getName());
318

    
319
        if (associatedTable != null) {
320
            xml.putProperty("layerName", ((FLayer) associatedTable).getName());
321
            xml.putProperty("viewName",
322
                project.getView((FLayer) associatedTable));
323
        }
324

    
325
        xml.putProperty("mapping", mapping);
326
        xml.putProperty("aliases", alias);
327
        }catch (Exception e) {
328
                        throw new SaveException(e,this.getClass().getName());
329
                }
330
        return xml;
331
    }
332

    
333
    /**
334
     * DOCUMENT ME!
335
     *
336
     * @param xml DOCUMENT ME!
337
     * @param p DOCUMENT ME!
338
     *
339
     * @throws XMLException
340
     * @throws DriverException
341
     *
342
     * @see com.iver.cit.gvsig.project.ProjectElement#setXMLEntity(com.iver.utiles.XMLEntity)
343
     */
344
    public void setXMLEntity03(XMLEntity xml, Project p)
345
        throws XMLException, DriverException {
346
        numTables = xml.getIntProperty("numTables");
347

    
348
        if (xml.getStringProperty("type").equals("otherDriverFile")) {
349
            LayerFactory.getDataSourceFactory().addFileDataSource(xml.getStringProperty(
350
                    "driverName"), xml.getStringProperty("gdbmsname"),
351
                xml.getStringProperty("file"));
352

    
353
            setSelectableDataSource03(xml);
354
        } else if (xml.getStringProperty("type").equals("sameDriverFile")) {
355
            String layerName = xml.getStringProperty("layerName");
356

    
357
            ProjectView vista = project.getViewByName(xml.getStringProperty(
358
                        "viewName"));
359
            FLayer layer = vista.getMapContext().getLayers().getLayer(layerName);
360

    
361
            esModel = (VectorialEditableAdapter)((FLyrVect) layer).getSource();
362
            associatedTable = (AlphanumericData) layer;
363

    
364
            LayerFactory.getDataSourceFactory().addDataSource((ObjectDriver) ((SingleLayer) layer).getSource()
365
                                                                              .getDriver(),
366
                xml.getStringProperty("gdbmsname"));
367
        } else if (xml.getStringProperty("type").equals("db")) {
368
            LayerFactory.getDataSourceFactory().addDBDataSourceByTable(xml.getStringProperty(
369
                    "gdbmsname"), xml.getStringProperty("host"),
370
                xml.getIntProperty("port"), xml.getStringProperty("user"),
371
                xml.getStringProperty("password"),
372
                xml.getStringProperty("dbName"),
373
                xml.getStringProperty("tableName"),
374
                xml.getStringProperty("driverInfo"));
375

    
376
            setSelectableDataSource03(xml);
377
        }
378

    
379
        setName(xml.getStringProperty("name"));
380
    }
381

    
382
    /**
383
     * DOCUMENT ME!
384
     *
385
     * @param xml DOCUMENT ME!
386
     * @param p DOCUMENT ME!
387
     *
388
     * @throws XMLException
389
     * @throws DriverException
390
     * @throws OpenException
391
     *
392
     * @see com.iver.cit.gvsig.project.ProjectElement#setXMLEntity(com.iver.utiles.XMLEntity)
393
     */
394
    public void setXMLEntity(XMLEntity xml, Project p)
395
        throws XMLException, DriverException, OpenException {
396
        try{
397
            setName(xml.getStringProperty("name"));
398
        numTables = xml.getIntProperty("numTables");
399

    
400
        setSelectableDataSource(xml);
401

    
402
        /*
403
           if (xml.getStringProperty("type").equals("otherDriverFile")) {
404
           } else if (xml.getStringProperty("type").equals("sameDriverFile")) {
405
                   String layerName = xml.getStringProperty("layerName");
406
                   ProjectView vista = project.getViewByName(xml.getStringProperty(
407
                   "viewName"));
408
                   FLayer layer = vista.getMapContext().getLayers().getLayer(layerName);
409

410
                   modelo = ((AlphanumericData) layer).getRecordset();
411
                   associatedTable = (AlphanumericData) layer;
412
           } else if (xml.getStringProperty("type").equals("db")) {
413
                   setSelectableDataSource(xml);
414
           }
415
         */
416
        setName(xml.getStringProperty("name"));
417

    
418
        if (xml.contains("linkTable")) {
419
            setLinkTable(xml.getStringProperty("linkTable"),
420
                xml.getStringProperty("field1"), xml.getStringProperty("field2"));
421
        }
422

    
423
        if (xml.contains("mapping")){
424
            mapping = (int[]) xml.getIntArrayProperty("mapping");
425
            alias = (String[]) xml.getStringArrayProperty("aliases");
426
        }else{
427
            try {
428
                createAlias();
429
            } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
430
                throw new XMLException(e);
431
            }
432
        }
433
        }catch (Exception e) {
434
                        throw new OpenException(e,this.getClass().getName());
435
                }
436
    }
437

    
438
    /**
439
     * DOCUMENT ME!
440
     *
441
     * @param xml DOCUMENT ME!
442
     *
443
     * @throws XMLException DOCUMENT ME!
444
     * @throws DriverException DOCUMENT ME!
445
     */
446
    private void setSelectableDataSource03(XMLEntity xml)
447
        throws XMLException, DriverException {
448
        String layerName = null;
449

    
450
        if (xml.contains("layerName")) {
451
            layerName = xml.getStringProperty("layerName");
452
        }
453

    
454
        if (layerName == null) {
455
            DataSource dataSource;
456

    
457
            try {
458
                dataSource = LayerFactory.getDataSourceFactory()
459
                                         .createRandomDataSource(xml.getStringProperty(
460
                            "gdbmsname"),
461
                        DataSourceFactory.AUTOMATIC_OPENING);
462

    
463
                SelectableDataSource sds = new SelectableDataSource(dataSource);
464

    
465
                sds.setXMLEntity03(xml.getChild(0));
466
                EditableAdapter auxea=new EditableAdapter();
467
                    auxea.setOriginalDataSource(sds);
468
                setDataSource(auxea);
469
            } catch (NoSuchTableException e) {
470
                throw new XMLException(e);
471
            } catch (DriverLoadException e) {
472
                throw new XMLException(e);
473
            } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
474
                throw new XMLException(e);
475
            }
476

    
477
        } else {
478
            ProjectView vista = project.getViewByName(xml.getStringProperty(
479
                        "viewName"));
480
            FLayer layer = vista.getMapContext().getLayers().getLayer(layerName);
481

    
482
            esModel = (VectorialEditableAdapter)((FLyrVect) layer).getSource();
483
            associatedTable = (AlphanumericData) layer;
484
        }
485
    }
486

    
487
    /**
488
     * DOCUMENT ME!
489
     *
490
     * @param xml DOCUMENT ME!
491
     *
492
     * @throws XMLException DOCUMENT ME!
493
     * @throws DriverException DOCUMENT ME!
494
     */
495
    private void setSelectableDataSource(XMLEntity xml)
496
        throws XMLException, DriverException {
497
        String layerName = null;
498
        boolean bNeedToReplace = false;
499
        XMLEntity xmlAux = null;
500

    
501
        try {
502
            EditableAdapter es;
503

    
504
            if (xml.contains("layerName")) {
505
                layerName = xml.getStringProperty("layerName");
506

    
507
                ProjectView vista = project.getViewByName(xml.getStringProperty(
508
                            "viewName"));
509
                       FLayer layer=getLayer(vista.getMapContext().getLayers(),layerName);
510
                       EditableAdapter ea=new EditableAdapter();
511
                       SelectableDataSource sds=((FLyrVect) layer).getRecordset();
512
                       //sds.setSelectionSupport(((FLyrVect) layer).getSelectionSupport());
513
                       ea.setOriginalDataSource(sds);
514

    
515
                       es = ea;
516
            } else {
517
                es= new EditableAdapter();
518
                es.setOriginalDataSource(SelectableDataSource.createSelectableDataSource(xml.getChild(
519
                            0)));
520
            }
521

    
522
            setDataSource(es);
523

    
524
            if (xml.getNumChild() == 2) {
525
                bNeedToReplace = true;
526
                xmlAux = xml.getChild(1);
527
                // replaceDataSource(SelectableDataSource.createSelectableDataSource(xml.getChild(1)));
528
            }
529
        } catch (NoSuchTableException e) {
530
            throw new XMLException(e);
531
        } catch (ParseException e) {
532
            throw new XMLException(e);
533
        } catch (DriverLoadException e) {
534
            throw new XMLException(e);
535
        } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
536
            throw new XMLException(e);
537
        } catch (SemanticException e) {
538
            throw new XMLException(e);
539
        } catch (IOException e) {
540
            throw new XMLException(e);
541
        }
542

    
543
        if (layerName != null) {
544
            ProjectView vista = project.getViewByName(xml.getStringProperty(
545
                        "viewName"));
546
                FLayer layer=getLayer(vista.getMapContext().getLayers(),layerName);
547

    
548
            //                        modelo = ((AlphanumericData) layer).getRecordset();
549
            associatedTable = (AlphanumericData) layer;
550

    
551
            if (bNeedToReplace)
552
            {
553
                try {
554
                        EditableAdapter auxea=new EditableAdapter();
555
                        auxea.setOriginalDataSource(SelectableDataSource.createSelectableDataSource(xmlAux));
556
                    replaceDataSource(auxea);
557
                } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
558
                    // TODO Auto-generated catch block
559
                    e.printStackTrace();
560
                } catch (NoSuchTableException e) {
561
                    // TODO Auto-generated catch block
562
                    e.printStackTrace();
563
                } catch (ParseException e) {
564
                    // TODO Auto-generated catch block
565
                    e.printStackTrace();
566
                } catch (DriverLoadException e) {
567
                    // TODO Auto-generated catch block
568
                    e.printStackTrace();
569
                } catch (SemanticException e) {
570
                    // TODO Auto-generated catch block
571
                    e.printStackTrace();
572
                } catch (IOException e) {
573
                    // TODO Auto-generated catch block
574
                    e.printStackTrace();
575
                } catch (XMLException e) {
576
                    // TODO Auto-generated catch block
577
                    e.printStackTrace();
578
                }
579
            }
580
        }
581
    }
582
    private FLayer getLayer(FLayers layers,String name){
583
            for (int i=0;i<layers.getLayersCount();i++){
584
                    if (layers.getLayer(i) instanceof FLayers){
585
                            return getLayer((FLayers)layers.getLayer(i),name);
586
                    }else if (layers.getLayer(i).getName().equals(name)){
587
                            return layers.getLayer(i);
588
                    }
589
            }
590
    return null;
591
    }
592
    /**
593
     * DOCUMENT ME!
594
     *
595
     * @return DOCUMENT ME!
596
     */
597
    public AlphanumericData getAssociatedTable() {
598
        return associatedTable;
599
    }
600

    
601
    /**
602
     * DOCUMENT ME!
603
     *
604
     * @param associatedTable DOCUMENT ME!
605
     */
606
    public void setAssociatedTable(AlphanumericData associatedTable) {
607
        this.associatedTable = associatedTable;
608
    }
609

    
610
    /**
611
     * Obtiene la fuente de datos original de la tabla si se ha invocado
612
     * replaceDataSource. Si no se invoc? este m?todo o se invoc?
613
     * posteriormente restoreDataSource se devuelve null
614
     *
615
     * @return Returns the original.
616
     */
617
    public IEditableSource getOriginal() {
618
               return original;
619
        }
620

    
621
    /**
622
     * Devuelve el identificador de la tabla que contiene el link.
623
     *
624
     * @return identificador ?nico de la tabla.
625
     */
626
    public String getLinkTable() {
627
        return linkTable;
628
    }
629

    
630
    /**
631
     * Devuelve el nombre del campo de la tabla a enlazar.
632
     *
633
     * @return Nombre del campo de la tabla a enlazar.
634
     */
635
    public String getField1() {
636
        return field1;
637
    }
638

    
639
    /**
640
     * Devuelve el nombre del campo de la tabla enlazada.
641
     *
642
     * @return Nombre del campo de la tabla enlazada.
643
     */
644
    public String getField2() {
645
        return field2;
646
    }
647

    
648
    /**
649
     * Inserta el identificador de la tabla, el campo de la primera tabla y el
650
     * campo de la segunda tabla.
651
     *
652
     * @param lt identificado de la tabla.
653
     * @param f1 nombre del campo de la primera tabla.
654
     * @param f2 nombre del campo de la segunda tabla.
655
     */
656
    public void setLinkTable(String lt, String f1, String f2) {
657
        linkTable = lt;
658
        field1 = f1;
659
        field2 = f2;
660
    }
661

    
662
    /**
663
     * Borra el identificador de la tabla y elimina del array de listener los
664
     * listener que sean del tipo: LinkSelectionListenr
665
     */
666
    public void removeLinkTable() {
667
        linkTable = null;
668
        try {
669
                ((SelectableDataSource)getModelo().getRecordset()).removeLinksSelectionListener();
670
                } catch (DriverLoadException e) {
671
                        // TODO Auto-generated catch block
672
                        e.printStackTrace();
673
                }
674
    }
675
    public String[] getAliases() {
676
        return alias;
677
    }
678
    public void setAliases(String[] alias) {
679
        this.alias = alias;
680
    }
681
    public int[] getMapping() {
682
        return mapping;
683
    }
684
    public void setMapping(int[] mapping) {
685
        this.mapping = mapping;
686
    }
687
    public void setModel(IEditableSource ies){
688
            esModel=ies;
689
    }
690
}