Revision 2822 org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/java/org/gvsig/vcsgis/app/VCSGisSwingServicesImpl.java
VCSGisSwingServicesImpl.java | ||
---|---|---|
11 | 11 |
import javax.swing.DefaultListModel; |
12 | 12 |
import javax.swing.ListModel; |
13 | 13 |
import javax.swing.tree.TreeModel; |
14 |
import org.apache.commons.lang.StringUtils; |
|
14 | 15 |
import org.gvsig.app.ApplicationLocator; |
15 | 16 |
import org.gvsig.app.ApplicationManager; |
16 | 17 |
import org.gvsig.app.project.Project; |
... | ... | |
89 | 90 |
|
90 | 91 |
@Override |
91 | 92 |
public void addLayerToView(FeatureStore store, LabeledValue labeledView) { |
93 |
addLayerToView(store, labeledView, null); |
|
94 |
} |
|
95 |
|
|
96 |
@Override |
|
97 |
public void addLayerToView(FeatureStore store, LabeledValue labeledView, String name) { |
|
92 | 98 |
try { |
93 | 99 |
if (labeledView.getValue() == null){ |
94 | 100 |
return; |
95 | 101 |
} |
96 | 102 |
ViewDocument view = (ViewDocument) labeledView.getValue(); |
97 |
FLayer layer = MapContextLocator.getMapContextManager().createLayer(store.getName(), store); |
|
103 |
String layerName = name; |
|
104 |
if(StringUtils.isBlank(layerName)){ |
|
105 |
layerName = store.getName(); |
|
106 |
} |
|
107 |
FLayer layer = MapContextLocator.getMapContextManager().createLayer(layerName, store); |
|
98 | 108 |
view.getMapContext().getLayers().add(layer); |
99 | 109 |
} catch (Exception ex) { |
100 | 110 |
throw new RuntimeException("Can't add layer to view.", ex); //FIXME |
Also available in: Unified diff