svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / castor / ProjectTable.java @ 449
History | View | Annotate | Download (3.45 KB)
1 |
package com.iver.cit.gvsig.project.castor; |
---|---|
2 |
|
3 |
import com.hardcode.gdbms.engine.data.DataSource; |
4 |
import com.iver.utiles.XMLEntity; |
5 |
|
6 |
import java.text.DateFormat; |
7 |
|
8 |
import java.util.Date; |
9 |
|
10 |
|
11 |
/**
|
12 |
* Tabla del proyecto
|
13 |
*
|
14 |
* @author Fernando Gonz?lez Cort?s
|
15 |
*/
|
16 |
public class ProjectTable extends ProjectElement { |
17 |
private static int numTables = 0; |
18 |
|
19 |
private DataSource modelo; |
20 |
|
21 |
/**
|
22 |
* Establece a true el bit index-?simo del bitmap de campos visibles. Los
|
23 |
* campos cuyos bits est?n a true se considerar?n visibles y viceversa
|
24 |
*
|
25 |
* @param index indice del bit que se quiere establecer a true
|
26 |
*/
|
27 |
public void set(int index) { |
28 |
//TODO implementar bien
|
29 |
// modelo.set(index);
|
30 |
change.firePropertyChange("visibles", true, true); |
31 |
} |
32 |
|
33 |
/**
|
34 |
* Obtiene el valor del bit index-?simo del bitmap de campos visibles
|
35 |
*
|
36 |
* @param index indice del bit que se quiere obtener
|
37 |
*
|
38 |
* @return devuelve true si el campo index-?simo es visible y false en caso
|
39 |
* contrario
|
40 |
*/
|
41 |
public boolean get(int index) { |
42 |
//TODO implementar bien
|
43 |
// return modelo.get(index);
|
44 |
return false; |
45 |
} |
46 |
|
47 |
/**
|
48 |
* Obtiene el modelo de la Tabla. Es decir, una clase con capacidad para
|
49 |
* leer la informaci?n de la tabla
|
50 |
*
|
51 |
* @return
|
52 |
*/
|
53 |
public DataSource getModelo() { |
54 |
return modelo;
|
55 |
} |
56 |
|
57 |
|
58 |
/**
|
59 |
* Establece el modelo de la tabla. Es decir, una clase con capacidad para
|
60 |
* leer la informaci?n de la tabla
|
61 |
*
|
62 |
* @param model
|
63 |
*/
|
64 |
public void setModelo(DataSource model) { |
65 |
modelo = model; |
66 |
change.firePropertyChange("modelo", modelo, modelo);
|
67 |
} |
68 |
|
69 |
|
70 |
/**
|
71 |
* Establece el valor del bit index-?simo al valor 'value'
|
72 |
*
|
73 |
* @param bitIndex indice del bit que se quiere tocar
|
74 |
* @param value valor que se quiere establecer en el bit indicado
|
75 |
*/
|
76 |
public void set(int bitIndex, boolean value) { |
77 |
//TODO implementar bien
|
78 |
// modelo.set(bitIndex, value);
|
79 |
change.firePropertyChange("visibles", value, value);
|
80 |
} |
81 |
|
82 |
/**
|
83 |
* DOCUMENT ME!
|
84 |
*
|
85 |
* @param baseName
|
86 |
*
|
87 |
* @return
|
88 |
*/
|
89 |
public static ProjectTable createTable(String baseName) { |
90 |
ProjectTable t = new ProjectTable();
|
91 |
t.setName(baseName); |
92 |
t.setCreationDate(DateFormat.getInstance().format(new Date())); |
93 |
numTables++; |
94 |
|
95 |
return t;
|
96 |
} |
97 |
|
98 |
//TODO implementar bien
|
99 |
|
100 |
/*
|
101 |
* @param baseName
|
102 |
* @return
|
103 |
*
|
104 |
public static ProjectTable createTable(String viewName, FTable ftable) {
|
105 |
Table t = new Table();
|
106 |
t.setName(viewName + " - Datos");
|
107 |
t.setCreationDate(DateFormat.getInstance().format(new Date()));
|
108 |
t.setModelo(ftable);
|
109 |
numTables++;
|
110 |
return t;
|
111 |
}*/
|
112 |
|
113 |
/**
|
114 |
* DOCUMENT ME!
|
115 |
*
|
116 |
* @return DOCUMENT ME!
|
117 |
*/
|
118 |
public XMLEntity getXMLEntity() {
|
119 |
XMLEntity xml = super.getXMLEntity();
|
120 |
xml.putProperty("nameClass",this.getClass().getName()); |
121 |
xml.putProperty("numTables", numTables);
|
122 |
//TODO xml.addChild(DataSource);
|
123 |
return xml;
|
124 |
} |
125 |
|
126 |
/**
|
127 |
* @see com.iver.cit.gvsig.project.castor.ProjectElement#setXMLEntity(com.iver.utiles.XMLEntity)
|
128 |
*/
|
129 |
public void setXMLEntity(XMLEntity xml,Project p) { |
130 |
numTables = xml.getIntProperty("numViews");
|
131 |
///setModelo(dataSource);
|
132 |
} |
133 |
} |