Revision 689
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.98/org.gvsig.jexcel.provider/src/main/resources/org/gvsig/jexcel/dal/provider/JExcelMetadata.xml | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
Definitions of metadata fields of a shp file. |
|
4 |
--> |
|
5 |
<definitions> |
|
6 |
<version>1.0.0</version> |
|
7 |
<classes> |
|
8 |
|
|
9 |
<class name="JExcel" namespace="Metadata"> |
|
10 |
<extends> |
|
11 |
<class namespace="Metadata" name="SpatialProvider"/> |
|
12 |
</extends> |
|
13 |
<description>Metadata of a JExcel store</description> |
|
14 |
<fields> |
|
15 |
</fields> |
|
16 |
</class> |
|
17 |
|
|
18 |
</classes> |
|
19 |
</definitions> |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.98/org.gvsig.jexcel.provider/src/main/resources/org/gvsig/jexcel/dal/provider/JExcelParameters.xml | ||
---|---|---|
1 |
<?xml version= "1.0 "?> |
|
2 |
<definitions> |
|
3 |
<version>1.0.0</version> |
|
4 |
<classes> |
|
5 |
<class name="JExcel"> |
|
6 |
<extends> |
|
7 |
<class namespace="dal" name="ProviderParameters"/> |
|
8 |
</extends> |
|
9 |
<description>Store the parameters need to open a Excel file</description> |
|
10 |
<fields> |
|
11 |
<field name="file" label="File" type="file" mandatory="true"> |
|
12 |
<description>Excel file</description> |
|
13 |
</field> |
|
14 |
<field name="locale" label="Locale" type="string" mandatory="true" defaultValue="DEFAULT"> |
|
15 |
<description>Locale used to parse double and float values (BCP47 language tag representing the locale)</description> |
|
16 |
<availableValues> |
|
17 |
<value label="Default (use system locale)">DEFAULT</value> |
|
18 |
<value label="Canada (english)">en-CA</value> |
|
19 |
<value label="Canada (french)">fr-CA</value> |
|
20 |
<value label="Chinese">zh</value> |
|
21 |
<value label="English">en</value> |
|
22 |
<value label="French">fr</value> |
|
23 |
<value label="German">de</value> |
|
24 |
<value label="Italian">it</value> |
|
25 |
<value label="Japanese">ja</value> |
|
26 |
<value label="Korea">ko</value> |
|
27 |
<value label="Spain">es</value> |
|
28 |
<value label="Uk">en-GB</value> |
|
29 |
<value label="Us">en-US</value> |
|
30 |
</availableValues> |
|
31 |
</field> |
|
32 |
<field name="sheet" label="Sheet to load" type="integer" subtype="jexcel.sheet.selector" mandatory="false" defaultValue="0"> |
|
33 |
<description>Sheet to use.</description> |
|
34 |
</field> |
|
35 |
<field name="isFirstRowHeadeer" label="Use first row as header" type="boolean" mandatory="false" defaultValue="false"> |
|
36 |
<description>Check for use first row as header.</description> |
|
37 |
</field> |
|
38 |
<field name="CRS" type="crs" mandatory="false"> |
|
39 |
<description>The coordinate reference system used when use the point parameter to generate a layer</description> |
|
40 |
</field> |
|
41 |
<field name="point" label="Point (X,Y,Z)" type="string" mandatory="false" defaultValue="" > |
|
42 |
<description>This field allow to add a Geometry column to the table. It is a list of field names separated by commas used as dimensions for the attribute GEOM of type point to add to the table.</description> |
|
43 |
</field> |
|
44 |
|
|
45 |
<field name="header" label="Header" type="string" mandatory="false" defaultValue="" group="Advanced"> |
|
46 |
<description>The header or empty if parsed automatically</description> |
|
47 |
</field> |
|
48 |
<field name="fieldtypes" label="Field types" type="string" mandatory="false" defaultValue="" group="Advanced"> |
|
49 |
<description>Comma separated list of field types. If empty strings are assumed (Eg: integer,string,double,boolean,float,geometry).</description> |
|
50 |
</field> |
|
51 |
<field name="automaticTypesDetection" label="Automatic types detection" type="boolean" mandatory="false" defaultValue="true" group="Advanced"> |
|
52 |
<description>This flag activate the autodetection of types in the CSV. Can be slow.</description> |
|
53 |
</field> |
|
54 |
<field name="ignoreErrors" label="Ignore errors" type="boolean" mandatory="false" defaultValue="false" group="Advanced"> |
|
55 |
<description>Set to true to ignore errors during load of data.</description> |
|
56 |
</field> |
|
57 |
</fields> |
|
58 |
|
|
59 |
</class> |
|
60 |
</classes> |
|
61 |
</definitions> |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.98/org.gvsig.jexcel.provider/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.jexcel.JExcelLibrary |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.98/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.98/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.98/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.98/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 |
} |
|
48 |
} catch (Exception ex) { |
|
49 |
LOGGER.warn("Problems processing task (" + (task == null ? "null" : task.hashCode()) + ")", ex); |
|
50 |
} |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
public void add(Task task) { |
|
55 |
if( !this.isAlive() ) { |
|
56 |
this.start(); |
|
57 |
} |
|
58 |
this.tasks.add(task); |
|
59 |
} |
|
60 |
|
|
61 |
public void cancelAll() { |
|
62 |
for (Task task : tasks) { |
|
63 |
task.cancelRequest(); |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
} |
|
68 |
|
|
69 |
private class TaskUpdateAvailbleFields implements Task { |
|
70 |
|
|
71 |
private final File spreadFile; |
|
72 |
private final int sheetIndex; |
|
73 |
private final boolean isFirstRowHeader; |
|
74 |
private boolean cancelled; |
|
75 |
private Locale locale; |
|
76 |
|
|
77 |
public TaskUpdateAvailbleFields(File spreadFile, int sheetIndex, boolean isFirstRowHeader, Locale locale) { |
|
78 |
this.spreadFile = spreadFile; |
|
79 |
this.isFirstRowHeader = isFirstRowHeader; |
|
80 |
this.sheetIndex = sheetIndex; |
|
81 |
this.cancelled = false; |
|
82 |
this.locale = locale; |
|
83 |
} |
|
84 |
|
|
85 |
@Override |
|
86 |
public void run() { |
|
87 |
Cursor save_cursor = pointFieldsSelector.getCursor(); |
|
88 |
try { |
|
89 |
pointFieldsSelector.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
|
90 |
Sheet sheet = getSheet(spreadFile, locale, sheetIndex); |
|
91 |
if (sheet != null) { |
|
92 |
final List<String> columnNames = sheet.getColumnNames(isFirstRowHeader); |
|
93 |
SwingUtilities.invokeLater(new Runnable() { |
|
94 |
@Override |
|
95 |
public void run() { |
|
96 |
if (!cancelled) { |
|
97 |
pointFieldsSelector.setAvailableFields(columnNames); |
|
98 |
if (pointFieldsSelector.isEmpty()) { |
|
99 |
pointFieldsSelector.detect(); |
|
100 |
} |
|
101 |
} |
|
102 |
} |
|
103 |
}); |
|
104 |
} |
|
105 |
} finally { |
|
106 |
pointFieldsSelector.setCursor(save_cursor); |
|
107 |
} |
|
108 |
} |
|
109 |
|
|
110 |
@Override |
|
111 |
public boolean isCancellationRequested() { |
|
112 |
return this.cancelled; |
|
113 |
} |
|
114 |
|
|
115 |
@Override |
|
116 |
public void cancelRequest() { |
|
117 |
this.cancelled = true; |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
121 |
private JDynFormFieldListener updateSelectorListener; |
|
122 |
private PointFieldsSelector pointFieldsSelector = null; |
|
123 |
private Sheet currentSheet; |
|
124 |
private final TaskList tasks; |
|
125 |
|
|
126 |
public JDynFormFieldExcelPointFields( |
|
127 |
DynFormSPIManager serviceManager, |
|
128 |
DynFormSPIManager.ComponentsFactory componentsFactory, |
|
129 |
JDynFormFieldFactory factory, |
|
130 |
DynFormFieldDefinition definition, |
|
131 |
Object value |
|
132 |
) { |
|
133 |
super(serviceManager, componentsFactory, factory, definition, value); |
|
134 |
this.tasks = new TaskList(); |
|
135 |
} |
|
136 |
|
|
137 |
@Override |
|
138 |
public void initComponent() { |
|
139 |
this.pointFieldsSelector = new PointFieldsSelector(); |
|
140 |
if (this.getDefinition().isReadOnly()) { |
|
141 |
this.pointFieldsSelector.setEnabled(false); |
|
142 |
} |
|
143 |
this.addListenerToFields(); |
|
144 |
this.contents = this.pointFieldsSelector; |
|
145 |
} |
|
146 |
|
|
147 |
@Override |
|
148 |
public void setValue(Object value) { |
|
149 |
this.pointFieldsSelector.setSelectedFields((String) value); |
|
150 |
} |
|
151 |
|
|
152 |
@Override |
|
153 |
public Object getValue() { |
|
154 |
return this.pointFieldsSelector.getSelectedFields(); |
|
155 |
} |
|
156 |
|
|
157 |
public void addListenerToFields() { |
|
158 |
if (this.updateSelectorListener != null) { |
|
159 |
return; |
|
160 |
} |
|
161 |
JDynForm form = this.getForm(); |
|
162 |
if (form == null) { |
|
163 |
return; |
|
164 |
} |
|
165 |
JDynFormField fileField = form.getField("file"); |
|
166 |
JDynFormField sheetField = form.getField("sheet"); |
|
167 |
JDynFormField isFirstRowHeaderField = form.getField("isFirstRowHeader"); |
|
168 |
if (fileField == null || sheetField == null || isFirstRowHeaderField == null) { |
|
169 |
return; |
|
170 |
} |
|
171 |
JDynFormFieldListener listener = new JDynFormFieldListener() { |
|
172 |
@Override |
|
173 |
public void fieldEnter(JDynFormField jdff) { |
|
174 |
} |
|
175 |
|
|
176 |
@Override |
|
177 |
public void fieldExit(JDynFormField jdff) { |
|
178 |
} |
|
179 |
|
|
180 |
@Override |
|
181 |
public void fieldChanged(JDynFormField jdff) { |
|
182 |
doUpdateSelector(); |
|
183 |
} |
|
184 |
|
|
185 |
@Override |
|
186 |
public void message(JDynFormField jdff, String string) { |
|
187 |
} |
|
188 |
}; |
|
189 |
fileField.addListener(listener); |
|
190 |
sheetField.addListener(listener); |
|
191 |
isFirstRowHeaderField.addListener(listener); |
|
192 |
this.updateSelectorListener = listener; |
|
193 |
this.pointFieldsSelector.clear(); |
|
194 |
this.pointFieldsSelector.setAvailableFields(null); |
|
195 |
} |
|
196 |
|
|
197 |
public Sheet getCurrentSheet() { |
|
198 |
return this.currentSheet; |
|
199 |
} |
|
200 |
|
|
201 |
private Sheet getSheet(File spreadFile, Locale locale, int sheetIndex) { |
|
202 |
if (this.currentSheet != null) { |
|
203 |
if (sheetIndex == this.currentSheet.getSheetIndex()) { |
|
204 |
if (StringUtils.equals( |
|
205 |
Objects.toString(spreadFile, null), |
|
206 |
Objects.toString(this.currentSheet.getFile(), null) |
|
207 |
)) { |
|
208 |
return this.currentSheet; |
|
209 |
} |
|
210 |
} |
|
211 |
} |
|
212 |
Spread spread = Spread.create(spreadFile, locale); |
|
213 |
this.currentSheet = spread.getSheet(sheetIndex); |
|
214 |
return this.currentSheet; |
|
215 |
} |
|
216 |
|
|
217 |
private void doUpdateSelector() { |
|
218 |
this.pointFieldsSelector.clear(); |
|
219 |
this.pointFieldsSelector.setAvailableFields(null); |
|
220 |
JDynForm form = this.getForm(); |
|
221 |
JDynFormField fileField = form.getField("file"); |
|
222 |
JDynFormField localeField = form.getField("locale"); |
|
223 |
JDynFormField sheetField = form.getField("sheet"); |
|
224 |
final JDynFormField isFirstRowHeaderField = form.getField("isFirstRowHeader"); |
|
225 |
if (fileField != null && sheetField != null && isFirstRowHeaderField != null) { |
|
226 |
File spreadFile = (File) fileField.getValue(); |
|
227 |
int sheetIndex = (int) ObjectUtils.defaultIfNull(sheetField.getValue(), -1); |
|
228 |
boolean isFirstRowHeader = (boolean) ObjectUtils.defaultIfNull(isFirstRowHeaderField.getValue(), false); |
|
229 |
Locale locale = Locale.getDefault(); |
|
230 |
String x = Objects.toString(localeField.getValue(), null); |
|
231 |
if (!StringUtils.isBlank(x)) { |
|
232 |
locale = new Locale(x); |
|
233 |
} |
|
234 |
this.tasks.cancelAll(); |
|
235 |
this.tasks.add(new TaskUpdateAvailbleFields(spreadFile, sheetIndex, isFirstRowHeader, locale)); |
|
236 |
} |
|
237 |
} |
|
238 |
|
|
239 |
} |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.98/org.gvsig.jexcel.provider/src/main/java/org/gvsig/jexcel/dynformfield/point/PointFieldsSelector.java | ||
---|---|---|
1 |
package org.gvsig.jexcel.dynformfield.point; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import java.awt.event.ItemEvent; |
|
6 |
import java.awt.event.ItemListener; |
|
7 |
import java.util.HashSet; |
|
8 |
import java.util.List; |
|
9 |
import java.util.Set; |
|
10 |
import javax.swing.DefaultComboBoxModel; |
|
11 |
import org.apache.commons.lang3.StringUtils; |
|
12 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
13 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
|
14 |
|
|
15 |
/** |
|
16 |
* |
|
17 |
* @author jjdelcerro |
|
18 |
*/ |
|
19 |
public class PointFieldsSelector extends PointFieldsSelectorView { |
|
20 |
|
|
21 |
Set<String> fieldNames; |
|
22 |
boolean processingUserChangeCombo=false; |
|
23 |
|
|
24 |
public PointFieldsSelector() { |
|
25 |
this.fieldNames = new HashSet<>(); |
|
26 |
this.initComponents(); |
|
27 |
} |
|
28 |
|
|
29 |
private void initComponents() { |
|
30 |
ToolsSwingManager swingManager = ToolsSwingLocator.getToolsSwingManager(); |
|
31 |
swingManager.addClearButton(this.txtXYZ, new ActionListener() { |
|
32 |
@Override |
|
33 |
public void actionPerformed(ActionEvent e) { |
|
34 |
clear(); |
|
35 |
} |
|
36 |
}); |
|
37 |
ItemListener listener = new ItemListener() { |
|
38 |
@Override |
|
39 |
public void itemStateChanged(ItemEvent e) { |
|
40 |
if( processingUserChangeCombo ) { |
|
41 |
return; |
|
42 |
} |
|
43 |
try { |
|
44 |
processingUserChangeCombo = true; |
|
45 |
if( cboX.isEnabled() ) { |
|
46 |
updateText(); |
|
47 |
} |
|
48 |
} finally { |
|
49 |
processingUserChangeCombo = false; |
|
50 |
} |
|
51 |
} |
|
52 |
}; |
|
53 |
this.cboX.addItemListener(listener); |
|
54 |
this.cboY.addItemListener(listener); |
|
55 |
this.cboZ.addItemListener(listener); |
|
56 |
this.txtXYZ.setEditable(false); |
|
57 |
} |
|
58 |
|
|
59 |
public void setAvailableFields(List<String> fieldNames) { |
|
60 |
boolean enabled = this.isEnabled(); |
|
61 |
String selectedFields = this.getSelectedFields(); |
|
62 |
DefaultComboBoxModel modelX = new DefaultComboBoxModel(); |
|
63 |
DefaultComboBoxModel modelY = new DefaultComboBoxModel(); |
|
64 |
DefaultComboBoxModel modelZ = new DefaultComboBoxModel(); |
|
65 |
modelX.addElement(" "); |
|
66 |
modelY.addElement(" "); |
|
67 |
modelZ.addElement(" "); |
|
68 |
this.fieldNames.clear(); |
|
69 |
if (fieldNames == null || fieldNames.isEmpty()) { |
|
70 |
enabled = false; |
|
71 |
this.txtXYZ.setEditable(true); |
|
72 |
} else { |
|
73 |
this.txtXYZ.setEditable(false); |
|
74 |
for (String fieldName : fieldNames) { |
|
75 |
modelX.addElement(fieldName); |
|
76 |
modelY.addElement(fieldName); |
|
77 |
modelZ.addElement(fieldName); |
|
78 |
this.fieldNames.add(fieldName); |
|
79 |
} |
|
80 |
} |
|
81 |
this.cboX.setModel(modelX); |
|
82 |
this.cboY.setModel(modelY); |
|
83 |
this.cboZ.setModel(modelZ); |
|
84 |
|
|
85 |
this.cboX.setEnabled(enabled); |
|
86 |
this.cboY.setEnabled(enabled); |
|
87 |
this.cboZ.setEnabled(enabled); |
|
88 |
|
|
89 |
this.setSelectedFields(selectedFields); |
|
90 |
} |
|
91 |
|
|
92 |
public void clear() { |
|
93 |
this.cboX.setSelectedIndex(-1); |
|
94 |
this.cboY.setSelectedIndex(-1); |
|
95 |
this.cboZ.setSelectedIndex(-1); |
|
96 |
this.txtXYZ.setText(""); |
|
97 |
} |
|
98 |
|
|
99 |
public boolean isEmpty() { |
|
100 |
return StringUtils.isBlank(this.txtXYZ.getText()); |
|
101 |
} |
|
102 |
|
|
103 |
public void setSelectedFields(String fields) { |
|
104 |
if( StringUtils.isBlank(fields) ) { |
|
105 |
this.clear(); |
|
106 |
return; |
|
107 |
} |
|
108 |
String[] m = StringUtils.split(fields, ','); |
|
109 |
if( m.length<2 || m.length>3 ) { |
|
110 |
this.clear(); |
|
111 |
return; |
|
112 |
} |
|
113 |
for (int i = 0; i < m.length; i++) { |
|
114 |
m[i] = m[i].trim(); |
|
115 |
} |
|
116 |
if( this.isEnabled() && this.cboX.isEnabled() ) { |
|
117 |
if( this.fieldNames.contains(m[0]) ) { |
|
118 |
this.cboX.setSelectedItem(m[0]); |
|
119 |
} |
|
120 |
if( this.fieldNames.contains(m[1]) ) { |
|
121 |
this.cboY.setSelectedItem(m[1]); |
|
122 |
} |
|
123 |
if( m.length>2 ) { |
|
124 |
if( this.fieldNames.contains(m[2]) ) { |
|
125 |
this.cboZ.setSelectedItem(m[2]); |
|
126 |
} |
|
127 |
} |
|
128 |
} |
|
129 |
this.txtXYZ.setText(fields); |
|
130 |
} |
|
131 |
|
|
132 |
public String getSelectedFields() { |
|
133 |
if( !this.cboX.isEnabled() ) { |
|
134 |
return StringUtils.defaultIfEmpty(this.txtXYZ.getText(),null); |
|
135 |
} |
|
136 |
String xfield = (String) this.cboX.getSelectedItem(); |
|
137 |
String yfield = (String) this.cboY.getSelectedItem(); |
|
138 |
String zfield = (String) this.cboZ.getSelectedItem(); |
|
139 |
if( StringUtils.isBlank(xfield) || StringUtils.isBlank(yfield) ) { |
|
140 |
return null; |
|
141 |
} |
|
142 |
if( StringUtils.isBlank(zfield) ) { |
|
143 |
return xfield + "," + yfield; |
|
144 |
} |
|
145 |
return xfield + "," + yfield + "," +zfield; |
|
146 |
} |
|
147 |
|
|
148 |
private void updateText() { |
|
149 |
String value; |
|
150 |
String xfield = StringUtils.defaultIfBlank((String) this.cboX.getSelectedItem(),"-"); |
|
151 |
String yfield = StringUtils.defaultIfBlank((String) this.cboY.getSelectedItem(),"-"); |
|
152 |
String zfield = (String) this.cboZ.getSelectedItem(); |
|
153 |
if( StringUtils.isBlank(zfield) ) { |
|
154 |
value = xfield + "," + yfield; |
|
155 |
} else { |
|
156 |
value = xfield + "," + yfield + "," +zfield; |
|
157 |
} |
|
158 |
this.txtXYZ.setText(value); |
|
159 |
} |
|
160 |
|
|
161 |
@Override |
|
162 |
public void setEnabled(boolean enabled) { |
|
163 |
super.setEnabled(enabled); |
|
164 |
this.cboX.setEnabled(enabled); |
|
165 |
this.cboY.setEnabled(enabled); |
|
166 |
this.cboZ.setEnabled(enabled); |
|
167 |
} |
|
168 |
|
|
169 |
public void detect() { |
|
170 |
String xfield = null; |
|
171 |
String yfield = null; |
|
172 |
String zfield = null; |
|
173 |
|
|
174 |
for (String fieldName : fieldNames) { |
|
175 |
if( fieldName.equalsIgnoreCase("x") ) { |
|
176 |
xfield = fieldName; |
|
177 |
} |
|
178 |
if( StringUtils.containsIgnoreCase(fieldName,"lon") ) { |
|
179 |
if( xfield == null ) { |
|
180 |
xfield = fieldName; |
|
181 |
} |
|
182 |
} |
|
183 |
if( fieldName.equalsIgnoreCase("y") ) { |
|
184 |
yfield = fieldName; |
|
185 |
} |
|
186 |
if( StringUtils.containsIgnoreCase(fieldName, "lat") ) { |
|
187 |
if( yfield == null ) { |
|
188 |
yfield = fieldName; |
|
189 |
} |
|
190 |
} |
|
191 |
if( fieldName.equalsIgnoreCase("z") ) { |
|
192 |
zfield = fieldName; |
|
193 |
} |
|
194 |
} |
|
195 |
if( xfield!=null ) { |
|
196 |
this.cboX.setSelectedItem(xfield); |
|
197 |
} |
|
198 |
if( yfield!=null ) { |
|
199 |
this.cboY.setSelectedItem(yfield); |
|
200 |
} |
|
201 |
if( zfield!=null ) { |
|
202 |
this.cboZ.setSelectedItem(zfield); |
|
203 |
} |
|
204 |
} |
|
205 |
|
|
206 |
} |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.98/org.gvsig.jexcel.provider/src/main/java/org/gvsig/jexcel/dynformfield/point/JDynFormFieldExcelPointFieldsFactory.java | ||
---|---|---|
1 |
package org.gvsig.jexcel.dynformfield.point; |
|
2 |
|
|
3 |
import org.gvsig.jexcel.Spread; |
|
4 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
5 |
import org.gvsig.tools.dynform.DynFormFieldDefinition; |
|
6 |
import org.gvsig.tools.dynform.JDynFormField; |
|
7 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
|
8 |
import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormFieldFactory; |
|
9 |
import org.gvsig.tools.dynform.spi.dynformfield.JDynFormFieldFactory; |
|
10 |
|
|
11 |
public class JDynFormFieldExcelPointFieldsFactory |
|
12 |
extends AbstractJDynFormFieldFactory |
|
13 |
implements JDynFormFieldFactory |
|
14 |
{ |
|
15 |
|
|
16 |
public JDynFormFieldExcelPointFieldsFactory() { |
|
17 |
super(Spread.NAME+".pointFields", DataTypes.STRING); |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
public JDynFormField create( |
|
22 |
DynFormSPIManager serviceManager, |
|
23 |
DynFormSPIManager.ComponentsFactory componentsFactory, |
|
24 |
DynFormFieldDefinition fieldDefinition, |
|
25 |
Object value |
|
26 |
) { |
|
27 |
|
|
28 |
return new JDynFormFieldExcelPointFields(serviceManager, componentsFactory, this, fieldDefinition, value); |
|
29 |
} |
|
30 |
|
|
31 |
} |
org.gvsig.jexcel/tags/org.gvsig.jexcel-1.0.98/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.98/org.gvsig.jexcel.provider/src/main/java/org/gvsig/jexcel/JExcelSpread.java | ||
---|---|---|
1 |
package org.gvsig.jexcel; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
import java.util.ArrayList; |
|
6 |
import java.util.Collections; |
|
7 |
import java.util.List; |
|
8 |
import java.util.Locale; |
|
9 |
import java.util.Objects; |
|
10 |
import org.apache.commons.lang3.StringUtils; |
|
11 |
import java.awt.Rectangle; |
|
12 |
import java.util.Arrays; |
|
13 |
import jxl.Cell; |
Also available in: Unified diff