/[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 1205 by iliev, Thu May 24 21:55:41 2007 UTC revision 1355 by iliev, Mon Sep 17 23:55:27 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 189  public class InstrumentsDbFrame extends Line 191  public class InstrumentsDbFrame extends
191                                    
192                  m.addSeparator();                  m.addSeparator();
193                                    
194                    mi = new JMenuItem(i18n.getMenuLabel("instrumentsdb.actions.format"));
195                    m.add(mi);
196                    mi.addActionListener(new ActionListener() {
197                            public void
198                            actionPerformed(ActionEvent e) {
199                                    String s = i18n.getMessage("InstrumentsDbFrame.formatDatabase?");
200                                    if(!HF.showYesNoDialog(InstrumentsDbFrame.this, s)) return;
201                                    CC.getTaskQueue().add(new InstrumentsDb.Format());
202                            }
203                    });
204                    
205                    m.addSeparator();
206                    
207                  loadInstrumentMenu =                  loadInstrumentMenu =
208                          new JMenu(i18n.getMenuLabel("instrumentsdb.actions.loadInstrument"));                          new JMenu(i18n.getMenuLabel("instrumentsdb.actions.loadInstrument"));
209                  m.add(loadInstrumentMenu);                  m.add(loadInstrumentMenu);
# Line 281  public class InstrumentsDbFrame extends Line 296  public class InstrumentsDbFrame extends
296                  });                  });
297          }          }
298                    
         public static DbClipboard  
         getDbClipboard() { return dbClipboard; }  
           
299          /** Invoked when this window is about to close. */          /** Invoked when this window is about to close. */
300          private void          private void
301          onWindowClose() {          onWindowClose() {
# Line 298  public class InstrumentsDbFrame extends Line 310  public class InstrumentsDbFrame extends
310                  sb.append(d.width).append(',').append(d.height);                  sb.append(d.width).append(',').append(d.height);
311                  ClassicPrefs.setWindowSizeAndLocation("InstrumentsDbFrame", sb.toString());                  ClassicPrefs.setWindowSizeAndLocation("InstrumentsDbFrame", sb.toString());
312                  int i = splitPane.getDividerLocation();                  int i = splitPane.getDividerLocation();
313                  ClassicPrefs.setIntProperty("InstrumentsDbFrame.dividerLocation", i);                  preferences().setIntProperty("InstrumentsDbFrame.dividerLocation", i);
314                                    
315                  mainPane.getInstrumentsTable().saveColumnsVisibleState();                  mainPane.getInstrumentsTable().saveColumnsVisibleState();
316                  mainPane.getInstrumentsTable().saveColumnWidths();                  mainPane.getInstrumentsTable().saveColumnWidths();
# Line 337  public class InstrumentsDbFrame extends Line 349  public class InstrumentsDbFrame extends
349                                                    
350                          setBounds(x, y, width, height);                          setBounds(x, y, width, height);
351                                                    
352                          i = ClassicPrefs.getIntProperty("InstrumentsDbFrame.dividerLocation");                          i = preferences().getIntProperty("InstrumentsDbFrame.dividerLocation");
353                          if(i != 0) splitPane.setDividerLocation(i);                          if(i != 0) splitPane.setDividerLocation(i);
354                                                    
355                  } catch(Exception x) {                  } catch(Exception x) {
# Line 355  public class InstrumentsDbFrame extends Line 367  public class InstrumentsDbFrame extends
367                  getContentPane().remove(mainPane);                  getContentPane().remove(mainPane);
368                  splitPane.setRightComponent(mainPane);                  splitPane.setRightComponent(mainPane);
369                  getContentPane().add(splitPane);                  getContentPane().add(splitPane);
370                  int i = ClassicPrefs.getIntProperty("InstrumentsDbFrame.dividerLocation");                  int i = preferences().getIntProperty("InstrumentsDbFrame.dividerLocation");
371                  if(i != 0) splitPane.setDividerLocation(i);                  if(i != 0) splitPane.setDividerLocation(i);
372          }          }
373                    
374          private void          private void
375          removeSidePane() {          removeSidePane() {
376                  int i = splitPane.getDividerLocation();                  int i = splitPane.getDividerLocation();
377                  ClassicPrefs.setIntProperty("InstrumentsDbFrame.dividerLocation", i);                  preferences().setIntProperty("InstrumentsDbFrame.dividerLocation", i);
378                  getContentPane().remove(splitPane);                  getContentPane().remove(splitPane);
379                  getContentPane().add(mainPane);                  getContentPane().add(mainPane);
380          }          }
# Line 583  public class InstrumentsDbFrame extends Line 595  public class InstrumentsDbFrame extends
595                  }                  }
596          }          }
597                    
598          public InstrumentsDbTree          public JSInstrumentsDbTree
599          getInstrumentsDbTree() { return instrumentsDbTree; }          getInstrumentsDbTree() { return instrumentsDbTree; }
600                    
601          public void          public void
# Line 623  public class InstrumentsDbFrame extends Line 635  public class InstrumentsDbFrame extends
635          }          }
636                    
637          class MainPane extends JPanel {          class MainPane extends JPanel {
638                  private final InstrumentsDbTable instrumentsTable =                  private final JSInstrumentsDbTable instrumentsTable =
639                          new InstrumentsDbTable(instrumentsDbTree);                          new JSInstrumentsDbTable(instrumentsDbTree);
640                                    
641                  private final DbDirectoryTreeNode searchResultsNode = new DbDirectoryTreeNode(null);                  private final DbDirectoryTreeNode searchResultsNode = new DbDirectoryTreeNode(null);
642                                    
# Line 632  public class InstrumentsDbFrame extends Line 644  public class InstrumentsDbFrame extends
644                          setLayout(new BorderLayout());                          setLayout(new BorderLayout());
645                          JScrollPane sp = new JScrollPane(instrumentsTable);                          JScrollPane sp = new JScrollPane(instrumentsTable);
646                          add(sp);                          add(sp);
647                            instrumentsTable.reloadAction.putValue(Action.SMALL_ICON, Res.iconReload22);
648                            
649                            instrumentsTable.createDirectoryAction.putValue (
650                                    Action.SMALL_ICON, Res.iconNew16
651                            );
652                            
653                          instrumentsTable.getParent().setBackground(instrumentsTable.getBackground());                          instrumentsTable.getParent().setBackground(instrumentsTable.getBackground());
654                          instrumentsTable.getRowSorter().toggleSortOrder(0);                          instrumentsTable.getRowSorter().toggleSortOrder(0);
655                          searchResultsNode.setDetached(true);                          searchResultsNode.setDetached(true);
656                  }                  }
657                                    
658                  public InstrumentsDbTable                  public JSInstrumentsDbTable
659                  getInstrumentsTable() { return instrumentsTable; }                  getInstrumentsTable() { return instrumentsTable; }
660                                    
661                  public DbDirectoryTreeNode                  public DbDirectoryTreeNode

Legend:
Removed from v.1205  
changed lines
  Added in v.1355

  ViewVC Help
Powered by ViewVC