Revision 928
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
|
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.jexcel</artifactId> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<name>${project.artifactId}</name> |
|
9 |
<version>1.0.122</version> |
|
10 |
<description>Excel support fort DAL and gvSIG</description> |
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.desktop</artifactId> |
|
14 |
<version>2.0.311</version> |
|
15 |
</parent> |
|
16 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-jexcel</url> |
|
17 |
|
|
18 |
<scm> |
|
19 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-jexcel/org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122</connection> |
|
20 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-jexcel/org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122</developerConnection> |
|
21 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-jexcel/repository/show/org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122</url> |
|
22 |
</scm> |
|
23 |
<repositories> |
|
24 |
<repository> |
|
25 |
<id>gvsig-public-http-repository</id> |
|
26 |
<name>gvSIG maven public HTTP repository</name> |
|
27 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
28 |
<releases> |
|
29 |
<enabled>true</enabled> |
|
30 |
<updatePolicy>daily</updatePolicy> |
|
31 |
<checksumPolicy>warn</checksumPolicy> |
|
32 |
</releases> |
|
33 |
<snapshots> |
|
34 |
<enabled>true</enabled> |
|
35 |
<updatePolicy>daily</updatePolicy> |
|
36 |
<checksumPolicy>warn</checksumPolicy> |
|
37 |
</snapshots> |
|
38 |
</repository> |
|
39 |
</repositories> |
|
40 |
|
|
41 |
<build> |
|
42 |
<plugins> |
|
43 |
<plugin> |
|
44 |
<groupId>org.apache.maven.plugins</groupId> |
|
45 |
<artifactId>maven-release-plugin</artifactId> |
|
46 |
<configuration> |
|
47 |
<tagBase>https://devel.gvsig.org/svn/gvsig-jexcel/org.gvsig.jexcel/tags</tagBase> |
|
48 |
</configuration> |
|
49 |
</plugin> |
|
50 |
</plugins> |
|
51 |
</build> |
|
52 |
|
|
53 |
<dependencyManagement> |
|
54 |
<dependencies> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.jexcel.provider</artifactId> |
|
58 |
<version>1.0.122</version> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.jexcel.app.mainplugin</artifactId> |
|
63 |
<version>1.0.122</version> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>net.sourceforge.jexcelapi</groupId> |
|
67 |
<artifactId>jxl</artifactId> |
|
68 |
<version>2.6.12</version> |
|
69 |
</dependency> |
|
70 |
</dependencies> |
|
71 |
</dependencyManagement> |
|
72 |
|
|
73 |
<dependencies> |
|
74 |
<dependency> |
|
75 |
<groupId>org.slf4j</groupId> |
|
76 |
<artifactId>slf4j-api</artifactId> |
|
77 |
<scope>compile</scope> |
|
78 |
</dependency> |
|
79 |
</dependencies> |
|
80 |
|
|
81 |
<modules> |
|
82 |
<module>org.gvsig.jexcel.app</module> |
|
83 |
<module>org.gvsig.jexcel.provider</module> |
|
84 |
|
|
85 |
</modules> |
|
86 |
|
|
87 |
|
|
88 |
</project> |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.app/org.gvsig.jexcel.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Sun Jan 17 22:37:19 CET 2021 |
|
2 |
buildNumber=126 |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.app/org.gvsig.jexcel.app.mainplugin/src/main/userdoc/user_manual.rst | ||
---|---|---|
1 |
jexcel plugin user manual v0.2 |
|
2 |
================================= |
|
3 |
|
|
4 |
.. contents:: Contents |
|
5 |
|
|
6 |
Introduction |
|
7 |
-------------- |
|
8 |
|
|
9 |
The jexcel plugin add to gvSIG the following functionalities: |
|
10 |
|
|
11 |
* Load Microsoft Excel spreadsheets as tables. |
|
12 |
* Load Microsoft Excel spreadsheets as layers. |
|
13 |
* Export a table to Excel spreadsheet format. |
|
14 |
|
|
15 |
It supports the following Excel spreadsheet versions: |
|
16 |
|
|
17 |
* Reading: Excel 95, 97, 2000, XP, and 2003 workbooks. |
|
18 |
* Writing: Excel 2000 |
|
19 |
|
|
20 |
Installation |
|
21 |
-------------- |
|
22 |
|
|
23 |
(TODO) |
|
24 |
|
|
25 |
Loading a table from an Excel spreadsheet |
|
26 |
------------------------------------------ |
|
27 |
|
|
28 |
From the gvSIG project manager, select the “Table” document (1) and click on “New” (2). In the “New table” window the “File” tab is selected by default. Click on “Add” (3) and find the Excel file that contains the spreadsheet you want to load (4). Finally click on “Open” (5). |
|
29 |
|
|
30 |
| |
|
31 |
|
|
32 |
.. image:: Selection_088.png |
|
33 |
:align: center |
|
34 |
:scale: 150 |
|
35 |
|
|
36 |
Once the file appears in the “New table” window, click on “Properties” (7) in order to set up the following parameters: |
|
37 |
|
|
38 |
Data source properties |
|
39 |
+++++++++++++++++++++++ |
|
40 |
|
|
41 |
General tab (default) |
|
42 |
^^^^^^^^^^^^^^^^^^^^^^ |
|
43 |
|
|
44 |
- **File:** File path. |
|
45 |
- **Locale:** Localization configuration. This determines the characters used as decimal and thousands separators. |
|
46 |
- **Sheet to load:** Position within the spreadsheet file of the sheet that we want to load. First position corresponds with the number "0", second with "1" and so on. |
|
47 |
- **Use first row as header:** In case this option is checked it will consider the first row values as the field names. |
|
48 |
- **CRS:** In case the sheet contains coordinates this parameter sets its Coordinate Reference System. |
|
49 |
- **Point (X,Y,Z):** Position of the fields that contains the coordinates. It should be provided at least two fields for X,Y coordinates. |
|
50 |
|
|
51 |
| |
|
52 |
|
|
53 |
.. image:: Selection_091.png |
|
54 |
:align: center |
|
55 |
:scale: 150 |
|
56 |
|
|
57 |
Advanced tab |
|
58 |
^^^^^^^^^^^^^^ |
|
59 |
|
|
60 |
- **ProviderName:** The provider name (internal use). |
|
61 |
- **Header:** In case the sheet doesn't have a header we can define it here. We have to type the name of the fields separated by a comma. |
|
62 |
- **Field types:** The is useful if we want to force the program to load the table with a specific field types. |
|
63 |
- **Automatic types detection:** This options is checked by default. It tryes to figure out what the field types are. |
|
64 |
- **Ignore errors:** This option forces the program to load the table even in case it finds erros. |
|
65 |
|
|
66 |
| |
|
67 |
|
|
68 |
.. image:: Selection_090.png |
|
69 |
:align: center |
|
70 |
:scale: 150 |
|
71 |
|
|
72 |
Once all the needed parameters have been set up click on “Accept” and finally on “Ok”. If everything worked fine the table should appear. |
|
73 |
|
|
74 |
| |
|
75 |
|
|
76 |
.. image:: Selection_092.png |
|
77 |
:align: center |
|
78 |
:scale: 150 |
|
79 |
|
|
80 |
Loading a layer from an Excel Spreadsheet |
|
81 |
------------------------------------------ |
|
82 |
|
|
83 |
From the gvSIG project manager, select the “View” document (1) and click on “New” (2). In the “Add layer” window the “File” tab is selected by default. Click on “Add” (4) and find the Excel file that contains the spreadsheet you want to load (5). Finally click on “Open” (6). |
|
84 |
|
|
85 |
| |
|
86 |
|
|
87 |
.. image:: Selection_095.png |
|
88 |
:align: center |
|
89 |
:scale: 150 |
|
90 |
|
|
91 |
Once the file appears in the “Add layer” window, click on “Properties” (7) in order to set up the following parameters: |
|
92 |
|
|
93 |
Data source properties |
|
94 |
+++++++++++++++++++++++ |
|
95 |
|
|
96 |
General tab (default) |
|
97 |
^^^^^^^^^^^^^^^^^^^^^^ |
|
98 |
|
|
99 |
- **File:** File path. |
|
100 |
- **Locale:** Localization configuration. This determines the characters used as decimal and thousands separators. |
|
101 |
- **Sheet to load:** Position within the spreadsheet file of the sheet that we want to load. First position corresponds with the number "0", second with "1" and so on. |
|
102 |
- **Use first row as header:** In case this option is checked it will consider the first row values as the field names. |
|
103 |
- **CRS:** In case the sheet contains coordinates this parameter sets its Coordinate Reference System. |
|
104 |
- **Point (X,Y,Z):** Position of the fields that contains the coordinates. It should be provided at least two fields for X,Y coordinates. |
|
105 |
|
|
106 |
| |
|
107 |
|
|
108 |
.. image:: Selection_096.png |
|
109 |
:align: center |
|
110 |
:scale: 150 |
|
111 |
|
|
112 |
Advanced tab |
|
113 |
^^^^^^^^^^^^^^ |
|
114 |
|
|
115 |
- **ProviderName:** The provider name (internal use). |
|
116 |
- **Header:** In case the sheet doesn't have a header we can define it here. We have to type the name of the fields separated by a comma. |
|
117 |
- **Field types:** The is useful if we want to force the program to load the table with a specific field types. |
|
118 |
- **Automatic types detection:** This options is checked by default. It tryes to figure out what the field types are. |
|
119 |
- **Ignore errors:** This option forces the program to load the table even in case it finds erros. |
|
120 |
|
|
121 |
| |
|
122 |
|
|
123 |
.. image:: Selection_097.png |
|
124 |
:align: center |
|
125 |
:scale: 150 |
|
126 |
|
|
127 |
Once all the needed parameters have been set up click on “Accept” and finally on “Ok”. If everything worked fine the layer should appear in the view. |
|
128 |
|
|
129 |
| |
|
130 |
|
|
131 |
.. image:: Selection_098.png |
|
132 |
:align: center |
|
133 |
:scale: 150 |
|
134 |
|
|
135 |
Exporting a table to Excel spreadsheet format |
|
136 |
---------------------------------------------- |
|
137 |
|
|
138 |
(TODO) |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.app/org.gvsig.jexcel.app.mainplugin/src/main/resources-plugin/test1.txt | ||
---|---|---|
1 |
>>> from jxl import Workbook |
|
2 |
>>> Workbook.getWorkbook |
|
3 |
<java function getWorkbook 1> |
|
4 |
>>> from java.io import File |
|
5 |
>>> f=File("/home/usuario/datos/geodata/tables/torrent_4-es-excel2003.xls") |
|
6 |
>>> f.exists() |
|
7 |
1 |
|
8 |
>>> w=Workbook.getWorkbook(f) |
|
9 |
>>> dir(w) |
|
10 |
['XCTRecords', 'addInFunctionNames', 'buttonPropertySet', 'class', 'close', 'compoundFile', 'containsMacros', 'countryRecord', 'createWorkbook', 'drawingGroup', 'equals', 'externalSheetRecord', 'findByName', 'findCellByName', 'fonts', 'formattingRecords', 'getAddInFunctionNames', 'getButtonPropertySet', 'getCell', 'getClass', 'getCompoundFile', 'getCountryRecord', 'getDrawingGroup', 'getExternalSheetIndex', 'getExternalSheetName', 'getExternalSheetRecord', 'getFonts', 'getFormattingRecords', 'getIndex', 'getLastExternalSheetIndex', 'getLastExternalSheetName', 'getMsoDrawingGroupRecord', 'getName', 'getNameIndex', 'getNameRecords', 'getNumberOfSheets', 'getRangeNames', 'getReadSheet', 'getSettings', 'getSheet', 'getSheetNames', 'getSheets', 'getSupbookRecords', 'getVersion', 'getWorkbook', 'getWorkbookBof', 'getXCTRecords', 'hashCode', 'isProtected', 'msoDrawingGroupRecord', 'nameRecords', 'notify', 'notifyAll', 'numberOfSheets', 'protected', 'rangeNames', 'settings', 'sheetNames', 'sheets', 'supbookRecords', 'toString', 'wait', 'workbookBof'] |
|
11 |
>>> w.numberOfSheets |
|
12 |
1 |
|
13 |
>>> w.sheetNames |
|
14 |
array(java.lang.String,['Hoja1']) |
|
15 |
>>> w.sheets |
|
16 |
array(jxl.Sheet,[jxl.read.biff.SheetImpl@3a4f51e8]) |
|
17 |
>>> s=w.sheets[0] |
|
18 |
>>> s |
|
19 |
jxl.read.biff.SheetImpl@3a4f51e8 |
|
20 |
>>> dir(s) |
|
21 |
['PLS', 'autoFilter', 'buttonPropertySet', 'charts', 'class', 'columnInfos', 'columnPageBreaks', 'columns', 'conditionalFormats', 'dataValidation', 'drawingData', 'drawings', 'equals', 'findCell', 'findLabelCell', 'getAutoFilter', 'getButtonPropertySet', 'getCell', 'getCharts', 'getClass', 'getColumn', 'getColumnFormat', 'getColumnInfo', 'getColumnInfos', 'getColumnPageBreaks', 'getColumnView', 'getColumnWidth', 'getColumns', 'getConditionalFormats', 'getDataValidation', 'getDrawing', 'getDrawingData', 'getDrawings', 'getHyperlinks', 'getMaxColumnOutlineLevel', 'getMaxRowOutlineLevel', 'getMergedCells', 'getName', 'getNumberOfImages', 'getPLS', 'getRow', 'getRowHeight', 'getRowPageBreaks', 'getRowProperties', 'getRowView', 'getRows', 'getSettings', 'getSheetBof', 'getWorkbook', 'getWorkbookBof', 'getWorkspaceOptions', 'hashCode', 'hidden', 'hyperlinks', 'isHidden', 'isProtected', 'maxColumnOutlineLevel', 'maxRowOutlineLevel', 'mergedCells', 'name', 'notify', 'notifyAll', 'numberOfImages', 'protected', 'rowPageBreaks', 'rowProperties', 'rows', 'settings', 'sheetBof', 'toString', 'wait', 'workbook', 'workbookBof', 'workspaceOptions'] |
|
22 |
>>> |
|
23 |
>>> s.getRows() |
|
24 |
382 |
|
25 |
>>> s.columns |
|
26 |
5 |
|
27 |
>>> |
|
28 |
>>> c=s.getCell(0,0) |
|
29 |
>>> dir(c) |
|
30 |
['XFIndex', 'cellFeatures', 'cellFormat', 'class', 'column', 'contents', 'equals', 'getCellFeatures', 'getCellFormat', 'getClass', 'getColumn', 'getContents', 'getRow', 'getString', 'getType', 'getXFIndex', 'hashCode', 'hidden', 'isHidden', 'notify', 'notifyAll', 'row', 'setCellFeatures', 'string', 'toString', 'type', 'wait'] |
|
31 |
>>> |
|
32 |
>>> c.toString() |
|
33 |
'jxl.read.biff.LabelSSTRecord@14a614b5' |
|
34 |
>>> c.contents |
|
35 |
'B1' |
|
36 |
>>> |
|
37 |
>>> s.getCell(0,s.getRows()-1) |
|
38 |
jxl.read.biff.NumberValue@3e803098 |
|
39 |
>>> s.getCell(s.columns-1,s.getRows()-1) |
|
40 |
jxl.read.biff.LabelSSTRecord@56dc16be |
|
41 |
>>> s.getCell(s.columns-1,s.getRows()-1).contents |
|
42 |
'R' |
|
43 |
>>> |
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.app/org.gvsig.jexcel.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<libraries library-dir="lib/"/> |
|
4 |
<depends plugin-name="org.gvsig.app.mainplugin"/> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<extensions> |
|
7 |
<extension class-name="org.gvsig.andami.LibraryExtension" active="false"/> |
|
8 |
</extensions> |
|
9 |
</plugin-config> |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.app/org.gvsig.jexcel.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
<dependencySets> |
|
26 |
|
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
<includes> |
|
32 |
<include>net.sourceforge.jexcelapi:jxl</include> |
|
33 |
<include>org.gvsig:org.gvsig.jexcel.provider</include> |
|
34 |
</includes> |
|
35 |
</dependencySet> |
|
36 |
|
|
37 |
</dependencySets> |
|
38 |
|
|
39 |
</assembly> |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.app/org.gvsig.jexcel.app.mainplugin/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.jexcel.app.mainplugin</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<description>Excel file format support</description> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.jexcel.app</artifactId> |
|
11 |
<version>1.0.122</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
<dependencies> |
|
15 |
<dependency> |
|
16 |
<groupId>org.gvsig</groupId> |
|
17 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
18 |
<scope>compile</scope> |
|
19 |
</dependency> |
|
20 |
<dependency> |
|
21 |
<groupId>org.gvsig</groupId> |
|
22 |
<artifactId>org.gvsig.andami</artifactId> |
|
23 |
<scope>compile</scope> |
|
24 |
</dependency> |
|
25 |
<dependency> |
|
26 |
<groupId>org.gvsig</groupId> |
|
27 |
<artifactId>org.gvsig.jexcel.provider</artifactId> |
|
28 |
<scope>compile</scope> |
|
29 |
</dependency> |
|
30 |
|
|
31 |
<dependency> |
|
32 |
<groupId>net.sourceforge.jexcelapi</groupId> |
|
33 |
<artifactId>jxl</artifactId> |
|
34 |
<scope>compile</scope> |
|
35 |
</dependency> |
|
36 |
|
|
37 |
</dependencies> |
|
38 |
|
|
39 |
<properties> |
|
40 |
<!-- Package info property values --> |
|
41 |
<!-- Default values in org.gvsig.desktop --> |
|
42 |
<gvsig.package.info.name>Formats: Excel file format support</gvsig.package.info.name> |
|
43 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
44 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
45 |
<gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0-A</gvsig.package.info.dependencies> |
|
46 |
<gvsig.package.info.categories>Formats,Vector</gvsig.package.info.categories> |
|
47 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-jexcel/pool/</gvsig.package.info.poolURL> |
|
48 |
</properties> |
|
49 |
|
|
50 |
</project> |
|
0 | 51 |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.app/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.jexcel.app</artifactId> |
|
5 |
<packaging>pom</packaging> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.jexcel</artifactId> |
|
10 |
<version>1.0.122</version> |
|
11 |
</parent> |
|
12 |
|
|
13 |
<modules> |
|
14 |
<module>org.gvsig.jexcel.app.mainplugin</module> |
|
15 |
</modules> |
|
16 |
|
|
17 |
|
|
18 |
</project> |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.provider/src/main/java/org/gvsig/jexcel/dynformfield/sheet/JDynFormFieldExcelSheet.java | ||
---|---|---|
1 |
package org.gvsig.jexcel.dynformfield.sheet; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.List; |
|
5 |
import java.util.Locale; |
|
6 |
import java.util.Objects; |
|
7 |
import javax.swing.DefaultComboBoxModel; |
|
8 |
import org.apache.commons.lang3.StringUtils; |
|
9 |
import org.gvsig.jexcel.Spread; |
|
10 |
import org.gvsig.tools.dynform.DynFormFieldDefinition; |
|
11 |
import org.gvsig.tools.dynform.JDynForm; |
|
12 |
import org.gvsig.tools.dynform.JDynFormField; |
|
13 |
import org.gvsig.tools.dynform.services.dynformfield.Integer.JDynFormFieldInteger; |
|
14 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
|
15 |
import org.gvsig.tools.dynform.spi.dynformfield.JDynFormFieldFactory; |
|
16 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
public class JDynFormFieldExcelSheet extends JDynFormFieldInteger { |
|
21 |
|
|
22 |
private JDynFormFieldListener fileChangedListener; |
|
23 |
private DynObjectValueItem[] availableValues; |
|
24 |
private File lastSelectedFile; |
|
25 |
|
|
26 |
public JDynFormFieldExcelSheet( |
|
27 |
DynFormSPIManager serviceManager, |
|
28 |
DynFormSPIManager.ComponentsFactory componentsFactory, |
|
29 |
JDynFormFieldFactory factory, |
|
30 |
DynFormFieldDefinition definition, |
|
31 |
Object value |
|
32 |
) { |
|
33 |
super(serviceManager, componentsFactory, factory, definition, value); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public DynObjectValueItem[] getAvailableValues() { |
|
38 |
if( this.availableValues==null ) { |
|
39 |
// Forzamos a que muestre un dropdown, aunque este vacio |
|
40 |
// hasta que se seleccione un fichero. |
|
41 |
this.availableValues = new DynObjectValueItem[0]; |
|
42 |
} |
|
43 |
return availableValues; |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public void setValue(Object value) { |
|
48 |
this.addListenerToFile(); |
|
49 |
super.setValue(value); |
|
50 |
} |
|
51 |
|
|
52 |
public void addListenerToFile() { |
|
53 |
if( this.fileChangedListener!=null ) { |
|
54 |
return; |
|
55 |
} |
|
56 |
JDynForm form = this.getForm(); |
|
57 |
JDynFormField fileField = form.getField("file"); |
|
58 |
if( fileField == null ) { |
|
59 |
return; |
|
60 |
} |
|
61 |
JDynFormFieldListener listener = new JDynFormFieldListener() { |
|
62 |
|
|
63 |
@Override |
|
64 |
public void fieldEnter(JDynFormField field) { |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public void fieldExit(JDynFormField field) { |
|
69 |
} |
|
70 |
|
|
71 |
@Override |
|
72 |
public void fieldChanged(JDynFormField field) { |
|
73 |
doChangeFile(field); |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
public void message(JDynFormField field, String message) { |
|
78 |
} |
|
79 |
}; |
|
80 |
fileField.addListener(listener); |
|
81 |
this.fileChangedListener = listener; |
|
82 |
doChangeFile(fileField); |
|
83 |
} |
|
84 |
|
|
85 |
private Locale getLocale() { |
|
86 |
JDynForm form = this.getForm(); |
|
87 |
JDynFormField localeField = form.getField("locale"); |
|
88 |
Locale locale = Locale.getDefault(); |
|
89 |
String x = Objects.toString(localeField.getValue(),null); |
|
90 |
if( !StringUtils.isBlank(x) ) { |
|
91 |
locale = new Locale(x); |
|
92 |
} |
|
93 |
return locale; |
|
94 |
} |
|
95 |
|
|
96 |
protected DynObjectValueItem[] getAvailableSheets(File file) { |
|
97 |
try { |
|
98 |
if ( file == null ) { |
|
99 |
return null; |
|
100 |
} |
|
101 |
Spread spread = Spread.create(file); |
|
102 |
List<String> sheetNames = spread.getSheetNames(); |
|
103 |
DynObjectValueItem[] values = new DynObjectValueItem[sheetNames.size()]; |
|
104 |
for ( int i = 0; i < sheetNames.size(); i++ ) { |
|
105 |
values[i] = new DynObjectValueItem(i, sheetNames.get(i)); |
|
106 |
} |
|
107 |
return values; |
|
108 |
} catch (Exception ex) { |
|
109 |
LOGGER.warn("Can't retrieve the number of sheets.", ex); |
|
110 |
return null; |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
public void doChangeFile(JDynFormField field) { |
|
115 |
File currentFile = (File) field.getValue(); |
|
116 |
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
|
117 |
if( currentFile!=null ) { |
|
118 |
if( this.lastSelectedFile==null || currentFile.getPath().equals(this.lastSelectedFile.getPath())) { |
|
119 |
this.availableValues = this.getAvailableSheets(currentFile); |
|
120 |
if ( availableValues != null ) { |
|
121 |
for (DynObjectValueItem availableValue : availableValues) { |
|
122 |
model.addElement(availableValue); |
|
123 |
} |
|
124 |
} |
|
125 |
this.lastSelectedFile = currentFile; |
|
126 |
} |
|
127 |
} |
|
128 |
this.getDropDown().setModel(model); |
|
129 |
if ( model.getSize() > 0 ) { |
|
130 |
this.getDropDown().setSelectedIndex(0); |
|
131 |
this.fireFieldChangedEvent(); |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
} |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.provider/src/main/java/org/gvsig/jexcel/dynformfield/sheet/JDynFormFieldExcelSheetFactory.java | ||
---|---|---|
1 |
package org.gvsig.jexcel.dynformfield.sheet; |
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
import org.gvsig.jexcel.Spread; |
|
7 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
8 |
import org.gvsig.tools.dynform.DynFormFieldDefinition; |
|
9 |
import org.gvsig.tools.dynform.JDynFormField; |
|
10 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
|
11 |
import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldFactory; |
|
12 |
import org.gvsig.tools.dynform.spi.dynformfield.JDynFormFieldFactory; |
|
13 |
|
|
14 |
public class JDynFormFieldExcelSheetFactory |
|
15 |
extends AbstractJDynFormFieldFactory |
|
16 |
implements JDynFormFieldFactory |
|
17 |
{ |
|
18 |
public JDynFormFieldExcelSheetFactory() { |
|
19 |
super(Spread.NAME+".sheet", DataTypes.INT); |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
public JDynFormField create( |
|
24 |
DynFormSPIManager serviceManager, |
|
25 |
DynFormSPIManager.ComponentsFactory componentsFactory, |
|
26 |
DynFormFieldDefinition fieldDefinition, |
|
27 |
Object value |
|
28 |
) { |
|
29 |
return new JDynFormFieldExcelSheet(serviceManager, componentsFactory, this, fieldDefinition, value); |
|
30 |
} |
|
31 |
} |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.provider/src/main/java/org/gvsig/jexcel/dynformfield/point/PointFieldsSelectorView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">/home/jjdelcerro/datos/devel/org.gvsig.ods/org.gvsig.ods.provider/src/main/java/org/gvsig/ods/dynformfield/odspointfields/PointFieldsSelectorView.xml</at> |
|
28 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at> |
|
29 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at> |
|
30 |
<at name="components"> |
|
31 |
<object classname="java.util.LinkedList"> |
|
32 |
<item > |
|
33 |
<at name="value"> |
|
34 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
35 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
36 |
<at name="cellconstraints"> |
|
37 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
38 |
<at name="column">4</at> |
|
39 |
<at name="row">4</at> |
|
40 |
<at name="colspan">1</at> |
|
41 |
<at name="rowspan">1</at> |
|
42 |
<at name="halign">default</at> |
|
43 |
<at name="valign">default</at> |
|
44 |
<at name="insets" object="insets">0,0,0,0</at> |
|
45 |
</object> |
|
46 |
</at> |
|
47 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
48 |
</super> |
|
49 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
50 |
<at name="beanclass">javax.swing.JComboBox</at> |
|
51 |
<at name="beanproperties"> |
|
52 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
53 |
<at name="classname">javax.swing.JComboBox</at> |
|
54 |
<at name="properties"> |
|
55 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
56 |
<at name="border"> |
|
57 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
58 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
59 |
<at name="name">border</at> |
|
60 |
</super> |
|
61 |
<at name="borders"> |
|
62 |
<object classname="java.util.LinkedList"> |
|
63 |
<item > |
|
64 |
<at name="value"> |
|
65 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
66 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
67 |
<at name="name">border</at> |
|
68 |
</super> |
|
69 |
</object> |
|
70 |
</at> |
|
71 |
</item> |
|
72 |
</object> |
|
73 |
</at> |
|
74 |
</object> |
|
75 |
</at> |
|
76 |
<at name="name">cboX</at> |
|
77 |
<at name="width">906</at> |
|
78 |
<at name="items"> |
|
79 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
80 |
<at name="name">items</at> |
|
81 |
</object> |
|
82 |
</at> |
|
83 |
<at name="height">20</at> |
|
84 |
</object> |
|
85 |
</at> |
|
86 |
</object> |
|
87 |
</at> |
|
88 |
</object> |
|
89 |
</at> |
|
90 |
</item> |
|
91 |
<item > |
|
92 |
<at name="value"> |
|
93 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
94 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
95 |
<at name="cellconstraints"> |
|
96 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
97 |
<at name="column">4</at> |
|
98 |
<at name="row">6</at> |
|
99 |
<at name="colspan">1</at> |
|
100 |
<at name="rowspan">1</at> |
|
101 |
<at name="halign">default</at> |
|
102 |
<at name="valign">default</at> |
|
103 |
<at name="insets" object="insets">0,0,0,0</at> |
|
104 |
</object> |
|
105 |
</at> |
|
106 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
107 |
</super> |
|
108 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
109 |
<at name="beanclass">javax.swing.JComboBox</at> |
|
110 |
<at name="beanproperties"> |
|
111 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
112 |
<at name="classname">javax.swing.JComboBox</at> |
|
113 |
<at name="properties"> |
|
114 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
115 |
<at name="border"> |
|
116 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
117 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
118 |
<at name="name">border</at> |
|
119 |
</super> |
|
120 |
<at name="borders"> |
|
121 |
<object classname="java.util.LinkedList"> |
|
122 |
<item > |
|
123 |
<at name="value"> |
|
124 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
125 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
126 |
<at name="name">border</at> |
|
127 |
</super> |
|
128 |
</object> |
|
129 |
</at> |
|
130 |
</item> |
|
131 |
</object> |
|
132 |
</at> |
|
133 |
</object> |
|
134 |
</at> |
|
135 |
<at name="name">cboY</at> |
|
136 |
<at name="width">906</at> |
|
137 |
<at name="items"> |
|
138 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
139 |
<at name="name">items</at> |
|
140 |
</object> |
|
141 |
</at> |
|
142 |
<at name="height">20</at> |
|
143 |
</object> |
|
144 |
</at> |
|
145 |
</object> |
|
146 |
</at> |
|
147 |
</object> |
|
148 |
</at> |
|
149 |
</item> |
|
150 |
<item > |
|
151 |
<at name="value"> |
|
152 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
153 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
154 |
<at name="cellconstraints"> |
|
155 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
156 |
<at name="column">4</at> |
|
157 |
<at name="row">8</at> |
|
158 |
<at name="colspan">1</at> |
|
159 |
<at name="rowspan">1</at> |
|
160 |
<at name="halign">default</at> |
|
161 |
<at name="valign">default</at> |
|
162 |
<at name="insets" object="insets">0,0,0,0</at> |
|
163 |
</object> |
|
164 |
</at> |
|
165 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
166 |
</super> |
|
167 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
168 |
<at name="beanclass">javax.swing.JComboBox</at> |
|
169 |
<at name="beanproperties"> |
|
170 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
171 |
<at name="classname">javax.swing.JComboBox</at> |
|
172 |
<at name="properties"> |
|
173 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
174 |
<at name="border"> |
|
175 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
176 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
177 |
<at name="name">border</at> |
|
178 |
</super> |
|
179 |
<at name="borders"> |
|
180 |
<object classname="java.util.LinkedList"> |
|
181 |
<item > |
|
182 |
<at name="value"> |
|
183 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
184 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
185 |
<at name="name">border</at> |
|
186 |
</super> |
|
187 |
</object> |
|
188 |
</at> |
|
189 |
</item> |
|
190 |
</object> |
|
191 |
</at> |
|
192 |
</object> |
|
193 |
</at> |
|
194 |
<at name="name">cboZ</at> |
|
195 |
<at name="width">906</at> |
|
196 |
<at name="items"> |
|
197 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
198 |
<at name="name">items</at> |
|
199 |
</object> |
|
200 |
</at> |
|
201 |
<at name="height">20</at> |
|
202 |
</object> |
|
203 |
</at> |
|
204 |
</object> |
|
205 |
</at> |
|
206 |
</object> |
|
207 |
</at> |
|
208 |
</item> |
|
209 |
<item > |
|
210 |
<at name="value"> |
|
211 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
212 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
213 |
<at name="cellconstraints"> |
|
214 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
215 |
<at name="column">2</at> |
|
216 |
<at name="row">4</at> |
|
217 |
<at name="colspan">1</at> |
|
218 |
<at name="rowspan">1</at> |
|
219 |
<at name="halign">default</at> |
|
220 |
<at name="valign">default</at> |
|
221 |
<at name="insets" object="insets">0,0,0,0</at> |
|
222 |
</object> |
|
223 |
</at> |
|
224 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
225 |
</super> |
|
226 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
227 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
228 |
<at name="beanproperties"> |
|
229 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
230 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
231 |
<at name="properties"> |
|
232 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
233 |
<at name="border"> |
|
234 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
235 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
236 |
<at name="name">border</at> |
|
237 |
</super> |
|
238 |
<at name="borders"> |
|
239 |
<object classname="java.util.LinkedList"> |
|
240 |
<item > |
|
241 |
<at name="value"> |
|
242 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
243 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
244 |
<at name="name">border</at> |
|
245 |
</super> |
|
246 |
</object> |
|
247 |
</at> |
|
248 |
</item> |
|
249 |
</object> |
|
250 |
</at> |
|
251 |
</object> |
|
252 |
</at> |
|
253 |
<at name="name">lblX</at> |
|
254 |
<at name="width">12</at> |
|
255 |
<at name="text">X</at> |
|
256 |
<at name="fill"> |
|
257 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
258 |
<at name="name">fill</at> |
|
259 |
</object> |
|
260 |
</at> |
|
261 |
<at name="height">14</at> |
|
262 |
</object> |
|
263 |
</at> |
|
264 |
</object> |
|
265 |
</at> |
|
266 |
</object> |
|
267 |
</at> |
|
268 |
</item> |
|
269 |
<item > |
|
270 |
<at name="value"> |
|
271 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
272 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
273 |
<at name="cellconstraints"> |
|
274 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
275 |
<at name="column">2</at> |
|
276 |
<at name="row">6</at> |
|
277 |
<at name="colspan">1</at> |
|
278 |
<at name="rowspan">1</at> |
|
279 |
<at name="halign">default</at> |
|
280 |
<at name="valign">default</at> |
|
281 |
<at name="insets" object="insets">0,0,0,0</at> |
|
282 |
</object> |
|
283 |
</at> |
|
284 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
285 |
</super> |
|
286 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
287 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
288 |
<at name="beanproperties"> |
|
289 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
290 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
291 |
<at name="properties"> |
|
292 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
293 |
<at name="border"> |
|
294 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
295 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
296 |
<at name="name">border</at> |
|
297 |
</super> |
|
298 |
<at name="borders"> |
|
299 |
<object classname="java.util.LinkedList"> |
|
300 |
<item > |
|
301 |
<at name="value"> |
|
302 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
303 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
304 |
<at name="name">border</at> |
|
305 |
</super> |
|
306 |
</object> |
|
307 |
</at> |
|
308 |
</item> |
|
309 |
</object> |
|
310 |
</at> |
|
311 |
</object> |
|
312 |
</at> |
|
313 |
<at name="name">lblY</at> |
|
314 |
<at name="width">12</at> |
|
315 |
<at name="text">Y</at> |
|
316 |
<at name="fill"> |
|
317 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
318 |
<at name="name">fill</at> |
|
319 |
</object> |
|
320 |
</at> |
|
321 |
<at name="height">14</at> |
|
322 |
</object> |
|
323 |
</at> |
|
324 |
</object> |
|
325 |
</at> |
|
326 |
</object> |
|
327 |
</at> |
|
328 |
</item> |
|
329 |
<item > |
|
330 |
<at name="value"> |
|
331 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
332 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
333 |
<at name="cellconstraints"> |
|
334 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
335 |
<at name="column">2</at> |
|
336 |
<at name="row">8</at> |
|
337 |
<at name="colspan">1</at> |
|
338 |
<at name="rowspan">1</at> |
|
339 |
<at name="halign">default</at> |
|
340 |
<at name="valign">default</at> |
|
341 |
<at name="insets" object="insets">0,0,0,0</at> |
|
342 |
</object> |
|
343 |
</at> |
|
344 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
345 |
</super> |
|
346 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
347 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
348 |
<at name="beanproperties"> |
|
349 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
350 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
351 |
<at name="properties"> |
|
352 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
353 |
<at name="border"> |
|
354 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
355 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
356 |
<at name="name">border</at> |
|
357 |
</super> |
|
358 |
<at name="borders"> |
|
359 |
<object classname="java.util.LinkedList"> |
|
360 |
<item > |
|
361 |
<at name="value"> |
|
362 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
363 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
364 |
<at name="name">border</at> |
|
365 |
</super> |
|
366 |
</object> |
|
367 |
</at> |
|
368 |
</item> |
|
369 |
</object> |
|
370 |
</at> |
|
371 |
</object> |
|
372 |
</at> |
|
373 |
<at name="name">lblZ</at> |
|
374 |
<at name="width">12</at> |
|
375 |
<at name="text">Z</at> |
|
376 |
<at name="fill"> |
|
377 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
378 |
<at name="name">fill</at> |
|
379 |
</object> |
|
380 |
</at> |
|
381 |
<at name="height">14</at> |
|
382 |
</object> |
|
383 |
</at> |
|
384 |
</object> |
|
385 |
</at> |
|
386 |
</object> |
|
387 |
</at> |
|
388 |
</item> |
|
389 |
<item > |
|
390 |
<at name="value"> |
|
391 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
392 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
393 |
<at name="cellconstraints"> |
|
394 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
395 |
<at name="column">2</at> |
|
396 |
<at name="row">2</at> |
|
397 |
<at name="colspan">3</at> |
|
398 |
<at name="rowspan">1</at> |
|
399 |
<at name="halign">default</at> |
|
400 |
<at name="valign">default</at> |
|
401 |
<at name="insets" object="insets">0,0,0,0</at> |
|
402 |
</object> |
|
403 |
</at> |
|
404 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
405 |
</super> |
|
406 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
407 |
<at name="beanclass">javax.swing.JTextField</at> |
|
408 |
<at name="beanproperties"> |
|
409 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
410 |
<at name="classname">javax.swing.JTextField</at> |
|
411 |
<at name="properties"> |
|
412 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
413 |
<at name="border"> |
|
414 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
415 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
416 |
<at name="name">border</at> |
|
417 |
</super> |
|
418 |
<at name="borders"> |
|
419 |
<object classname="java.util.LinkedList"> |
|
420 |
<item > |
|
421 |
<at name="value"> |
|
422 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
423 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
424 |
<at name="name">border</at> |
|
425 |
</super> |
|
426 |
</object> |
|
427 |
</at> |
|
428 |
</item> |
|
429 |
</object> |
|
430 |
</at> |
|
431 |
</object> |
|
432 |
</at> |
|
433 |
<at name="name">txtXYZ</at> |
|
434 |
<at name="width">929</at> |
|
435 |
<at name="height">20</at> |
|
436 |
</object> |
|
437 |
</at> |
|
438 |
</object> |
|
439 |
</at> |
|
440 |
</object> |
|
441 |
</at> |
|
442 |
</item> |
|
443 |
</object> |
|
444 |
</at> |
|
445 |
<at name="properties"> |
|
446 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
447 |
<at name="classname">com.jeta.forms.gui.form.GridView</at> |
|
448 |
<at name="properties"> |
|
449 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
450 |
<at name="border"> |
|
451 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
452 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
453 |
<at name="name">border</at> |
|
454 |
</super> |
|
455 |
<at name="borders"> |
|
456 |
<object classname="java.util.LinkedList"/> |
|
457 |
</at> |
|
458 |
</object> |
|
459 |
</at> |
|
460 |
<at name="name"></at> |
|
461 |
<at name="fill"> |
|
462 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
463 |
<at name="name">fill</at> |
|
464 |
</object> |
|
465 |
</at> |
|
466 |
<at name="scollBars"> |
|
467 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
468 |
<at name="name">scollBars</at> |
|
469 |
<at name="verticalpolicy">21</at> |
|
470 |
<at name="horizontalpolicy">31</at> |
|
471 |
<at name="border"> |
|
472 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
473 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
474 |
<at name="name">border</at> |
|
475 |
</super> |
|
476 |
<at name="borders"> |
|
477 |
<object classname="java.util.LinkedList"> |
|
478 |
<item > |
|
479 |
<at name="value"> |
|
480 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
481 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
482 |
<at name="name">border</at> |
|
483 |
</super> |
|
484 |
</object> |
|
485 |
</at> |
|
486 |
</item> |
|
487 |
</object> |
|
488 |
</at> |
|
489 |
</object> |
|
490 |
</at> |
|
491 |
</object> |
|
492 |
</at> |
|
493 |
</object> |
|
494 |
</at> |
|
495 |
</object> |
|
496 |
</at> |
|
497 |
<at name="cellpainters"> |
|
498 |
<object classname="com.jeta.forms.store.support.Matrix"> |
|
499 |
<at name="rows"> |
|
500 |
<object classname="[Ljava.lang.Object;" size="9"> |
|
501 |
<at name="item" index="0"> |
|
502 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
503 |
</at> |
|
504 |
<at name="item" index="1"> |
|
505 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
506 |
</at> |
|
507 |
<at name="item" index="2"> |
|
508 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
509 |
</at> |
|
510 |
<at name="item" index="3"> |
|
511 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
512 |
</at> |
|
513 |
<at name="item" index="4"> |
|
514 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
515 |
</at> |
|
516 |
<at name="item" index="5"> |
|
517 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
518 |
</at> |
|
519 |
<at name="item" index="6"> |
|
520 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
521 |
</at> |
|
522 |
<at name="item" index="7"> |
|
523 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
524 |
</at> |
|
525 |
<at name="item" index="8"> |
|
526 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
527 |
</at> |
|
528 |
</object> |
|
529 |
</at> |
|
530 |
</object> |
|
531 |
</at> |
|
532 |
<at name="rowgroups"> |
|
533 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
534 |
<at name="groups"> |
|
535 |
<object classname="java.util.HashMap"/> |
|
536 |
</at> |
|
537 |
</object> |
|
538 |
</at> |
|
539 |
<at name="colgroups"> |
|
540 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
541 |
<at name="groups"> |
|
542 |
<object classname="java.util.HashMap"/> |
|
543 |
</at> |
|
544 |
</object> |
|
545 |
</at> |
|
546 |
</object> |
|
547 |
</at> |
|
548 |
</object> |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.provider/src/main/java/org/gvsig/jexcel/dynformfield/point/PointFieldsSelectorView.java | ||
---|---|---|
1 |
package org.gvsig.jexcel.dynformfield.point; |
|
2 |
|
|
3 |
import com.jeta.open.i18n.I18NUtils; |
|
4 |
import com.jgoodies.forms.layout.CellConstraints; |
|
5 |
import com.jgoodies.forms.layout.FormLayout; |
|
6 |
import java.awt.BorderLayout; |
|
7 |
import java.awt.ComponentOrientation; |
|
8 |
import java.awt.Container; |
|
9 |
import java.awt.Dimension; |
|
10 |
import javax.swing.Box; |
|
11 |
import javax.swing.ImageIcon; |
|
12 |
import javax.swing.JComboBox; |
|
13 |
import javax.swing.JFrame; |
|
14 |
import javax.swing.JLabel; |
|
15 |
import javax.swing.JPanel; |
|
16 |
import javax.swing.JTextField; |
|
17 |
|
|
18 |
|
|
19 |
public class PointFieldsSelectorView extends JPanel |
|
20 |
{ |
|
21 |
JComboBox cboX = new JComboBox(); |
|
22 |
JComboBox cboY = new JComboBox(); |
|
23 |
JComboBox cboZ = new JComboBox(); |
|
24 |
JLabel lblX = new JLabel(); |
|
25 |
JLabel lblY = new JLabel(); |
|
26 |
JLabel lblZ = new JLabel(); |
|
27 |
JTextField txtXYZ = new JTextField(); |
|
28 |
|
|
29 |
/** |
|
30 |
* Default constructor |
|
31 |
*/ |
|
32 |
public PointFieldsSelectorView() |
|
33 |
{ |
|
34 |
initializePanel(); |
|
35 |
} |
|
36 |
|
|
37 |
/** |
|
38 |
* Adds fill components to empty cells in the first row and first column of the grid. |
|
39 |
* This ensures that the grid spacing will be the same as shown in the designer. |
|
40 |
* @param cols an array of column indices in the first row where fill components should be added. |
|
41 |
* @param rows an array of row indices in the first column where fill components should be added. |
|
42 |
*/ |
|
43 |
void addFillComponents( Container panel, int[] cols, int[] rows ) |
|
44 |
{ |
|
45 |
Dimension filler = new Dimension(10,10); |
|
46 |
|
|
47 |
boolean filled_cell_11 = false; |
|
48 |
CellConstraints cc = new CellConstraints(); |
|
49 |
if ( cols.length > 0 && rows.length > 0 ) |
|
50 |
{ |
|
51 |
if ( cols[0] == 1 && rows[0] == 1 ) |
|
52 |
{ |
|
53 |
/** add a rigid area */ |
|
54 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); |
|
55 |
filled_cell_11 = true; |
|
56 |
} |
|
57 |
} |
|
58 |
|
|
59 |
for( int index = 0; index < cols.length; index++ ) |
|
60 |
{ |
|
61 |
if ( cols[index] == 1 && filled_cell_11 ) |
|
62 |
{ |
|
63 |
continue; |
|
64 |
} |
|
65 |
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); |
|
66 |
} |
|
67 |
|
|
68 |
for( int index = 0; index < rows.length; index++ ) |
|
69 |
{ |
|
70 |
if ( rows[index] == 1 && filled_cell_11 ) |
|
71 |
{ |
|
72 |
continue; |
|
73 |
} |
|
74 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); |
|
75 |
} |
|
76 |
|
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Helper method to load an image file from the CLASSPATH |
|
81 |
* @param imageName the package and name of the file to load relative to the CLASSPATH |
|
82 |
* @return an ImageIcon instance with the specified image file |
|
83 |
* @throws IllegalArgumentException if the image resource cannot be loaded. |
|
84 |
*/ |
|
85 |
public ImageIcon loadImage( String imageName ) |
|
86 |
{ |
|
87 |
try |
|
88 |
{ |
|
89 |
ClassLoader classloader = getClass().getClassLoader(); |
|
90 |
java.net.URL url = classloader.getResource( imageName ); |
|
91 |
if ( url != null ) |
|
92 |
{ |
|
93 |
ImageIcon icon = new ImageIcon( url ); |
|
94 |
return icon; |
|
95 |
} |
|
96 |
} |
|
97 |
catch( Exception e ) |
|
98 |
{ |
|
99 |
e.printStackTrace(); |
|
100 |
} |
|
101 |
throw new IllegalArgumentException( "Unable to load image: " + imageName ); |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* Method for recalculating the component orientation for |
|
106 |
* right-to-left Locales. |
|
107 |
* @param orientation the component orientation to be applied |
|
108 |
*/ |
|
109 |
public void applyComponentOrientation( ComponentOrientation orientation ) |
|
110 |
{ |
|
111 |
// Not yet implemented... |
|
112 |
// I18NUtils.applyComponentOrientation(this, orientation); |
|
113 |
super.applyComponentOrientation(orientation); |
|
114 |
} |
|
115 |
|
|
116 |
public JPanel createPanel() |
|
117 |
{ |
|
118 |
JPanel jpanel1 = new JPanel(); |
|
119 |
FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE","CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE"); |
|
120 |
CellConstraints cc = new CellConstraints(); |
|
121 |
jpanel1.setLayout(formlayout1); |
|
122 |
|
|
123 |
cboX.setName("cboX"); |
|
124 |
jpanel1.add(cboX,cc.xy(4,4)); |
|
125 |
|
|
126 |
cboY.setName("cboY"); |
|
127 |
jpanel1.add(cboY,cc.xy(4,6)); |
|
128 |
|
|
129 |
cboZ.setName("cboZ"); |
|
130 |
jpanel1.add(cboZ,cc.xy(4,8)); |
|
131 |
|
|
132 |
lblX.setName("lblX"); |
|
133 |
lblX.setText("X"); |
|
134 |
jpanel1.add(lblX,cc.xy(2,4)); |
|
135 |
|
|
136 |
lblY.setName("lblY"); |
|
137 |
lblY.setText("Y"); |
|
138 |
jpanel1.add(lblY,cc.xy(2,6)); |
|
139 |
|
|
140 |
lblZ.setName("lblZ"); |
|
141 |
lblZ.setText("Z"); |
|
142 |
jpanel1.add(lblZ,cc.xy(2,8)); |
|
143 |
|
|
144 |
txtXYZ.setName("txtXYZ"); |
|
145 |
jpanel1.add(txtXYZ,cc.xywh(2,2,3,1)); |
|
146 |
|
|
147 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9 }); |
|
148 |
return jpanel1; |
|
149 |
} |
|
150 |
|
|
151 |
/** |
|
152 |
* Initializer |
|
153 |
*/ |
|
154 |
protected void initializePanel() |
|
155 |
{ |
|
156 |
setLayout(new BorderLayout()); |
|
157 |
add(createPanel(), BorderLayout.CENTER); |
|
158 |
} |
|
159 |
|
|
160 |
|
|
161 |
} |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.122/org.gvsig.jexcel.provider/src/main/java/org/gvsig/jexcel/dynformfield/point/JDynFormFieldExcelPointFields.java | ||
---|---|---|
1 |
package org.gvsig.jexcel.dynformfield.point; |
|
2 |
|
|
3 |
import java.awt.Cursor; |
|
4 |
import java.io.File; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Locale; |
|
7 |
import java.util.Objects; |
|
8 |
import java.util.concurrent.LinkedBlockingDeque; |
|
9 |
import javax.swing.SwingUtilities; |
|
10 |
import org.apache.commons.lang3.ObjectUtils; |
|
11 |
import org.apache.commons.lang3.StringUtils; |
|
12 |
import org.gvsig.jexcel.Spread; |
|
13 |
import org.gvsig.jexcel.Spread.Sheet; |
|
14 |
import org.gvsig.tools.dynform.DynFormFieldDefinition; |
|
15 |
import org.gvsig.tools.dynform.JDynForm; |
|
16 |
import org.gvsig.tools.dynform.JDynFormField; |
|
17 |
import org.gvsig.tools.dynform.JDynFormField.JDynFormFieldListener; |
|
18 |
import org.gvsig.tools.dynform.services.dynformfield.String.JDynFormFieldString; |
|
19 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
|
20 |
import org.gvsig.tools.dynform.spi.dynformfield.JDynFormFieldFactory; |
|
21 |
import org.gvsig.tools.task.CancellableTask; |
|
22 |
|
|
23 |
@SuppressWarnings("UseSpecificCatch") |
|
24 |
public class JDynFormFieldExcelPointFields extends JDynFormFieldString { |
|
25 |
|
|
26 |
private interface Task extends Runnable, CancellableTask { |
|
27 |
|
|
28 |
} |
|
29 |
|
|
30 |
private static class TaskList extends Thread { |
|
31 |
|
|
32 |
private final LinkedBlockingDeque<Task> tasks; |
|
33 |
|
|
34 |
public TaskList() { |
|
35 |
super(Spread.NAME + "PointFields-tasklist"); |
|
36 |
this.tasks = new LinkedBlockingDeque<>(); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public void run() { |
|
41 |
while (true) { |
|
42 |
Task task = null; |
|
43 |
try { |
|
44 |
task = this.tasks.take(); |
|
45 |
if (!task.isCancellationRequested()) { |
|
46 |
task.run(); |
|
47 |
} |
Also available in: Unified diff