/[svn]/jsampler/trunk/src/org/jsampler/view/fantasia/RightSidePane.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/fantasia/RightSidePane.java

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

revision 1777 by iliev, Mon Aug 11 22:51:24 2008 UTC revision 1778 by iliev, Sun Sep 28 20:38:36 2008 UTC
# Line 29  import java.beans.PropertyChangeEvent; Line 29  import java.beans.PropertyChangeEvent;
29  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
30    
31  import javax.swing.BorderFactory;  import javax.swing.BorderFactory;
32    import javax.swing.JPanel;
33  import javax.swing.JScrollPane;  import javax.swing.JScrollPane;
 import javax.swing.JTabbedPane;  
34    
35  import javax.swing.event.ChangeEvent;  import javax.swing.event.ChangeEvent;
36  import javax.swing.event.ChangeListener;  import javax.swing.event.ChangeListener;
37    
38  import org.jvnet.substance.SubstanceLookAndFeel;  import net.sf.juife.JuifeUtils;
39    
40  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
41  import static org.jsampler.view.fantasia.FantasiaPrefs.preferences;  import static org.jsampler.view.fantasia.FantasiaPrefs.preferences;
# Line 45  import static org.jsampler.view.fantasia Line 45  import static org.jsampler.view.fantasia
45   *   *
46   * @author Grigor Iliev   * @author Grigor Iliev
47   */   */
48  public class RightSidePane extends PixmapPane {  public class RightSidePane extends FantasiaPanel {
49          private JTabbedPane tabbedPane = new JTabbedPane();          private FantasiaTabbedPane tabbedPane = new FantasiaTabbedPane();
50          private InstrumentsDbPane instrumentsDbPane = null;          private InstrumentsDbPane instrumentsDbPane = null;
51          private final DevicesPane devicesPane = new DevicesPane();          private final DevicesPane devicesPane = new DevicesPane();
52          private final JScrollPane spDevicesPane = new JScrollPane();          private final JScrollPane spDevicesPane = new JScrollPane();
53                    
54            private final JPanel mainPane = new FantasiaSubPanel(false, true);
55                    
56          /**          /**
57           * Creates a new instance of <code>RightSidePane</code>           * Creates a new instance of <code>RightSidePane</code>
58           */           */
59          public          public
60          RightSidePane() {          RightSidePane() {
                 super(Res.gfxRoundBg14);  
61                  setOpaque(false);                  setOpaque(false);
                 setPixmapInsets(new java.awt.Insets(6, 6, 6, 6));  
                 setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));  
62                  setLayout(new BorderLayout());                  setLayout(new BorderLayout());
63                                    
64                    tabbedPane.getMainPane().setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
65                    
66                  spDevicesPane.setOpaque(false);                  spDevicesPane.setOpaque(false);
67                  spDevicesPane.getViewport().setOpaque(false);                  spDevicesPane.getViewport().setOpaque(false);
68                  spDevicesPane.setViewportView(devicesPane);                  spDevicesPane.setViewportView(devicesPane);
# Line 73  public class RightSidePane extends Pixma Line 73  public class RightSidePane extends Pixma
73                  final String s = "rightSidePane.showInstrumentsDb";                  final String s = "rightSidePane.showInstrumentsDb";
74                  setTabbedView(preferences().getBoolProperty(s));                  setTabbedView(preferences().getBoolProperty(s));
75                                    
                 tabbedPane.setBackground(new java.awt.Color(0x828282));  
                 tabbedPane.putClientProperty(SubstanceLookAndFeel.COLORIZATION_FACTOR, 1.0);  
                   
76                  preferences().addPropertyChangeListener(s, getHandler());                  preferences().addPropertyChangeListener(s, getHandler());
77                    setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 3));
78          }          }
79                    
80          public DevicesPane          public DevicesPane
# Line 84  public class RightSidePane extends Pixma Line 82  public class RightSidePane extends Pixma
82                    
83          private void          private void
84          setTabbedView(boolean b) {          setTabbedView(boolean b) {
85                  remove(spDevicesPane);                  remove(mainPane);
86                  remove(tabbedPane);                  remove(tabbedPane);
87                                    
88                  tabbedPane.removeChangeListener(getHandler());                  tabbedPane.removeChangeListener(getHandler());
# Line 92  public class RightSidePane extends Pixma Line 90  public class RightSidePane extends Pixma
90                                    
91                  if(b) {                  if(b) {
92                          if(instrumentsDbPane == null) instrumentsDbPane = new InstrumentsDbPane();                          if(instrumentsDbPane == null) instrumentsDbPane = new InstrumentsDbPane();
93                          tabbedPane.addTab(i18n.getLabel("RightSidePane.tabDevices"), spDevicesPane);                          
94                          tabbedPane.addTab(i18n.getLabel("RightSidePane.tabInstrumentsDb"), instrumentsDbPane);                          FantasiaTabbedPane tp = tabbedPane;
95                          tabbedPane.addChangeListener(getHandler());                          tp.addTab(i18n.getLabel("RightSidePane.tabDevices"), spDevicesPane);
96                            tp.addTab(i18n.getLabel("RightSidePane.tabInstrumentsDb"), instrumentsDbPane);
97                            tp.addChangeListener(getHandler());
98                            
99                            Dimension d = JuifeUtils.getUnionSize(tp.getTabButton(0), tp.getTabButton(1));
100                            tp.getTabButton(0).setPreferredSize(d);
101                            tp.getTabButton(1).setPreferredSize(d);
102                            tp.getTabButton(0).setMinimumSize(d);
103                            tp.getTabButton(1).setMinimumSize(d);
104                    
105                          add(tabbedPane);                          add(tabbedPane);
106                                                    
107                          int i = preferences().getIntProperty("rightSidePane.tabIndex", 0);                          int i = preferences().getIntProperty("rightSidePane.tabIndex", 0);
108                          if(tabbedPane.getTabCount() > i) tabbedPane.setSelectedIndex(i);                          if(tabbedPane.getTabCount() > i) tabbedPane.setSelectedIndex(i);
109                  } else {                  } else {
110                          add(spDevicesPane);                          mainPane.add(spDevicesPane);
111                            add(mainPane);
112                  }                  }
113                                    
114                  validate();                  validate();
# Line 117  public class RightSidePane extends Pixma Line 125  public class RightSidePane extends Pixma
125          getHandler() { return eventHandler; }          getHandler() { return eventHandler; }
126                    
127          private class EventHandler implements ChangeListener, PropertyChangeListener {          private class EventHandler implements ChangeListener, PropertyChangeListener {
128                    @Override
129                  public void                  public void
130                  stateChanged(ChangeEvent e) {                  stateChanged(ChangeEvent e) {
131                          int idx = tabbedPane.getSelectedIndex();                          int idx = tabbedPane.getSelectedIndex();
# Line 124  public class RightSidePane extends Pixma Line 133  public class RightSidePane extends Pixma
133                          preferences().setIntProperty("rightSidePane.tabIndex", idx);                          preferences().setIntProperty("rightSidePane.tabIndex", idx);
134                  }                  }
135                                    
136                    @Override
137                  public void                  public void
138                  propertyChange(PropertyChangeEvent e) {                  propertyChange(PropertyChangeEvent e) {
139                          setTabbedView(preferences().getBoolProperty("rightSidePane.showInstrumentsDb"));                          setTabbedView(preferences().getBoolProperty("rightSidePane.showInstrumentsDb"));

Legend:
Removed from v.1777  
changed lines
  Added in v.1778

  ViewVC Help
Powered by ViewVC