/[svn]/jsampler/trunk/src/org/jsampler/view/classic/InstrumentsDbFrame.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/classic/InstrumentsDbFrame.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1284 by iliev, Thu May 24 21:55:41 2007 UTC revision 1285 by iliev, Fri Aug 10 19:55:03 2007 UTC
# Line 39  import javax.swing.AbstractAction; Line 39  import javax.swing.AbstractAction;
39  import javax.swing.Action;  import javax.swing.Action;
40  import javax.swing.BorderFactory;  import javax.swing.BorderFactory;
41  import javax.swing.BoxLayout;  import javax.swing.BoxLayout;
42    import javax.swing.Icon;
43  import javax.swing.JCheckBox;  import javax.swing.JCheckBox;
44  import javax.swing.JComponent;  import javax.swing.JComponent;
45  import javax.swing.JFrame;  import javax.swing.JFrame;
# Line 77  import org.jsampler.JSI18n; Line 78  import org.jsampler.JSI18n;
78    
79  import org.jsampler.task.InstrumentsDb;  import org.jsampler.task.InstrumentsDb;
80    
 import org.jsampler.view.DbClipboard;  
81  import org.jsampler.view.DbDirectoryTreeNode;  import org.jsampler.view.DbDirectoryTreeNode;
82  import org.jsampler.view.InstrumentsDbTableModel;  import org.jsampler.view.InstrumentsDbTableModel;
83    import org.jsampler.view.InstrumentsDbTableView;
84    import org.jsampler.view.std.JSInstrumentsDbTable;
85    import org.jsampler.view.std.JSInstrumentsDbTree;
86    
87  import org.linuxsampler.lscp.DbDirectoryInfo;  import org.linuxsampler.lscp.DbDirectoryInfo;
88  import org.linuxsampler.lscp.DbInstrumentInfo;  import org.linuxsampler.lscp.DbInstrumentInfo;
89  import org.linuxsampler.lscp.DbSearchQuery;  import org.linuxsampler.lscp.DbSearchQuery;
90    
91  import static org.jsampler.view.classic.ClassicI18n.i18n;  import static org.jsampler.view.classic.ClassicI18n.i18n;
92    import static org.jsampler.view.classic.ClassicPrefs.preferences;
93    
94  /**  /**
95   *   *
# Line 93  import static org.jsampler.view.classic. Line 97  import static org.jsampler.view.classic.
97   */   */
98  public class InstrumentsDbFrame extends JFrame {  public class InstrumentsDbFrame extends JFrame {
99          private final JMenuBar menuBar = new JMenuBar();          private final JMenuBar menuBar = new JMenuBar();
100          private final InstrumentsDbTree instrumentsDbTree;          private final JSInstrumentsDbTree instrumentsDbTree;
101          private final SidePane sidePane;          private final SidePane sidePane;
102          private final JSplitPane splitPane;          private final JSplitPane splitPane;
103          private final MainPane mainPane;          private final MainPane mainPane;
# Line 104  public class InstrumentsDbFrame extends Line 108  public class InstrumentsDbFrame extends
108                    
109          private final NavigationHistoryModel navigationHistoryModel = new NavigationHistoryModel();          private final NavigationHistoryModel navigationHistoryModel = new NavigationHistoryModel();
110                    
         private static final DbClipboard dbClipboard = new DbClipboard();  
           
111          private JMenu loadInstrumentMenu;          private JMenu loadInstrumentMenu;
112          private JMenu addToMidiMapMenu;          private JMenu addToMidiMapMenu;
113          private JMenu addToOrchestraMenu;          private JMenu addToOrchestraMenu;
# Line 118  public class InstrumentsDbFrame extends Line 120  public class InstrumentsDbFrame extends
120                  setTitle(i18n.getLabel("InstrumentsDbFrame.title"));                  setTitle(i18n.getLabel("InstrumentsDbFrame.title"));
121                  if(Res.appIcon != null) setIconImage(Res.appIcon.getImage());                  if(Res.appIcon != null) setIconImage(Res.appIcon.getImage());
122                                    
123                  instrumentsDbTree = new InstrumentsDbTree(CC.getInstrumentsDbTreeModel());                  instrumentsDbTree = new JSInstrumentsDbTree(CC.getInstrumentsDbTreeModel());
124                                    
125                  sidePane = new SidePane();                  sidePane = new SidePane();
126                  mainPane = new MainPane();                  mainPane = new MainPane();
# Line 281  public class InstrumentsDbFrame extends Line 283  public class InstrumentsDbFrame extends
283                  });                  });
284          }          }
285                    
         public static DbClipboard  
         getDbClipboard() { return dbClipboard; }  
           
286          /** Invoked when this window is about to close. */          /** Invoked when this window is about to close. */
287          private void          private void
288          onWindowClose() {          onWindowClose() {
# Line 298  public class InstrumentsDbFrame extends Line 297  public class InstrumentsDbFrame extends
297                  sb.append(d.width).append(',').append(d.height);                  sb.append(d.width).append(',').append(d.height);
298                  ClassicPrefs.setWindowSizeAndLocation("InstrumentsDbFrame", sb.toString());                  ClassicPrefs.setWindowSizeAndLocation("InstrumentsDbFrame", sb.toString());
299                  int i = splitPane.getDividerLocation();                  int i = splitPane.getDividerLocation();
300                  ClassicPrefs.setIntProperty("InstrumentsDbFrame.dividerLocation", i);                  preferences().setIntProperty("InstrumentsDbFrame.dividerLocation", i);
301                                    
302                  mainPane.getInstrumentsTable().saveColumnsVisibleState();                  mainPane.getInstrumentsTable().saveColumnsVisibleState();
303                  mainPane.getInstrumentsTable().saveColumnWidths();                  mainPane.getInstrumentsTable().saveColumnWidths();
# Line 337  public class InstrumentsDbFrame extends Line 336  public class InstrumentsDbFrame extends
336                                                    
337                          setBounds(x, y, width, height);                          setBounds(x, y, width, height);
338                                                    
339                          i = ClassicPrefs.getIntProperty("InstrumentsDbFrame.dividerLocation");                          i = preferences().getIntProperty("InstrumentsDbFrame.dividerLocation");
340                          if(i != 0) splitPane.setDividerLocation(i);                          if(i != 0) splitPane.setDividerLocation(i);
341                                                    
342                  } catch(Exception x) {                  } catch(Exception x) {
# Line 355  public class InstrumentsDbFrame extends Line 354  public class InstrumentsDbFrame extends
354                  getContentPane().remove(mainPane);                  getContentPane().remove(mainPane);
355                  splitPane.setRightComponent(mainPane);                  splitPane.setRightComponent(mainPane);
356                  getContentPane().add(splitPane);                  getContentPane().add(splitPane);
357                  int i = ClassicPrefs.getIntProperty("InstrumentsDbFrame.dividerLocation");                  int i = preferences().getIntProperty("InstrumentsDbFrame.dividerLocation");
358                  if(i != 0) splitPane.setDividerLocation(i);                  if(i != 0) splitPane.setDividerLocation(i);
359          }          }
360                    
361          private void          private void
362          removeSidePane() {          removeSidePane() {
363                  int i = splitPane.getDividerLocation();                  int i = splitPane.getDividerLocation();
364                  ClassicPrefs.setIntProperty("InstrumentsDbFrame.dividerLocation", i);                  preferences().setIntProperty("InstrumentsDbFrame.dividerLocation", i);
365                  getContentPane().remove(splitPane);                  getContentPane().remove(splitPane);
366                  getContentPane().add(mainPane);                  getContentPane().add(mainPane);
367          }          }
# Line 583  public class InstrumentsDbFrame extends Line 582  public class InstrumentsDbFrame extends
582                  }                  }
583          }          }
584                    
585          public InstrumentsDbTree          public JSInstrumentsDbTree
586          getInstrumentsDbTree() { return instrumentsDbTree; }          getInstrumentsDbTree() { return instrumentsDbTree; }
587                    
588          public void          public void
# Line 623  public class InstrumentsDbFrame extends Line 622  public class InstrumentsDbFrame extends
622          }          }
623                    
624          class MainPane extends JPanel {          class MainPane extends JPanel {
625                  private final InstrumentsDbTable instrumentsTable =                  private final JSInstrumentsDbTable instrumentsTable =
626                          new InstrumentsDbTable(instrumentsDbTree);                          new JSInstrumentsDbTable(instrumentsDbTree);
627                                    
628                  private final DbDirectoryTreeNode searchResultsNode = new DbDirectoryTreeNode(null);                  private final DbDirectoryTreeNode searchResultsNode = new DbDirectoryTreeNode(null);
629                                    
# Line 632  public class InstrumentsDbFrame extends Line 631  public class InstrumentsDbFrame extends
631                          setLayout(new BorderLayout());                          setLayout(new BorderLayout());
632                          JScrollPane sp = new JScrollPane(instrumentsTable);                          JScrollPane sp = new JScrollPane(instrumentsTable);
633                          add(sp);                          add(sp);
634                            instrumentsTable.reloadAction.putValue(Action.SMALL_ICON, Res.iconReload22);
635                            
636                            instrumentsTable.createDirectoryAction.putValue (
637                                    Action.SMALL_ICON, Res.iconNew16
638                            );
639                            
640                          instrumentsTable.getParent().setBackground(instrumentsTable.getBackground());                          instrumentsTable.getParent().setBackground(instrumentsTable.getBackground());
641                          instrumentsTable.getRowSorter().toggleSortOrder(0);                          instrumentsTable.getRowSorter().toggleSortOrder(0);
642                          searchResultsNode.setDetached(true);                          searchResultsNode.setDetached(true);
643                  }                  }
644                                    
645                  public InstrumentsDbTable                  public JSInstrumentsDbTable
646                  getInstrumentsTable() { return instrumentsTable; }                  getInstrumentsTable() { return instrumentsTable; }
647                                    
648                  public DbDirectoryTreeNode                  public DbDirectoryTreeNode

Legend:
Removed from v.1284  
changed lines
  Added in v.1285

  ViewVC Help
Powered by ViewVC