Changeset 9895


Ignore:
Timestamp:
03/27/11 13:05:51 (9 years ago)
Author:
mlg
Message:

Adds a refresh button on the FileTree

Location:
extensions/jiwigo/trunk/src/main
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/tree/FileTree.java

    r8838 r9895  
    33import java.awt.BorderLayout; 
    44import java.awt.Dimension; 
     5import java.awt.FlowLayout; 
    56import java.awt.event.ActionEvent; 
    67import java.awt.event.ActionListener; 
     
    910import java.util.ArrayList; 
    1011 
     12import javax.swing.ImageIcon; 
     13import javax.swing.JButton; 
    1114import javax.swing.JFileChooser; 
    1215import javax.swing.JFrame; 
     
    2528 
    2629import fr.mael.jiwigo.transverse.ImagesManagement; 
     30import fr.mael.jiwigo.transverse.util.Tools; 
    2731import fr.mael.jiwigo.ui.mainframe.DialogPrivacyLevel; 
    2832import fr.mael.jiwigo.ui.search.DialogChooseCategory; 
     
    3236    Copyright (c) 2010, Mael 
    3337    All rights reserved. 
    34      
     38 
    3539    Redistribution and use in source and binary forms, with or without 
    3640    modification, are permitted provided that the following conditions are met: 
     
    4347       names of its contributors may be used to endorse or promote products 
    4448       derived from this software without specific prior written permission. 
    45      
     49 
    4650    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
    4751    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
     
    5458    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
    5559    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    56      
     60 
    5761    * @author mael 
    5862    * File tree 
     
    6367    private JTextField fieldPath; 
    6468 
     69    private JButton refreshButton; 
     70 
     71    private JPanel panelNorth; 
     72 
    6573    private DefaultMutableTreeNode root = new DefaultMutableTreeNode(""); 
    6674 
     
    92100        fieldPath = new JTextField(path); 
    93101        fieldPath.addMouseListener(this); 
     102        refreshButton = new JButton(); 
     103        refreshButton.setIcon(new ImageIcon(Tools.getURL("fr/mael/jiwigo/img/refresh.png"))); 
     104        refreshButton.addActionListener(this); 
     105        refreshButton.setFocusPainted(false); 
     106        refreshButton.setBorderPainted(false); 
     107        refreshButton.setContentAreaFilled(false); 
     108 
     109        panelNorth = new JPanel(new FlowLayout()); 
     110        panelNorth.add(fieldPath); 
     111        panelNorth.add(refreshButton); 
     112 
    94113        tree = new JTree(root); 
    95114        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); 
     
    102121        treeView.setMinimumSize(minimumSize); 
    103122        this.add(treeView, BorderLayout.CENTER); 
    104         this.add(fieldPath, BorderLayout.NORTH); 
     123        this.add(panelNorth, BorderLayout.NORTH); 
    105124        reload(); 
    106125    } 
     
    246265            //then the dialog that allow to choose the category is called 
    247266            new DialogChooseCategory(filesToSend); 
    248         } 
    249     } 
    250  
     267        } else if (paramActionEvent.getSource().equals(refreshButton)) { 
     268            reload(); 
     269        } 
     270    } 
    251271} 
Note: See TracChangeset for help on using the changeset viewer.