source: extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/MyCollapsiblePanel.java @ 9878

Last change on this file since 9878 was 9878, checked in by mlg, 13 years ago

Fixes one major display bug
There were displays bugs with the horizontal splitpane where trying to resize it.
I have fixed by changing the original scale (1.0 to 0.99). Don't know why I had to do this, bug it seems to fix the bug
Fixes an other bug in the image browser : the image list was kept when browsing through the different categories.

File size: 4.5 KB
Line 
1package fr.mael.jiwigo.ui;
2
3/*
4  * $Id: CollapsiblePaneDemo.java 1164 2009-11-03 04:22:00Z kschaefe $
5  *
6  * Copyright 2009 Sun Microsystems, Inc., 4150 Network Circle,
7  * Santa Clara, California 95054, U.S.A. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  */
23
24import java.awt.BorderLayout;
25
26import javax.swing.JButton;
27import javax.swing.JPanel;
28import javax.swing.JSplitPane;
29import javax.swing.JTabbedPane;
30
31import org.jdesktop.swingx.JXCollapsiblePane;
32
33import fr.mael.jiwigo.ui.browser.BrowserPanel;
34
35/**
36   Copyright (c) 2010, Mael
37   All rights reserved.
38
39   Redistribution and use in source and binary forms, with or without
40   modification, are permitted provided that the following conditions are met:
41    * Redistributions of source code must retain the above copyright
42      notice, this list of conditions and the following disclaimer.
43    * Redistributions in binary form must reproduce the above copyright
44      notice, this list of conditions and the following disclaimer in the
45      documentation and/or other materials provided with the distribution.
46    * Neither the name of jiwigo nor the
47      names of its contributors may be used to endorse or promote products
48      derived from this software without specific prior written permission.
49
50   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
51   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
52   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
53   DISCLAIMED. IN NO EVENT SHALL Mael BE LIABLE FOR ANY
54   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
55   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
56   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
57   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 * @author Karl George Schaefer
62 */
63@SuppressWarnings("serial")
64public class MyCollapsiblePanel extends JPanel {
65    private JXCollapsiblePane collapsiblePane;
66    private JButton collapsingButton;
67    private BrowserPanel browserFrame = BrowserPanel.getInstance();
68    private JSplitPane splitPane;
69
70    //    /**
71    //     * main method allows us to run as a standalone demo.
72    //     */
73    //    public static void main(String[] args) {
74    //  SwingUtilities.invokeLater(new Runnable() {
75    //      public void run() {
76    //          JFrame frame = new JFrame();
77    //
78    //          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
79    //          frame.getContentPane().add(new TEst());
80    //          frame.setPreferredSize(new Dimension(800, 600));
81    //          frame.pack();
82    //          frame.setLocationRelativeTo(null);
83    //          frame.setVisible(true);
84    //      }
85    //  });
86    //    }
87
88    public MyCollapsiblePanel(JTabbedPane tabbedPane) {
89        setLayout(new BorderLayout());
90        splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
91        splitPane.setTopComponent(browserFrame);
92        splitPane.setBottomComponent(tabbedPane);
93        //      splitPane.addPropertyChangeListener(new PropertyChangeListener() {
94        //
95        //          @Override
96        //          public void propertyChange(PropertyChangeEvent evt) {
97        //              if (evt.getPropertyName().equals("dividerLocation")) {
98        //                  browserFrame.callRepaint();
99        //              }
100        //          }
101        //      });
102        splitPane.setResizeWeight(0.5);
103        add(splitPane, BorderLayout.CENTER);
104
105    }
106
107    @Override
108    public void revalidate() {
109        // TODO Auto-generated method stub
110        super.revalidate();
111
112    }
113
114    //    public void changeSize(Dimension dimension) {
115    //  Dimension dim = new Dimension(dimension.width, dimension.height - 400);
116    //
117    //    }
118
119}
Note: See TracBrowser for help on using the repository browser.