--- jsampler/trunk/src/org/jsampler/view/fantasia/OrchestrasPane.java 2007/09/08 18:33:05 1329 +++ jsampler/trunk/src/org/jsampler/view/fantasia/OrchestrasPane.java 2008/09/28 20:38:36 1778 @@ -1,7 +1,7 @@ /* * JSampler - a java front-end for LinuxSampler * - * Copyright (C) 2005-2007 Grigor Iliev + * Copyright (C) 2005-2008 Grigor Iliev * * This file is part of JSampler. * @@ -37,14 +37,12 @@ import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; -import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JToolBar; import org.jsampler.CC; -import org.jsampler.DefaultOrchestraModel; import org.jsampler.OrchestraModel; import org.jsampler.event.OrchestraAdapter; @@ -52,9 +50,6 @@ import org.jsampler.event.ListEvent; import org.jsampler.event.ListListener; -import org.jsampler.view.InstrumentTable; -import org.jsampler.view.InstrumentTableModel; - import org.jsampler.view.std.JSManageOrchestrasPane; import org.jsampler.view.std.JSOrchestraPane; @@ -68,7 +63,7 @@ */ public class OrchestrasPane extends JPanel { private final JPanel taskPaneContainer = new JPanel(); - private final TaskPane orchestrasTaskPane = new TaskPane(); + private final FantasiaTaskPane orchestrasTaskPane = new FantasiaTaskPane(); private ManageOrchestrasPane manageOrchestrasPane = new ManageOrchestrasPane(); @@ -88,7 +83,10 @@ setOpaque(false); orchestrasTaskPane.setTitle(i18n.getLabel("OrchestrasPane.orchestrasTaskPane")); - orchestrasTaskPane.add(manageOrchestrasPane); + + FantasiaSubPanel fsp = new FantasiaSubPanel(false, true, false); + fsp.add(manageOrchestrasPane); + orchestrasTaskPane.add(fsp); boolean b; orchestrasTaskPane.setAnimated(preferences().getBoolProperty(ANIMATED)); b = preferences().getBoolProperty("OrchestrasPane.orchestrasTaskPane.expanded"); @@ -156,40 +154,24 @@ InstrumentsPane() { setOpaque(false); setLayout(new BorderLayout()); - setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5)); - PixmapPane p = new PixmapPane(Res.gfxChannelOptions); - p.setPixmapInsets(new Insets(1, 1, 1, 1)); - p.setLayout(new BorderLayout()); - p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - - PixmapPane p2 = new PixmapPane(Res.gfxRoundBg7); - p2.setPixmapInsets(new Insets(3, 3, 3, 3)); + FantasiaSubPanel p2 = new FantasiaSubPanel(true, false); p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); p2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - p2.add(cbOrchestras); - p2.add(Box.createRigidArea(new Dimension(0, 5))); - p2.add(orchestraPane); + JPanel p = new FantasiaPanel(); + p.setOpaque(false); + p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); + p.add(cbOrchestras); + p.setBorder(BorderFactory.createEmptyBorder(3, 1, 5, 1)); + p2.add(p); - add(p2); - } - } - - static class ToolBar extends JToolBar { - private static Insets pixmapInsets = new Insets(1, 1, 1, 1); - - ToolBar() { - setFloatable(false); - setOpaque(false); - setPreferredSize(new Dimension(77, 29)); - setMinimumSize(getPreferredSize()); - } - - protected void - paintComponent(Graphics g) { - super.paintComponent(g); + FantasiaSubPanel fsp = new FantasiaSubPanel(false, true, false); + fsp.add(orchestraPane); + + p2.add(fsp); - PixmapPane.paintComponent(this, g, Res.gfxCreateChannel, pixmapInsets); + add(p2); } } @@ -201,7 +183,7 @@ removeAll(); - ToolBar toolBar = new ToolBar(); + JToolBar toolBar = FantasiaUtils.createSubToolBar(); toolBar.add(new ToolbarButton(actionAddOrchestra)); toolBar.add(new ToolbarButton(actionEditOrchestra)); toolBar.add(new ToolbarButton(actionDeleteOrchestra)); @@ -210,17 +192,8 @@ JScrollPane sp = new JScrollPane(orchestraTable); sp.setPreferredSize(new Dimension(120, 130)); - PixmapPane p = new PixmapPane(Res.gfxChannelOptions); - p.setPixmapInsets(new Insets(1, 1, 1, 1)); - p.setLayout(new BorderLayout()); - p.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); - - PixmapPane p2 = new PixmapPane(Res.gfxBorder); - p2.setPixmapInsets(new Insets(1, 1, 1, 1)); - p2.setLayout(new BorderLayout()); - p2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - p2.add(sp); - p.add(p2); + JPanel p = FantasiaUtils.createBottomSubPane(); + p.add(sp); add(p); } @@ -236,7 +209,7 @@ removeAll(); - ToolBar toolBar = new ToolBar(); + JToolBar toolBar = FantasiaUtils.createSubToolBar(); toolBar.add(new ToolbarButton(actionAddInstrument)); toolBar.add(new ToolbarButton(actionEditInstrument)); toolBar.add(new ToolbarButton(actionDeleteInstrument)); @@ -254,17 +227,8 @@ d = new Dimension(sp.getMinimumSize().width, sp.getPreferredSize().height); sp.setPreferredSize(d); - PixmapPane p = new PixmapPane(Res.gfxChannelOptions); - p.setPixmapInsets(new Insets(1, 1, 1, 1)); - p.setLayout(new BorderLayout()); - p.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); - - PixmapPane p2 = new PixmapPane(Res.gfxBorder); - p2.setPixmapInsets(new Insets(1, 1, 1, 1)); - p2.setLayout(new BorderLayout()); - p2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - p2.add(sp); - p.add(p2); + JPanel p = FantasiaUtils.createBottomSubPane(); + p.add(sp); add(p); } @@ -277,6 +241,7 @@ private class Handler extends OrchestraAdapter implements ListListener { /** Invoked when an orchestra is added to the orchestra list. */ + @Override public void entryAdded(ListEvent e) { if(cbOrchestras.getItemCount() == 0) cbOrchestras.setEnabled(true); @@ -290,6 +255,7 @@ } /** Invoked when an orchestra is removed from the orchestra list. */ + @Override public void entryRemoved(ListEvent e) { cbOrchestras.removeItem(e.getEntry()); @@ -299,12 +265,14 @@ } /** Invoked when the name of orchestra is changed. */ + @Override public void nameChanged(OrchestraEvent e) { } /** Invoked when the description of orchestra is changed. */ + @Override public void descriptionChanged(OrchestraEvent e) { }