public JTree addNode(Table table) { HideableNode root = (HideableNode) tree.getModel().getRoot(); root.add(new HideableNode(table)); HideableTreeModel ml = new HideableTreeModel(root); ml.activateFilter(true); tree = new JTree(ml); return tree; }
public EIELDominioPanelTree(int modoSeleccion) { super(new GridLayout(1, 0)); this.locale = AppContext.getApplicationContext() .getUserPreference(AppContext.GEOPISTA_LOCALE_KEY, "es_ES", true); try { logger.info("Recuperando dominios de la EIEL"); EIELDominioPanelTree.lstReferencias = ConstantesLocalGISEIEL.clienteLocalGISEIEL.getDominiosEIEL( ConstantesLocalGISEIEL.DOMAIN_NAME, locale); referenciasTraidas = new boolean[lstReferencias.size()]; for (int i = 0; i < referenciasTraidas.length; i++) { referenciasTraidas[i] = false; } DefaultMutableTreeNode top = new DefaultMutableTreeNode(); // Crea los nodos createNodes(top); // Crea un arbol que permite la seleccion indicada en modoSeleccion HideableTreeModel ml = new HideableTreeModel(top); ml.activateFilter(true); tree = new JTree(ml); tree.getSelectionModel().setSelectionMode(modoSeleccion); // Aspecto del arbol (renderer) tree.setCellRenderer(new TreeRendereEIELDomains(locale)); tree.setName("Información de la EIEL"); tree.setEditable(false); if (playWithLineStyle) { System.out.println("line style = " + lineStyle); tree.putClientProperty("JTree.lineStyle", lineStyle); } add(tree, null); tree.setSelectionRow(0); } catch (Exception e) { e.printStackTrace(); } }