/[svn]/jsampler/trunk/src/org/jsampler/view/std/JSNewMidiInstrumentWizard.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/std/JSNewMidiInstrumentWizard.java

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

revision 1870 by iliev, Mon Sep 8 00:19:27 2008 UTC revision 1871 by iliev, Sun Mar 22 18:11:39 2009 UTC
# Line 1  Line 1 
1  /*  /*
2   *   JSampler - a java front-end for LinuxSampler   *   JSampler - a java front-end for LinuxSampler
3   *   *
4   *   Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com>   *   Copyright (C) 2005-2009 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 23  Line 23 
23  package org.jsampler.view.std;  package org.jsampler.view.std;
24    
25  import java.awt.BorderLayout;  import java.awt.BorderLayout;
 import java.awt.Dimension;  
26  import java.awt.GridBagConstraints;  import java.awt.GridBagConstraints;
27  import java.awt.GridBagLayout;  import java.awt.GridBagLayout;
28  import java.awt.Insets;  import java.awt.Insets;
# Line 31  import java.awt.Insets; Line 30  import java.awt.Insets;
30  import java.awt.event.ActionEvent;  import java.awt.event.ActionEvent;
31  import java.awt.event.ActionListener;  import java.awt.event.ActionListener;
32    
33  import javax.swing.Box;  import java.io.File;
34    
35  import javax.swing.BoxLayout;  import javax.swing.BoxLayout;
36  import javax.swing.ButtonGroup;  import javax.swing.ButtonGroup;
37  import javax.swing.ImageIcon;  import javax.swing.ImageIcon;
38  import javax.swing.JButton;  import javax.swing.JButton;
39  import javax.swing.JCheckBox;  import javax.swing.JCheckBox;
40  import javax.swing.JComboBox;  import javax.swing.JComboBox;
 import javax.swing.JFileChooser;  
41  import javax.swing.JLabel;  import javax.swing.JLabel;
42  import javax.swing.JPanel;  import javax.swing.JPanel;
43  import javax.swing.JRadioButton;  import javax.swing.JRadioButton;
# Line 140  class NewMidiInstrumentWizardModel exten Line 139  class NewMidiInstrumentWizardModel exten
139           * Moves to the next page in the wizard.           * Moves to the next page in the wizard.
140           * @return The next page in the wizard.           * @return The next page in the wizard.
141           */           */
142            @Override
143          public WizardPage          public WizardPage
144          next() {          next() {
145                  InstrLocationMethodWizardPage p1 = instrLocationMethodWizardPage;                  InstrLocationMethodWizardPage p1 = instrLocationMethodWizardPage;
# Line 159  class NewMidiInstrumentWizardModel exten Line 159  class NewMidiInstrumentWizardModel exten
159           * @return The previous page in the wizard.           * @return The previous page in the wizard.
160           * @see #hasPrevious           * @see #hasPrevious
161           */           */
162            @Override
163          public WizardPage          public WizardPage
164          previous() {          previous() {
165                  InstrLocationMethodWizardPage p1 = instrLocationMethodWizardPage;                  InstrLocationMethodWizardPage p1 = instrLocationMethodWizardPage;
# Line 442  class OrchestraSelectWizardPage extends Line 443  class OrchestraSelectWizardPage extends
443                  getWizard().enableNextButton(instr != null);                  getWizard().enableNextButton(instr != null);
444          }          }
445                    
446            @Override
447          public void          public void
448          postinitPage() {          postinitPage() {
449                  getWizard().enableNextButton(cbInstruments.getSelectedItem() != null);                  getWizard().enableNextButton(cbInstruments.getSelectedItem() != null);
# Line 606  class ManualSelectWizardPage extends Use Line 608  class ManualSelectWizardPage extends Use
608                    
609          private void          private void
610          onBrowse() {          onBrowse() {
611                  String s = preferences().getStringProperty("lastInstrumentLocation");                  File f = StdUtils.showOpenInstrumentFileChooser(getWizardDialog());
612                  JFileChooser fc = new JFileChooser(s);                  if(f == null) return;
                 int result = fc.showOpenDialog(this);  
                 if(result != JFileChooser.APPROVE_OPTION) return;  
613                                    
614                  String path = fc.getSelectedFile().getAbsolutePath();                  String path = f.getAbsolutePath();
615                  if(java.io.File.separatorChar == '\\') {                  if(java.io.File.separatorChar == '\\') {
616                          path = path.replace('\\', '/');                          path = path.replace('\\', '/');
617                  }                  }
618                  cbFilename.setSelectedItem(toEscapedString(path));                  cbFilename.setSelectedItem(toEscapedString(path));
                 path = fc.getCurrentDirectory().getAbsolutePath();  
                 preferences().setStringProperty("lastInstrumentLocation", path);  
619          }          }
620                    
621          private void          private void
# Line 670  class ManualSelectWizardPage extends Use Line 668  class ManualSelectWizardPage extends Use
668                  return s.substring(i + 3);                  return s.substring(i + 3);
669          }          }
670                    
671            @Override
672          public void          public void
673          postinitPage() {          postinitPage() { updateState(); }
                 updateState();  
         }  
674                    
675          /**          /**
676           * Gets the name of the instrument file.           * Gets the name of the instrument file.
# Line 708  class ManualSelectWizardPage extends Use Line 705  class ManualSelectWizardPage extends Use
705                    
706          private class Handler implements DocumentListener {          private class Handler implements DocumentListener {
707                  // DocumentListener                  // DocumentListener
708                    @Override
709                  public void                  public void
710                  insertUpdate(DocumentEvent e) { updateState(); }                  insertUpdate(DocumentEvent e) { updateState(); }
711                                    
712                    @Override
713                  public void                  public void
714                  removeUpdate(DocumentEvent e) { updateState(); }                  removeUpdate(DocumentEvent e) { updateState(); }
715                                    
716                    @Override
717                  public void                  public void
718                  changedUpdate(DocumentEvent e) { updateState(); }                  changedUpdate(DocumentEvent e) { updateState(); }
719          }          }
# Line 878  class InstrumentMappingWizardPage extend Line 878  class InstrumentMappingWizardPage extend
878                  cbProgram.setSelectedIndex(entry.getMidiProgram());                  cbProgram.setSelectedIndex(entry.getMidiProgram());
879          }          }
880                    
881            @Override
882          public void          public void
883          postinitPage() {          postinitPage() {
884                  String s = wizardModel.getInstrumentName();                  String s = wizardModel.getInstrumentName();
# Line 894  class InstrumentMappingWizardPage extend Line 895  class InstrumentMappingWizardPage extend
895           * while this page is the current page of the wizard.           * while this page is the current page of the wizard.
896           * @return <code>true</code>           * @return <code>true</code>
897           */           */
898            @Override
899          public boolean          public boolean
900          mayFinish() {          mayFinish() {
901                  ((NewMidiInstrumentWizardModel)getWizardModel()).mapInstrument();                  ((NewMidiInstrumentWizardModel)getWizardModel()).mapInstrument();
# Line 951  class InstrumentMappingWizardPage extend Line 953  class InstrumentMappingWizardPage extend
953                    
954          private class Handler implements DocumentListener {          private class Handler implements DocumentListener {
955                  // DocumentListener                  // DocumentListener
956                    @Override
957                  public void                  public void
958                  insertUpdate(DocumentEvent e) { updateState(); }                  insertUpdate(DocumentEvent e) { updateState(); }
959                                    
960                    @Override
961                  public void                  public void
962                  removeUpdate(DocumentEvent e) { updateState(); }                  removeUpdate(DocumentEvent e) { updateState(); }
963                                    
964                    @Override
965                  public void                  public void
966                  changedUpdate(DocumentEvent e) { updateState(); }                  changedUpdate(DocumentEvent e) { updateState(); }
967          }          }

Legend:
Removed from v.1870  
changed lines
  Added in v.1871

  ViewVC Help
Powered by ViewVC