Revision 423 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/TOC.java

View differences:

TOC.java
19 19
import java.awt.event.MouseAdapter;
20 20
import java.awt.event.MouseEvent;
21 21
import java.util.ArrayList;
22
import java.util.Enumeration;
22 23

  
23 24
import javax.swing.BorderFactory;
24 25
import javax.swing.JColorChooser;
......
44 45
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
45 46
import com.iver.cit.gvsig.gui.toc.DnDJTree;
46 47
import com.iver.cit.gvsig.gui.toc.FPopupMenu;
48
import com.iver.cit.gvsig.gui.toc.ITocItem;
47 49
import com.iver.cit.gvsig.gui.toc.ITocOrderListener;
48 50
import com.iver.cit.gvsig.gui.toc.TOCRenderer;
49 51
import com.iver.cit.gvsig.gui.toc.TocItemBranch;
......
238 240
	}
239 241
	private void doRefresh(FLayers theLayers, DefaultMutableTreeNode parentNode)
240 242
	{
243
		Dimension sizeLeaf = new Dimension(m_Tree.getWidth(), 15);
244
		Dimension sizeBranch = new Dimension(m_Tree.getWidth(), 20);
241 245
		for (int i=theLayers.getLayersCount()-1;i>=0; i--)
242 246
		{
243 247
			FLayer lyr = theLayers.getLayer(i);
244 248
			TocItemBranch elTema = new TocItemBranch(lyr);
249
			elTema.setSize(sizeBranch);
245 250
			DefaultMutableTreeNode nodeLayer = new DefaultMutableTreeNode(elTema);
246 251
			
247 252
			m_TreeModel.insertNodeInto(nodeLayer, parentNode, parentNode.getChildCount());
......
266 271
						{					
267 272
							TocItemLeaf itemLeaf;
268 273
							itemLeaf = new TocItemLeaf(symbols[j],descriptions[j], aux.getShapeType());
274
							itemLeaf.setSize(sizeLeaf);
269 275
							DefaultMutableTreeNode nodeValue = new DefaultMutableTreeNode(itemLeaf);
270 276
							m_TreeModel.insertNodeInto(nodeValue, nodeLayer, nodeLayer.getChildCount());
271 277
							TreePath pathSymbol = new TreePath(m_TreeModel.getPathToRoot(nodeValue));
......
274 280
					}
275 281
					TocItemLeaf itemLeaf;
276 282
					itemLeaf = new TocItemLeaf(legendInfo.getDefaultSymbol(),"Default", aux.getShapeType());
283
					itemLeaf.setSize(sizeLeaf);
277 284
					DefaultMutableTreeNode nodeValue = new DefaultMutableTreeNode(itemLeaf);
278 285
					m_TreeModel.insertNodeInto(nodeValue, nodeLayer, nodeLayer.getChildCount());
279 286
					TreePath pathSymbol = new TreePath(m_TreeModel.getPathToRoot(nodeValue));
......
334 341
	 */
335 342
	public void componentResized(ComponentEvent e) {
336 343
		System.out.println("Cambiando tama?o.");
344
		
345
		int i = 0;
346
		DefaultMutableTreeNode n;
347
		Enumeration enum = m_Root.children();
348
		while (enum.hasMoreElements())
349
		{
350
			n =  (DefaultMutableTreeNode) enum.nextElement();
351
			if (n.getUserObject() instanceof TocItemBranch)
352
			{
353
				
354
		       	ITocItem item = (ITocItem) n.getUserObject();
355
		       	Dimension szAnt = item.getSize();
356
		       	item.setSize(new Dimension(this.getWidth()-30,szAnt.height));
357
			}						
358
			System.out.println("i=" + i++);
359
		} 
337 360
		m_Tree.setSize(this.getSize());
338
		System.out.println("Ancho del tree=" + m_Tree.getWidth());
361
		
362
		System.out.println("Ancho del tree=" + m_Tree.getWidth() + " " + m_Tree.getComponentCount());
339 363
		System.out.println("Ancho del TOC=" + this.getWidth());
340
		/* while (m_Root.children().hasMoreElements())
341
		{
342
			DefaultMutableTreeNode n =  (DefaultMutableTreeNode) m_Root.children().nextElement();
343
		} */
344
		// refresh();
345
		// m_Tree.repaint(m_Tree.getBounds());
364
		// m_Tree.repaint();
346 365
		
347 366
		
348 367
	}

Also available in: Unified diff