1 /* Copyright (C) 2003-2011 JabRef contributors.
2 This program is free software; you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation; either version 2 of the License, or
5 (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License along
13 with this program; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 package net.sf.jabref;
18 import java.awt.Dimension;
19 import java.awt.Insets;
20 import java.awt.event.ActionEvent;
21 import java.awt.event.ActionListener;
24 import javax.swing.BorderFactory;
25 import javax.swing.ImageIcon;
26 import javax.swing.JButton;
27 import javax.swing.JToolBar;
29 import com.jgoodies.uif_lite.panel.SimpleInternalFrame;
31 public abstract class SidePaneComponent extends SimpleInternalFrame {
33 protected JButton close = new JButton(GUIGlobals.getImage("close"));
35 protected boolean visible = false;
37 protected SidePaneManager manager;
39 protected BasePanel panel = null;
41 public SidePaneComponent(SidePaneManager manager, URL icon, String title) {
42 super(new ImageIcon(icon), title);
43 this.manager = manager;
45 JToolBar tlb = new JToolBar();
46 close.setMargin(new Insets(0, 0, 0, 0));
47 // tlb.setOpaque(false);
48 close.setBorder(null);
49 tlb.setFloatable(false);
51 close.addActionListener(new CloseButtonListener());
53 // setBorder(BorderFactory.createEtchedBorder());
54 setBorder(BorderFactory.createEmptyBorder());
55 // setBorder(BorderFactory.createMatteBorder(1,1,1,1,java.awt.Color.green));
56 // setPreferredSize(new java.awt.Dimension
57 // (GUIGlobals.SPLIT_PANE_DIVIDER_LOCATION, 200));
58 // Util.pr(""+GUIGlobals.SPLIT_PANE_DIVIDER_LOCATION);
61 public void hideAway() {
62 manager.hideComponent(this);
66 * Used by SidePaneManager only, to keep track of visibility.
69 void setVisibility(boolean vis) {
74 * Used by SidePaneManager only, to keep track of visibility.
77 boolean hasVisibility() {
81 public void setActiveBasePanel(BasePanel panel) {
85 public BasePanel getActiveBasePanel() {
90 * Override this method if the component needs to make any changes before it
93 public void componentClosing() {
98 * Override this method if the component needs to do any actions when
101 public void componentOpening() {
105 public Dimension getMinimumSize() {
106 return getPreferredSize();
109 class CloseButtonListener implements ActionListener {
110 public void actionPerformed(ActionEvent e) {