001: /*
002: * FindBugs - Find Bugs in Java programs
003: * Copyright (C) 2006, University of Maryland
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019:
020: package edu.umd.cs.findbugs.gui2;
021:
022: import java.awt.BorderLayout;
023:
024: import javax.swing.JLabel;
025: import javax.swing.JMenu;
026: import javax.swing.JPanel;
027: import javax.swing.JSplitPane;
028:
029: /**
030: * @author pugh
031: */
032: public class SplitLayout implements FindBugsLayoutManager {
033:
034: final MainFrame frame;
035: JLabel sourceTitle;
036: JSplitPane topLeftSPane;
037: JSplitPane topSPane;
038: JSplitPane summarySPane;
039: JSplitPane mainSPane;
040:
041: /**
042: * @param frame
043: */
044: public SplitLayout(MainFrame frame) {
045: this .frame = frame;
046: }
047:
048: /* (non-Javadoc)
049: * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#createWindowMenu()
050: */
051: public JMenu createWindowMenu() {
052: return null;
053: }
054:
055: /* (non-Javadoc)
056: * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#initialize()
057: */
058: public void initialize() {
059:
060: topLeftSPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, frame
061: .bugListPanel(), frame.createCommentsInputPanel());
062: topLeftSPane.setOneTouchExpandable(true);
063: topLeftSPane.setDividerLocation(GUISaveState.getInstance()
064: .getSplitTreeComments());
065:
066: JPanel sourcePanel = new JPanel();
067: sourcePanel.setLayout(new BorderLayout());
068: sourceTitle = new JLabel();
069: sourceTitle.setText(edu.umd.cs.findbugs.L10N.getLocalString(
070: "txt.source_listing", "<source listing>"));
071: sourcePanel.add(sourceTitle, BorderLayout.NORTH);
072: sourcePanel.add(frame.createSourceCodePanel(),
073: BorderLayout.CENTER);
074: sourcePanel.add(frame.createSourceSearchPanel(),
075: BorderLayout.SOUTH);
076: topSPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
077: topLeftSPane, sourcePanel);
078: topSPane.setOneTouchExpandable(true);
079: topSPane.setDividerLocation(GUISaveState.getInstance()
080: .getSplitTop());
081:
082: summarySPane = frame.summaryTab();
083: mainSPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topSPane,
084: summarySPane);
085: mainSPane.setOneTouchExpandable(true);
086: mainSPane.setDividerLocation(GUISaveState.getInstance()
087: .getSplitMain());
088:
089: frame.setLayout(new BorderLayout());
090: frame.add(mainSPane, BorderLayout.CENTER);
091: frame.add(frame.statusBar(), BorderLayout.SOUTH);
092:
093: }
094:
095: /* (non-Javadoc)
096: * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#makeCommentsVisible()
097: */
098: public void makeCommentsVisible() {
099:
100: }
101:
102: /* (non-Javadoc)
103: * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#makeSourceVisible()
104: */
105: public void makeSourceVisible() {
106:
107: }
108:
109: /* (non-Javadoc)
110: * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#saveState()
111: */
112: public void saveState() {
113: GUISaveState.getInstance().setSplitTreeComments(
114: topLeftSPane.getDividerLocation());
115: GUISaveState.getInstance().setSplitTop(
116: topSPane.getDividerLocation());
117: GUISaveState.getInstance().setSplitSummary(
118: summarySPane.getDividerLocation());
119: GUISaveState.getInstance().setSplitMain(
120: mainSPane.getDividerLocation());
121: }
122:
123: /* (non-Javadoc)
124: * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#setSourceTitle(java.lang.String)
125: */
126: public void setSourceTitle(String title) {
127: sourceTitle.setText(title);
128: }
129:
130: }
|