Revision 3496

View differences:

org.gvsig.report/tags/org.gvsig.report-1.0.63/org.gvsig.report.lib/org.gvsig.report.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.report.lib.impl.ReportImplLibrary
org.gvsig.report/tags/org.gvsig.report-1.0.63/org.gvsig.report.lib/org.gvsig.report.lib.impl/src/main/java/org/gvsig/report/lib/impl/DefaultReportDataSet.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.report.lib.impl;
25

  
26
import java.io.File;
27
import java.io.IOException;
28
import java.util.List;
29
import org.apache.commons.lang3.StringUtils;
30
import org.gvsig.expressionevaluator.Expression;
31
import org.gvsig.expressionevaluator.ExpressionBuilder;
32
import org.gvsig.expressionevaluator.ExpressionUtils;
33
import org.gvsig.fmap.dal.DALLocator;
34
import org.gvsig.fmap.dal.DataManager;
35
import org.gvsig.fmap.dal.DataStoreParameters;
36
import org.gvsig.fmap.dal.exception.DataException;
37
import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable;
38
import org.gvsig.fmap.dal.feature.Feature;
39
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
40
import org.gvsig.fmap.dal.feature.FeatureQuery;
41
import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
42
import org.gvsig.fmap.dal.feature.FeatureReference;
43
import org.gvsig.fmap.dal.feature.FeatureStore;
44
import org.gvsig.fmap.dal.feature.FeatureType;
45
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
46
import org.gvsig.tools.visitor.Visitor;
47
import org.json.JSONObject;
48
import org.gvsig.report.lib.api.ReportDataSet;
49
import org.gvsig.report.lib.api.ReportServices;
50
import org.gvsig.tools.exception.BaseException;
51
import org.gvsig.tools.util.UnmodifiableBasicList64;
52
import org.gvsig.tools.util.UnmodifiableBasicList64Adapter;
53
import org.gvsig.tools.visitor.VisitCanceledException;
54
import org.json.JSONArray;
55

  
56
/**
57
 *
58
 * @author jjdelcerro
59
 */
60
@SuppressWarnings("EqualsAndHashcode")
61
public class DefaultReportDataSet implements ReportDataSet {
62

  
63
    private final ReportServices services;
64
    private String name;
65
    private FeatureStore store;
66
    private String fullName;
67
    private File path;
68
    private int limit;
69
    private Expression filter;
70
    private boolean exposeGeometry;
71
    private final DefaultSelectionOfFeatures selectionOfFeatures;
72
    private FeatureQuery query;
73

  
74
    public DefaultReportDataSet(ReportServices services, String name, FeatureStore store) {
75
        this.services = services;
76
        this.name = name;
77
        this.store = store;
78
        this.selectionOfFeatures = new DefaultSelectionOfFeatures(this);
79
        if (store != null) {
80
            this.fullName = store.getFullName();
81
            DataStoreParameters parameters = this.store.getParameters();
82
            if (parameters instanceof FilesystemStoreParameters) {
83
                this.path = ((FilesystemStoreParameters) parameters).getFile();
84
            }
85
        }
86
        this.query = store.createFeatureQuery();
87
    }
88

  
89
    public DefaultReportDataSet(ReportServices services, String name, FeatureStore store, FeatureQuery query) {
90
        this(services, name, store);
91
        if (query == null) {
92
            this.query = store.createFeatureQuery();
93
        } else {
94
            this.query = query;
95
        }
96
    }
97

  
98
    public DefaultReportDataSet(ReportServices services, JSONObject jsonDataSet) {
99
        this.services = services;
100
        this.selectionOfFeatures = new DefaultSelectionOfFeatures(this);
101
        this.name = jsonDataSet.getString("name");
102
        this.fullName = jsonDataSet.getString("fullName");
103
        this.limit = jsonDataSet.getInt("limit");
104
        if (jsonDataSet.has("filter")) {
105
            this.filter = ExpressionUtils.createExpression();
106
            this.filter.fromJSON(jsonDataSet.getString("filter"));
107
        } else {
108
            this.filter = null;
109
        }
110
        this.exposeGeometry = jsonDataSet.getBoolean("exposeGeometry");
111
        if (jsonDataSet.has("path")) {
112
            this.path = this.services.derelativizeFile(
113
                    new File(jsonDataSet.getString("path"))
114
            );
115
        }
116
        this.store = null;
117
        if (jsonDataSet.has("features")) {
118
            JSONArray jsonFeatures = jsonDataSet.getJSONArray("features");
119
            for (Object x : jsonFeatures) {
120
                String referenceCode = (String) x;
121
                this.selectionOfFeatures.add(referenceCode);
122
            }
123
        }
124
    }
125

  
126
    JSONObject toJSON() {
127
        JSONObject jsonDataSet = new JSONObject();
128
        jsonDataSet.put("name", this.name);
129
        jsonDataSet.put("limit", this.limit);
130
        jsonDataSet.put("filter", this.filter);
131
        jsonDataSet.put("fullName", this.fullName);
132
        jsonDataSet.put("exposeGeometry", this.exposeGeometry);
133
        if (this.path != null) {
134
            jsonDataSet.put("path", this.services.relativizeFile(this.path).getPath());
135
        }
136
        if (!this.selectionOfFeatures.isEmpty()) {
137
            JSONArray jsonFeatures = new JSONArray();
138
            for (int i = 0; i < this.selectionOfFeatures.size64(); i++) {
139
                FeatureReference reference = this.selectionOfFeatures.getReference(i);
140
                jsonFeatures.put(reference.getCode());
141
            }
142
            jsonDataSet.put("features", jsonFeatures);
143
        }
144
        return jsonDataSet;
145
    }
146

  
147
    @Override
148
    public boolean equals(Object obj) {
149
        if (!(obj instanceof DefaultReportDataSet)) {
150
            return false;
151
        }
152
        DefaultReportDataSet other = (DefaultReportDataSet) obj;
153
        if (this.store != other.store) {
154
            return false;
155
        }
156
        if (!StringUtils.equals(this.getName(), other.getName())) {
157
            return false;
158
        }
159
        return true;
160
    }
161

  
162
    @Override
163
    public String getName() {
164
        return this.name;
165
    }
166

  
167
    @Override
168
    public void setName(String name) {
169
        this.name = name;
170
    }
171

  
172
    @Override
173
    @SuppressWarnings("UseSpecificCatch")
174
    public String toString() {
175
        try {
176
            FeatureAttributeDescriptor attr = this.getStore().getDefaultFeatureType().getDefaultGeometryAttribute();
177
            String geomType = attr.getGeomType().getName();
178
            return this.name + " (" + geomType + ")";
179
        } catch (Exception ex) {
180
            return this.name;
181
        }
182
    }
183

  
184
    @Override
185
    public FeatureStore getStore() {
186
        if (this.store == null) {
187
            this.store = this.services.getFeatureStore(this);
188
        }
189
        if (this.store != null) {
190
            DataStoreParameters parameters = this.store.getParameters();
191
            if (parameters instanceof FilesystemStoreParameters) {
192
                this.path = ((FilesystemStoreParameters) parameters).getFile();
193
            }
194
        }
195
        return this.store;
196
    }
197

  
198
    @Override
199
    public FeatureType getFeatureType() {
200
        FeatureStore theStore = this.getStore();
201
        try {
202
            return theStore.getDefaultFeatureType();
203
        } catch (DataException ex) {
204
            return null;
205
        }
206
    }
207

  
208
    @Override
209
    public boolean hasThisStore(FeatureStore store) {
210
        if (store == null) {
211
            return false;
212
        }
213
        if (this.path != null) {
214
            try {
215
                DataStoreParameters parameters = store.getParameters();
216
                if (parameters instanceof FilesystemStoreParameters) {
217
                    File thePath = ((FilesystemStoreParameters) parameters).getFile();
218
                    if (this.path.getCanonicalPath().equals(thePath.getCanonicalPath())) {
219
                        return true;
220
                    }
221
                }
222
            } catch (IOException ex) {
223
            }
224
        }
225
        return StringUtils.equals(this.fullName, store.getFullName());
226
    }
227

  
228
    @Override
229
    public void accept(Visitor visitor) {
230
        this.accept(visitor, (Expression) null, null, true);
231
    }
232

  
233
    @Override
234
    public void accept(Visitor visitor, Expression filter) {
235
        this.accept(visitor, filter, null, true);
236
    }
237

  
238
    @Override
239
    public void accept(final Visitor visitor, String filter, String sortfields, boolean ascending) {
240
        this.accept(visitor, ExpressionUtils.createExpression(filter), sortfields, ascending);
241
    }
242

  
243
    @Override
244
    @SuppressWarnings("UseSpecificCatch")
245
    public void accept(final Visitor visitor, final Expression filter, String sortfields, boolean ascending) {
246
        try {
247
            if (this.selectionOfFeatures.isEmpty()) {
248
                FeatureQuery dataQuery = this.getQuery();
249
                if (filter != null) {
250
                    dataQuery.addFilter(filter);
251
                    dataQuery.retrievesAllAttributes();
252
                }
253
                if (!StringUtils.isEmpty(sortfields)) {
254
                    FeatureQueryOrder order = dataQuery.getOrder();
255
                    for (String field : StringUtils.split(sortfields, ',')) {
256
                        order.add(field, ascending);
257
                    }
258
                }
259
                FeatureStore st = this.getStore();
260
                st.accept(visitor, dataQuery);
261
                return;
262
            }
263
            if (filter == null) {
264
                this.selectionOfFeatures.accept(visitor);
265
                return;
266
            }
267
            DataManager manager = DALLocator.getDataManager();
268
            final FeatureSymbolTable featureSymbolTable = manager.createFeatureSymbolTable();
269
            this.selectionOfFeatures.accept(new Visitor() {
270
                @Override
271
                public void visit(Object o) throws VisitCanceledException, BaseException {
272
                    featureSymbolTable.setFeature((Feature) o);
273
                    Boolean r = (Boolean) filter.execute(featureSymbolTable);
274
                    if (r) {
275
                        visitor.visit(o);
276
                    }
277
                }
278
            });
279
        } catch (Exception ex) {
280
            throw new RuntimeException(ex);
281
        }
282
    }
283

  
284
    @Override
285
    public FeatureQuery getQuery() {
286
        return this.getQuery(null);
287
    }
288

  
289
    public FeatureQuery getQuery(Expression filter) {
290
        FeatureStore st = this.getStore();
291
        FeatureQuery dataQuery = this.query; //st.createFeatureQuery();
292
        if (!ExpressionUtils.isPhraseEmpty(this.filter) && !ExpressionUtils.isPhraseEmpty(filter)) {
293
            ExpressionBuilder builder = ExpressionUtils.createExpressionBuilder();
294
            Expression f = ExpressionUtils.createExpression(
295
                    builder.and(filter, this.filter).toString()
296
            );
297
            dataQuery.addFilter(f);
298
            dataQuery.retrievesAllAttributes();
299
        } else if (!ExpressionUtils.isPhraseEmpty(this.filter)) {
300
            dataQuery.addFilter(this.filter);
301
            dataQuery.retrievesAllAttributes();
302
        } else if (!ExpressionUtils.isPhraseEmpty(filter)) {
303
            dataQuery.addFilter(filter);
304
            dataQuery.retrievesAllAttributes();
305
        }
306
        dataQuery.setLimit(limit);
307
        return dataQuery;
308
    }
309

  
310
    @Override
311
    public SelectionOfFeatures getSelectionOfFeatures() {
312
        return this.selectionOfFeatures;
313
    }
314

  
315
    @Override
316
    public UnmodifiableBasicList64<Feature> getFeatures() {
317
        return this.getFeatures(null);
318
    }
319

  
320
    @Override
321
    public UnmodifiableBasicList64<Feature> getFeatures(Expression filter) {
322
        List<Feature> r;
323
        if (this.selectionOfFeatures.isEmpty()) {
324
            FeatureStore theStore = this.getStore();
325
            FeatureQuery query = this.getQuery(filter);
326
            r = theStore.getFeatures(query);
327
            return new UnmodifiableBasicList64Adapter<>(r);
328
        }
329
        return this.getSelectionOfFeatures();
330
    }
331

  
332
    @Override
333
    public int getLimit() {
334
        return this.limit;
335
    }
336

  
337
    @Override
338
    public Expression getFilter() {
339
        return this.filter;
340
    }
341

  
342
    @Override
343
    public void setLimit(int limit) {
344
        this.limit = limit;
345
    }
346

  
347
    @Override
348
    public void setFilter(Expression filter) {
349
        this.filter = filter;
350
    }
351

  
352
    @Override
353
    public boolean getExposeGeometry() {
354
        return this.exposeGeometry;
355
    }
356

  
357
    @Override
358
    public void setExposeGeometry(boolean selected) {
359
        this.exposeGeometry = selected;
360
    }
361

  
362
    @Override
363
    public String getURLPath() {
364
        String p = "/dataset/" + this.getName();
365
        return p;
366
    }
367
}
org.gvsig.report/tags/org.gvsig.report-1.0.63/org.gvsig.report.lib/org.gvsig.report.lib.impl/src/main/java/org/gvsig/report/lib/impl/ResourcesRepositoryService.java
1
package org.gvsig.report.lib.impl;
2

  
3
import java.io.ByteArrayInputStream;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.io.OutputStream;
7
import java.net.URL;
8
import net.sf.jasperreports.engine.JRRuntimeException;
9
import net.sf.jasperreports.engine.util.JRLoader;
10
import net.sf.jasperreports.repo.InputStreamResource;
11
import net.sf.jasperreports.repo.ObjectResource;
12
import net.sf.jasperreports.repo.Resource;
13
import net.sf.jasperreports.repo.StreamRepositoryService;
14
import org.gvsig.report.lib.impl.commands.GetImage;
15
import org.gvsig.tools.resourcesstorage.ResourcesStorage;
16

  
17
/**
18
 *
19
 * @author jjdelcerro
20
 */
21
@SuppressWarnings("UseSpecificCatch")
22
public class ResourcesRepositoryService implements StreamRepositoryService {
23

  
24
    private final ResourcesStorage resources;
25
    private final GetImage fetchFromField;
26

  
27
    private class GVResourceToJRInputStreamResourceAdapter extends InputStreamResource {
28
        private final ResourcesStorage.Resource resource;
29
        
30
        public GVResourceToJRInputStreamResourceAdapter(ResourcesStorage.Resource resource) {
31
            this.resource = resource;
32
        }
33

  
34
        @Override
35
        public InputStream getValue() {
36
            try {
37
                return this.resource.asInputStream();
38
            } catch (IOException ex) {
39
                return null;
40
            }
41
        }
42
    }
43
    
44
    private class URLToJRInputStreamResourceAdapter extends InputStreamResource {
45
        private final URL url;
46
        
47
        public URLToJRInputStreamResourceAdapter(URL url) {
48
            this.url = url;
49
        }
50

  
51
        @Override
52
        public InputStream getValue() {
53
            try {
54
                return this.url.openStream();
55
            } catch (IOException ex) {
56
                return null;
57
            }
58
        }
59
    }
60

  
61
    private class ByteArrayToJRInputStreamResourceAdapter extends InputStreamResource {
62
        private final byte[] data;
63
        
64
        public ByteArrayToJRInputStreamResourceAdapter(byte[] data) {
65
            this.data = data;
66
        }
67

  
68
        @Override
69
        public InputStream getValue() {
70
          ByteArrayInputStream is = new ByteArrayInputStream(this.data);
71
          return is;
72
        }
73
    }
74

  
75
    
76
    public ResourcesRepositoryService(ResourcesStorage resources) {
77
        this.resources = resources;
78
        this.fetchFromField = new GetImage();
79
    }
80

  
81
    @Override
82
    public InputStream getInputStream(String uri) {
83
        try {
84
            InputStream is;
85
            ResourcesStorage.Resource resource = this.resources.getResource(uri);
86
            if (resource != null) {
87
                is = resource.asInputStream();
88
            } else {
89
                URL url = new URL(uri);
90
                if( this.fetchFromField.canUse(url) ) {
91
                  byte[] image = this.fetchFromField.fetch(url);
92
                  is = new ByteArrayInputStream(image);
93
                } else {
94
                  is = url.openStream();
95
                }
96
            }
97
            return is;
98
        } catch (Exception ex) {
99
            throw new JRRuntimeException(ex);
100
        }
101
    }
102

  
103
    @Override
104
    public OutputStream getOutputStream(String uri) {
105
        return null;
106
    }
107

  
108
    @Override
109
    public Resource getResource(String uri) {
110
        try {
111
            Resource r;
112
            ResourcesStorage.Resource resource = this.resources.getResource(uri);
113
            if (resource != null) {
114
                r = new GVResourceToJRInputStreamResourceAdapter(resource);
115
                return r;
116
            } else {
117
                URL url = new URL(uri);
118
                if( this.fetchFromField.canUse(url) ) {
119
                  byte[] image = this.fetchFromField.fetch(url);
120
                  r = new ByteArrayToJRInputStreamResourceAdapter(image);
121
                } else {
122
                  r = new URLToJRInputStreamResourceAdapter(url);
123
                }
124
            }
125
            return r;
126
        } catch (Exception ex) {
127
            throw new JRRuntimeException(ex);
128
        }
129
    }
130

  
131
    @Override
132
    public void saveResource(String uri, Resource resource) {
133
        
134
    }
135

  
136
    @Override
137
    public <K extends Resource> K getResource(String uri, Class<K> resourceType) {
138
        try {
139
            ObjectResource r = (ObjectResource) resourceType.newInstance();
140
            r.setName(uri);
141
            ResourcesStorage.Resource resource = this.resources.getResource(uri);
142
            if (resource != null) {
143
                InputStream is = resource.asInputStream();
144
                if (is!=null) {
145
                    Object v = JRLoader.loadObject(is);
146
                    r.setValue(v);
147
                    return (K) r;
148
                }
149
            }
150
            URL url = new URL(uri);
151
            if (this.fetchFromField.canUse(url)) {
152
                byte[] image = this.fetchFromField.fetch(url);
153
                ByteArrayInputStream is = new ByteArrayInputStream(image);
154
                r.setValue(is);
155
            } else {
156
                r.setValue(url.openStream());
157
            }
158
            
159
            return (K) r;
160
        } catch (Throwable th) {
161
            return null;
162
        }
163
    }
164
}
org.gvsig.report/tags/org.gvsig.report-1.0.63/org.gvsig.report.lib/org.gvsig.report.lib.impl/src/main/java/org/gvsig/report/lib/impl/DefaultReportServerConfig.java
1
package org.gvsig.report.lib.impl;
2

  
3
import java.beans.PropertyChangeEvent;
4
import java.beans.PropertyChangeListener;
5
import java.beans.PropertyChangeSupport;
6
import java.util.List;
7
import org.apache.commons.lang3.StringUtils;
8
import org.gvsig.fmap.dal.DALLocator;
9
import org.gvsig.fmap.dal.DataManager;
10
import org.gvsig.fmap.dal.DataStore;
11
import org.gvsig.fmap.dal.feature.FeatureStore;
12
import org.json.JSONArray;
13
import org.json.JSONObject;
14
import org.gvsig.report.lib.api.ReportDataSet;
15
import org.gvsig.report.lib.api.ReportDataSets;
16
import org.gvsig.report.lib.api.ReportManager;
17
import org.gvsig.report.lib.api.ReportServerConfig;
18
import org.gvsig.report.lib.api.ReportServices;
19
import org.gvsig.report.lib.api.ReportViewCapture;
20

  
21
/**
22
 *
23
 * @author jjdelcerro
24
 */
25
public class DefaultReportServerConfig implements ReportServerConfig {
26

  
27
    private int port;
28
    private int timeout;
29
    private String serverInfo;
30
    private ReportDataSets datasets;
31
    private boolean locked;
32
    private DefaultReportViewCaptures viewCaptures;
33
    private final PropertyChangeSupport propertyChangeSupport;
34
    private final ReportServices services;
35
    private final ReportManager manager;
36
    private boolean autostart;
37

  
38
    public DefaultReportServerConfig(ReportManager manager, ReportServices services) {
39
        this.services = services;
40
        this.manager = manager;
41

  
42
        this.port = 9876;
43
        this.timeout = 15000;
44
        this.serverInfo = "Test/1.1";
45
        this.locked = false;
46
        this.autostart = false;
47
        this.propertyChangeSupport = new PropertyChangeSupport(this);
48

  
49
        this.viewCaptures = new DefaultReportViewCaptures();
50
        this.viewCaptures.addPropertyChangeListener(new PropertyChangeListener() {
51
            @Override
52
            public void propertyChange(PropertyChangeEvent evt) {
53
                propertyChangeSupport.firePropertyChange("viewCaptures", null, null);
54
            }
55
        });
56
                
57
        this.datasets = new DefaultReportDataSets(manager, services);
58
        this.datasets.addPropertyChangeListener(new PropertyChangeListener() {
59
            @Override
60
            public void propertyChange(PropertyChangeEvent evt) {
61
                propertyChangeSupport.firePropertyChange("datasets", null, null);
62
            }
63
        });
64
    }
65

  
66
    @Override
67
    public ReportServices getServices() {
68
        return this.services;
69
    }
70

  
71
    public boolean isLocked() {
72
        return locked;
73
    }
74

  
75
    public void setLocked(boolean locked) {
76
        this.locked = locked;
77
    }
78

  
79
    @Override
80
    public int getPort() {
81
        return this.port;
82
    }
83

  
84
    @Override
85
    public ReportServerConfig setPort(int port) {
86
        int oldValue = this.port;
87
        this.port = port;
88
        this.propertyChangeSupport.firePropertyChange("port", oldValue, port);
89
        return this;
90
    }
91

  
92
    @Override
93
    public int getTimeout() {
94
        return this.timeout;
95
    }
96

  
97
    @Override
98
    public ReportServerConfig setTimeout(int timeout) {
99
        int oldValue = this.timeout;
100
        this.timeout = timeout;
101
        this.propertyChangeSupport.firePropertyChange("timeout", oldValue, timeout);
102
        return this;
103
    }
104

  
105
    @Override
106
    public String getServerInfo() {
107
        return this.serverInfo;
108
    }
109

  
110
    @Override
111
    public ReportServerConfig setServerInfo(String serverInfo) {
112
        String oldValue = this.serverInfo;
113
        this.serverInfo = serverInfo;
114
        this.propertyChangeSupport.firePropertyChange("serverInfo", oldValue, serverInfo);
115
        return this;
116
    }
117

  
118
    @Override
119
    public ReportDataSets getDatasets() {
120
        return this.datasets;
121
    }
122

  
123
    @Override
124
    public ReportDataSet getDataset(String name) {
125
        ReportDataSet dataset = this.datasets.get(name);
126
        if( dataset == null ) {
127
          DataManager dataManager = DALLocator.getDataManager();
128
          DataStore store = dataManager.getStoresRepository().getStore(name);
129
          if( store == null || !(store instanceof FeatureStore)) {
130
            return null;
131
          }
132
          dataset = new DefaultReportDataSet(services, name, (FeatureStore) store);
133
        }
134
        return dataset;
135
    }
136

  
137
    @Override
138
    public String toJSON() {
139
        JSONObject jsonconfig = new JSONObject();
140

  
141
        jsonconfig.put("port", this.port);
142
        jsonconfig.put("timeout", this.timeout);
143
        jsonconfig.put("serverInfo", this.serverInfo);
144
        jsonconfig.put("autostart", this.autostart);
145
        
146
        JSONArray jsondatasets = new JSONArray();
147
        jsonconfig.put("datasets", jsondatasets);
148
        for (ReportDataSet dataset : this.datasets) {
149
            jsondatasets.put(((DefaultReportDataSet) dataset).toJSON());
150
        }
151

  
152
        JSONArray jsonviewcaptures = new JSONArray();
153
        jsonconfig.put("viewcaptures", jsonviewcaptures);
154
        for (ReportViewCapture viewcapture : this.viewCaptures) {
155
            jsonviewcaptures.put(((DefaultReportViewCapture) viewcapture).toJSON());
156
        }
157
        return jsonconfig.toString();
158
    }
159

  
160
    public void fromJSON(JSONObject jsonConfig) {
161
        DefaultReportDataSets theDatasets = new DefaultReportDataSets(manager, services);
162
        DefaultReportViewCaptures theViewCaptures = new DefaultReportViewCaptures();
163
        
164
        if (jsonConfig.has("port")) {
165
            this.port = jsonConfig.getInt("port");
166
        }
167
        if (jsonConfig.has("timeout")) {
168
            this.timeout = jsonConfig.getInt("timeout");
169
        }
170
        if (jsonConfig.has("serverInfo")) {
171
            this.serverInfo = jsonConfig.getString("serverInfo");
172
        }
173
        if (jsonConfig.has("autostart")) {
174
            this.autostart = jsonConfig.getBoolean("autostart");
175
        }
176
        if (jsonConfig.has("datasets")) {
177
            JSONArray jsonDatasets = jsonConfig.getJSONArray("datasets");
178
            for (Object jsonDataset : jsonDatasets) {
179
                if( !(jsonDataset instanceof JSONObject) ) {
180
                    jsonDataset = new JSONObject(jsonDataset.toString());
181
                }
182
                ReportDataSet dataset = new DefaultReportDataSet(
183
                        this.getServices(),
184
                        (JSONObject) jsonDataset
185
                );
186
                theDatasets.add(dataset);
187
            }
188
        }
189
        theDatasets.addPropertyChangeListener(new PropertyChangeListener() {
190
            @Override
191
            public void propertyChange(PropertyChangeEvent evt) {
192
                propertyChangeSupport.firePropertyChange("datasets", null, null);
193
            }
194
        });
195
        this.datasets = theDatasets;
196

  
197
        if (jsonConfig.has("viewcaptures")) {
198
            JSONArray jsonViewCaptures = jsonConfig.getJSONArray("viewcaptures");
199
            for (Object jsonViewCapture : jsonViewCaptures) {
200
                if( !(jsonViewCapture instanceof JSONObject) ) {
201
                    jsonViewCapture = new JSONObject(jsonViewCapture.toString());
202
                }
203
                ReportViewCapture viewCapture = new DefaultReportViewCapture(
204
                        this,
205
                        (JSONObject) jsonViewCapture
206
                );
207
                theViewCaptures.add(viewCapture);
208
            }
209
        }
210
        theViewCaptures.addPropertyChangeListener(new PropertyChangeListener() {
211
            @Override
212
            public void propertyChange(PropertyChangeEvent evt) {
213
                propertyChangeSupport.firePropertyChange("viewcaptures", null, null);
214
            }
215
        });
216
        this.viewCaptures = theViewCaptures;
217
        
218
    }
219

  
220
    @Override
221
    public List<ReportViewCapture> getViewCaptures() {
222
        return this.viewCaptures;
223
    }
224

  
225
    @Override
226
    public ReportViewCapture getViewCapture(String name) {
227
        for (ReportViewCapture viewCapture : viewCaptures) {
228
            if( StringUtils.equalsIgnoreCase(name, viewCapture.getName()) ) {
229
                return viewCapture;
230
            }
231
        }
232
        return null;
233
    }
234
    
235
    @Override
236
    public void addPropertyChangeListener(PropertyChangeListener listener) {
237
        this.propertyChangeSupport.addPropertyChangeListener(listener);
238
    }
239

  
240
    @Override
241
    public void removePropertyChangeListener(PropertyChangeListener listener) {
242
        this.propertyChangeSupport.removePropertyChangeListener(listener);
243
    }
244

  
245
    @Override
246
    public boolean getAutostart() {
247
        return this.autostart;
248
    }
249

  
250
    @Override
251
    public void setAutostart(boolean autostart) {
252
        boolean oldValue = this.autostart;
253
        this.autostart = autostart;
254
        this.propertyChangeSupport.firePropertyChange("autostart", oldValue, this.autostart);
255
    }
256

  
257
}
org.gvsig.report/tags/org.gvsig.report-1.0.63/org.gvsig.report.lib/org.gvsig.report.lib.impl/src/main/java/org/gvsig/report/lib/impl/DefaultReportViewCapture.java
1
package org.gvsig.report.lib.impl;
2

  
3
import java.awt.Dimension;
4
import java.beans.PropertyChangeEvent;
5
import java.beans.PropertyChangeListener;
6
import java.beans.PropertyChangeSupport;
7
import java.io.UnsupportedEncodingException;
8
import java.net.URLEncoder;
9
import org.apache.commons.lang3.StringUtils;
10
import org.gvsig.expressionevaluator.Expression;
11
import org.gvsig.expressionevaluator.ExpressionUtils;
12
import org.gvsig.expressionevaluator.Formatter;
13
import org.gvsig.report.lib.api.ReportDataSet;
14
import org.gvsig.report.lib.api.ReportServerConfig;
15
import org.gvsig.report.lib.api.ReportViewCapture;
16
import org.json.JSONObject;
17

  
18
/**
19
 *
20
 * @author jjdelcerro
21
 */
22
public class DefaultReportViewCapture implements ReportViewCapture {
23

  
24
    private static int counter = 0;
25
    
26
    private class DefaultReportViewCaptureFilter implements ReportViewCaptureFilter {
27

  
28
        private Expression expression;
29
        private String datasetName;
30
        private final PropertyChangeSupport propertyChangeSupport;
31

  
32
        public DefaultReportViewCaptureFilter() {
33
            this.propertyChangeSupport = new PropertyChangeSupport(this);
34
        }
35

  
36
        public DefaultReportViewCaptureFilter(JSONObject json) {
37
            this();
38
            if( json.has("expression") ) {
39
                this.expression = ExpressionUtils.createExpressionFromJSON(
40
                        json.getString("expression")
41
                );
42
            }
43
            if( json.has("datasetName") ) {
44
                this.datasetName = json.getString("datasetName");
45
            }
46
        }
47

  
48
        public JSONObject toJSON() {
49
            JSONObject me = new JSONObject();
50

  
51
            if( this.expression!=null ) {
52
                me.put("expression", this.expression.toJSON());
53
            }
54
            me.put("datasetName", StringUtils.defaultIfEmpty(this.datasetName,null));
55

  
56
            return me;
57
        }
58

  
59
        public String getURLPart() {
60
            if( StringUtils.isBlank(reportDataSetName) ) {
61
                return null;
62
            }
63
            ReportDataSet dataset = config.getDataset(reportDataSetName);
64
            if( dataset == null ) {
65
                return null;
66
            }
67
            Formatter reportformatter = new ReportExpressionCodeFormatter(
68
                    dataset.getFeatureType()
69
            );
70
            String s = expression.getCode().toString(reportformatter);
71
            s = s.replace(" ","+");
72
            return s;
73
        }
74
        
75
        @Override
76
        public String getDataSet() {
77
            return this.datasetName;
78
        }
79

  
80
        @Override
81
        public Expression getExpression() {
82
            return this.expression;
83
        }
84

  
85
        @Override
86
        public void setDataSet(String dataset) {
87
            this.datasetName = dataset;
88
            this.propertyChangeSupport.firePropertyChange("dataset", null, null);
89
        }
90

  
91
        @Override
92
        public void setDataSet(ReportDataSet dataset) {
93
            if( dataset == null ) {
94
                this.datasetName = null;
95
            } else {
96
                this.datasetName = dataset.getName();
97
            }
98
            this.propertyChangeSupport.firePropertyChange("dataset", null, null);
99
        }
100

  
101
        @Override
102
        public void setExpression(Expression expression) {
103
            this.expression = expression;
104
            this.propertyChangeSupport.firePropertyChange("expression", null, null);
105
        }
106

  
107
        @Override
108
        public boolean isEmpty() {
109
            return StringUtils.isEmpty(this.datasetName) || 
110
                    ExpressionUtils.isPhraseEmpty(this.expression);
111
        }
112

  
113
        public void addPropertyChangeListener(PropertyChangeListener listener) {
114
            this.propertyChangeSupport.addPropertyChangeListener(listener);
115
        }
116

  
117
        public void removePropertyChangeListener(PropertyChangeListener listener) {
118
            this.propertyChangeSupport.removePropertyChangeListener(listener);
119
        }
120

  
121
    }
122

  
123
    private DefaultReportViewCaptureFilter zoomFilter;
124
    private DefaultReportViewCaptureFilter centerFilter;
125
    private DefaultReportViewCaptureFilter selectFilter;
126
    private String name;
127
    private String viewName;
128
    private String reportDataSetName;
129
    private int margins;
130
    private boolean clearSelection;
131
    private Dimension dimensions;
132
    private int resolution;
133
    private final PropertyChangeSupport propertyChangeSupport;
134
    private final ReportServerConfig config;
135

  
136
    public DefaultReportViewCapture(ReportServerConfig config) {
137
        this.config = config;
138
        this.centerFilter = new DefaultReportViewCaptureFilter();
139
        this.centerFilter.addPropertyChangeListener(new PropertyChangeListener() {
140
            @Override
141
            public void propertyChange(PropertyChangeEvent evt) {
142
                propertyChangeSupport.firePropertyChange("centerFilter", null, null);
143
            }
144
        });
145
        this.zoomFilter = new DefaultReportViewCaptureFilter();
146
        this.zoomFilter.addPropertyChangeListener(new PropertyChangeListener() {
147
            @Override
148
            public void propertyChange(PropertyChangeEvent evt) {
149
                propertyChangeSupport.firePropertyChange("zoomFilter", null, null);
150
            }
151
        });
152
        this.selectFilter = new DefaultReportViewCaptureFilter();
153
        this.selectFilter.addPropertyChangeListener(new PropertyChangeListener() {
154
            @Override
155
            public void propertyChange(PropertyChangeEvent evt) {
156
                propertyChangeSupport.firePropertyChange("selectFilter", null, null);
157
            }
158
        });
159
        this.resolution = 72;
160
        this.clearSelection = false;
161
        this.name = "capture"+counter++;
162
        this.viewName = null;
163
        this.margins = 0;
164
        this.dimensions = new Dimension();
165
        this.propertyChangeSupport = new PropertyChangeSupport(this);
166
    }
167

  
168
    public DefaultReportViewCapture(ReportServerConfig config, JSONObject json) {
169
        this(config);
170
        this.fromJSON(json);
171
    }
172

  
173
    @Override
174
    public boolean isEmpty() {
175
        return StringUtils.isBlank(this.viewName);
176
    }
177

  
178
    @Override
179
    public String getReportDataSet() {
180
        return reportDataSetName;
181
    }
182
    
183
    @Override
184
    public void setReportDataSet(String reportDataSet) {
185
        this.reportDataSetName = reportDataSet;
186
    }
187
    
188
    @Override
189
    public String toString() {
190
        return this.getName();
191
    }
192

  
193
    @Override
194
    public String getName() {
195
        return this.name;
196
    }
197

  
198
    @Override
199
    public void setName(String name) {
200
        this.name = name;
201
        this.propertyChangeSupport.firePropertyChange("name", null, null);
202
    }
203

  
204
    @Override
205
    public String getView() {
206
        return this.viewName;
207
    }
208

  
209
    @Override
210
    public void setView(String view) {
211
        this.viewName = view;
212
        this.propertyChangeSupport.firePropertyChange("view", null, null);
213
    }
214
   
215
    private static String encodeForURL(String s) {
216
        try {
217
            return URLEncoder.encode(s, "UTF8");
218
        } catch (UnsupportedEncodingException ex) {
219
            return s;
220
        }
221
    }
222
    
223
    @Override
224
    public String getFullURLPath() {
225
        StringBuilder builder = new StringBuilder();
226
        builder.append("/captureview/captureName/");
227
        builder.append(encodeForURL(this.name));
228
        builder.append("/viewName/");
229
        builder.append(encodeForURL(this.viewName));
230
        if( this.getResolution()>0 ) {
231
            builder.append("/DPI/");
232
            builder.append(this.getResolution());
233
        }
234
        if (!this.centerFilter.isEmpty()) {
235
            builder.append("/center/");
236
            builder.append(this.centerFilter.getDataSet());
237
            builder.append("/");
238
            builder.append(this.centerFilter.getURLPart());
239
        }
240
        if (!this.zoomFilter.isEmpty()) {
241
            builder.append("/zoom/");
242
            builder.append(this.zoomFilter.getDataSet());
243
            builder.append("/");
244
            builder.append(this.zoomFilter.getURLPart());
245
        }
246
        if (!this.selectFilter.isEmpty()) {
247
            builder.append("/select/");
248
            builder.append(this.selectFilter.getDataSet());
249
            builder.append("/");
250
            builder.append(this.selectFilter.getURLPart());
251
        }
252
        if (this.margins > 0) {
253
            builder.append("/margins/");
254
            builder.append(this.margins);
255
        }
256
        if (this.clearSelection) {
257
            builder.append("/clearselection");
258
        }
259
        if (this.hasDimensions()) {
260
            builder.append("/width/");
261
            builder.append(this.dimensions.width);
262
            builder.append("/height/");
263
            builder.append(this.dimensions.height);
264
        }
265
        return builder.toString();
266
    }
267
    
268
    @Override
269
    public boolean hasDimensions() {
270
        return this.dimensions.height > 0 || this.dimensions.width > 0;
271
    }
272

  
273
    @Override
274
    public Dimension getDimensions() {
275
        return this.dimensions;
276
    }
277

  
278
    @Override
279
    public ReportViewCaptureFilter getZoomFilter() {
280
        return this.zoomFilter;
281
    }
282

  
283
    @Override
284
    public ReportViewCaptureFilter getCenterFilter() {
285
        return this.centerFilter;
286
    }
287

  
288
    @Override
289
    public ReportViewCaptureFilter getSelectionFilter() {
290
        return this.selectFilter;
291
    }
292

  
293
    @Override
294
    public int getMargins() {
295
        return this.margins;
296
    }
297

  
298
    @Override
299
    public void setMargins(int margins) {
300
        this.margins = margins;
301
        this.propertyChangeSupport.firePropertyChange("margins", null, null);
302
    }
303

  
304
    @Override
305
    public boolean getClearSelection() {
306
        return this.clearSelection;
307
    }
308

  
309
    @Override
310
    public void setClearSelection(boolean clearSelection) {
311
        this.clearSelection = clearSelection;
312
        this.propertyChangeSupport.firePropertyChange("clearSelection", null, null);
313
    }
314

  
315
    public void addPropertyChangeListener(PropertyChangeListener listener) {
316
        this.propertyChangeSupport.addPropertyChangeListener(listener);
317
    }
318

  
319
    public void removePropertyChangeListener(PropertyChangeListener listener) {
320
        this.propertyChangeSupport.removePropertyChangeListener(listener);
321
    }
322

  
323
    public JSONObject toJSON() {
324
        JSONObject me = new JSONObject();
325

  
326
        me.put("zoomFilter", this.zoomFilter.toJSON());
327
        me.put("centerFilter", this.centerFilter.toJSON());
328
        me.put("selectFilter", this.selectFilter.toJSON());
329
        me.put("viewName", this.viewName);
330
        me.put("reportDataSetName", this.reportDataSetName);
331
        me.put("clearSelection", this.clearSelection);
332
        me.put("dimension.width", this.dimensions.width);
333
        me.put("dimension.height", this.dimensions.height);
334

  
335
        return me;
336
    }
337

  
338
    public void fromJSON(JSONObject json) {
339
        this.zoomFilter = new DefaultReportViewCaptureFilter(json.getJSONObject("zoomFilter"));
340
        this.centerFilter = new DefaultReportViewCaptureFilter(json.getJSONObject("centerFilter"));
341
        this.selectFilter = new DefaultReportViewCaptureFilter(json.getJSONObject("selectFilter"));
342
        if( json.has("viewName") ) {
343
            this.viewName = json.getString("viewName");
344
        }
345
        if( json.has("reportDataSetName") ) {
346
            this.reportDataSetName = json.getString("reportDataSetName");
347
        }
348
        if( json.has("clearSelection") ) {
349
            this.clearSelection = json.getBoolean("clearSelection");
350
        }
351
        int width = 0;
352
        int height = 0;
353
        if( json.has("dimension.width") ) {
354
            width = json.getInt("dimension.width");
355
        }
356
        if( json.has("dimension.height") ) {
357
            height = json.getInt("dimension.height");
358
        }
359
        this.dimensions = new Dimension(width, height);
360
    }
361
    @Override
362
    public int getResolution() {
363
        return this.resolution;
364
    }
365

  
366
    @Override
367
    public void setResolution(int resolution) {
368
        this.resolution = resolution;
369
    }
370

  
371
}
org.gvsig.report/tags/org.gvsig.report-1.0.63/org.gvsig.report.lib/org.gvsig.report.lib.impl/src/main/java/org/gvsig/report/lib/impl/reportbuilder/DefaultStyleBuilder.java
1
package org.gvsig.report.lib.impl.reportbuilder;
2

  
3
import ar.com.fdvs.dj.domain.Style;
4
import ar.com.fdvs.dj.domain.constants.Font;
5
import ar.com.fdvs.dj.domain.constants.HorizontalAlign;
6
import ar.com.fdvs.dj.domain.constants.Rotation;
7
import ar.com.fdvs.dj.domain.constants.Stretching;
8
import ar.com.fdvs.dj.domain.constants.Transparency;
9
import ar.com.fdvs.dj.domain.constants.VerticalAlign;
10
import java.awt.Color;
11
import org.gvsig.report.lib.api.ReportBuilder;
12
import org.gvsig.report.lib.api.ReportBuilder.StyleBuilder;
13
import org.gvsig.tools.persistence.PersistentState;
14
import org.gvsig.tools.persistence.exception.PersistenceException;
15

  
16
/**
17
 *
18
 * @author jjdelcerro
19
 */
20
public class DefaultStyleBuilder implements ReportBuilder.StyleBuilder {
21

  
22
    private Color textColor;
23
    private Color backgroundColor;
24
    private int rotation;
25
    private int stretching;
26
    private boolean stretchingWithOverflow;
27
    private boolean transparent;
28
    private int verticalAlign;
29
    private int horizontalAlign;
30
    private ReportBuilder.BorderBuilder borderTop;
31
    private ReportBuilder.BorderBuilder borderBottom;
32
    private ReportBuilder.BorderBuilder borderLeft;
33
    private ReportBuilder.BorderBuilder borderRight;
34
    private int paddingTop;
35
    private int paddingBottom;
36
    private int paddingLeft;
37
    private int paddingRight;
38
    private int font;
39
    private int fontSize;
40
    private int transparency;
41

  
42
    public DefaultStyleBuilder() {
43
        this.borderTop = new DefaultBorderBuilder();
44
        this.borderBottom = new DefaultBorderBuilder();
45
        this.borderLeft = new DefaultBorderBuilder();
46
        this.borderRight = new DefaultBorderBuilder();
47
        this.textColor = Color.BLACK;
48
        this.backgroundColor = Color.WHITE;
49
        this.transparency = StyleBuilder.TRANSPARENCY_OPAQUE;
50
        this.transparent = false;
51
        this.font = StyleBuilder.FONT_ARIAL;
52
        this.fontSize = 10;
53
        this.paddingBottom = 2;
54
        this.paddingLeft = 2;
55
        this.paddingRight = 2;
56
        this.paddingTop = 2;
57
        this.stretching = StyleBuilder.STRETCHING_RELATIVE_TO_TALLEST_OBJECT;
58
        this.stretchingWithOverflow = true;
59
    }
60

  
61
    @Override
62
    public ReportBuilder.StyleBuilder clone() throws CloneNotSupportedException {
63
        DefaultStyleBuilder other = (DefaultStyleBuilder) super.clone();
64
        other.borderTop = this.borderTop.clone();
65
        other.borderBottom = this.borderBottom.clone();
66
        other.borderLeft = this.borderLeft.clone();
67
        other.borderRight = this.borderRight.clone();
68
        return other;
69
    }
70

  
71
    @Override
72
    public void copyFrom(ReportBuilder.StyleBuilder other) {
73
        try {
74
            this.font = other.getFont();
75
            this.fontSize = other.getFontSize();
76
            this.textColor = other.getTextColor();
77
            this.backgroundColor = other.getBackgroundColor();
78
            this.rotation = other.getRotation();
79
            this.stretching = other.getStretching();
80
            this.stretchingWithOverflow = other.getStretchingWithOverflow();
81
            this.transparency = other.getTransparency();
82
            this.transparent = other.getTransparent();
83
            this.verticalAlign = other.getVerticalAlign();
84
            this.horizontalAlign = other.getHorizontalAlign();
85
            this.paddingTop = other.getPaddingTop();
86
            this.paddingBottom = other.getPaddingBottom();
87
            this.paddingLeft = other.getPaddingLeft();
88
            this.paddingRight = other.getPaddingRight();
89

  
90
            this.borderTop = other.getBorderTop().clone();
91
            this.borderBottom = other.getBorderBottom().clone();
92
            this.borderLeft = other.getBorderLeft().clone();
93
            this.borderRight = other.getBorderRight().clone();
94
        } catch (CloneNotSupportedException ex) {
95
            throw new RuntimeException("Can't copy Style", ex);
96
        }
97
    }
98

  
99
    @Override
100
    public Color getTextColor() {
101
        return this.textColor;
102
    }
103

  
104
    @Override
105
    public ReportBuilder.StyleBuilder textColor(Color textColor) {
106
        this.textColor = textColor;
107
        return this;
108
    }
109

  
110
    @Override
111
    public Color getBackgroundColor() {
112
        return this.backgroundColor;
113
    }
114

  
115
    @Override
116
    public ReportBuilder.StyleBuilder backgroundColor(Color backgroundColor) {
117
        this.backgroundColor = backgroundColor;
118
        return this;
119
    }
120

  
121
    @Override
122
    public int getRotation() {
123
        return this.rotation;
124
    }
125

  
126
    @Override
127
    public ReportBuilder.StyleBuilder rotation(int rotation) {
128
        this.rotation = rotation;
129
        return this;
130
    }
131

  
132
    @Override
133
    public int getStretching() {
134
        return this.stretching;
135
    }
136

  
137
    @Override
138
    public ReportBuilder.StyleBuilder stretching(int stretching) {
139
        this.stretching = stretching;
140
        return this;
141
    }
142

  
143
    @Override
144
    public boolean getStretchingWithOverflow() {
145
        return this.stretchingWithOverflow;
146
    }
147

  
148
    @Override
149
    public ReportBuilder.StyleBuilder stretchingWithOverflow(boolean stretchingWithOverflow) {
150
        this.stretchingWithOverflow = stretchingWithOverflow;
151
        return this;
152
    }
153

  
154
    @Override
155
    public boolean getTransparent() {
156
        return this.transparent;
157
    }
158

  
159
    @Override
160
    public ReportBuilder.StyleBuilder transparent(boolean transparent) {
161
        this.transparent = transparent;
162
        return this;
163
    }
164

  
165
    @Override
166
    public int getTransparency() {
167
        return this.transparency;
168
    }
169

  
170
    @Override
171
    public ReportBuilder.StyleBuilder transparency(int transparency) {
172
        this.transparency = transparency;
173
        return this;
174
    }
175

  
176
    @Override
177
    public int getVerticalAlign() {
178
        return this.verticalAlign;
179
    }
180

  
181
    @Override
182
    public ReportBuilder.StyleBuilder verticalAlign(int verticalAlign) {
183
        this.verticalAlign = verticalAlign;
184
        return this;
185
    }
186

  
187
    @Override
188
    public int getHorizontalAlign() {
189
        return this.horizontalAlign;
190
    }
191

  
192
    @Override
193
    public ReportBuilder.StyleBuilder horizontalAlign(int horizontalAlign) {
194
        this.horizontalAlign = horizontalAlign;
195
        return this;
196
    }
197

  
198
    @Override
199
    public ReportBuilder.BorderBuilder getBorderTop() {
200
        return this.borderTop;
201
    }
202

  
203
    @Override
204
    public ReportBuilder.StyleBuilder borderTop(ReportBuilder.BorderBuilder border) {
205
        this.borderTop = border;
206
        return this;
207
    }
208

  
209
    @Override
210
    public ReportBuilder.BorderBuilder getBorderBottom() {
211
        return this.borderBottom;
212
    }
213

  
214
    @Override
215
    public ReportBuilder.StyleBuilder borderBottom(ReportBuilder.BorderBuilder border) {
216
        this.borderBottom = border;
217
        return this;
218
    }
219

  
220
    @Override
221
    public ReportBuilder.BorderBuilder getBorderLeft() {
222
        return this.borderLeft;
223
    }
224

  
225
    @Override
226
    public ReportBuilder.StyleBuilder borderLeft(ReportBuilder.BorderBuilder border) {
227
        this.borderLeft = border;
228
        return this;
229
    }
230

  
231
    @Override
232
    public ReportBuilder.BorderBuilder getBorderRight() {
233
        return this.borderRight;
234
    }
235

  
236
    @Override
237
    public ReportBuilder.StyleBuilder borderRight(ReportBuilder.BorderBuilder border) {
238
        this.borderRight = border;
239
        return this;
240
    }
241

  
242
    @Override
243
    public int getPaddingTop() {
244
        return this.paddingTop;
245
    }
246

  
247
    @Override
248
    public ReportBuilder.StyleBuilder paddingTop(int padding) {
249
        this.paddingTop = padding;
250
        return this;
251
    }
252

  
253
    @Override
254
    public int getPaddingBottom() {
255
        return this.paddingBottom;
256
    }
257

  
258
    @Override
259
    public ReportBuilder.StyleBuilder paddingBottom(int padding) {
260
        this.paddingBottom = padding;
261
        return this;
262
    }
263

  
264
    @Override
265
    public int getPaddingLeft() {
266
        return this.paddingLeft;
267
    }
268

  
269
    @Override
270
    public ReportBuilder.StyleBuilder paddingLeft(int padding) {
271
        this.paddingLeft = padding;
272
        return this;
273
    }
274

  
275
    @Override
276
    public int getPaddingRight() {
277
        return this.paddingRight;
278
    }
279

  
280
    @Override
281
    public ReportBuilder.StyleBuilder paddingRight(int padding) {
282
        this.paddingRight = padding;
283
        return this;
284
    }
285

  
286
    @Override
287
    public void saveToState(PersistentState ps) throws PersistenceException {
288
        // TODO
289
    }
290

  
291
    @Override
292
    public void loadFromState(PersistentState ps) throws PersistenceException {
293
        // TODO
294
    }
295

  
296
    public static void registerPersistence() {
297
        // TODO
298
    }
299

  
300
    Style build() {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff