KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lucane > applications > sharedfolder > gui > ActionToolBar


1 /*
2  * Lucane - a collaborative platform
3  * Copyright (C) 2005 Vincent Fiack <vfiack@mail15.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package org.lucane.applications.sharedfolder.gui;
20
21 import javax.swing.*;
22 import org.lucane.applications.sharedfolder.SharedFolderPlugin;
23 import org.lucane.applications.sharedfolder.gui.actions.*;
24
25 import java.util.ArrayList JavaDoc;
26 import java.util.Iterator JavaDoc;
27
28 public class ActionToolBar extends JToolBar
29 {
30     private ArrayList JavaDoc buttons;
31     private boolean history;
32
33     public ActionToolBar(SharedFolderPlugin plugin, JTable table, boolean history)
34     {
35         this.buttons = new ArrayList JavaDoc();
36         this.history = history;
37         this.setFloatable(false);
38
39
40         addButton(new JButton(new OpenParentAction(plugin, table, history)));
41         addButton(new JButton(new RefreshAction(plugin, table, history)));
42         addButton(new JButton(new OpenFolderAction(plugin, table, history)));
43         addButton(new JButton(new DownloadAction(plugin, table, history)));
44         addSeparator();
45
46         addButton(new JButton(new CreateFolderAction(plugin, table, history)));
47         addButton(new JButton(new UploadAction(plugin, table, history)));
48         addButton(new JButton(new NewVersionAction(plugin, table, history)));
49         addSeparator();
50
51         addButton(new JButton(new EditAclAction(plugin, table, history)));
52         addSeparator();
53
54         addButton(new JButton(new RenameAction(plugin, table, history)));
55         addButton(new JButton(new MoveAction(plugin, table, history)));
56         addButton(new JButton(new RemoveAction(plugin, table, history)));
57         addSeparator();
58
59         addButton(new JButton(new HistoryAction(plugin, table, history)));
60     }
61     
62     private void addButton(JButton button)
63     {
64         buttons.add(button);
65         button.setFocusable(false);
66         add(button);
67     }
68
69     public void refresh()
70     {
71         Iterator JavaDoc i = buttons.iterator();
72         while(i.hasNext())
73         {
74             JButton button = (JButton)i.next();
75             boolean performable = ((PerformableAction)button.getAction()).isPerformable();
76             button.setEnabled(performable);
77         }
78     }
79
80     public boolean isHistory() {
81         return history;
82     }
83 }
84
85
Popular Tags