Revision 21299 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/actions/ChangeSymbolTocMenuEntry.java

View differences:

ChangeSymbolTocMenuEntry.java
1 1
package com.iver.cit.gvsig.project.documents.view.toc.actions;
2 2

  
3 3
import org.apache.log4j.Logger;
4
import org.gvsig.data.ReadException;
4 5
import org.gvsig.fmap.mapcontext.MapContext;
5 6
import org.gvsig.fmap.mapcontext.layers.FLayer;
6 7
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
......
11 12
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
12 13
import org.gvsig.fmap.mapcontext.rendering.symbols.MultiLayerFillSymbol;
13 14

  
14
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
15 15
import com.iver.andami.PluginServices;
16 16
import com.iver.andami.messages.NotificationManager;
17 17
import com.iver.cit.gvsig.ProjectExtension;
......
128 128
		boolean showDialog = isTocItemLeaf(item);
129 129

  
130 130
		if (!showDialog) return;
131
		
131

  
132 132
		try {
133 133
			FLyrVect layer = (FLyrVect) selectedItems[0];
134 134
			ISymbol oldSymbol = ((TocItemLeaf) item).getSymbol();
135
			// patch, figure out an ellegant way to solve this 
135
			// patch, figure out an ellegant way to solve this
136 136
			if (oldSymbol instanceof MultiLayerFillSymbol) {
137 137
				MultiLayerFillSymbol ms = (MultiLayerFillSymbol) oldSymbol;
138 138
				for (int i = 0; i < ms.getLayerCount(); i++) {
139 139
					if (ms.getLayer(i).getClassName().equals("org.gvsig.symbology.symbols.DotDensityFillSymbol")) {
140
						/* 
141
						 * since dot density symbol works together with the 
140
						/*
141
						 * since dot density symbol works together with the
142 142
						 * legend, there is no way to edit it from the symbol selector and editor
143 143
						 * we have to break now!
144 144
						 */
......
147 147
				}
148 148
			}
149 149
			// end patch
150
			
151
			
150

  
151

  
152 152
			int shapeType = ((IVectorLegend) layer.getLegend()).getShapeType();
153 153
			if (shapeType == 0) {
154 154
				Logger.getLogger(ChangeNameTocMenuEntry.class).debug("Error legend "+layer.getLegend()+" does not have shapetype initialized");
......
160 160
			try {
161 161
				symSel = SymbolSelector.createSymbolSelector(oldSymbol, shapeType);
162 162
			} catch (IllegalArgumentException iaEx) {
163
				/* 
164
				 * this usually happens when the Legend has a composed 
163
				/*
164
				 * this usually happens when the Legend has a composed
165 165
				 * symbol that collides with the normal operation and
166 166
				 * it only can be changed from the panel of the legend
167
				 */ 
167
				 */
168 168
				// TODO throw a signal and show a warning message box telling
169
				// that the operation cannot be performed 
169
				// that the operation cannot be performed
170 170
				return;
171 171
			}
172 172
			PluginServices.getMDIManager().addWindow(symSel);
173 173
			ISymbol newSymbol = (ISymbol) symSel.getSelectedObject();
174
			
174

  
175 175
			if (newSymbol == null)
176 176
				return;
177
			
177

  
178 178
			newSymbol.setDescription(oldSymbol.getDescription());
179
			
179

  
180 180
			for (int i = 0; i < selectedItems.length; i++) {
181 181
				FLyrVect theLayer = ((FLyrVect) selectedItems[i]);
182
				
182

  
183 183
				try {
184 184
					ILegend legend = theLayer.getLegend();
185 185
					if (legend instanceof IClassifiedVectorLegend) {
......
192 192
				} catch (Exception e) {
193 193
					NotificationManager.addWarning(PluginServices.getText(this, "skipped_symbol_changed_for_layer")+": "+theLayer.getName(), e);
194 194
				}
195
					
195

  
196 196
			}
197 197
		     // refresh view treak
198 198
			MapContext mc = layer.getMapContext();
......
200 200
			Project project=((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject();
201 201
			project.setModified(true);
202 202
			mc.callLegendChanged();
203
			
204
		} catch (ReadDriverException e) {
203

  
204
		} catch (ReadException e) {
205 205
			NotificationManager.addError(PluginServices.getText(this, "getting_shape_type"), e);
206 206
		}
207 207
	}

Also available in: Unified diff