Revision 1836
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/ProjectTable.java | ||
---|---|---|
46 | 46 |
|
47 | 47 |
import com.hardcode.driverManager.DriverLoadException; |
48 | 48 |
import com.hardcode.gdbms.engine.data.DataSource; |
49 |
import com.hardcode.gdbms.engine.data.DataSourceLayerMemento; |
|
50 |
import com.hardcode.gdbms.engine.data.Memento; |
|
51 |
import com.hardcode.gdbms.engine.data.MementoException; |
|
52 | 49 |
import com.hardcode.gdbms.engine.data.NoSuchTableException; |
53 |
import com.hardcode.gdbms.engine.data.OperationLayerMemento; |
|
54 | 50 |
import com.hardcode.gdbms.engine.data.db.DBDriverInfo; |
55 | 51 |
import com.hardcode.gdbms.engine.data.db.DBTableDriverInfo; |
56 | 52 |
import com.hardcode.gdbms.engine.data.file.FileDriverInfo; |
57 | 53 |
import com.hardcode.gdbms.engine.data.object.ObjectDriverInfo; |
54 |
import com.hardcode.gdbms.engine.data.persistence.DataSourceLayerMemento; |
|
55 |
import com.hardcode.gdbms.engine.data.persistence.Memento; |
|
56 |
import com.hardcode.gdbms.engine.data.persistence.MementoException; |
|
57 |
import com.hardcode.gdbms.engine.data.persistence.OperationLayerMemento; |
|
58 | 58 |
import com.hardcode.gdbms.engine.instruction.SemanticException; |
59 | 59 |
import com.hardcode.gdbms.parser.ParseException; |
60 | 60 |
import com.iver.cit.gvsig.fmap.DriverException; |
... | ... | |
241 | 241 |
try { |
242 | 242 |
sds = SelectableDataSource.createSelectableDataSource(xml.getChild(0)); |
243 | 243 |
setDataSource(sds); |
244 |
/* |
|
244 |
|
|
245 | 245 |
if (xml.getNumChild() == 2){ |
246 | 246 |
replaceDataSource(SelectableDataSource.createSelectableDataSource(xml.getChild(1))); |
247 | 247 |
} |
248 |
*/ } catch (NoSuchTableException e) {
|
|
248 |
} catch (NoSuchTableException e) { |
|
249 | 249 |
throw new XMLException(e); |
250 | 250 |
} catch (ParseException e) { |
251 | 251 |
throw new XMLException(e); |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableOperations.java | ||
---|---|---|
161 | 161 |
String field1 = (String) firstTableField.getSelected(); |
162 | 162 |
String field2 = (String) secondTableField.getSelected(); |
163 | 163 |
|
164 |
String sql = "custom arcjoin tables '" + tableName1 + |
|
164 |
String sql = "custom com_iver_cit_gvsig_arcjoin tables '" + tableName1 +
|
|
165 | 165 |
"', '" + tableName2 + "' values(" + field1 + ", " + |
166 | 166 |
field2 + ");"; |
167 | 167 |
System.out.println(sql); |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/Abrir.java | ||
---|---|---|
62 | 62 |
import com.iver.cit.gvsig.fmap.drivers.RasterDriver; |
63 | 63 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver; |
64 | 64 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
65 |
import com.iver.cit.gvsig.fmap.drivers.jdbc.mysql.MySQLdriver; |
|
66 |
import com.iver.cit.gvsig.fmap.drivers.jdbc.postgis.PostGisDriver; |
|
67 | 65 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
68 | 66 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
69 | 67 |
import com.iver.cit.gvsig.gui.FOpenDialog; |
... | ... | |
248 | 246 |
String dbUrl = dbWiz.getUrlConnect(); |
249 | 247 |
String fields = dbWiz.getSqlFields(); |
250 | 248 |
String whereClause = dbWiz.getSqlWhere(); |
251 |
|
|
249 |
|
|
250 |
/* |
|
252 | 251 |
try { |
253 | 252 |
|
254 | 253 |
// TODO: ?C?mo se hace esto para que sea gen?rico?. |
... | ... | |
278 | 277 |
// TODO Auto-generated catch block |
279 | 278 |
e.printStackTrace(); |
280 | 279 |
} |
281 |
|
|
280 |
*/ |
|
282 | 281 |
} // for |
283 | 282 |
|
284 | 283 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/arcview/ArcJoin.java | ||
---|---|---|
107 | 107 |
} |
108 | 108 |
} |
109 | 109 |
|
110 |
/** |
|
111 |
* @see com.hardcode.gdbms.engine.customQuery.CustomQuery#getName() |
|
112 |
*/ |
|
113 |
public String getName() { |
|
114 |
return "com_iver_cit_gvsig_arcjoin"; |
|
115 |
} |
|
116 |
|
|
110 | 117 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/arcview/ArcJoinDataSource.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import com.hardcode.gdbms.engine.data.DataSource; |
4 | 4 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
5 |
import com.hardcode.gdbms.engine.data.persistence.Memento; |
|
6 |
import com.hardcode.gdbms.engine.data.persistence.MementoException; |
|
7 |
import com.hardcode.gdbms.engine.data.persistence.OperationLayerMemento; |
|
5 | 8 |
import com.hardcode.gdbms.engine.strategies.OperationDataSource; |
6 | 9 |
import com.hardcode.gdbms.engine.values.Value; |
7 | 10 |
|
... | ... | |
137 | 140 |
return source.getFieldType(i); |
138 | 141 |
} |
139 | 142 |
} |
143 |
|
|
144 |
/** |
|
145 |
* @see com.hardcode.gdbms.engine.data.DataSource#getMemento() |
|
146 |
*/ |
|
147 |
public Memento getMemento() throws MementoException { |
|
148 |
return new OperationLayerMemento(getName(), |
|
149 |
new Memento[]{source.getMemento(), linked.getMemento()}, getSQL()); |
|
150 |
} |
|
140 | 151 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FSymbol.java | ||
---|---|---|
46 | 46 |
*/ |
47 | 47 |
package com.iver.cit.gvsig.fmap.core.v02; |
48 | 48 |
|
49 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
50 |
|
|
51 |
import com.iver.utiles.StringUtilities; |
|
52 |
import com.iver.utiles.XMLEntity; |
|
53 |
|
|
54 | 49 |
import java.awt.BasicStroke; |
55 | 50 |
import java.awt.Color; |
56 | 51 |
import java.awt.Font; |
... | ... | |
60 | 55 |
import java.awt.Rectangle; |
61 | 56 |
import java.awt.Stroke; |
62 | 57 |
import java.awt.image.BufferedImage; |
58 |
import java.net.MalformedURLException; |
|
59 |
import java.net.URI; |
|
60 |
import java.net.URISyntaxException; |
|
63 | 61 |
|
62 |
import javax.swing.ImageIcon; |
|
64 | 63 |
|
64 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
65 |
import com.iver.utiles.StringUtilities; |
|
66 |
import com.iver.utiles.XMLEntity; |
|
67 |
|
|
68 |
|
|
65 | 69 |
/** |
66 | 70 |
* S?mbolo utilizado para guardar las caracter?sticas que se deben de aplicar a |
67 | 71 |
* los Shapes a dibujar. |
... | ... | |
97 | 101 |
private boolean m_bDrawShape = true; |
98 | 102 |
private int m_Size; |
99 | 103 |
private Image m_Icon; |
104 |
private URI m_IconURI; |
|
100 | 105 |
private int m_Rotation; |
101 | 106 |
private Paint m_Fill; |
102 | 107 |
public String m_LinePattern = "0"; // Solo para poder mostrarlo cuando vamos a seleccionar un s?mbolo |
... | ... | |
197 | 202 |
nS.m_bDrawShape = m_bDrawShape; |
198 | 203 |
nS.m_Size = m_Size; |
199 | 204 |
nS.m_Icon = m_Icon; |
205 |
nS.m_IconURI = m_IconURI; |
|
200 | 206 |
nS.m_Rotation = m_Rotation; |
201 | 207 |
nS.m_Fill = m_Fill; |
202 | 208 |
nS.m_Stroke = m_Stroke; |
... | ... | |
366 | 372 |
} |
367 | 373 |
|
368 | 374 |
xml.putProperty("rgb", rgb); |
375 |
|
|
376 |
if (m_Icon != null) |
|
377 |
{ |
|
378 |
xml.putProperty("m_IconURI", m_IconURI); |
|
379 |
} |
|
369 | 380 |
|
370 | 381 |
return xml; |
371 | 382 |
} |
... | ... | |
441 | 452 |
} |
442 | 453 |
|
443 | 454 |
symbol.rgb = xml.getIntProperty("rgb"); |
455 |
|
|
456 |
if (xml.contains("m_IconURI")) { |
|
457 |
try { |
|
458 |
symbol.setIconURI(new URI(xml.getStringProperty("m_IconURI"))); |
|
459 |
} catch (URISyntaxException e) { |
|
460 |
// TODO Auto-generated catch block |
|
461 |
e.printStackTrace(); |
|
462 |
} |
|
463 |
} |
|
444 | 464 |
|
445 | 465 |
return symbol; |
446 | 466 |
} |
... | ... | |
836 | 856 |
public float getFontSize() { |
837 | 857 |
return m_FontSize; |
838 | 858 |
} |
859 |
public URI getIconURI() { |
|
860 |
return m_IconURI; |
|
861 |
} |
|
862 |
public void setIconURI(URI iconURI) { |
|
863 |
m_IconURI = iconURI; |
|
864 |
ImageIcon prov; |
|
865 |
try { |
|
866 |
prov = new ImageIcon(iconURI.toURL()); |
|
867 |
m_Icon = prov.getImage(); |
|
868 |
} catch (MalformedURLException e) { |
|
869 |
// TODO Auto-generated catch block |
|
870 |
e.printStackTrace(); |
|
871 |
} |
|
872 |
|
|
873 |
} |
|
839 | 874 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FGraphicUtilities.java | ||
---|---|---|
600 | 600 |
float w; |
601 | 601 |
float h; |
602 | 602 |
|
603 |
if (theSymbol.isSizeInPixels()) { |
|
603 |
if (!theSymbol.isSizeInPixels()) {
|
|
604 | 604 |
// Suponemos que m_Size viene en coordenadas de mundo real |
605 | 605 |
// Por ejemplo, nos valemos del ancho para fijar la escala |
606 | 606 |
w = (float) (theSymbol.getSize() * mT.getScaleX()); |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/GDBMSParser.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.fmap.layers; |
|
2 |
|
|
3 |
import org.xml.sax.ContentHandler; |
|
4 |
import org.xml.sax.SAXException; |
|
5 |
import org.xml.sax.helpers.AttributesImpl; |
|
6 |
|
|
7 |
import com.iver.utiles.XMLEntity; |
|
8 |
|
|
9 |
/** |
|
10 |
* @author Fernando Gonz?lez Cort?s |
|
11 |
*/ |
|
12 |
public class GDBMSParser { |
|
13 |
XMLEntity xml; |
|
14 |
private ContentHandler handler; |
|
15 |
public GDBMSParser(XMLEntity xml){ |
|
16 |
this.xml = xml; |
|
17 |
} |
|
18 |
|
|
19 |
public void setContentHandler(ContentHandler handler){ |
|
20 |
this.handler = handler; |
|
21 |
} |
|
22 |
|
|
23 |
public void parse() throws SAXException{ |
|
24 |
AttributesImpl atts = new AttributesImpl(); |
|
25 |
for (int i = 0; i < xml.getPropertyCount(); i++) { |
|
26 |
String key = xml.getPropertyName(i); |
|
27 |
String value = xml.getPropertyValue(i); |
|
28 |
|
|
29 |
atts.addAttribute("", key, key, "string", value); |
|
30 |
} |
|
31 |
|
|
32 |
handler.startElement("", xml.getName(), xml.getName(), atts); |
|
33 |
|
|
34 |
for (int i = 0; i < xml.getNumChild(); i++) { |
|
35 |
GDBMSParser p = new GDBMSParser(xml.getChild(i)); |
|
36 |
p.setContentHandler(handler); |
|
37 |
p.parse(); |
|
38 |
} |
|
39 |
|
|
40 |
handler.endElement("", xml.getName(), xml.getName()); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/SelectableDataSource.java | ||
---|---|---|
43 | 43 |
import java.io.IOException; |
44 | 44 |
|
45 | 45 |
import org.apache.log4j.Logger; |
46 |
import org.xml.sax.SAXException; |
|
46 | 47 |
|
47 | 48 |
import com.hardcode.driverManager.DriverLoadException; |
48 | 49 |
import com.hardcode.gdbms.engine.data.DataSource; |
49 | 50 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
50 |
import com.hardcode.gdbms.engine.data.DataSourceLayerMemento; |
|
51 |
import com.hardcode.gdbms.engine.data.Memento; |
|
52 |
import com.hardcode.gdbms.engine.data.MementoException; |
|
53 | 51 |
import com.hardcode.gdbms.engine.data.NoSuchTableException; |
54 |
import com.hardcode.gdbms.engine.data.OperationLayerMemento; |
|
55 | 52 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
56 | 53 |
import com.hardcode.gdbms.engine.data.driver.DriverInfo; |
54 |
import com.hardcode.gdbms.engine.data.persistence.Handler; |
|
55 |
import com.hardcode.gdbms.engine.data.persistence.Memento; |
|
56 |
import com.hardcode.gdbms.engine.data.persistence.MementoContentHandler; |
|
57 |
import com.hardcode.gdbms.engine.data.persistence.MementoException; |
|
57 | 58 |
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException; |
58 | 59 |
import com.hardcode.gdbms.engine.instruction.SemanticException; |
59 | 60 |
import com.hardcode.gdbms.engine.values.Value; |
... | ... | |
81 | 82 |
dataSource = ds; |
82 | 83 |
} |
83 | 84 |
|
84 |
public static SelectableDataSource createSelectableDataSource(XMLEntity xml) throws NoSuchTableException, ParseException, DriverLoadException, DriverException, SemanticException, IOException{ |
|
85 |
public static SelectableDataSource createSelectableDataSource(XMLEntity xml) throws NoSuchTableException, ParseException, DriverLoadException, DriverException, SemanticException, IOException, XMLException{
|
|
85 | 86 |
|
86 | 87 |
SelectionSupport ss = new SelectionSupport(); |
87 | 88 |
ss.setXMLEntity(xml.getChild(0)); |
88 | 89 |
XMLEntity xmlDS = xml.getChild(1); |
89 |
DataSource dataSource = null;
|
|
90 |
if (xmlDS.contains("tableName")){
|
|
91 |
dataSource = LayerFactory.getDataSourceFactory().createRandomDataSource(
|
|
92 |
xmlDS.getStringProperty("tableName"),
|
|
93 |
xmlDS.getStringProperty("tableAlias"), DataSourceFactory.AUTOMATIC_MODE);
|
|
94 |
}else if (xmlDS.contains("sql")){
|
|
95 |
dataSource = LayerFactory.getDataSourceFactory().executeSQL(xmlDS.getStringProperty("sql"), DataSourceFactory.AUTOMATIC_MODE);
|
|
90 |
GDBMSParser parser = new GDBMSParser(xmlDS);
|
|
91 |
MementoContentHandler gdbmsHandler = new MementoContentHandler();
|
|
92 |
parser.setContentHandler(gdbmsHandler);
|
|
93 |
try {
|
|
94 |
parser.parse();
|
|
95 |
} catch (SAXException e) {
|
|
96 |
throw new XMLException(e);
|
|
96 | 97 |
} |
97 | 98 |
|
98 |
SelectableDataSource ret = new SelectableDataSource(dataSource); |
|
99 |
ret.selectionSupport = ss; |
|
100 |
|
|
101 |
return ret; |
|
99 |
return new SelectableDataSource(gdbmsHandler.getDataSource(LayerFactory.getDataSourceFactory(), DataSourceFactory.AUTOMATIC_MODE)); |
|
102 | 100 |
} |
103 |
|
|
104 |
public Memento getMemento() throws MementoException { |
|
105 |
return dataSource.getMemento(); |
|
106 |
} |
|
101 |
|
|
107 | 102 |
public void setDataSourceFactory(DataSourceFactory dsf) { |
108 | 103 |
dataSource.setDataSourceFactory(dsf); |
109 | 104 |
} |
... | ... | |
311 | 306 |
|
312 | 307 |
private void putMemento(XMLEntity xml) throws XMLException { |
313 | 308 |
try { |
314 |
XMLEntity child = new XMLEntity(); |
|
315 |
Memento memento = getMemento(); |
|
316 |
if (memento instanceof DataSourceLayerMemento){ |
|
317 |
DataSourceLayerMemento m = (DataSourceLayerMemento) memento; |
|
318 |
child.putProperty("tableAlias", m.getTableAlias()); |
|
319 |
child.putProperty("tableName", m.getTableName()); |
|
320 |
}else if (memento instanceof OperationLayerMemento){ |
|
321 |
OperationLayerMemento m = (OperationLayerMemento) memento; |
|
322 |
child.putProperty("sql", m.getSql()); |
|
323 |
}else{ |
|
324 |
throw new RuntimeException("Tipo de dataSource no contemplado"); |
|
325 |
} |
|
309 |
GDBMSHandler handler = new GDBMSHandler(); |
|
310 |
Memento m = getMemento(); |
|
311 |
m.setContentHandler(handler); |
|
312 |
m.getXML(); |
|
313 |
XMLEntity child = handler.getXMLEntity(); |
|
326 | 314 |
|
327 | 315 |
xml.addChild(child); |
328 | 316 |
} catch (MementoException e) { |
329 | 317 |
throw new XMLException(e); |
318 |
} catch (SAXException e) { |
|
319 |
throw new XMLException(e); |
|
330 | 320 |
} |
331 | 321 |
} |
332 | 322 |
|
... | ... | |
387 | 377 |
public void remove() { |
388 | 378 |
dataSource.remove(); |
389 | 379 |
} |
380 |
|
|
381 |
/** |
|
382 |
* @see com.hardcode.gdbms.engine.data.DataSource#getMemento() |
|
383 |
*/ |
|
384 |
public Memento getMemento() throws MementoException { |
|
385 |
return dataSource.getMemento(); |
|
386 |
} |
|
387 |
|
|
388 |
/** |
|
389 |
* @see com.hardcode.gdbms.engine.data.DataSource#getSourceInfo() |
|
390 |
*/ |
|
391 |
public DriverInfo getSourceInfo() { |
|
392 |
return dataSource.getSourceInfo(); |
|
393 |
} |
|
390 | 394 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/GDBMSHandler.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.fmap.layers; |
|
2 |
|
|
3 |
import java.util.Stack; |
|
4 |
|
|
5 |
import org.xml.sax.Attributes; |
|
6 |
import org.xml.sax.ContentHandler; |
|
7 |
import org.xml.sax.Locator; |
|
8 |
import org.xml.sax.SAXException; |
|
9 |
|
|
10 |
import com.iver.utiles.XMLEntity; |
|
11 |
|
|
12 |
/** |
|
13 |
* @author Fernando Gonz?lez Cort?s |
|
14 |
*/ |
|
15 |
public class GDBMSHandler implements ContentHandler{ |
|
16 |
|
|
17 |
private Stack entities = new Stack(); |
|
18 |
private XMLEntity last; |
|
19 |
|
|
20 |
/** |
|
21 |
* @see org.xml.sax.ContentHandler#endDocument() |
|
22 |
*/ |
|
23 |
public void endDocument() throws SAXException { |
|
24 |
// TODO Auto-generated method stub |
|
25 |
|
|
26 |
} |
|
27 |
|
|
28 |
/** |
|
29 |
* @see org.xml.sax.ContentHandler#startDocument() |
|
30 |
*/ |
|
31 |
public void startDocument() throws SAXException { |
|
32 |
// TODO Auto-generated method stub |
|
33 |
|
|
34 |
} |
|
35 |
|
|
36 |
/** |
|
37 |
* @see org.xml.sax.ContentHandler#characters(char[], int, int) |
|
38 |
*/ |
|
39 |
public void characters(char[] ch, int start, int length) throws SAXException { |
|
40 |
// TODO Auto-generated method stub |
|
41 |
|
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) |
|
46 |
*/ |
|
47 |
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { |
|
48 |
// TODO Auto-generated method stub |
|
49 |
|
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String) |
|
54 |
*/ |
|
55 |
public void endPrefixMapping(String prefix) throws SAXException { |
|
56 |
// TODO Auto-generated method stub |
|
57 |
|
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String) |
|
62 |
*/ |
|
63 |
public void skippedEntity(String name) throws SAXException { |
|
64 |
// TODO Auto-generated method stub |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator) |
|
70 |
*/ |
|
71 |
public void setDocumentLocator(Locator locator) { |
|
72 |
// TODO Auto-generated method stub |
|
73 |
|
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) |
|
78 |
*/ |
|
79 |
public void processingInstruction(String target, String data) throws SAXException { |
|
80 |
// TODO Auto-generated method stub |
|
81 |
|
|
82 |
} |
|
83 |
|
|
84 |
/** |
|
85 |
* @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String) |
|
86 |
*/ |
|
87 |
public void startPrefixMapping(String prefix, String uri) throws SAXException { |
|
88 |
// TODO Auto-generated method stub |
|
89 |
|
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) |
|
94 |
*/ |
|
95 |
public void endElement(String namespaceURI, String localName, String qName) throws SAXException { |
|
96 |
last = (XMLEntity) entities.pop(); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) |
|
101 |
*/ |
|
102 |
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { |
|
103 |
//Configuramos el xml entity |
|
104 |
XMLEntity xml = new XMLEntity(); |
|
105 |
xml.setName(qName); |
|
106 |
for (int i = 0; i < atts.getLength(); i++) { |
|
107 |
String name = atts.getQName(i); |
|
108 |
String value = atts.getValue(i); |
|
109 |
xml.putProperty(name, value); |
|
110 |
} |
|
111 |
|
|
112 |
if (!entities.isEmpty()){ |
|
113 |
XMLEntity parent = (XMLEntity) entities.peek(); |
|
114 |
parent.addChild(xml); |
|
115 |
} |
|
116 |
|
|
117 |
entities.push(xml); |
|
118 |
} |
|
119 |
|
|
120 |
public XMLEntity getXMLEntity() { |
|
121 |
return last; |
|
122 |
} |
|
123 |
} |
|
0 | 124 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/VectorialFileAdapter.java | ||
---|---|---|
48 | 48 |
import com.hardcode.gdbms.engine.data.DataSource; |
49 | 49 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
50 | 50 |
import com.hardcode.gdbms.engine.data.NoSuchTableException; |
51 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
51 | 52 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
52 | 53 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
53 | 54 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
... | ... | |
217 | 218 |
} catch (NoSuchTableException e) { |
218 | 219 |
throw new RuntimeException( |
219 | 220 |
"Error de implementaci?n, se ha a?adido una tabla y luego esa tabla no ha podido ser cargada"); |
221 |
} catch (DriverException e) { |
|
222 |
throw new RuntimeException(e); |
|
220 | 223 |
} |
221 | 224 |
|
222 | 225 |
return ds; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/VectorialDBAdapter.java | ||
---|---|---|
171 | 171 |
try { |
172 | 172 |
ds = LayerFactory.getDataSourceFactory().createRandomDataSource(name, DataSourceFactory.AUTOMATIC_MODE); |
173 | 173 |
} catch (NoSuchTableException e) { |
174 |
throw new DriverLoadException(e); |
|
175 |
} |
|
174 |
throw new RuntimeException(e); |
|
175 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
176 |
throw new RuntimeException(e); |
|
177 |
} |
|
176 | 178 |
} |
177 | 179 |
return ds; |
178 | 180 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/LayerFactory.java | ||
---|---|---|
390 | 390 |
} |
391 | 391 |
|
392 | 392 |
getDataSourceFactory().setDriverManager(driverManager); |
393 |
QueryManager.registerQuery("arcjoin", new ArcJoin());
|
|
393 |
QueryManager.registerQuery(new ArcJoin()); |
|
394 | 394 |
} |
395 | 395 |
} |
396 | 396 |
|
trunk/libraries/libCorePlugin/src/com/iver/core/mdiManager/SingletonViewSupport.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.core.mdiManager; |
42 | 42 |
|
43 |
import java.awt.Component; |
|
43 | 44 |
import java.util.ArrayList; |
44 | 45 |
import java.util.Comparator; |
45 | 46 |
import java.util.Iterator; |
... | ... | |
50 | 51 |
|
51 | 52 |
import com.iver.andami.ui.mdiManager.SingletonDialogAlreadyShownException; |
52 | 53 |
import com.iver.andami.ui.mdiManager.SingletonView; |
54 |
import com.iver.andami.ui.mdiManager.View; |
|
53 | 55 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
54 | 56 |
|
55 | 57 |
|
... | ... | |
60 | 62 |
* @version $Revision$ |
61 | 63 |
*/ |
62 | 64 |
public class SingletonViewSupport { |
65 |
private static int singletonViewInfoID = 0; |
|
63 | 66 |
/** Hashtable que asocia contenido con vistas */ |
64 | 67 |
private TreeMap contentViewInfo = new TreeMap(new SingletonViewInfoComparator()); |
65 | 68 |
private ViewInfoSupport vis; |
... | ... | |
145 | 148 |
* @author Fernando Gonz?lez Cort?s |
146 | 149 |
*/ |
147 | 150 |
public class SingletonViewInfo { |
151 |
|
|
152 |
public int id; |
|
153 |
|
|
148 | 154 |
/** Clase de la vista */ |
149 | 155 |
public Class clase; |
150 | 156 |
|
... | ... | |
160 | 166 |
public SingletonViewInfo(Class clase, Object modelo) { |
161 | 167 |
this.clase = clase; |
162 | 168 |
this.modelo = modelo; |
169 |
this.id = singletonViewInfoID; |
|
170 |
singletonViewInfoID++; |
|
163 | 171 |
} |
164 | 172 |
|
165 |
/**
|
|
173 |
/* |
|
166 | 174 |
* @see java.lang.Object#equals(java.lang.Object) |
167 |
*/
|
|
175 |
* |
|
168 | 176 |
public boolean equals(Object obj) { |
169 | 177 |
if (obj.getClass() != SingletonViewInfo.class) { |
170 | 178 |
throw new IllegalArgumentException(); |
... | ... | |
177 | 185 |
} else { |
178 | 186 |
return false; |
179 | 187 |
} |
180 |
} |
|
188 |
}*/
|
|
181 | 189 |
} |
182 | 190 |
|
183 | 191 |
/** |
... | ... | |
200 | 208 |
(s1.modelo == s2.modelo)) { |
201 | 209 |
return 0; |
202 | 210 |
} else { |
203 |
return (s1.clase.getName() + s1.modelo + "_").compareTo(s2.clase.getName() + |
|
204 |
s2.modelo); |
|
211 |
return (s1.id < s2.id)?-1:1; |
|
205 | 212 |
} |
206 | 213 |
}catch(ClassCastException e){ |
207 | 214 |
e.printStackTrace(); |
trunk/libraries/libIverUtiles/src/com/iver/utiles/swing/objectSelection/ObjectSelection.java | ||
---|---|---|
1 |
package com.iver.utiles.swing.objectSelection; |
|
2 |
|
|
3 |
import javax.swing.DefaultComboBoxModel; |
|
4 |
import javax.swing.JLabel; |
|
5 |
import javax.swing.JPanel; |
|
6 |
|
|
7 |
import com.iver.utiles.swing.JComboBox; |
|
8 |
|
|
9 |
|
|
10 |
/** |
|
11 |
* Control consistente en un texto y un combo autocompletable |
|
12 |
* |
|
13 |
* @author Fernando Gonz?lez Cort?s |
|
14 |
*/ |
|
15 |
public class ObjectSelection extends JPanel { |
|
16 |
private JLabel jLabel = null; |
|
17 |
private JComboBox combo = null; |
|
18 |
private ObjectSelectionModel model; |
|
19 |
private DefaultComboBoxModel cmbModel = new DefaultComboBoxModel(); |
|
20 |
private Object selected; |
|
21 |
/** |
|
22 |
* This is the default constructor |
|
23 |
*/ |
|
24 |
public ObjectSelection() { |
|
25 |
super(); |
|
26 |
initialize(); |
|
27 |
} |
|
28 |
|
|
29 |
/** |
|
30 |
* This method initializes this |
|
31 |
*/ |
|
32 |
private void initialize() { |
|
33 |
jLabel = new JLabel(); |
|
34 |
this.setSize(504, 265); |
|
35 |
jLabel.setText("Seleccione objeto:"); |
|
36 |
this.add(jLabel, null); |
|
37 |
this.add(getCombo(), null); |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* Obtiene una referencia al combo |
|
42 |
* |
|
43 |
* @return com.iver.utiles.swing.JComboBox |
|
44 |
*/ |
|
45 |
protected JComboBox getCombo() { |
|
46 |
if (combo == null) { |
|
47 |
combo = new JComboBox(); |
|
48 |
combo.setModel(cmbModel); |
|
49 |
combo.setEditable(true); |
|
50 |
combo.addItemListener(new java.awt.event.ItemListener() { |
|
51 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
52 |
seleccion(); |
|
53 |
} |
|
54 |
}); |
|
55 |
} |
|
56 |
|
|
57 |
return combo; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* M?todo invocado cuando cambia la selecci?n del combo |
|
62 |
*/ |
|
63 |
protected void seleccion() { |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* Establece el modelo del control |
|
68 |
* |
|
69 |
* @param model The model to set. |
|
70 |
* |
|
71 |
* @throws SelectionException Si hay alg?n error leyendo los |
|
72 |
* datos del modelo |
|
73 |
*/ |
|
74 |
public void setModel(ObjectSelectionModel model) throws SelectionException { |
|
75 |
this.model = model; |
|
76 |
|
|
77 |
Object[] objects = model.getObjects(); |
|
78 |
cmbModel.removeAllElements(); |
|
79 |
|
|
80 |
for (int i = 0; i < objects.length; i++) { |
|
81 |
cmbModel.addElement(objects[i]); |
|
82 |
} |
|
83 |
|
|
84 |
getCombo().setSelectedIndex(-1); |
|
85 |
|
|
86 |
jLabel.setText(model.getMsg()); |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Obtiene el elemento actualmente seleccionado |
|
91 |
* |
|
92 |
* @return Returns the selected item. |
|
93 |
*/ |
|
94 |
public Object getSelected() { |
|
95 |
return cmbModel.getSelectedItem(); |
|
96 |
} |
|
97 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
0 | 98 |
trunk/libraries/libIverUtiles/src/com/iver/utiles/swing/objectSelection/ObjectSelectionModel.java | ||
---|---|---|
1 |
package com.iver.utiles.swing.objectSelection; |
|
2 |
|
|
3 |
/** |
|
4 |
* Modelo del control ObjectSelection |
|
5 |
* |
|
6 |
* @author Fernando Gonz?lez Cort?s |
|
7 |
*/ |
|
8 |
public interface ObjectSelectionModel { |
|
9 |
/** |
|
10 |
* Obtiene las referencias a los objetos que aparecer?n |
|
11 |
* seleccionables en el combo |
|
12 |
* |
|
13 |
* @return array de objetos |
|
14 |
* |
|
15 |
* @throws SelectionException Si se produce alg?n error |
|
16 |
*/ |
|
17 |
public Object[] getObjects() throws SelectionException; |
|
18 |
|
|
19 |
/** |
|
20 |
* Obtiene el mensaje que se mostrar? al usuario |
|
21 |
* |
|
22 |
* @return String |
|
23 |
* |
|
24 |
* @throws SelectionException Si no se puede obtener el mensaje |
|
25 |
*/ |
|
26 |
public String getMsg() throws SelectionException; |
|
27 |
} |
|
0 | 28 |
trunk/libraries/libIverUtiles/src/com/iver/utiles/swing/objectSelection/SelectionException.java | ||
---|---|---|
1 |
package com.iver.utiles.swing.objectSelection; |
|
2 |
|
|
3 |
/** |
|
4 |
* Excepci?n que indica que el modelo del control ObjectSelection no puede |
|
5 |
* proporcionar la informaci?n requerida. |
|
6 |
* |
|
7 |
* @author Fernando Gonz?lez Cort?s |
|
8 |
*/ |
|
9 |
public class SelectionException extends Exception { |
|
10 |
/** |
|
11 |
* |
|
12 |
*/ |
|
13 |
public SelectionException() { |
|
14 |
super(); |
|
15 |
|
|
16 |
// TODO Auto-generated constructor stub |
|
17 |
} |
|
18 |
|
|
19 |
/** |
|
20 |
* constructor |
|
21 |
* |
|
22 |
* @param message |
|
23 |
*/ |
|
24 |
public SelectionException(String message) { |
|
25 |
super(message); |
|
26 |
|
|
27 |
// TODO Auto-generated constructor stub |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* constructor |
|
32 |
* |
|
33 |
* @param message |
|
34 |
* @param cause |
|
35 |
*/ |
|
36 |
public SelectionException(String message, Throwable cause) { |
|
37 |
super(message, cause); |
|
38 |
|
|
39 |
// TODO Auto-generated constructor stub |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* constructor |
|
44 |
* |
|
45 |
* @param cause |
|
46 |
*/ |
|
47 |
public SelectionException(Throwable cause) { |
|
48 |
super(cause); |
|
49 |
|
|
50 |
// TODO Auto-generated constructor stub |
|
51 |
} |
|
52 |
} |
|
0 | 53 |
trunk/libraries/libIverUtiles/src/com/iver/utiles/swing/wizard/Step.java | ||
---|---|---|
1 |
package com.iver.utiles.swing.wizard; |
|
2 |
|
|
3 |
/** |
|
4 |
* Interfaz a implementar por todas las p?ginas del wizard. |
|
5 |
* |
|
6 |
* @author Fernando Gonz?lez Cort?s |
|
7 |
*/ |
|
8 |
public interface Step { |
|
9 |
/** |
|
10 |
* Recibe la referencia al Wizard del que forman parte |
|
11 |
* |
|
12 |
* @param w Referencia al wizard |
|
13 |
*/ |
|
14 |
public void init(WizardControl w); |
|
15 |
} |
|
0 | 16 |
trunk/libraries/libIverUtiles/src/com/iver/utiles/swing/wizard/Wizard.java | ||
---|---|---|
1 |
package com.iver.utiles.swing.wizard; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.CardLayout; |
|
5 |
|
|
6 |
import java.util.ArrayList; |
|
7 |
import java.util.Iterator; |
|
8 |
|
|
9 |
import javax.swing.JButton; |
|
10 |
import javax.swing.JComponent; |
|
11 |
import javax.swing.JPanel; |
|
12 |
|
|
13 |
|
|
14 |
/** |
|
15 |
* Clase wizard con la gesti?n de los botones y los paneles a?adidos al mismo. |
|
16 |
* Al avanzar o retrasar un paso el asistente se desactivan todos los botones |
|
17 |
* menos el de cancelar, que est? activo siempre por defecto |
|
18 |
* |
|
19 |
* @author Fernando Gonz?lez Cort?s |
|
20 |
*/ |
|
21 |
public class Wizard extends JPanel implements WizardControl { |
|
22 |
private JPanel jPanel = null; |
|
23 |
private JButton btnBack = null; |
|
24 |
private JButton btnNext = null; |
|
25 |
private JButton btnFinish = null; |
|
26 |
private JButton btnCancel = null; |
|
27 |
private ArrayList steps = new ArrayList(); |
|
28 |
private int currentStep = 0; |
|
29 |
private JPanel pnlSteps = null; |
|
30 |
private ArrayList listeners = new ArrayList(); |
|
31 |
|
|
32 |
/** |
|
33 |
* This is the default constructor |
|
34 |
*/ |
|
35 |
public Wizard() { |
|
36 |
super(); |
|
37 |
initialize(); |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* A?ade un l?stener de eventos del wizard |
|
42 |
* |
|
43 |
* @param listener |
|
44 |
*/ |
|
45 |
public void addWizardListener(WizardListener listener) { |
|
46 |
listeners.add(listener); |
|
47 |
} |
|
48 |
|
|
49 |
/** |
|
50 |
* Elimina un listener de eventos del wizard |
|
51 |
* |
|
52 |
* @param listener |
|
53 |
*/ |
|
54 |
public void removeWizardListener(WizardListener listener) { |
|
55 |
listeners.remove(listener); |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Invoca en los listeners el evento cancel |
|
60 |
*/ |
|
61 |
private void callCancelListener() { |
|
62 |
for (Iterator iter = listeners.iterator(); iter.hasNext();) { |
|
63 |
WizardListener element = (WizardListener) iter.next(); |
|
64 |
element.cancel(new WizardEvent(this, currentStep)); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* Invoca en los listeners el evento finish |
|
70 |
*/ |
|
71 |
private void callFinishListener() { |
|
72 |
for (Iterator iter = listeners.iterator(); iter.hasNext();) { |
|
73 |
WizardListener element = (WizardListener) iter.next(); |
|
74 |
element.finished(new WizardEvent(this, currentStep)); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* Invoca en los listeners el evento next |
|
80 |
*/ |
|
81 |
private void callNextListener() { |
|
82 |
for (Iterator iter = listeners.iterator(); iter.hasNext();) { |
|
83 |
WizardListener element = (WizardListener) iter.next(); |
|
84 |
element.next(new WizardEvent(this, currentStep)); |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Invoca en los listeners el evento back |
|
90 |
*/ |
|
91 |
private void callBackListener() { |
|
92 |
for (Iterator iter = listeners.iterator(); iter.hasNext();) { |
|
93 |
WizardListener element = (WizardListener) iter.next(); |
|
94 |
element.back(new WizardEvent(this, currentStep)); |
|
95 |
} |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* This method initializes this |
|
100 |
*/ |
|
101 |
private void initialize() { |
|
102 |
this.setLayout(new BorderLayout()); |
|
103 |
this.setSize(300, 200); |
|
104 |
this.add(getJPanel(), java.awt.BorderLayout.SOUTH); |
|
105 |
this.add(getPnlSteps(), java.awt.BorderLayout.CENTER); |
|
106 |
} |
|
107 |
|
|
108 |
/** |
|
109 |
* A?ade un paso al asistente. Inicializa el paso |
|
110 |
* |
|
111 |
* @param s Paso a a?adir |
|
112 |
* |
|
113 |
* @throws RuntimeException DOCUMENT ME! |
|
114 |
*/ |
|
115 |
public void addStep(Step s) { |
|
116 |
if (!(s instanceof JComponent)) { |
|
117 |
throw new RuntimeException( |
|
118 |
"Step must be a visual component (descend from JComponent)"); |
|
119 |
} |
|
120 |
|
|
121 |
getPnlSteps().add((JComponent) s, BorderLayout.CENTER); |
|
122 |
steps.add(s); |
|
123 |
disableButtons(); |
|
124 |
s.init(this); |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* Habilita o deshabilita los botones en funci?n del paso en el que se |
|
129 |
* encuentre el asistente |
|
130 |
*/ |
|
131 |
private void disableButtons() { |
|
132 |
btnNext.setEnabled(false); |
|
133 |
btnBack.setEnabled(false); |
|
134 |
btnFinish.setEnabled(false); |
|
135 |
} |
|
136 |
|
|
137 |
/** |
|
138 |
* Activa el paso al siguiente paso del asistente |
|
139 |
*/ |
|
140 |
public void enableNext(boolean enabled) { |
|
141 |
if (currentStep == (steps.size() - 1)) { |
|
142 |
btnFinish.setEnabled(enabled); |
|
143 |
} else { |
|
144 |
btnNext.setEnabled(enabled); |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
/** |
|
149 |
* Activa el paso al paso anterior del asistente |
|
150 |
*/ |
|
151 |
public void enableBack(boolean enabled) { |
|
152 |
if (currentStep != 0) { |
|
153 |
btnBack.setEnabled(enabled); |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
/** |
|
158 |
* This method initializes jPanel |
|
159 |
* |
|
160 |
* @return javax.swing.JPanel |
|
161 |
*/ |
|
162 |
private JPanel getJPanel() { |
|
163 |
if (jPanel == null) { |
|
164 |
jPanel = new JPanel(); |
|
165 |
jPanel.add(getBtnBack(), null); |
|
166 |
jPanel.add(getBtnNext(), null); |
|
167 |
jPanel.add(getBtnFinish(), null); |
|
168 |
jPanel.add(getBtnCancel(), null); |
|
169 |
} |
|
170 |
|
|
171 |
return jPanel; |
|
172 |
} |
|
173 |
|
|
174 |
/** |
|
175 |
* Obtiene una referencia al bot?n de dar un paso atr?s |
|
176 |
* |
|
177 |
* @return javax.swing.JButton |
|
178 |
*/ |
|
179 |
public JButton getBtnBack() { |
|
180 |
if (btnBack == null) { |
|
181 |
btnBack = new JButton(); |
|
182 |
btnBack.setPreferredSize(new java.awt.Dimension(54, 18)); |
|
183 |
btnBack.setText("Back"); |
|
184 |
btnBack.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
|
185 |
btnBack.setEnabled(false); |
|
186 |
btnBack.addActionListener(new java.awt.event.ActionListener() { |
|
187 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
188 |
backStep(); |
|
189 |
} |
|
190 |
}); |
|
191 |
} |
|
192 |
|
|
193 |
return btnBack; |
|
194 |
} |
|
195 |
|
|
196 |
/** |
|
197 |
* Obtiene una referencia al bot?n de dar un paso adelante |
|
198 |
* |
|
199 |
* @return javax.swing.JButton |
|
200 |
*/ |
|
201 |
public JButton getBtnNext() { |
|
202 |
if (btnNext == null) { |
|
203 |
btnNext = new JButton(); |
|
204 |
btnNext.setText("Next"); |
|
205 |
btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
|
206 |
btnNext.setPreferredSize(new java.awt.Dimension(54, 18)); |
|
207 |
btnNext.setEnabled(false); |
|
208 |
btnNext.addActionListener(new java.awt.event.ActionListener() { |
|
209 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
210 |
nextStep(); |
|
211 |
} |
|
212 |
}); |
|
213 |
} |
|
214 |
|
|
215 |
return btnNext; |
|
216 |
} |
|
217 |
|
|
218 |
/** |
|
219 |
* Obtiene una referencia al bot?n de finalizar |
|
220 |
* |
|
221 |
* @return javax.swing.JButton |
|
222 |
*/ |
|
223 |
public JButton getBtnFinish() { |
|
224 |
if (btnFinish == null) { |
|
225 |
btnFinish = new JButton(); |
|
226 |
btnFinish.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
|
227 |
btnFinish.setPreferredSize(new java.awt.Dimension(54, 18)); |
|
228 |
btnFinish.setText("Finish"); |
|
229 |
btnFinish.setEnabled(false); |
|
230 |
btnFinish.addActionListener(new java.awt.event.ActionListener() { |
|
231 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
232 |
callFinishListener(); |
|
233 |
} |
|
234 |
}); |
|
235 |
} |
|
236 |
|
|
237 |
return btnFinish; |
|
238 |
} |
|
239 |
|
|
240 |
/** |
|
241 |
* Obtiene una referencia al bot?n de cancelar |
|
242 |
* |
|
243 |
* @return javax.swing.JButton |
|
244 |
*/ |
|
245 |
public JButton getBtnCancel() { |
|
246 |
if (btnCancel == null) { |
|
247 |
btnCancel = new JButton(); |
|
248 |
btnCancel.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
|
249 |
btnCancel.setPreferredSize(new java.awt.Dimension(54, 18)); |
|
250 |
btnCancel.setText("Cancel"); |
|
251 |
btnCancel.addActionListener(new java.awt.event.ActionListener() { |
|
252 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
253 |
callCancelListener(); |
|
254 |
} |
|
255 |
}); |
|
256 |
} |
|
257 |
|
|
258 |
return btnCancel; |
|
259 |
} |
|
260 |
|
|
261 |
/** |
|
262 |
* This method initializes pnlSteps |
|
263 |
* |
|
264 |
* @return javax.swing.JPanel |
|
265 |
*/ |
|
266 |
private JPanel getPnlSteps() { |
|
267 |
if (pnlSteps == null) { |
|
268 |
pnlSteps = new JPanel(); |
|
269 |
pnlSteps.setLayout(new CardLayout()); |
|
270 |
} |
|
271 |
|
|
272 |
return pnlSteps; |
|
273 |
} |
|
274 |
|
|
275 |
/** |
|
276 |
* Muestra el panel del siguiente paso del asistente |
|
277 |
*/ |
|
278 |
public void nextStep() { |
|
279 |
currentStep++; |
|
280 |
((CardLayout) getPnlSteps().getLayout()).next(getPnlSteps()); |
|
281 |
disableButtons(); |
|
282 |
callNextListener(); |
|
283 |
} |
|
284 |
|
|
285 |
/** |
|
286 |
* Muestra el panel del paso anterior del asistente |
|
287 |
*/ |
|
288 |
public void backStep() { |
|
289 |
currentStep--; |
|
290 |
((CardLayout) getPnlSteps().getLayout()).previous(getPnlSteps()); |
|
291 |
disableButtons(); |
|
292 |
callBackListener(); |
|
293 |
} |
|
294 |
|
|
295 |
/** |
|
296 |
* Se cancela el asistente. Esta operaci?n no tiene ning?n efecto, salvo |
|
297 |
* que se disparar? el evento de cancelado. El resultado de esto depender? |
|
298 |
* de las implementaciones que haya escuchando el evento. Generalmente |
|
299 |
* deber? haber un objeto que al escuchar este evento cerrar? el |
|
300 |
* asistente. |
|
301 |
*/ |
|
302 |
public void cancel() { |
|
303 |
callCancelListener(); |
|
304 |
} |
|
305 |
|
|
306 |
/** |
|
307 |
* Se finaliza el asistente. Esta operaci?n no tiene ning?n efecto, salvo |
|
308 |
* que se disparar? el evento de finalizaci?n. El resultado de esto |
|
309 |
* depender? de las implementaciones que haya escuchando el evento. |
|
310 |
* Generalmente deber? haber un objeto que al escuchar este evento cerrar? |
|
311 |
* el asistente. |
|
312 |
*/ |
|
313 |
public void finish() { |
|
314 |
callFinishListener(); |
|
315 |
} |
|
316 |
|
|
317 |
/** |
|
318 |
* Obtiene un array con los pasos del asistente |
|
319 |
* |
|
320 |
* @return array de pasos |
|
321 |
*/ |
|
322 |
public Step[] getSteps() { |
|
323 |
return (Step[]) steps.toArray(new Step[0]); |
|
324 |
} |
|
325 |
|
|
326 |
/** |
|
327 |
* Obtiene el paso actual del asistente |
|
328 |
* |
|
329 |
* @return Paso actual del asistente |
|
330 |
*/ |
|
331 |
public Step getCurrentStep() { |
|
332 |
return getSteps()[currentStep]; |
|
333 |
} |
|
334 |
} |
|
0 | 335 |
trunk/libraries/libIverUtiles/src/com/iver/utiles/swing/wizard/WizardControl.java | ||
---|---|---|
1 |
package com.iver.utiles.swing.wizard; |
|
2 |
|
|
3 |
/** |
|
4 |
* Visi?n que tienen los escuchadores de eventos sobre el Wizard |
|
5 |
* |
|
6 |
* @author Fernando Gonz?lez Cort?s |
|
7 |
*/ |
|
8 |
public interface WizardControl { |
|
9 |
/** |
|
10 |
* Activa el paso al siguiente paso del asistente |
|
11 |
* |
|
12 |
* @param enabled si se habilita o no |
|
13 |
*/ |
|
14 |
public abstract void enableNext(boolean enabled); |
|
15 |
|
|
16 |
/** |
|
17 |
* Activa el paso al paso anterior del asistente |
|
18 |
* |
|
19 |
* @param enabled si se habilita o no |
|
20 |
*/ |
|
21 |
public abstract void enableBack(boolean enabled); |
|
22 |
|
|
23 |
/** |
|
24 |
* Muestra el panel del siguiente paso del asistente |
|
25 |
*/ |
|
26 |
public abstract void nextStep(); |
|
27 |
|
|
28 |
/** |
|
29 |
* Muestra el panel del paso anterior del asistente |
|
30 |
*/ |
|
31 |
public abstract void backStep(); |
|
32 |
|
|
33 |
/** |
|
34 |
* Se cancela el asistente. Esta operaci?n no tiene ning?n efecto, salvo |
|
35 |
* que se disparar? el evento de cancelado. El resultado de esto depender? |
|
36 |
* de las implementaciones que haya escuchando el evento. Generalmente |
|
37 |
* deber? haber un objeto que al escuchar este evento cerrar? el |
|
38 |
* asistente. |
|
39 |
*/ |
|
40 |
public abstract void cancel(); |
|
41 |
|
|
42 |
/** |
|
43 |
* Se finaliza el asistente. Esta operaci?n no tiene ning?n efecto, salvo |
|
44 |
* que se disparar? el evento de finalizaci?n. El resultado de esto |
|
45 |
* depender? de las implementaciones que haya escuchando el evento. |
|
46 |
* Generalmente deber? haber un objeto que al escuchar este evento cerrar? |
|
47 |
* el asistente. |
|
48 |
*/ |
|
49 |
public abstract void finish(); |
|
50 |
|
|
51 |
/** |
|
52 |
* Obtiene el paso actual del asistente |
|
53 |
* |
|
54 |
* @return Paso actual del asistente |
|
55 |
*/ |
|
56 |
public abstract Step getCurrentStep(); |
|
57 |
} |
|
0 | 58 |
trunk/libraries/libIverUtiles/src/com/iver/utiles/swing/wizard/WizardEvent.java | ||
---|---|---|
1 |
package com.iver.utiles.swing.wizard; |
|
2 |
|
|
3 |
/** |
|
4 |
* Evento con la informaci?n del estado del asistente |
|
5 |
* |
|
6 |
* @author Fernando Gonz?lez Cort?s |
|
7 |
*/ |
|
8 |
public class WizardEvent { |
|
9 |
public WizardControl wizard; |
|
10 |
public int currentStep; |
|
11 |
|
|
12 |
/** |
|
13 |
* Crea un nuevo WizardEvent. |
|
14 |
* |
|
15 |
* @param w referencia al asistente donde se gener? el evento |
|
16 |
* @param currentStep paso actual del asistente |
|
17 |
*/ |
|
18 |
public WizardEvent(Wizard w, int currentStep) { |
|
19 |
this.wizard = w; |
|
20 |
this.currentStep = currentStep; |
|
21 |
} |
|
22 |
} |
|
0 | 23 |
trunk/libraries/libIverUtiles/src/com/iver/utiles/swing/wizard/WizardListener.java | ||
---|---|---|
1 |
package com.iver.utiles.swing.wizard; |
|
2 |
|
|
3 |
/** |
|
4 |
* Listener de los eventos del asistente |
|
5 |
* |
|
6 |
* @author Fernando Gonz?lez Cort?s |
|
7 |
*/ |
|
8 |
public interface WizardListener { |
|
9 |
/** |
|
10 |
* Evento disparado cuando se cancela el asistente |
|
11 |
* |
|
12 |
* @param w objeto con la informaci?n del evento |
|
13 |
*/ |
|
14 |
public void cancel(WizardEvent w); |
|
15 |
|
|
16 |
/** |
|
17 |
* Evento disparado cuando se finaliza el asistente |
|
18 |
* |
|
19 |
* @param w objeto con la informaci?n del evento |
|
20 |
*/ |
|
21 |
public void finished(WizardEvent w); |
|
22 |
|
|
23 |
/** |
|
24 |
* Evento disparado cuando se avanza un paso el asistente |
|
25 |
* |
|
26 |
* @param w objeto con la informaci?n del evento |
|
27 |
*/ |
|
28 |
public void next(WizardEvent w); |
|
29 |
|
|
30 |
/** |
|
31 |
* Evento disparado cuando se da un paso atr?s en el asistente |
|
32 |
* |
|
33 |
* @param w objeto con la informaci?n del evento |
|
34 |
*/ |
|
35 |
public void back(WizardEvent w); |
|
36 |
} |
|
0 | 37 |
trunk/libraries/libIverUtiles/src/com/iver/utiles/swing/JComboBox.java | ||
---|---|---|
129 | 129 |
DefaultComboBoxModel model = (DefaultComboBoxModel) JComboBox.this.getModel(); |
130 | 130 |
|
131 | 131 |
for (int i = 0; i < model.getSize(); i++) { |
132 |
if (((String) model.getElementAt(i)).startsWith(text)) {
|
|
133 |
return (String) model.getElementAt(i);
|
|
132 |
if ((model.getElementAt(i).toString()).startsWith(text)) {
|
|
133 |
return model.getElementAt(i).toString();
|
|
134 | 134 |
} |
135 | 135 |
} |
136 | 136 |
|
trunk/libraries/libIverUtiles/src/com/iver/utiles/console/JConsole.java | ||
---|---|---|
188 | 188 |
} |
189 | 189 |
|
190 | 190 |
/** |
191 |
* A?ade un texto a la consola que es tomado como si lo |
|
192 |
* hubiese escrito el usuario. Formar? parte de la respuesta |
|
193 |
* |
|
194 |
* @param text Texto que se a?ade a la consola |
|
195 |
*/ |
|
196 |
public void addResponseText(String text) { |
|
197 |
txt.setText(txt.getText() + text); |
|
198 |
txt.setCaretPosition(txt.getText().length()); |
|
199 |
} |
|
200 |
|
|
201 |
/** |
|
191 | 202 |
* This method initializes jScrollPane |
192 | 203 |
* |
193 | 204 |
* @return javax.swing.JScrollPane |
trunk/libraries/libIverUtiles/src/com/iver/utiles/XMLEntity.java | ||
---|---|---|
904 | 904 |
} |
905 | 905 |
return exists; |
906 | 906 |
} |
907 |
|
|
908 |
public int getPropertyCount(){ |
|
909 |
return xmltag.getPropertyCount(); |
|
910 |
} |
|
911 |
|
|
912 |
public String getPropertyValue(int index){ |
|
913 |
return xmltag.getProperty(index).getValue(); |
|
914 |
} |
|
915 |
|
|
916 |
public String getPropertyName(int index){ |
|
917 |
return xmltag.getProperty(index).getKey(); |
|
918 |
} |
|
907 | 919 |
} |
Also available in: Unified diff