Revision 38189

View differences:

branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/ShowDevelInfoExtension.java
4 4
import java.awt.Dimension;
5 5
import java.awt.event.ActionEvent;
6 6
import java.awt.event.ActionListener;
7
import java.awt.event.ComponentEvent;
8
import java.awt.event.ComponentListener;
9 7
import java.io.File;
10 8
import java.io.FileWriter;
11 9
import java.io.IOException;
......
18 16
import java.util.TreeSet;
19 17

  
20 18
import javax.swing.BorderFactory;
19
import javax.swing.Box;
21 20
import javax.swing.BoxLayout;
22 21
import javax.swing.JButton;
23 22
import javax.swing.JPanel;
......
27 26
import org.gvsig.andami.iconthemes.IIconTheme;
28 27
import org.gvsig.andami.iconthemes.IconThemeManager;
29 28
import org.gvsig.andami.plugins.Extension;
30
import org.gvsig.andami.ui.mdiManager.IWindow;
31
import org.gvsig.andami.ui.mdiManager.MDIManagerFactory;
32
import org.gvsig.andami.ui.mdiManager.WindowInfo;
33 29
import org.gvsig.andami.ui.mdiManager.MDIManager.UIActionTool;
30
import org.gvsig.andami.ui.mdiManager.MDIManagerFactory;
34 31
import org.gvsig.app.ApplicationLocator;
35 32
import org.gvsig.tools.ToolsLocator;
36 33
import org.gvsig.tools.dataTypes.DataTypesManager;
......
40 37
import org.gvsig.tools.persistence.PersistenceManager;
41 38
import org.gvsig.tools.persistence.Persistent;
42 39
import org.gvsig.tools.persistence.exception.PersistenceException;
40
import org.gvsig.tools.swing.api.ToolsSwingLocator;
41
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
43 42
import org.slf4j.Logger;
44 43
import org.slf4j.LoggerFactory;
45 44

  
46 45
public class ShowDevelInfoExtension extends Extension {
47
	public static final int MODE_DIALOG = 1;
48
    public static final int MODE_WINDOW = 2;
49
    public static final int MODE_TOOL = 3;
50 46

  
51
    private Logger logger = LoggerFactory.getLogger(ShowDevelInfoExtension.class);
52
    
47
	private Logger logger = LoggerFactory
48
			.getLogger(ShowDevelInfoExtension.class);
49

  
53 50
	public void initialize() {
54 51
		// Do nothing
55 52
	}
......
61 58
		try {
62 59
			manager.setAutoValidation(PersistenceManager.MANDATORY_IF_DECLARED);
63 60
		} catch (PersistenceException e) {
64
			logger.warn("Error modificando el modo de autovalidacion de persistencia.", e);
61
			logger.warn(
62
					"Error modificando el modo de autovalidacion de persistencia.",
63
					e);
65 64
		}
66
		
65

  
67 66
	}
68
	
67

  
69 68
	public void execute(String actionCommand) {
70
		if( "ShowPersistenceFactories".equalsIgnoreCase(actionCommand) ) {
71
			showInfoPanel("Persistence factories", MODE_WINDOW, this.getPersistenceFactories());
72
		} else if( "ShowIconThemeInformation".equalsIgnoreCase(actionCommand) ) {
73
			showInfoPanel("Icon theme information", MODE_WINDOW, this.getIconThemeInformation());
74
		} else if( "ShowActionsInformation".equalsIgnoreCase(actionCommand) ) {
75
			showInfoPanel("Actions information", MODE_WINDOW, this.getActionsInformation());
69
		if ("ShowPersistenceFactories".equalsIgnoreCase(actionCommand)) {
70
			showInfoPanel("Persistence factories", WindowManager.MODE.WINDOW,
71
					this.getPersistenceFactories());
72
		} else if ("ShowIconThemeInformation".equalsIgnoreCase(actionCommand)) {
73
			showInfoPanel("Icon theme information", WindowManager.MODE.WINDOW,
74
					this.getIconThemeInformation());
75
		} else if ("ShowActionsInformation".equalsIgnoreCase(actionCommand)) {
76
			showInfoPanel("Actions information", WindowManager.MODE.WINDOW,
77
					this.getActionsInformation());
76 78
		}
77
		
79

  
78 80
	}
79 81

  
80 82
	private String getActionsInformation() {
81 83
		StringBuffer buffer = new StringBuffer();
82
		
84

  
83 85
		buffer.append("<html>\n");
84 86
		buffer.append("<body>\n");
85 87
		buffer.append("<h2>Actions information</h2>\n");
......
96 98
		buffer.append("    <td>Tip</td>\n");
97 99
		buffer.append("    <td>Enabled text</td>\n");
98 100
		buffer.append("  </tr>\n");
99
		Iterator<UIActionTool> actions = MDIManagerFactory.createManager().getActionTools();
100
		while( actions.hasNext() ) {
101
		Iterator<UIActionTool> actions = MDIManagerFactory.createManager()
102
				.getActionTools();
103
		while (actions.hasNext()) {
101 104
			UIActionTool action = actions.next();
102 105
			buffer.append("  <tr>\n");
103
			buffer.append("    <td>").append(action.getName()).append("</td>\n");
104
			buffer.append("    <td>").append(action.getExtensionName()).append("</td>\n");
105
			buffer.append("    <td>").append(action.getPosition()).append("</td>\n");
106
			buffer.append("    <td>").append(action.getText()).append("</td>\n");
107
			buffer.append("    <td>").append(action.getCommand()).append("</td>\n");
108
			buffer.append("    <td>").append(action.getIconName()).append("</td>\n");
109
			buffer.append("    <td>").append(action.getTooptip()).append("</td>\n");
110
			buffer.append("    <td>").append(action.getEnableText()).append("</td>\n");
106
			buffer.append("    <td>").append(action.getName())
107
					.append("</td>\n");
108
			buffer.append("    <td>").append(action.getExtensionName())
109
					.append("</td>\n");
110
			buffer.append("    <td>").append(action.getPosition())
111
					.append("</td>\n");
112
			buffer.append("    <td>").append(action.getText())
113
					.append("</td>\n");
114
			buffer.append("    <td>").append(action.getCommand())
115
					.append("</td>\n");
116
			buffer.append("    <td>").append(action.getIconName())
117
					.append("</td>\n");
118
			buffer.append("    <td>").append(action.getTooptip())
119
					.append("</td>\n");
120
			buffer.append("    <td>").append(action.getEnableText())
121
					.append("</td>\n");
111 122
			buffer.append("  </tr>\n");
112 123
		}
113 124
		buffer.append("</table>\n");
114 125
		buffer.append("</body>\n");
115 126
		buffer.append("</html>\n");
116 127

  
117
		save2file("actionsinfo",buffer.toString());
128
		save2file("actionsinfo", buffer.toString());
118 129

  
119
		return buffer.toString();	}
130
		return buffer.toString();
131
	}
120 132

  
121 133
	private String getIconThemeInformation() {
122 134
		StringBuffer buffer = new StringBuffer();
123
		
135

  
124 136
		IconThemeManager manager = IconThemeManager.getIconThemeManager();
125 137
		IIconTheme theme = manager.getCurrent();
126
		
138

  
127 139
		buffer.append("<html>\n");
128 140
		buffer.append("<body>\n");
129 141
		buffer.append("<h2>Icon theme information</h2>\n");
......
144 156
		buffer.append("    <td>Resource id</td>\n");
145 157
		buffer.append("  </tr>\n");
146 158
		Iterator<String> names = theme.iterator();
147
		while( names.hasNext() ) {
159
		while (names.hasNext()) {
148 160
			String name = names.next();
149 161
			buffer.append("  <tr>\n");
150 162
			buffer.append("    <td>").append(name).append("</td>\n");
151
			buffer.append("    <td>").append(theme.getResourceID(name)).append("</td>\n");
163
			buffer.append("    <td>").append(theme.getResourceID(name))
164
					.append("</td>\n");
152 165
			buffer.append("  </tr>\n");
153 166
		}
154 167
		buffer.append("</table>\n");
155 168
		buffer.append("</body>\n");
156 169
		buffer.append("</html>\n");
157 170

  
158
		save2file("iconthemeinfo",buffer.toString());
159
		
171
		save2file("iconthemeinfo", buffer.toString());
172

  
160 173
		return buffer.toString();
161 174
	}
162 175

  
163 176
	private void save2file(String name, String contents) {
164 177
		File file;
165 178
		try {
166
			file = File.createTempFile("gvsig-"+name, ".html");
179
			file = File.createTempFile("gvsig-" + name, ".html");
167 180
			FileWriter fwriter = new FileWriter(file);
168 181
			fwriter.append(contents);
169 182
			fwriter.close();
170 183
		} catch (IOException e) {
171
			logger.warn("Can't save contents to temp file gvsig-"+name, e );
184
			logger.warn("Can't save contents to temp file gvsig-" + name, e);
172 185
		}
173 186
	}
174
	
187

  
175 188
	public boolean isEnabled() {
176 189
		return true;
177 190
	}
......
180 193
		return true;
181 194
	}
182 195

  
183
	private void showInfoPanel(String title, int mode, String html) {
184
		IWindow win = new JInfoPanel(title, mode, html);
185
		ApplicationLocator.getManager().getUIManager().addCentredWindow(win);
196
	private void showInfoPanel(String title, WindowManager.MODE mode,
197
			String html) {
198
		JPanel panel = new JInfoPanel(html);
199
		WindowManager wm = ToolsSwingLocator.getWindowManager();
200
		wm.showWindow(panel, title, mode);
186 201
	}
187
	
188
	private class JInfoPanel extends JPanel implements IWindow, ComponentListener  {
189
	    /**
202

  
203
	private class JInfoPanel extends JPanel {
204
		/**
190 205
		 * 
191 206
		 */
192 207
		private static final long serialVersionUID = 7164653790859770568L;
193 208

  
194

  
195 209
		private JButton accept = null;
196 210
		private JButton copy = null;
197 211
		private JTextPane text = null;
198 212

  
199
	    private WindowInfo info;
213
		public JInfoPanel(final String html) {
214
			this.setLayout(new BorderLayout());
215
			this.setPreferredSize(new Dimension(500, 300));
216
			this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
200 217

  
201
	    private Object profile = WindowInfo.TOOL_PROFILE;
218
			text = new JTextPane();
219
			text.setContentType("text/html");
220
			text.setEditable(false);
221
			text.setText(html);
222
			text.setCaretPosition(0);
202 223

  
224
			JScrollPane scrollPane = new JScrollPane(text);
225
			scrollPane.setPreferredSize(new Dimension(500, 220));
203 226

  
204
		public JInfoPanel(String title, int mode, final String html) {
205
	
206
		    this.setLayout(new BorderLayout());
207
		    this.setPreferredSize(new Dimension(500, 300));
208
	
209
		    text = new JTextPane();
210
		    text.setContentType("text/html");
211
		    text.setEditable(false);
212
		    text.setText(html);
213
		    text.setCaretPosition(0);
214
		    
215
		    JScrollPane scrollPane = new JScrollPane(text);
216
		    scrollPane.setPreferredSize(new Dimension(500, 220));
217
	
218
		    accept = new JButton("Accept");
219
		    accept.addActionListener(new ActionListener() {
220
			    public void actionPerformed(ActionEvent arg0) {
221
				    setVisible(false);
222
			    }
223
		    });
224
		    copy = new JButton("Copy to clipboard");
225
		    copy.addActionListener(new ActionListener() {
226
			    public void actionPerformed(ActionEvent arg0) {
227
			    	ApplicationLocator.getManager().putInClipboard(text.getText());
228
			    }
229
		    });
230
		    
231
		    JPanel optionsPane = new JPanel();
232
		    optionsPane.setLayout(new BoxLayout(optionsPane, BoxLayout.LINE_AXIS));
233
		    optionsPane.setBorder(BorderFactory.createEmptyBorder(4,4,4,4));
234
		    
235
		    optionsPane.add(copy);
236
		    optionsPane.add(accept);
237
	
238
		    this.add(scrollPane, BorderLayout.CENTER);
239
		    this.add(optionsPane, BorderLayout.SOUTH);
240
		    this.setVisible(true);
241
		    profile = WindowInfo.DIALOG_PROFILE;
242
		    
243
	        int code = WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE
244
	                | WindowInfo.RESIZABLE;
245
	        switch (mode) {
246
	        case MODE_DIALOG:
247
	            code |= WindowInfo.MODALDIALOG;
248
	            profile = WindowInfo.DIALOG_PROFILE;
249
	            break;
250
	        case MODE_TOOL:
251
	            code |= WindowInfo.PALETTE;
252
	            profile = WindowInfo.TOOL_PROFILE;
253
	            break;
254
	        case MODE_WINDOW:
255
	        default:
256
	            code |= WindowInfo.MODELESSDIALOG;
257
	            profile = WindowInfo.DIALOG_PROFILE;
258
	        }
259
	        info = new WindowInfo(code);
260
	        info.setTitle(title);
261
	        info.setMinimumSize(getPreferredSize());
262
	        info.setHeight(400);
263
	        info.setWidth(600);
227
			accept = new JButton("Accept");
228
			accept.addActionListener(new ActionListener() {
229
				public void actionPerformed(ActionEvent arg0) {
230
					setVisible(false);
231
				}
232
			});
233
			copy = new JButton("Copy to clipboard");
234
			copy.addActionListener(new ActionListener() {
235
				public void actionPerformed(ActionEvent arg0) {
236
					ApplicationLocator.getManager().putInClipboard(
237
							text.getText());
238
				}
239
			});
264 240

  
265
	        addComponentListener(this);
266
		}
241
			JPanel buttonsPanel = new JPanel();
242
			buttonsPanel.setLayout(new BoxLayout(buttonsPanel,
243
					BoxLayout.LINE_AXIS));
244
			buttonsPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
267 245

  
268
	    public WindowInfo getWindowInfo() {
269
	        return info;
270
	    }
271
	
272
	    public Object getWindowProfile() {
273
	        return profile;
274
	    }
275
	    
276
	    public void componentHidden(ComponentEvent componentEvent) {
277
	    	ApplicationLocator.getManager().getUIManager().closeWindow(this);
278
	    }
246
			buttonsPanel.add(Box.createHorizontalGlue());
247
			buttonsPanel.add(copy);
248
			buttonsPanel.add(accept);
279 249

  
280
	    public void componentMoved(ComponentEvent arg0) {
281
	        // Do nothing
282
	    }
283

  
284
	    public void componentResized(ComponentEvent arg0) {
285
	        // Do nothing
286
	    }
287

  
288
	    public void componentShown(ComponentEvent arg0) {
289
	        // Do nothing
290
	    }
250
			this.add(scrollPane, BorderLayout.CENTER);
251
			this.add(buttonsPanel, BorderLayout.SOUTH);
252
			this.setVisible(true);
253
		}
291 254
	}
292 255

  
293 256
	public class PersistenceInfo implements Comparable<PersistenceInfo> {
......
295 258
		@SuppressWarnings("rawtypes")
296 259
		Class theClass;
297 260
		DynStruct definition;
298
		
299
		PersistenceInfo(PersistenceFactory factory,	@SuppressWarnings("rawtypes") Class theClass,	DynStruct definition) {
261

  
262
		PersistenceInfo(PersistenceFactory factory,
263
				@SuppressWarnings("rawtypes") Class theClass,
264
				DynStruct definition) {
300 265
			this.factory = factory;
301 266
			this.theClass = theClass;
302 267
			this.definition = definition;
303 268
		}
304 269

  
305 270
		String getDefinitionName() {
306
			if( definition == null ) {
271
			if (definition == null) {
307 272
				return "";
308 273
			}
309 274
			return definition.getFullName();
310
		} 
311
		
275
		}
276

  
312 277
		String getDefinitionDescription() {
313
			if( definition == null ) {
278
			if (definition == null) {
314 279
				return "";
315 280
			}
316 281
			return definition.getDescription();
317
		} 
282
		}
318 283

  
319 284
		String getClassName() {
320
			if( theClass == null ) {
285
			if (theClass == null) {
321 286
				return "";
322 287
			}
323 288
			return theClass.getName();
324
		} 
325
		
289
		}
290

  
326 291
		String getFactoryName() {
327
			if( factory == null ) {
292
			if (factory == null) {
328 293
				return "";
329 294
			}
330 295
			return factory.getClass().getName();
331
		} 
296
		}
332 297

  
333
		
334 298
		public int compareTo(PersistenceInfo other) {
335
			int r = this.factory.getClass().getName().compareTo(other.factory.getClass().getName());
336
			if( r == 0 ) {
337
				return this.theClass.getName().compareTo(other.theClass.getName());
299
			int r = this.factory.getClass().getName()
300
					.compareTo(other.factory.getClass().getName());
301
			if (r == 0) {
302
				return this.theClass.getName().compareTo(
303
						other.theClass.getName());
338 304
			}
339 305
			return r;
340 306
		}
......
344 310
	public class ClassComparator implements Comparator {
345 311

  
346 312
		public int compare(Object o1, Object o2) {
347
			if( o1==null || o2==null || ((Class)o1).getName()==null ) {
313
			if (o1 == null || o2 == null || ((Class) o1).getName() == null) {
348 314
				logger.warn("Esto no deberia estar pasando.");
349 315
				return 0; // FIXME
350 316
			}
351
			return ((Class)o1).getName().compareTo(((Class)o2).getName());
317
			return ((Class) o1).getName().compareTo(((Class) o2).getName());
352 318
		}
353 319

  
354
		
355 320
	}
356
	
321

  
357 322
	@SuppressWarnings({ "unchecked", "rawtypes" })
358 323
	private String getPersistenceFactories() {
359
		int warningsCounter =0;
324
		int warningsCounter = 0;
360 325
		List<PersistenceInfo> classes = new ArrayList<PersistenceInfo>();
361 326
		Set<Class> referencedClasses = new TreeSet<Class>(new ClassComparator());
362
		
327

  
363 328
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
364 329

  
365 330
		List<PersistenceFactory> factories = manager.getFactories();
......
367 332
			List<Class> theClasses = factory.getManagedClasses();
368 333
			for (Class theClass : theClasses) {
369 334

  
370
                DynStruct definition = manager.getDefinition(theClass);
371
                List defs = factory.getDefinitions();
372
                if (definition == null && defs != null && !defs.isEmpty()) {
373
                    for (int i = 0; i < defs.size(); i++) {
374
                        definition = (DynStruct) defs.get(i);
375
                        classes.add(new PersistenceInfo(factory, theClass,
376
                            definition));
377
                    }
378
                } else {
379
                    classes.add(new PersistenceInfo(factory, theClass,
380
                        definition));
381
                }
335
				DynStruct definition = manager.getDefinition(theClass);
336
				List defs = factory.getDefinitions();
337
				if (definition == null && defs != null && !defs.isEmpty()) {
338
					for (int i = 0; i < defs.size(); i++) {
339
						definition = (DynStruct) defs.get(i);
340
						classes.add(new PersistenceInfo(factory, theClass,
341
								definition));
342
					}
343
				} else {
344
					classes.add(new PersistenceInfo(factory, theClass,
345
							definition));
346
				}
382 347
			}
383 348
		}
384 349
		Collections.sort(classes);
385
		
386
		
387
		StringBuffer buffer= new StringBuffer();
350

  
351
		StringBuffer buffer = new StringBuffer();
388 352
		StringBuffer warnings = new StringBuffer();
389
		
353

  
390 354
		buffer.append("<html>\n");
391 355
		buffer.append("<body>\n");
392 356
		buffer.append("<h2>Supported persistent classes</h2>\n");
......
395 359
		buffer.append("<ol>\n");
396 360
		for (PersistenceInfo classInfo : classes) {
397 361
			StringBuffer classBuffer = new StringBuffer();
398
            boolean warning = false;
362
			boolean warning = false;
399 363
			classBuffer.append("  <li>\n    ");
400 364
			classBuffer.append("Class: <i>");
401 365
			classBuffer.append(classInfo.getClassName());
402 366
			classBuffer.append("</i><br>\n    Persistent: <i>");
403
			if( Persistent.class.isAssignableFrom(classInfo.theClass) ) {
367
			if (Persistent.class.isAssignableFrom(classInfo.theClass)) {
404 368
				classBuffer.append(" yes.");
405 369
			} else {
406 370
				classBuffer.append(" through a factory.");
407 371
			}
408 372
			classBuffer.append("<br>\n    Factory: <i>");
409
			classBuffer.append(classInfo.getFactoryName()).append("</i><br>\n    Definition name: <i>");
410
			classBuffer.append(classInfo.getDefinitionName()).append("</i><br>\n    Description: \n");
411
			classBuffer.append(classInfo.getDefinitionDescription()).append("<br>\n    ");
412
			DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager();
373
			classBuffer.append(classInfo.getFactoryName()).append(
374
					"</i><br>\n    Definition name: <i>");
375
			classBuffer.append(classInfo.getDefinitionName()).append(
376
					"</i><br>\n    Description: \n");
377
			classBuffer.append(classInfo.getDefinitionDescription()).append(
378
					"<br>\n    ");
379
			DataTypesManager dataTypesManager = ToolsLocator
380
					.getDataTypesManager();
413 381
			DynStruct definition = classInfo.definition;
414
            if (definition == null) {
415
                classBuffer.append("Definition for ")
416
                    .append(classInfo.getClassName())
417
                    .append(" is null.<br>\n    ");
418
                warningsCounter++;
419
                warning = true;
420
            } else {
421
                DynField[] fields = definition.getDynFields();
422
                for (int i = 0; i < fields.length; i++) {
423
                    DynField field = fields[i];
424
                    if (dataTypesManager.isContainer(field.getType())) {
425
                        if (field.getClassOfItems() == null) {
426
                            classBuffer
427
                                .append("Field <b>")
428
                                .append(field.getName())
429
                                .append(
430
                                    "</b>, container,  can't has class for value of items.<br>\n    ");
431
                            warningsCounter++;
432
                            warning = true;
433
                        } else {
434
                            classBuffer.append("Field ")
435
                                .append(field.getName())
436
                                .append(", container of '")
437
                                .append(field.getClassOfItems().getName())
438
                                .append("'.<br>\n    ");
439
                            referencedClasses.add(field.getClassOfItems());
440
                        }
441
                    } else
442
                        if (dataTypesManager.isObject(field.getType())) {
443
                            if (field.getClassOfValue() == null) {
444
                                classBuffer
445
                                    .append("Field <b>")
446
                                    .append(field.getName())
447
                                    .append(
448
                                        "</b> can't has class of value.<br>\n    ");
449
                                warningsCounter++;
450
                                warning = true;
451
                            } else {
452
                                classBuffer.append("Field ")
453
                                    .append(field.getName()).append(" of '")
454
                                    .append(field.getClassOfValue())
455
                                    .append("'.<br>\n    ");
456
                                referencedClasses.add(field.getClassOfValue());
457
                            }
458
                        }
459
                }
382
			if (definition == null) {
383
				classBuffer.append("Definition for ")
384
						.append(classInfo.getClassName())
385
						.append(" is null.<br>\n    ");
386
				warningsCounter++;
387
				warning = true;
388
			} else {
389
				DynField[] fields = definition.getDynFields();
390
				for (int i = 0; i < fields.length; i++) {
391
					DynField field = fields[i];
392
					if (dataTypesManager.isContainer(field.getType())) {
393
						if (field.getClassOfItems() == null) {
394
							classBuffer
395
									.append("Field <b>")
396
									.append(field.getName())
397
									.append("</b>, container,  can't has class for value of items.<br>\n    ");
398
							warningsCounter++;
399
							warning = true;
400
						} else {
401
							classBuffer.append("Field ")
402
									.append(field.getName())
403
									.append(", container of '")
404
									.append(field.getClassOfItems().getName())
405
									.append("'.<br>\n    ");
406
							referencedClasses.add(field.getClassOfItems());
407
						}
408
					} else if (dataTypesManager.isObject(field.getType())) {
409
						if (field.getClassOfValue() == null) {
410
							classBuffer
411
									.append("Field <b>")
412
									.append(field.getName())
413
									.append("</b> can't has class of value.<br>\n    ");
414
							warningsCounter++;
415
							warning = true;
416
						} else {
417
							classBuffer.append("Field ")
418
									.append(field.getName()).append(" of '")
419
									.append(field.getClassOfValue())
420
									.append("'.<br>\n    ");
421
							referencedClasses.add(field.getClassOfValue());
422
						}
423
					}
424
				}
460 425
			}
461 426
			classBuffer.append("<br>\n  </li>\n");
462 427
			buffer.append(classBuffer);
463
            if (warning) {
428
			if (warning) {
464 429
				warnings.append(classBuffer);
465 430
			}
466 431
		}
......
472 437
		buffer.append("<ol>\n");
473 438
		buffer.append(warnings);
474 439
		buffer.append("</ol>\n");
475
		buffer.append("<br>\n<p>Total warnigs: ").append(warningsCounter).append("</p>");
440
		buffer.append("<br>\n<p>Total warnigs: ").append(warningsCounter)
441
				.append("</p>");
476 442

  
477 443
		buffer.append("<h2>Not persistents used classes</h2>\n");
478 444
		buffer.append("<ol>\n");
479
		for (Class  theClass : referencedClasses) {
480
//			if( manager.canPersist(theClass) ) {
481
//				continue;
482
//			}
483
			if( Persistent.class.isAssignableFrom(theClass) ) {
445
		for (Class theClass : referencedClasses) {
446
			// if( manager.canPersist(theClass) ) {
447
			// continue;
448
			// }
449
			if (Persistent.class.isAssignableFrom(theClass)) {
484 450
				continue;
485 451
			}
486
			if( manager.getFactories().get(theClass)!=null ) {
452
			if (manager.getFactories().get(theClass) != null) {
487 453
				continue;
488 454
			}
489 455
			buffer.append("  <li>\n");
490
			buffer.append("    <i>").append(theClass.getName()).append("</i><br>\n");
456
			buffer.append("    <i>").append(theClass.getName())
457
					.append("</i><br>\n");
491 458
			buffer.append("  </li>\n");
492 459
			warningsCounter++;
493 460
		}
......
495 462

  
496 463
		buffer.append("</body>\n");
497 464
		buffer.append("</html>\n");
498
		
499
		save2file("persistenceinfo",buffer.toString());
500 465

  
466
		save2file("persistenceinfo", buffer.toString());
467

  
501 468
		return buffer.toString();
502 469
	}
503 470

  
504

  
505 471
}

Also available in: Unified diff