Revision 19419
branches/v10/extensions/extPublish/src/org/gvsig/publish/serversmodel/Service.java | ||
---|---|---|
159 | 159 |
// } |
160 | 160 |
/** |
161 | 161 |
* TODO: I can't add two layers with the same name !! |
162 |
* I need an attribute name in the remote resource |
|
162 | 163 |
*/ |
163 |
private void addRemoteResource(RemoteResource r){ |
|
164 |
remoteResources.put(r.getLayerInfo().getName(), r); |
|
164 |
public void addRemoteResource(RemoteResource r){ |
|
165 |
//remoteResources.put(r.getLayerInfo().getName(), r); |
|
166 |
remoteResources.put(r.getName(), r); |
|
165 | 167 |
} |
166 | 168 |
/** |
167 | 169 |
* Useful for create a tree model |
branches/v10/extensions/extPublish/src/org/gvsig/publish/serversmodel/RemoteResource.java | ||
---|---|---|
80 | 80 |
* Properties |
81 | 81 |
*/ |
82 | 82 |
private String title = null; |
83 |
|
|
83 |
private String name = null; |
|
84 | 84 |
/** |
85 | 85 |
* Constructor |
86 | 86 |
* |
... | ... | |
110 | 110 |
public void setTitle(String title) { |
111 | 111 |
this.title = title; |
112 | 112 |
} |
113 |
|
|
114 | 113 |
/** |
115 | 114 |
* |
115 |
* @return name which identifies the remote resource. Is unique. |
|
116 |
*/ |
|
117 |
public String getName(){ |
|
118 |
if (this.name == null){ |
|
119 |
this.name = getLayerInfo().getName(); |
|
120 |
} |
|
121 |
return this.name; |
|
122 |
} |
|
123 |
/** |
|
124 |
* TODO: IMPORTANT: In not used at the moment (is used getLAyerInfo.getName() instead) |
|
125 |
* @param name String which identifies the remote resource. If this name exists, overrides the existent remote resource. |
|
126 |
*/ |
|
127 |
public void setName(String name){ |
|
128 |
this.name = name; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* |
|
116 | 133 |
* Useful to show in a tree. |
117 | 134 |
*/ |
118 | 135 |
public String toString(){ |
... | ... | |
254 | 271 |
XMLEntity children = xml.firstChild("role", "children"); |
255 | 272 |
for (int i=0; i<children.getChildrenCount(); i++){ |
256 | 273 |
XMLEntity child = children.getChild(i); |
257 |
RemoteResource r = PublishRegister.register().getRemoteResource(getService(), child.getStringProperty("type"));
|
|
274 |
RemoteResource r = PublishRegister.register().getRemoteResource(getService(), child.getStringProperty(REMOTERESOURCE_TYPE_KEY));
|
|
258 | 275 |
if (r == null){ |
259 | 276 |
PublishLogger.getLog().error("ERROR RemoteResource: I can't create a child from persistence"); |
260 | 277 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/IDataSourceInfo.java | ||
---|---|---|
77 | 77 |
abstract String getDataType(); |
78 | 78 |
/** |
79 | 79 |
* |
80 |
* @return bounding box |
|
80 |
* @return bounding box in native coordinates
|
|
81 | 81 |
*/ |
82 |
abstract Rectangle2D getBBox(); |
|
82 |
abstract Rectangle2D getNativeBBox();
|
|
83 | 83 |
/** |
84 |
* |
|
85 |
* @return bounding box in WGS84 coordinates |
|
86 |
*/ |
|
87 |
abstract Rectangle2D getLatLonBBox(); |
|
88 |
/** |
|
84 | 89 |
* @return data source type (SHAPE, POSTGIS, ECW) |
85 | 90 |
*/ |
86 | 91 |
abstract String getType(); |
87 |
|
|
92 |
/** |
|
93 |
* @return a string that identifies the datastore which contains the datasource |
|
94 |
*/ |
|
95 |
abstract String getConnectionName(); |
|
88 | 96 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/ILayerInfo.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
|
50 | 50 |
/** |
51 |
* This class represents the information about a layer. |
|
51 |
* This class represents the information about a layer you are seeing. |
|
52 |
* This class might be reprojected. |
|
52 | 53 |
* |
53 | 54 |
* @author Jos? Vicente Hig?n (josevicente.higon@iver.es) |
54 | 55 |
* |
55 | 56 |
*/ |
56 | 57 |
public interface ILayerInfo extends IPersistance { |
58 |
/** |
|
59 |
* |
|
60 |
* @return layer's title. It must be unique. |
|
61 |
*/ |
|
57 | 62 |
abstract String getName(); |
63 |
/** |
|
64 |
* |
|
65 |
* @return layer's title. |
|
66 |
*/ |
|
58 | 67 |
abstract String getTitle(); |
59 |
abstract String getEPSG(); |
|
68 |
/** |
|
69 |
* Gets the system reference identifier of the layer. |
|
70 |
* @return integer which identifies the layer's CRS. |
|
71 |
* If the layer is a group of layers, it will return -1 |
|
72 |
*/ |
|
73 |
abstract int getSRID(); |
|
74 |
/** |
|
75 |
* @deprecated use getSRID instead |
|
76 |
* @return string with the epsg code "EPSG:xxxx" |
|
77 |
*/ |
|
78 |
abstract String getEPSGString(); |
|
79 |
/** |
|
80 |
* |
|
81 |
* @return minimum scale (layer coordinates) you can see the layer |
|
82 |
*/ |
|
60 | 83 |
abstract double getMinscale(); |
84 |
/** |
|
85 |
* |
|
86 |
* @return maximum scale (layer coordinates) you can see the layer |
|
87 |
*/ |
|
61 | 88 |
abstract double getMaxscale(); |
62 |
abstract Rectangle2D getBBox(); |
|
63 |
abstract Object getLegend(); |
|
89 |
/** |
|
90 |
* |
|
91 |
* @return geographic bounding box in layer's coordinates |
|
92 |
*/ |
|
93 |
abstract Rectangle2D getBBox(); |
|
94 |
/** |
|
95 |
* |
|
96 |
* @return legend information |
|
97 |
*/ |
|
98 |
abstract ILegendInfo getLegend(); |
|
99 |
/** |
|
100 |
* |
|
101 |
* @return datasource information |
|
102 |
*/ |
|
64 | 103 |
abstract IDataSourceInfo getDataSource(); |
104 |
/** |
|
105 |
* |
|
106 |
* @return information about child layers |
|
107 |
*/ |
|
65 | 108 |
abstract ILayerInfo[] getChilds(); |
109 |
/** |
|
110 |
* |
|
111 |
* @return parent layer information |
|
112 |
*/ |
|
66 | 113 |
abstract ILayerInfo getParent(); |
114 |
/** |
|
115 |
* |
|
116 |
* @return information about the layer's view |
|
117 |
*/ |
|
67 | 118 |
abstract IViewInfo getViewInfo(); |
68 | 119 |
/** |
69 |
* It can be null!!
|
|
70 |
* @return |
|
120 |
* |
|
121 |
* @return information about the layer labeling. It can be null.
|
|
71 | 122 |
*/ |
72 | 123 |
abstract ILabelingInfo getLabeling(); |
73 | 124 |
|
... | ... | |
79 | 130 |
|
80 | 131 |
/** |
81 | 132 |
* |
82 |
* @param layerName |
|
83 |
* @return this
|
|
133 |
* @param layerName layer's name
|
|
134 |
* @return information about the layer
|
|
84 | 135 |
*/ |
85 | 136 |
abstract ILayerInfo findLayer(String layerName); |
86 | 137 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/legends/UniqueValuesLegendInfo.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
import com.hardcode.gdbms.engine.values.Value; |
50 | 50 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
51 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
51 | 52 |
import com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend; |
52 | 53 |
|
53 | 54 |
public class UniqueValuesLegendInfo implements IUniqueValuesLegendInfo { |
54 | 55 |
|
55 | 56 |
private UniqueValueLegend legend=null; |
57 |
private FLyrVect layer=null; |
|
56 | 58 |
private HashMap symbols = null; |
57 |
|
|
59 |
/** |
|
60 |
* default constructor |
|
61 |
* @param legend2 |
|
62 |
* @deprecated |
|
63 |
*/ |
|
58 | 64 |
public UniqueValuesLegendInfo(UniqueValueLegend legend2) { |
59 | 65 |
legend = legend2; |
60 | 66 |
symbols = new HashMap(); |
61 | 67 |
initialize(); |
62 | 68 |
} |
69 |
/** |
|
70 |
* |
|
71 |
* @param lyrVect gvSIG vectorial layer |
|
72 |
*/ |
|
73 |
public UniqueValuesLegendInfo(FLyrVect lyrVect) { |
|
74 |
this.layer = lyrVect; |
|
75 |
this.legend = (UniqueValueLegend)lyrVect.getLegend(); |
|
76 |
this.symbols = new HashMap(); |
|
77 |
initialize(); |
|
78 |
} |
|
63 | 79 |
private void initialize(){ |
64 | 80 |
Object[] values = legend.getValues(); |
65 | 81 |
for (int i = 0; i < values.length; i++){ |
... | ... | |
93 | 109 |
return stringValues; |
94 | 110 |
|
95 | 111 |
//return legend.getDescriptions(); |
96 |
} |
|
112 |
} |
|
113 |
/* |
|
114 |
* (non-Javadoc) |
|
115 |
* @see org.gvsig.publish.infoproject.ILegendInfo#getSLDString() |
|
116 |
*/ |
|
117 |
public String getSLDString() { |
|
118 |
if (layer != null){ |
|
119 |
return legend.getSLDString(layer.getName()); |
|
120 |
}else{ |
|
121 |
return legend.getSLDString("default"); |
|
122 |
} |
|
123 |
} |
|
97 | 124 |
|
98 | 125 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/legends/LegendInfoFactory.java | ||
---|---|---|
41 | 41 |
package org.gvsig.publish.infoproject.legends; |
42 | 42 |
|
43 | 43 |
|
44 |
import org.gvsig.publish.infoproject.ILegendInfo; |
|
45 |
|
|
44 | 46 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
45 | 47 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
46 | 48 |
import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend; |
... | ... | |
48 | 50 |
import com.iver.cit.gvsig.fmap.rendering.VectorialIntervalLegend; |
49 | 51 |
|
50 | 52 |
public class LegendInfoFactory { |
51 |
public static Object getInstance(FLayer layer){
|
|
53 |
public static ILegendInfo getInstance(FLayer layer){
|
|
52 | 54 |
if (layer instanceof FLyrVect){ |
53 | 55 |
FLyrVect lyrVect = (FLyrVect)layer; |
54 | 56 |
if (lyrVect.getLegend() instanceof SingleSymbolLegend){ |
55 |
return new SingleSymbolLegendInfo((SingleSymbolLegend)lyrVect.getLegend()); |
|
57 |
//return new SingleSymbolLegendInfo((SingleSymbolLegend)lyrVect.getLegend()); |
|
58 |
return new SingleSymbolLegendInfo(lyrVect); |
|
56 | 59 |
} |
57 | 60 |
if (lyrVect.getLegend() instanceof UniqueValueLegend){ |
58 |
return new UniqueValuesLegendInfo((UniqueValueLegend)lyrVect.getLegend()); |
|
61 |
//return new UniqueValuesLegendInfo((UniqueValueLegend)lyrVect.getLegend()); |
|
62 |
return new UniqueValuesLegendInfo(lyrVect); |
|
59 | 63 |
} |
60 | 64 |
if (lyrVect.getLegend() instanceof VectorialIntervalLegend){ |
61 |
return new VectorialIntervalLegendInfo((VectorialIntervalLegend)lyrVect.getLegend()); |
|
65 |
//return new VectorialIntervalLegendInfo((VectorialIntervalLegend)lyrVect.getLegend()); |
|
66 |
return new VectorialIntervalLegendInfo(lyrVect); |
|
62 | 67 |
} |
63 | 68 |
} |
64 | 69 |
return null; |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/legends/SingleSymbolLegendInfo.java | ||
---|---|---|
43 | 43 |
import org.gvsig.publish.infoproject.ISymbolInfo; |
44 | 44 |
import org.gvsig.publish.infoproject.symbols.SymbolInfoFactory; |
45 | 45 |
|
46 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
46 | 47 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
47 | 48 |
import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend; |
48 | 49 |
|
49 | 50 |
public class SingleSymbolLegendInfo implements ISingleSymbolLegendInfo{ |
50 | 51 |
private Legend legend = null; |
52 |
private FLyrVect layer = null; |
|
53 |
/** |
|
54 |
* default constructor |
|
55 |
* @param legend |
|
56 |
* @deprecated |
|
57 |
*/ |
|
51 | 58 |
public SingleSymbolLegendInfo(SingleSymbolLegend legend) { |
52 | 59 |
this.legend = legend; |
53 | 60 |
} |
54 |
|
|
61 |
/** |
|
62 |
* Constructor from FLayer. I need the layer's name in order to build the SLD |
|
63 |
*/ |
|
64 |
public SingleSymbolLegendInfo(FLyrVect lyrVect) { |
|
65 |
this.layer = lyrVect; |
|
66 |
this.legend = (SingleSymbolLegend)lyrVect.getLegend(); |
|
67 |
} |
|
55 | 68 |
public ISymbolInfo getSymbolInfo() { |
56 | 69 |
return SymbolInfoFactory.getInstance(this.legend.getDefaultSymbol()); |
57 | 70 |
} |
58 |
|
|
59 | 71 |
|
72 |
public String getSLDString() { |
|
73 |
if (layer != null){ |
|
74 |
return legend.getSLDString(layer.getName()); |
|
75 |
}else{ |
|
76 |
return legend.getSLDString("default"); |
|
77 |
} |
|
78 |
|
|
79 |
} |
|
80 |
|
|
60 | 81 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/legends/IIntervalLegendInfo.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.publish.infoproject.legends; |
42 | 42 |
|
43 |
import org.gvsig.publish.infoproject.ILegendInfo; |
|
43 | 44 |
import org.gvsig.publish.infoproject.ISymbolInfo; |
44 | 45 |
|
45 |
public interface IIntervalLegendInfo { |
|
46 |
public interface IIntervalLegendInfo extends ILegendInfo {
|
|
46 | 47 |
|
47 | 48 |
public String getFilterItem(); |
48 | 49 |
|
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/legends/VectorialIntervalLegendInfo.java | ||
---|---|---|
47 | 47 |
import org.gvsig.publish.infoproject.symbols.SymbolInfoFactory; |
48 | 48 |
|
49 | 49 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
50 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
50 | 51 |
import com.iver.cit.gvsig.fmap.rendering.VectorialIntervalLegend; |
51 | 52 |
|
52 | 53 |
public class VectorialIntervalLegendInfo implements IIntervalLegendInfo { |
53 | 54 |
private VectorialIntervalLegend legend = null; |
54 | 55 |
private HashMap expressions = null; |
55 | 56 |
private HashMap intervals = null; |
56 |
|
|
57 |
private FLyrVect layer = null; |
|
58 |
/** |
|
59 |
* constructor |
|
60 |
* @param legend |
|
61 |
* @deprecated |
|
62 |
*/ |
|
57 | 63 |
public VectorialIntervalLegendInfo(VectorialIntervalLegend legend) { |
58 | 64 |
this.legend = legend; |
59 | 65 |
initialize(); |
60 | 66 |
} |
61 |
|
|
67 |
/** |
|
68 |
* constructor |
|
69 |
* @param fLyrVect |
|
70 |
*/ |
|
71 |
public VectorialIntervalLegendInfo(FLyrVect fLyrVect) { |
|
72 |
this.layer = fLyrVect; |
|
73 |
this.legend = (VectorialIntervalLegend)fLyrVect.getLegend(); |
|
74 |
initialize(); |
|
75 |
} |
|
62 | 76 |
private void initialize(){ |
63 | 77 |
expressions = new HashMap(); |
64 | 78 |
intervals = new HashMap(); |
... | ... | |
146 | 160 |
} |
147 | 161 |
return null; |
148 | 162 |
} |
163 |
/* |
|
164 |
* (non-Javadoc) |
|
165 |
* @see org.gvsig.publish.infoproject.ILegendInfo#getSLDString() |
|
166 |
*/ |
|
167 |
public String getSLDString() { |
|
168 |
if (layer != null){ |
|
169 |
return legend.getSLDString(layer.getName()); |
|
170 |
}else{ |
|
171 |
return legend.getSLDString("default"); |
|
172 |
} |
|
173 |
} |
|
149 | 174 |
|
150 |
|
|
151 | 175 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/legends/IUniqueValuesLegendInfo.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.publish.infoproject.legends; |
42 | 42 |
|
43 |
import org.gvsig.publish.infoproject.ILegendInfo; |
|
43 | 44 |
import org.gvsig.publish.infoproject.ISymbolInfo; |
44 | 45 |
|
45 | 46 |
|
46 |
public interface IUniqueValuesLegendInfo{ |
|
47 |
public interface IUniqueValuesLegendInfo extends ILegendInfo{
|
|
47 | 48 |
public abstract String getFilterItem(); |
48 | 49 |
public abstract String[] getUniqueValues(); |
49 | 50 |
public abstract ISymbolInfo getSymbol(String value); |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/legends/ISingleSymbolLegendInfo.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.publish.infoproject.legends; |
42 | 42 |
|
43 |
import org.gvsig.publish.infoproject.ILegendInfo; |
|
43 | 44 |
import org.gvsig.publish.infoproject.ISymbolInfo; |
44 | 45 |
|
45 |
public interface ISingleSymbolLegendInfo { |
|
46 |
public interface ISingleSymbolLegendInfo extends ILegendInfo{
|
|
46 | 47 |
|
47 | 48 |
public abstract ISymbolInfo getSymbolInfo(); |
48 | 49 |
|
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/ILegendInfo.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004-2006 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Iba?ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.publish.infoproject; |
|
42 |
|
|
43 |
|
|
44 |
public interface ILegendInfo{ |
|
45 |
public abstract String getSLDString(); |
|
46 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/LayerInfo.java | ||
---|---|---|
97 | 97 |
layers[i] = new LayerInfo(flayers.getLayer(i),view, iview, this); |
98 | 98 |
} |
99 | 99 |
} |
100 |
|
|
100 |
/** |
|
101 |
* |
|
102 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getDataSource() |
|
103 |
*/ |
|
101 | 104 |
public IDataSourceInfo getDataSource() { |
102 | 105 |
return DataSourceInfoFactory.getInstance(this.layer); |
103 | 106 |
} |
104 |
|
|
105 |
public Object getLegend() { |
|
107 |
/** |
|
108 |
* |
|
109 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getLegend() |
|
110 |
*/ |
|
111 |
public ILegendInfo getLegend() { |
|
106 | 112 |
return LegendInfoFactory.getInstance(this.layer); |
107 | 113 |
} |
108 |
|
|
114 |
/** |
|
115 |
* |
|
116 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getMinscale() |
|
117 |
*/ |
|
109 | 118 |
public double getMinscale() { |
110 | 119 |
return layer.getMinScale(); |
111 | 120 |
} |
112 |
|
|
121 |
/** |
|
122 |
* |
|
123 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getName() |
|
124 |
*/ |
|
113 | 125 |
public String getName() { |
114 | 126 |
return this.layer.getName(); |
115 | 127 |
} |
116 |
|
|
128 |
/** |
|
129 |
* |
|
130 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getTitle() |
|
131 |
*/ |
|
117 | 132 |
public String getTitle() { |
118 | 133 |
return this.layer.getName(); |
119 | 134 |
} |
120 |
|
|
135 |
/** |
|
136 |
* |
|
137 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getChilds() |
|
138 |
*/ |
|
121 | 139 |
public ILayerInfo[] getChilds() { |
122 | 140 |
// TODO Auto-generated method stub |
123 | 141 |
return layers; |
124 | 142 |
} |
143 |
/** |
|
144 |
* |
|
145 |
* @see java.lang.Object#toString() |
|
146 |
*/ |
|
125 | 147 |
public String toString(){ |
126 | 148 |
return getName(); |
127 | 149 |
} |
128 |
|
|
150 |
/** |
|
151 |
* |
|
152 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getViewInfo() |
|
153 |
*/ |
|
129 | 154 |
public IViewInfo getViewInfo() { |
130 | 155 |
return iview; |
131 | 156 |
} |
132 |
|
|
133 |
public String getEPSG() { |
|
157 |
/** |
|
158 |
* |
|
159 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getEPSGString() |
|
160 |
*/ |
|
161 |
public String getEPSGString() { |
|
134 | 162 |
return layer.getProjection().getAbrev(); |
135 | 163 |
} |
136 |
|
|
164 |
/** |
|
165 |
* |
|
166 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getBBox() |
|
167 |
*/ |
|
137 | 168 |
public Rectangle2D getBBox() { |
138 | 169 |
Rectangle2D extent = null; |
139 | 170 |
try { |
... | ... | |
143 | 174 |
} |
144 | 175 |
return extent; |
145 | 176 |
} |
146 |
|
|
177 |
/** |
|
178 |
* |
|
179 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getMaxscale() |
|
180 |
*/ |
|
147 | 181 |
public double getMaxscale() { |
148 | 182 |
return layer.getMaxScale(); |
149 | 183 |
} |
150 |
|
|
151 |
/* |
|
152 |
* (non-Javadoc) |
|
153 |
* @see org.gvsig.publish.infoProject.ILayerInfo#getOpacityPercent() |
|
154 |
*/ |
|
184 |
|
|
185 |
/*
|
|
186 |
* (non-Javadoc)
|
|
187 |
* @see org.gvsig.publish.infoProject.ILayerInfo#getOpacityPercent()
|
|
188 |
*/
|
|
155 | 189 |
public int getOpacityPercent() { |
156 |
|
|
190 |
|
|
157 | 191 |
if (layer instanceof FLyrVect){ |
158 | 192 |
FLyrVect v = (FLyrVect)layer; |
159 | 193 |
FSymbol s = (FSymbol)v.getLegend().getDefaultSymbol(); |
... | ... | |
174 | 208 |
}else |
175 | 209 |
return 100; |
176 | 210 |
} |
177 |
|
|
211 |
|
|
178 | 212 |
} |
179 |
|
|
213 |
/** |
|
214 |
* |
|
215 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getLabeling() |
|
216 |
*/ |
|
180 | 217 |
public ILabelingInfo getLabeling() { |
181 | 218 |
if (layer instanceof FLyrVect){ |
182 | 219 |
FLyrVect v = (FLyrVect)layer; |
... | ... | |
188 | 225 |
return null; |
189 | 226 |
} |
190 | 227 |
/** |
191 |
* @return information about the parent layer |
|
228 |
* |
|
229 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getParent() |
|
192 | 230 |
*/ |
193 | 231 |
public ILayerInfo getParent() { |
194 |
|
|
232 |
|
|
195 | 233 |
return this.parent; |
196 | 234 |
} |
235 |
/** |
|
236 |
* |
|
237 |
* @see org.gvsig.publish.infoproject.ILayerInfo#findLayer(java.lang.String) |
|
238 |
*/ |
|
197 | 239 |
public ILayerInfo findLayer(String layerName) { |
198 | 240 |
if (getName().equals(layerName)){ |
199 | 241 |
return this; |
... | ... | |
213 | 255 |
} |
214 | 256 |
return null; |
215 | 257 |
} |
216 |
|
|
258 |
|
|
217 | 259 |
/** |
218 | 260 |
* |
219 | 261 |
* Constants used by ProjectInfoFactory |
220 | 262 |
*/ |
221 | 263 |
public static final String VERSION="LayerInfo_v1"; |
222 | 264 |
public static final String LAYERNAME="layername"; |
265 |
/** |
|
266 |
* |
|
267 |
* @see com.iver.utiles.IPersistance#getXMLEntity() |
|
268 |
*/ |
|
223 | 269 |
public XMLEntity getXMLEntity() { |
224 | 270 |
XMLEntity xml=new XMLEntity(); |
225 | 271 |
//put version |
... | ... | |
228 | 274 |
xml.putProperty(LAYERNAME, getName()); |
229 | 275 |
return xml; |
230 | 276 |
} |
231 |
|
|
277 |
/** |
|
278 |
* |
|
279 |
* @see com.iver.utiles.IPersistance#setXMLEntity(com.iver.utiles.XMLEntity) |
|
280 |
*/ |
|
232 | 281 |
public void setXMLEntity(XMLEntity xml) { |
233 | 282 |
//check version |
234 | 283 |
String classid = xml.getStringProperty("className"); |
... | ... | |
238 | 287 |
} |
239 | 288 |
/** |
240 | 289 |
* |
290 |
* @see com.iver.utiles.IPersistance#getClassName() |
|
241 | 291 |
*/ |
242 | 292 |
public String getClassName() { |
243 | 293 |
return VERSION; |
244 | 294 |
} |
295 |
/** |
|
296 |
* |
|
297 |
* @see org.gvsig.publish.infoproject.ILayerInfo#getSRID() |
|
298 |
*/ |
|
299 |
public int getSRID() { |
|
300 |
int srid=-1; |
|
301 |
if (layer.getProjection() != null){ |
|
302 |
String[] components = layer.getProjection().getAbrev().split(":"); |
|
303 |
srid = new Integer(components[1]).intValue(); |
|
304 |
} |
|
305 |
return srid; |
|
306 |
} |
|
245 | 307 |
|
246 | 308 |
|
247 |
|
|
248 | 309 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/datasources/IFileInfo.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.publish.infoproject.datasources; |
42 | 42 |
|
43 |
import java.io.File; |
|
44 |
|
|
45 |
/** |
|
46 |
* TODO: maybe this interface is unnecessary and the Idatasourceinfo is the |
|
47 |
* responsible to have a method like getFile():File (it can be null if its a db |
|
48 |
* connection) |
|
49 |
* |
|
50 |
* @author jvhigon |
|
51 |
* |
|
52 |
*/ |
|
43 | 53 |
public interface IFileInfo { |
44 |
|
|
54 |
/** |
|
55 |
* |
|
56 |
* @return |
|
57 |
*/ |
|
45 | 58 |
public abstract String getFileName(); |
46 | 59 |
public abstract String getAbsolutePath(); |
47 | 60 |
public abstract String getExtension(); |
61 |
public abstract File getFile(); |
|
62 |
public abstract String getFilenameWithoutExtension(); |
|
48 | 63 |
|
49 | 64 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/datasources/IDataBaseInfo.java | ||
---|---|---|
45 | 45 |
public abstract String getUser(); |
46 | 46 |
public abstract String getHost(); |
47 | 47 |
public abstract String getPassword(); |
48 |
//TODO: refactoring --> change return type to int |
|
48 | 49 |
public abstract String getPort(); |
49 | 50 |
public abstract String getDatabaseName(); |
50 | 51 |
public abstract String getTableName(); |
52 |
public abstract String getSchemaName(); |
|
51 | 53 |
public abstract String getGeometryColumn(); |
52 | 54 |
public abstract String getGID(); |
53 | 55 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/datasources/PostGISTableInfo.java | ||
---|---|---|
46 | 46 |
import java.sql.SQLException; |
47 | 47 |
import java.sql.Statement; |
48 | 48 |
|
49 |
import org.cresques.cts.ICoordTrans; |
|
50 |
import org.cresques.cts.IProjection; |
|
49 | 51 |
import org.gvsig.publish.PublishLogger; |
50 | 52 |
import org.gvsig.publish.infoproject.IDataSourceInfo; |
51 | 53 |
|
54 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
52 | 55 |
import com.iver.cit.gvsig.fmap.drivers.ConnectionJDBC; |
53 | 56 |
import com.iver.cit.gvsig.fmap.drivers.DBLayerDefinition; |
54 | 57 |
import com.iver.cit.gvsig.fmap.drivers.db.utils.ConnectionWithParams; |
... | ... | |
61 | 64 |
private PostGisDriver driver = null; |
62 | 65 |
private ConnectionJDBC connection = null; |
63 | 66 |
private DBLayerDefinition layerDef = null; |
64 |
ConnectionWithParams cwp = null; |
|
67 |
private ConnectionWithParams cwp = null;
|
|
65 | 68 |
/** |
66 | 69 |
* Constructor |
67 | 70 |
* @param vectorialAdapter The adapter from gvSIG |
... | ... | |
171 | 174 |
* (non-Javadoc) |
172 | 175 |
* @see org.gvsig.publish.infoProject.IDataSourceInfo#getBBox() |
173 | 176 |
*/ |
174 |
public Rectangle2D getBBox() { |
|
177 |
public Rectangle2D getNativeBBox() {
|
|
175 | 178 |
//this.adapter.getFullExtent(); |
179 |
Rectangle2D aux = null; |
|
176 | 180 |
try { |
177 |
this.driver.getFullExtent(); |
|
181 |
aux = this.driver.getFullExtent();
|
|
178 | 182 |
} catch (IOException e) { |
179 | 183 |
PublishLogger.getLog().error("ERROR PostGISTable",e); |
180 | 184 |
} |
181 |
return null;
|
|
185 |
return aux;
|
|
182 | 186 |
} |
183 | 187 |
/* |
184 | 188 |
* (non-Javadoc) |
... | ... | |
268 | 272 |
* (non-Javadoc) |
269 | 273 |
* @see org.gvsig.publish.infoProject.datasources.IDataBaseInfo#getGID() |
270 | 274 |
*/ |
271 |
public String getGID() { |
|
272 |
// TODO Auto-generated method stub |
|
275 |
public String getGID() { |
|
273 | 276 |
return layerDef.getFieldID(); |
274 | 277 |
} |
278 |
/** |
|
279 |
* |
|
280 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getLatLonBBox() |
|
281 |
*/ |
|
282 |
public Rectangle2D getLatLonBBox() { |
|
283 |
IProjection proj_source = CRSFactory.getCRS(getEPSG()); |
|
284 |
IProjection proj_dest = CRSFactory.getCRS("EPSG:4326"); |
|
285 |
ICoordTrans trans = proj_source.getCT(proj_dest); |
|
286 |
return trans.convert(getNativeBBox()); |
|
287 |
} |
|
288 |
/** |
|
289 |
* the datastore name is the connection name |
|
290 |
* @return connection name |
|
291 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getConnectionName() |
|
292 |
*/ |
|
293 |
public String getConnectionName() { |
|
294 |
return cwp.getName(); |
|
295 |
} |
|
296 |
/** |
|
297 |
* @return schema name |
|
298 |
* @see org.gvsig.publish.infoproject.datasources.IDataBaseInfo#getSchemaName() |
|
299 |
*/ |
|
300 |
public String getSchemaName() { |
|
301 |
String aux = cwp.getSchema(); |
|
302 |
if (aux == null){ |
|
303 |
aux = "public"; |
|
304 |
} |
|
305 |
return aux; |
|
306 |
} |
|
275 | 307 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/datasources/RasterInfo.java | ||
---|---|---|
41 | 41 |
package org.gvsig.publish.infoproject.datasources; |
42 | 42 |
|
43 | 43 |
import java.awt.geom.Rectangle2D; |
44 |
import java.io.File; |
|
44 | 45 |
|
46 |
import org.cresques.cts.ICoordTrans; |
|
45 | 47 |
import org.cresques.cts.IProjection; |
46 | 48 |
import org.gvsig.publish.infoproject.IDataSourceInfo; |
47 | 49 |
|
50 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
48 | 51 |
import com.iver.cit.gvsig.fmap.drivers.raster.CmsRasterDriver; |
49 | 52 |
import com.iver.utiles.FileUtils; |
50 | 53 |
|
... | ... | |
72 | 75 |
return driver.getNumBands(); |
73 | 76 |
} |
74 | 77 |
|
75 |
public Rectangle2D getBBox() { |
|
78 |
public Rectangle2D getNativeBBox() {
|
|
76 | 79 |
return extent; |
77 | 80 |
} |
78 | 81 |
/** |
... | ... | |
129 | 132 |
} |
130 | 133 |
|
131 | 134 |
|
132 |
|
|
135 |
/** |
|
136 |
* |
|
137 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getLatLonBBox() |
|
138 |
*/ |
|
139 |
public Rectangle2D getLatLonBBox() { |
|
140 |
IProjection proj_source = CRSFactory.getCRS(getEPSG()); |
|
141 |
IProjection proj_dest = CRSFactory.getCRS("EPSG:4326"); |
|
142 |
ICoordTrans trans = proj_source.getCT(proj_dest); |
|
143 |
return trans.convert(getNativeBBox()); |
|
144 |
} |
|
145 |
/** |
|
146 |
* the datastore is the file itself |
|
147 |
* @return file name |
|
148 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getConnectionName() |
|
149 |
*/ |
|
150 |
public String getConnectionName() { |
|
151 |
return getFileName(); |
|
152 |
} |
|
153 |
/* |
|
154 |
* (non-Javadoc) |
|
155 |
* @see org.gvsig.publish.infoproject.datasources.IFileInfo#getFile() |
|
156 |
*/ |
|
157 |
public File getFile() { |
|
158 |
return driver.getFile(); |
|
159 |
} |
|
160 |
/* |
|
161 |
* (non-Javadoc) |
|
162 |
* @see org.gvsig.publish.infoproject.datasources.IFileInfo#getFilenameWithoutExtension() |
|
163 |
*/ |
|
164 |
public String getFilenameWithoutExtension() { |
|
165 |
String[] aux = getFileName().split("."); |
|
166 |
if (aux.length > 0){ |
|
167 |
return aux[1]; |
|
168 |
}else{ |
|
169 |
return null; |
|
170 |
} |
|
171 |
} |
|
133 | 172 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/datasources/ShapefileInfo.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
|
44 | 44 |
import java.awt.geom.Rectangle2D; |
45 |
import java.io.File; |
|
45 | 46 |
import java.io.IOException; |
46 | 47 |
|
48 |
import org.cresques.cts.ICoordTrans; |
|
49 |
import org.cresques.cts.IProjection; |
|
47 | 50 |
import org.gvsig.publish.PublishLogger; |
48 | 51 |
import org.gvsig.publish.infoproject.IDataSourceInfo; |
49 | 52 |
|
50 | 53 |
import com.iver.cit.gvsig.fmap.core.FShape; |
54 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
51 | 55 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
52 | 56 |
import com.iver.cit.gvsig.fmap.drivers.shp.IndexedShpDriver; |
53 | 57 |
import com.iver.cit.gvsig.fmap.layers.VectorialAdapter; |
... | ... | |
115 | 119 |
|
116 | 120 |
// return null; |
117 | 121 |
// } |
118 |
public Rectangle2D getBBox() { |
|
122 |
public Rectangle2D getNativeBBox() {
|
|
119 | 123 |
|
120 | 124 |
Rectangle2D bbox = null; |
121 | 125 |
|
... | ... | |
156 | 160 |
} |
157 | 161 |
return null; |
158 | 162 |
} |
163 |
/** |
|
164 |
* |
|
165 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getType() |
|
166 |
*/ |
|
159 | 167 |
public String getType() { |
160 | 168 |
return SHAPE_TYPE; |
161 | 169 |
} |
170 |
/** |
|
171 |
* |
|
172 |
* @see org.gvsig.publish.infoproject.datasources.IFileInfo#getExtension() |
|
173 |
*/ |
|
162 | 174 |
public String getExtension() { |
163 | 175 |
return FileUtils.getFileExtension(driver.getFile()); |
164 | 176 |
} |
165 |
|
|
177 |
/** |
|
178 |
* |
|
179 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getLatLonBBox() |
|
180 |
*/ |
|
181 |
public Rectangle2D getLatLonBBox() { |
|
182 |
IProjection proj_source = CRSFactory.getCRS(getEPSG()); |
|
183 |
IProjection proj_dest = CRSFactory.getCRS("EPSG:4326"); |
|
184 |
ICoordTrans trans = proj_source.getCT(proj_dest); |
|
185 |
return trans.convert(getNativeBBox()); |
|
186 |
} |
|
187 |
/** |
|
188 |
* the datastore is the shapefile itself |
|
189 |
* @return shapefile name |
|
190 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getConnectionName() |
|
191 |
*/ |
|
192 |
public String getConnectionName() { |
|
193 |
return getFileName(); |
|
194 |
} |
|
195 |
/* |
|
196 |
* |
|
197 |
* @see org.gvsig.publish.infoproject.datasources.IFileInfo#getFile() |
|
198 |
*/ |
|
199 |
public File getFile() { |
|
200 |
return driver.getFile(); |
|
201 |
} |
|
202 |
/* |
|
203 |
* (non-Javadoc) |
|
204 |
* @see org.gvsig.publish.infoproject.datasources.IFileInfo#getFilenameWithoutExtension() |
|
205 |
*/ |
|
206 |
public String getFilenameWithoutExtension() { |
|
207 |
String aux = getFileName(); |
|
208 |
int i = aux.lastIndexOf("."); |
|
209 |
return aux.substring(0,i); |
|
210 |
} |
|
211 |
|
|
166 | 212 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/publish/PublishPanel.java | ||
---|---|---|
69 | 69 |
initLabels(); |
70 | 70 |
} |
71 | 71 |
private void initLabels(){ |
72 |
acceptButton.setText(PluginServices.getText(this,"accept")); |
|
72 |
acceptButton.setText(PluginServices.getText(this,"accept_publish"));
|
|
73 | 73 |
cancelButton.setText(PluginServices.getText(this,"cancel")); |
74 | 74 |
} |
75 | 75 |
/** |
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/publish/PublishController.java | ||
---|---|---|
140 | 140 |
} |
141 | 141 |
if (e.getActionCommand().equals(PublishController.PUBLISH_EVENT_ACCEPT)){ |
142 | 142 |
try { |
143 |
//TODO: I not know if is the best method
|
|
143 |
//TODO: I don't know if this is the best method
|
|
144 | 144 |
//I'm forcing to do a GetModel() |
145 |
window.getActivePublication(); |
|
145 |
//Why I can't use the plugincontroller instead? |
|
146 |
//window.getActivePublication(); |
|
147 |
pluginCtrl.getModel(); |
|
146 | 148 |
publication.getServer().publish(); |
147 | 149 |
} catch (PublishException e1) { |
148 | 150 |
PublishLogger.getLog().error("ERROR PublishController: error_publishing"); |
... | ... | |
168 | 170 |
} |
169 | 171 |
} |
170 | 172 |
private void updateWindow() { |
173 |
if (publication ==null){ |
|
174 |
PublishLogger.getLog().error("ERROR " + getClass().getName() + " I can't update the window, publication is null!!"); |
|
175 |
return; |
|
176 |
} |
|
171 | 177 |
//get active publication |
172 | 178 |
String key = publication.getServer().getType(); |
173 | 179 |
//get controller |
174 | 180 |
pluginCtrl = (IPublishPluginController) PublishRegister.register().getController(key); |
181 |
if (pluginCtrl == null){ |
|
182 |
PublishLogger.getLog().error("ERROR " + getClass().getName() + "The gui controller has not been loaded!!"); |
|
183 |
window.closeWindow(); |
|
184 |
return; |
|
185 |
} |
|
175 | 186 |
pluginCtrl.setModel(publication); |
176 | 187 |
//TODO: check casting |
177 | 188 |
IPublishPluginPanel publishPanel = pluginCtrl.getPanel(); |
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/publish/PublishWindow.java | ||
---|---|---|
54 | 54 |
mWindowInfo=new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE); |
55 | 55 |
mWindowInfo.setTitle(PluginServices.getText(this,"publication")); |
56 | 56 |
mWindowInfo.setHeight(500); |
57 |
mWindowInfo.setWidth(650);
|
|
57 |
mWindowInfo.setWidth(600);
|
|
58 | 58 |
} |
59 | 59 |
return mWindowInfo; |
60 | 60 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/selectServer/SelectServerWindow.java | ||
---|---|---|
64 | 64 |
public void closeWindow(){ |
65 | 65 |
PluginServices.getMDIManager().closeWindow(this); |
66 | 66 |
} |
67 |
|
|
68 | 67 |
|
68 |
|
|
69 | 69 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/selectServer/SelectServerPanel.java | ||
---|---|---|
57 | 57 |
import com.iver.utiles.swing.jcomboServer.JComboServer; |
58 | 58 |
import com.iver.utiles.swing.jcomboServer.ServerData; |
59 | 59 |
|
60 |
/** |
|
61 |
* GUI for server and service selection |
|
62 |
* |
|
63 |
* @author jvhigon |
|
64 |
* |
|
65 |
*/ |
|
60 | 66 |
|
61 |
|
|
62 | 67 |
public class SelectServerPanel extends JPanel { |
63 | 68 |
|
64 | 69 |
/** |
... | ... | |
177 | 182 |
private javax.swing.JComboBox servicecombo; |
178 | 183 |
// End of variables declaration |
179 | 184 |
|
180 |
|
|
185 |
/** |
|
186 |
* sets the listener for all the actions in the panel |
|
187 |
*/ |
|
181 | 188 |
public void setListener(EventListener listener) { |
182 | 189 |
//set listener into the buttons |
183 | 190 |
acceptButton.addActionListener((ActionListener)listener); |
... | ... | |
185 | 192 |
cancelButton.addActionListener((ActionListener)listener); |
186 | 193 |
cancelButton.setActionCommand(SelectServerController.NEWSERVER_EVENT_CANCEL); |
187 | 194 |
serverurlcombo.addActionListener((ActionListener)listener); |
188 |
serverurlcombo.setActionCommand(SelectServerController.COMBOSERVER_EVENT_CHANGE); |
|
195 |
serverurlcombo.setActionCommand(SelectServerController.COMBOSERVERURL_EVENT_CHANGE); |
|
196 |
servercombo.addActionListener((ActionListener)listener); |
|
197 |
servercombo.setActionCommand(SelectServerController.COMBOSERVER_EVENT_CHANGE); |
|
189 | 198 |
} |
190 |
|
|
199 |
/** |
|
200 |
* initialize combos |
|
201 |
*/ |
|
191 | 202 |
public void initCombos(){ |
192 | 203 |
//remove items |
193 | 204 |
servercombo.removeAllItems(); |
... | ... | |
211 | 222 |
} |
212 | 223 |
|
213 | 224 |
/** |
214 |
* Initializes the serverCombo with the saved servers |
|
225 |
* Initializes the serverComboURL with the saved servers
|
|
215 | 226 |
*/ |
216 | 227 |
private void initServerCombo(){ |
217 | 228 |
ServerDataPersistence persistence = new ServerDataPersistence(this,Server.PUBLISH_SERVERS); |
... | ... | |
244 | 255 |
} |
245 | 256 |
|
246 | 257 |
/** |
247 |
* Update the server and the service combo with the |
|
248 |
* selected server |
|
258 |
* Updates the server and the service combo with the
|
|
259 |
* selected server url
|
|
249 | 260 |
*/ |
250 | 261 |
protected void updateCombos(){ |
251 | 262 |
ServerData server = serverurlcombo.getSelectedServer(); |
... | ... | |
264 | 275 |
} |
265 | 276 |
} |
266 | 277 |
} |
278 |
/** |
|
279 |
* Updates the service combo when you select a server |
|
280 |
*/ |
|
281 |
public void updateServiceCombo() { |
|
282 |
servicecombo.removeAllItems(); |
|
283 |
ArrayList set = PublishRegister.register().getServicesNames(servercombo.getSelectedItem().toString()); |
|
284 |
Iterator i = set.iterator(); |
|
285 |
while (i.hasNext()){ |
|
286 |
servicecombo.addItem(i.next()); |
|
287 |
} |
|
288 |
} |
|
289 |
|
|
267 | 290 |
|
268 | 291 |
public String getSelectedServer(){ |
269 | 292 |
return servercombo.getSelectedItem().toString(); |
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/selectServer/SelectServerController.java | ||
---|---|---|
69 | 69 |
*/ |
70 | 70 |
public static final String NEWSERVER_EVENT_ACCEPT="accept_new_server"; |
71 | 71 |
public static final String NEWSERVER_EVENT_CANCEL="cancel_new_server"; |
72 |
public static final String COMBOSERVERURL_EVENT_CHANGE = "change_combo_serverurl"; |
|
72 | 73 |
public static final String COMBOSERVER_EVENT_CHANGE = "change_combo_server"; |
73 | 74 |
/** |
74 | 75 |
* dependences |
... | ... | |
144 | 145 |
window.closeWindow(); |
145 | 146 |
//I've changed byt the observer/observable pattern |
146 | 147 |
//publishController.showWindow(); |
147 |
}else if(e.getActionCommand().equals(SelectServerController.COMBOSERVER_EVENT_CHANGE)){ |
|
148 |
}else if(e.getActionCommand().equals(SelectServerController.COMBOSERVERURL_EVENT_CHANGE)){
|
|
148 | 149 |
window.updateCombos(); |
150 |
return; |
|
149 | 151 |
} |
152 |
if (e.getActionCommand().equals(SelectServerController.COMBOSERVER_EVENT_CHANGE)){ |
|
153 |
window.updateServiceCombo(); |
|
154 |
return; |
|
155 |
} |
|
150 | 156 |
} |
151 | 157 |
/** |
152 | 158 |
* Maybe is better to return the panel and do the cast in the other side. Then I won't have |
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/ogcMetadata/CommonOGCMetadataPanel.java | ||
---|---|---|
89 | 89 |
jScrollPane1 = new javax.swing.JScrollPane(); |
90 | 90 |
abstractArea = new javax.swing.JEditorPane(); |
91 | 91 |
|
92 |
setLayout(new java.awt.GridBagLayout()); |
|
93 |
|
|
94 |
|
|
92 |
setBorder(javax.swing.BorderFactory.createTitledBorder("common_ogc")); |
|
95 | 93 |
setAutoscrolls(true); |
96 | 94 |
setMaximumSize(new java.awt.Dimension(10, 10)); |
97 | 95 |
setPreferredSize(new java.awt.Dimension(300, 150)); |
96 |
setLayout(new java.awt.GridBagLayout()); |
|
97 |
|
|
98 | 98 |
nameLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); |
99 |
|
|
99 |
nameLabel.setText("name_label"); |
|
100 | 100 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
101 | 101 |
gridBagConstraints.gridx = 0; |
102 | 102 |
gridBagConstraints.gridy = 0; |
... | ... | |
105 | 105 |
|
106 | 106 |
nameField.setColumns(30); |
107 | 107 |
nameField.setEditable(false); |
108 |
|
|
108 |
nameField.setText("name"); |
|
109 | 109 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
110 | 110 |
gridBagConstraints.gridx = 1; |
111 | 111 |
gridBagConstraints.gridy = 0; |
... | ... | |
115 | 115 |
add(nameField, gridBagConstraints); |
116 | 116 |
|
117 | 117 |
titleLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); |
118 |
|
|
118 |
titleLabel.setText("title_label"); |
|
119 | 119 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
120 | 120 |
gridBagConstraints.gridx = 0; |
121 | 121 |
gridBagConstraints.gridy = 1; |
... | ... | |
124 | 124 |
|
125 | 125 |
titleField.setColumns(30); |
126 | 126 |
titleField.setHorizontalAlignment(javax.swing.JTextField.LEFT); |
127 |
|
|
127 |
titleField.setText("titlee"); |
|
128 | 128 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
129 | 129 |
gridBagConstraints.gridx = 1; |
130 | 130 |
gridBagConstraints.gridy = 1; |
... | ... | |
133 | 133 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
134 | 134 |
add(titleField, gridBagConstraints); |
135 | 135 |
|
136 |
|
|
136 |
abstractLabel.setText("abstract_label"); |
|
137 | 137 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
138 | 138 |
gridBagConstraints.gridx = 0; |
139 | 139 |
gridBagConstraints.gridy = 2; |
... | ... | |
151 | 151 |
gridBagConstraints.weighty = 1.0; |
152 | 152 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
153 | 153 |
add(jScrollPane1, gridBagConstraints); |
154 |
|
|
155 |
}// </editor-fold> |
|
154 |
}// </editor-fold> |
|
156 | 155 |
|
157 | 156 |
|
158 |
// Variables declaration - do not modify
|
|
159 |
private javax.swing.JEditorPane abstractArea;
|
|
157 |
// Variables declaration - do not modify |
|
158 |
public javax.swing.JEditorPane abstractArea;
|
|
160 | 159 |
private javax.swing.JLabel abstractLabel; |
161 | 160 |
private javax.swing.JScrollPane jScrollPane1; |
162 |
private javax.swing.JTextField nameField;
|
|
161 |
public javax.swing.JTextField nameField;
|
|
163 | 162 |
private javax.swing.JLabel nameLabel; |
164 |
private javax.swing.JTextField titleField;
|
|
163 |
public javax.swing.JTextField titleField;
|
|
165 | 164 |
private javax.swing.JLabel titleLabel; |
166 |
// End of variables declaration
|
|
165 |
// End of variables declaration |
|
167 | 166 |
|
168 | 167 |
public Object getModel() { |
169 | 168 |
model_ogcmetadata.setName(nameField.getText()); |
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/addResource/AddResourceController.java | ||
---|---|---|
140 | 140 |
publication = publi; |
141 | 141 |
} |
142 | 142 |
} |
143 |
/** |
|
144 |
* Gets the controller's panel |
|
145 |
*/ |
|
146 |
public AddResourcePanel getWindow(){ |
|
147 |
return this.window; |
|
148 |
} |
|
143 | 149 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/wizard/PublishWizardController.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004-2006 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Iba?ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.publish.gui.wizard; |
|
42 |
|
|
43 |
import java.awt.event.ActionEvent; |
|
44 |
import java.awt.event.ActionListener; |
|
45 |
|
|
46 |
import javax.swing.event.TreeSelectionEvent; |
|
47 |
import javax.swing.event.TreeSelectionListener; |
|
48 |
|
|
49 |
import org.gvsig.publish.gui.addResource.AddResourceController; |
|
50 |
import org.gvsig.publish.gui.publish.IPublishPluginController; |
|
51 |
import org.gvsig.publish.gui.publish.IPublishPluginPanel; |
|
52 |
import org.gvsig.publish.serversmodel.Publication; |
|
53 |
import org.gvsig.publish.serversmodel.RemoteResource; |
|
54 |
import org.gvsig.publish.serversmodel.Server; |
|
55 |
import org.gvsig.publish.serversmodel.Service; |
|
56 |
/** |
|
57 |
* GUI controller for a publication wizard. |
|
58 |
* |
|
59 |
* @author jvhigon |
|
60 |
* |
|
61 |
*/ |
|
62 |
public abstract class PublishWizardController implements IPublishPluginController, ActionListener, TreeSelectionListener { |
|
63 |
//Associations |
|
64 |
private PublishWizardPanel panel; |
|
65 |
private Publication publication; |
|
66 |
private Server currentServer; |
|
67 |
private Service currentService; |
|
68 |
private RemoteResource currentRemoteResource; |
|
69 |
private IPublishPluginPanel serverBasicPane; |
|
70 |
private IPublishPluginPanel serverAdvancedPane; |
|
71 |
private IPublishPluginPanel serviceBasicPane; |
|
72 |
private IPublishPluginPanel serviceAdvancedPane; |
|
73 |
private IPublishPluginPanel remoteBasicPane; |
|
74 |
private IPublishPluginPanel remoteAdvancedPane; |
|
75 |
//Events |
|
76 |
public static final String ADD_RESOURCE_EVENT="add_resource_event"; |
|
77 |
|
|
78 |
//Constructor |
|
79 |
/** |
|
80 |
* Default constructor. It creates the panel and set its listener as "this". |
|
81 |
*/ |
|
82 |
public PublishWizardController() { |
|
83 |
this.panel = new PublishWizardPanel(); |
|
84 |
this.panel.setListener(this); |
|
85 |
} |
|
86 |
//Abstract methods |
|
87 |
/** |
|
88 |
* Any subclass must have a panel for server parameters |
|
89 |
* @param server |
|
90 |
* @return |
|
91 |
*/ |
|
92 |
public abstract IPublishPluginPanel getServerPanel(Server server); |
|
93 |
/** |
|
94 |
* Any subclass must have a panel for advanced server parameters |
|
95 |
* @param server model I want to show |
|
96 |
* @return |
|
97 |
*/ |
|
98 |
public abstract IPublishPluginPanel getServerAdvancedPanel(Server server); |
|
99 |
/** |
|
100 |
* Any subclass must have a panel for service parameters |
|
101 |
* @param service model I want to show |
|
102 |
* @return |
|
103 |
*/ |
|
104 |
public abstract IPublishPluginPanel getServicePanel(Service service); |
|
105 |
/** |
|
106 |
* Any subclass must have a panel for advanced service parameters |
|
107 |
* @param service model I want to show |
|
108 |
* @return |
|
109 |
*/ |
|
110 |
public abstract IPublishPluginPanel getServiceAdvancedPanel(Service service); |
|
111 |
/** |
|
112 |
* Any subclass must have a panel for remote resources panel |
|
113 |
* @param remoteResource model I want to show |
|
114 |
* @return |
|
115 |
*/ |
|
116 |
public abstract IPublishPluginPanel getRemoteResourcePanel(RemoteResource remoteResource); |
|
117 |
/** |
|
118 |
* Any subclass must have a panel for advanced remote resources panel |
|
119 |
* @param remoteResource model I want to show |
|
120 |
* @return |
|
121 |
*/ |
|
122 |
public abstract IPublishPluginPanel getRemoteResourceAdvancedPanel(RemoteResource remoteResource); |
|
123 |
|
|
124 |
//Methods |
|
125 |
/** |
|
126 |
* Gets the publication from the GUI. The GUI will have to update the model first. |
|
127 |
*/ |
|
128 |
public Object getModel() { |
|
129 |
serverBasicPane.getModel(); |
|
130 |
serverAdvancedPane.getModel(); |
|
131 |
serviceBasicPane.getModel(); |
|
132 |
serviceAdvancedPane.getModel(); |
|
133 |
if (remoteBasicPane != null) |
|
134 |
remoteBasicPane.getModel(); |
|
135 |
if (remoteAdvancedPane != null) |
|
136 |
remoteAdvancedPane.getModel(); |
|
137 |
return this.panel.getModel(); |
|
138 |
} |
|
139 |
/** |
|
140 |
* Gets the GUI |
|
141 |
*/ |
|
142 |
public IPublishPluginPanel getPanel() { |
|
143 |
return this.panel; |
|
144 |
} |
|
145 |
/** |
|
146 |
* Sets the publication which will be showed by the GUI. Then changes the current visible |
|
147 |
* panel with the server panel |
|
148 |
* @param entityModel must be a "publication" object |
|
149 |
*/ |
|
150 |
public void setModel(Object entityModel) { |
|
151 |
// cast to publication |
|
152 |
this.publication = (Publication) entityModel; |
|
153 |
//puts the model into the panel |
|
154 |
this.panel.setModel(entityModel); |
|
155 |
|
|
156 |
//update the current server |
|
157 |
currentServer = publication.getServer(); |
|
158 |
//update the current service --> if I have only one service for server |
|
159 |
//If you want 2, you must pass an array of services and modify the services panel |
|
160 |
currentService = currentServer.getService(0); |
|
161 |
//update the current resource --> it depends changevalue event (at the begining I get the first rr) |
|
162 |
//if the model contains a remote resource ... |
|
163 |
if (currentService.getRemoteResourcesCount() > 0){ |
|
164 |
currentRemoteResource = currentService.getRemoteResource(0); |
|
165 |
} |
|
166 |
//set the panels in the GUI |
|
167 |
setPanels(); |
|
168 |
} |
|
169 |
/** |
|
170 |
* gets the panel, after updates the model |
|
171 |
*/ |
|
172 |
private void setPanels(){ |
|
173 |
|
|
174 |
//put server basic |
|
175 |
serverBasicPane = getServerPanel(currentServer); |
|
176 |
//serverBasicPane.setModel(currentServer); |
|
177 |
panel.setServerBasicPanel(serverBasicPane); |
|
178 |
|
|
179 |
//put server advanced |
|
180 |
serverAdvancedPane = getServerAdvancedPanel(currentServer); |
|
181 |
//serverAdvancedPane.setModel(currentServer); |
|
182 |
panel.setServerAdvancedPanel(serverAdvancedPane); |
|
183 |
|
|
184 |
//put service basic |
|
185 |
serviceBasicPane = getServicePanel(currentService); |
|
186 |
//serviceBasicPane.setModel(serviceAdvancedPane); |
|
187 |
panel.setServiceBasicPanel(serviceBasicPane); |
|
188 |
|
|
189 |
//put service advanced |
|
190 |
serviceAdvancedPane = getServiceAdvancedPanel(currentService); |
|
191 |
panel.setServiceAdvancedPanel(serviceAdvancedPane); |
|
192 |
|
|
193 |
//put remote basic |
|
194 |
if (currentRemoteResource !=null){ |
|
195 |
remoteBasicPane = getRemoteResourcePanel(currentRemoteResource); |
|
196 |
panel.setRemoteResourceBasicPanel(remoteBasicPane); |
|
197 |
} |
|
198 |
|
|
199 |
//put remote advanced |
|
200 |
if (currentRemoteResource !=null){ |
|
201 |
remoteAdvancedPane = getRemoteResourceAdvancedPanel(currentRemoteResource); |
|
202 |
//remoteAdvancedPane.setModel(currentRemoteResource); |
|
203 |
panel.setRemoteResourceAdvancedPanel(remoteAdvancedPane); |
|
204 |
} |
|
205 |
} |
|
206 |
/** |
|
207 |
* Actions from buttons |
|
208 |
*/ |
|
209 |
public void actionPerformed(ActionEvent e) { |
|
210 |
//first of all I update the model |
|
211 |
getModel(); |
|
212 |
if (e.getActionCommand().equals(ADD_RESOURCE_EVENT)){ |
|
213 |
AddResourceController addResourceCtrl = new AddResourceController(); |
|
214 |
addResourceCtrl.setPublication(publication); |
|
215 |
addResourceCtrl.showWindow(); |
|
216 |
} |
|
217 |
} |
Also available in: Unified diff