proyecto.arbol
Class ArbolFicheros

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by proyecto.arbol.ArbolFicheros
All Implemented Interfaces:
KeyListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class ArbolFicheros
extends JPanel
implements KeyListener

Author:
Parras
See Also:
Serialized Form

Nested Class Summary
(package private)  class ArbolFicheros.ComparadorNodos
           
(package private)  class ArbolFicheros.EditorListener
          The listener interface for receiving editor events.
(package private)  class ArbolFicheros.PonIcono
          Clase interna encargada de introduccir el Renderizado de nuestro árbol
si deseamos introducir un nuevo tipo de fichero aquí introduciremos
su tipo de fichero.
(package private)  class ArbolFicheros.TextFielEditor
          The Class TextFielEditor.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String EXTENSION_JAVA
           
static String EXTENSION_JAVACC
           
(package private)  JScrollPane iScrollpaneArbol
          Scroll de árbol
(package private)  DefaultMutableTreeNode nodoEliminar
          Nodo de nuestro árbol que vamos a borrar
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ArbolFicheros(File dir)
          Constructor arbol ficheros.
ArbolFicheros(File dir, PanelEdicion aPanel)
          Constructor arbol ficheros.
 
Method Summary
 void abrirFichero()
          Abrir fichero el fichero seleccionada en un tab.
 void abrirFichero(File nombreArchivo, Nodo nombreFichero)
          Abrir fichero.
static boolean acceptarExt(File file)
          Acceptar ext.
 ArrayList<PaqueteActivos> actualizarListaPaqueteActivos(DefaultMutableTreeNode aNodoRaiz)
           
 DefaultMutableTreeNode addNodes(DefaultMutableTreeNode nodo, File dir)
          Método que nos monta el arbol a traves de la ruta pasada como directorio.
 DefaultMutableTreeNode buscarNodo(DefaultMutableTreeNode aNodoRaiz, Nodo aNodoObjeto)
          Busca un objeto Nodo en nuestro árbol.
 void copiarCarpeta()
          Copiar carpeta.
 void copiarFichero()
          Copiar fichero.
(package private)  void cortarFcihero()
          Cortar fcihero.
 void despliegaArbol()
          Despliega arbol.
 void eliminarNodoActual()
          Elimina el nodo actual.
(package private)  void eliminarPath()
          Eliminar path seleccionado Creado : Parras, 18-abr-2009
 boolean eliminarUnPaquete(PaqueteActivos aPaquete)
          Eliminar un paquete.
static void expandJTree(JTree tree, int depth)
          Expands all nodes in a JTree.
static int expandJTreeNode(JTree tree, TreeModel model, Object node, int row, int depth)
          Expands a given node in a JTree.
 ArrayList<PaqueteActivos> getListaPaquetes()
          Obtener la lista paquetes.
 ArrayList<PaqueteActivos> getListaPaquetesActualizada()
          Obtener la lista paquetes.
 Dimension getMinimumSize()
           
 Nodo getObjetoNodo()
           
 Dimension getPreferredSize()
           
 JTree getTree()
          Obtener el tree.
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
static void main(String[] av)
          Método main.
static DefaultMutableTreeNode nodoArbolEncontrado(DefaultMutableTreeNode editNodo, Nodo nodoNew)
          Nodo arbol encontrado.
 DefaultMutableTreeNode nodoSeleccionado()
          Nodo seleccionado.
 void ordenarHijos(Object parent)
          Ordena los hijos de un DefaultMutableTreeNode
 File parsearFile(String aCadenaBuscar, String aPathErroneo, String aPathPdre)
          Repara el path erroneo en el árbol, esto sucede porque no renombran una carpeta.
 void pegarFichero()
          Pegar fichero.
static int posicionArbol(DefaultMutableTreeNode editNodo, Nodo nodoNew)
          Posicion arbol.
 void refrescarArbol()
          Refrescar arbol.
 DefaultMutableTreeNode renombrarArbol(DefaultMutableTreeNode aNodoPadre, Nodo aNodoOld, Nodo aNodonNew)
          Repara los nodos que estan situados en árbol.
(package private)  void renombrarPath()
          Renombrar path del arbol.
 void setCarpeta(String nombre)
          Modificar la propiedad carpeta.
 void setFichero(String nombre)
          Modificar la propiedad fichero.
 void setListaPaquetes(ArrayList<PaqueteActivos> listaPaquetes)
          Modificar la propiedad lista paquetes.
 boolean setNuevoElemento(PaqueteActivos nuevoPaquete)
          Abre crea un fichero o carpeta asociado.
 boolean ventanaOpcionBorrar(String fichero)
          Ventana opcion borrar.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXTENSION_JAVA

public static final String EXTENSION_JAVA
See Also:
Constant Field Values

EXTENSION_JAVACC

public static final String EXTENSION_JAVACC
See Also:
Constant Field Values

nodoEliminar

DefaultMutableTreeNode nodoEliminar
Nodo de nuestro árbol que vamos a borrar


iScrollpaneArbol

JScrollPane iScrollpaneArbol
Scroll de árbol

Constructor Detail

ArbolFicheros

public ArbolFicheros(File dir,
                     PanelEdicion aPanel)
Constructor arbol ficheros. Crea los paneles y llama al método de añadir nodos Creado : Parras, 18-abr-2009

Parameters:
dir - directorio que vamos a cargar
aPanel - PanelEdición al que vamos a referenciar

ArbolFicheros

public ArbolFicheros(File dir)
Constructor arbol ficheros. Para usuarlo como depurador de la aplicación Creado : Parras, 18-abr-2009

Parameters:
dir - the dir
Method Detail

addNodes

public DefaultMutableTreeNode addNodes(DefaultMutableTreeNode nodo,
                                       File dir)
Método que nos monta el arbol a traves de la ruta pasada como directorio. Estre método es recursivo para el tratamiento de directorio.

Parameters:
nodo - Nodo a tratar
dir - Directorio a tratar
Returns:
DefaultMutableTreeNode el nodo pasado como parametro fomrmado con su hijos.

getMinimumSize

public Dimension getMinimumSize()
Overrides:
getMinimumSize in class JComponent

getPreferredSize

public Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent

acceptarExt

public static boolean acceptarExt(File file)
Acceptar ext.

Parameters:
file - the file
Returns:
true, si es correcto Creado : Parras, 18-abr-2009

refrescarArbol

public void refrescarArbol()
Refrescar arbol. No guarda el estado anterior del árbol. Creado : Parras, 18-abr-2009


copiarFichero

public void copiarFichero()
Copiar fichero. Creado : Parras, 18-abr-2009


copiarCarpeta

public void copiarCarpeta()
Copiar carpeta. Creado : Parras, 18-abr-2009


cortarFcihero

void cortarFcihero()
Cortar fcihero. Creado : Parras, 18-abr-2009


renombrarPath

void renombrarPath()
Renombrar path del arbol. Llamado por la acciones de árbol. Creado : Parras, 18-abr-2009


ventanaOpcionBorrar

public boolean ventanaOpcionBorrar(String fichero)
Ventana opcion borrar.

Parameters:
fichero - the fichero
Returns:
true, si es correcto Creado : Parras, 18-abr-2009

pegarFichero

public void pegarFichero()
                  throws IOException
Pegar fichero. Creado : Parras, 18-abr-2009

Throws:
IOException - Signals that an I/O exception has occurred.

ordenarHijos

public void ordenarHijos(Object parent)
Ordena los hijos de un DefaultMutableTreeNode

Parameters:
aPadre -

setNuevoElemento

public boolean setNuevoElemento(PaqueteActivos nuevoPaquete)
Abre crea un fichero o carpeta asociado.

Parameters:
nuevoPaquete - the nuevo paquete
Returns:
true, if modifica la propiedad nuevo elemento

despliegaArbol

public void despliegaArbol()
Despliega arbol. Creado : Parras, 18-abr-2009


expandJTree

public static void expandJTree(JTree tree,
                               int depth)
Expands all nodes in a JTree.

Parameters:
tree - The JTree to expand.
depth - The depth to which the tree should be expanded. Zero will just expand the root node, a negative value will fully expand the tree, and a positive value will recursively expand the tree to that depth.

expandJTreeNode

public static int expandJTreeNode(JTree tree,
                                  TreeModel model,
                                  Object node,
                                  int row,
                                  int depth)
Expands a given node in a JTree.

Parameters:
tree - The JTree to expand.
model - The TreeModel for tree.
node - The node within tree to expand.
row - The displayed row in tree that represents node.
depth - The depth to which the tree should be expanded. Zero will just expand node, a negative value will fully expand the tree, and a positive value will recursively expand the tree to that depth relative to node.
Returns:
the int

setCarpeta

public void setCarpeta(String nombre)
Modificar la propiedad carpeta.

Parameters:
nombre - La propiedad carpeta

setFichero

public void setFichero(String nombre)
Modificar la propiedad fichero.

Parameters:
nombre - La propiedad fichero

nodoSeleccionado

public DefaultMutableTreeNode nodoSeleccionado()
Nodo seleccionado.

Returns:
the default mutable tree node Creado : Parras, 18-abr-2009

getObjetoNodo

public Nodo getObjetoNodo()

eliminarNodoActual

public void eliminarNodoActual()
Elimina el nodo actual.


eliminarPath

void eliminarPath()
Eliminar path seleccionado Creado : Parras, 18-abr-2009


abrirFichero

public void abrirFichero()
Abrir fichero el fichero seleccionada en un tab. Creado : Parras, 18-abr-2009


abrirFichero

public void abrirFichero(File nombreArchivo,
                         Nodo nombreFichero)
                  throws BadLocationException
Abrir fichero. Creado : Parras, 18-abr-2009

Parameters:
nombreArchivo - the nombre archivo
nombreFichero - the nombre fichero
Throws:
BadLocationException - the bad location exception

getTree

public JTree getTree()
Obtener el tree.

Returns:
el tree
Creado : Parras, 18-abr-2009

posicionArbol

public static int posicionArbol(DefaultMutableTreeNode editNodo,
                                Nodo nodoNew)
Posicion arbol. Inserta ordenado el nodo

Parameters:
editNodo - the edit nodo
nodoNew - the nodo new
Returns:
the int
Creado : Parras, 18-abr-2009

nodoArbolEncontrado

public static DefaultMutableTreeNode nodoArbolEncontrado(DefaultMutableTreeNode editNodo,
                                                         Nodo nodoNew)
Nodo arbol encontrado.

Parameters:
editNodo - the edit nodo
nodoNew - the nodo new
Returns:
the default mutable tree node
Creado : Parras, 18-abr-2009

main

public static void main(String[] av)
Método main.

Parameters:
av - the arguments
Creado : Parras, 18-abr-2009

getListaPaquetes

public ArrayList<PaqueteActivos> getListaPaquetes()
Obtener la lista paquetes.
Para nuestra ventana de nuevo fichero

Returns:
el lista paquetes
Creado : Parras, 18-abr-2009

getListaPaquetesActualizada

public ArrayList<PaqueteActivos> getListaPaquetesActualizada()
Obtener la lista paquetes. Actualizada (por si existiera alguna renombrado)
Para nuestra ventana de nuevo fichero

Returns:
el lista paquetes
Creado : Parras, 18-abr-2009

actualizarListaPaqueteActivos

public ArrayList<PaqueteActivos> actualizarListaPaqueteActivos(DefaultMutableTreeNode aNodoRaiz)

setListaPaquetes

public void setListaPaquetes(ArrayList<PaqueteActivos> listaPaquetes)
Modificar la propiedad lista paquetes.

Parameters:
listaPaquetes - La propiedad de lista paquetes

eliminarUnPaquete

public boolean eliminarUnPaquete(PaqueteActivos aPaquete)
Eliminar un paquete.

Parameters:
aPaquete - the a paquete
Returns:
true, si es correcto
Creado : Parras, 18-abr-2009

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener

renombrarArbol

public DefaultMutableTreeNode renombrarArbol(DefaultMutableTreeNode aNodoPadre,
                                             Nodo aNodoOld,
                                             Nodo aNodonNew)
Repara los nodos que estan situados en árbol. Ejmeplo de renombrar: c:\javac\ ==> c:\javaCC |c:\javac\|hola |c:\javaCC\|hola

Parameters:
aNodoPadre - DefaultMutableTreeNode
aNodoOld - Nodo
aNodonNew -
Returns:
Nodo

parsearFile

public File parsearFile(String aCadenaBuscar,
                        String aPathErroneo,
                        String aPathPdre)
Repara el path erroneo en el árbol, esto sucede porque no renombran una carpeta.

Parameters:
aCadenaBuscar -
aPathErroneo -
aPathPdre -
Returns:

buscarNodo

public DefaultMutableTreeNode buscarNodo(DefaultMutableTreeNode aNodoRaiz,
                                         Nodo aNodoObjeto)
Busca un objeto Nodo en nuestro árbol. La busqueda se realiza en anchura.

Parameters:
aNodoRaiz -
aNodoObjeto -
Returns: