public DataSource getDataSource() throws Exception {
// Retrieve the selected Layers
DefaultListModel tempModel = (DefaultListModel) myListSelectedLayers.getModel();
Layer[] tempSelectedLayers = new Layer[tempModel.size()];
for (int i=0; i<tempSelectedLayers.length; i++){
Layer tempLayer = (Layer) tempModel.getElementAt(i);
tempSelectedLayers[i] = tempLayer;
if (tempLayer.getSelectedStyle() == null){
if (tempLayer.getStyles() != null){
if (tempLayer.getStyles().length > 0){
tempLayer.setSelectedStyle(tempLayer.getStyles()[0]);
}
}
}
}
if (tempSelectedLayers.length == 0) throw new Exception("No layers selected");