| 1 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 ; 26 import java.util.Iterator ; 27 28 public class ActionToolBar extends JToolBar 29 { 30 private ArrayList buttons; 31 private boolean history; 32 33 public ActionToolBar(SharedFolderPlugin plugin, JTable table, boolean history) 34 { 35 this.buttons = new ArrayList (); 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 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 |