pmHelpDetailPanel.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright(c) 1999 - 2001 by Sun Microsystems, Inc.
* All rights reserved.
*
* View a help article
*/
class pmHelpLoc {
public pmHelpItem item;
public pmHelpLoc(pmHelpItem i) {
}
item = i;
pos = p;
}
public pmHelpLoc() {
}
}
public class pmHelpDetailPanel extends JPanel {
int historyIndex;
int historyLast;
static final int MAX_HISTORY_ITEMS = 101;
controller = ctrl;
// build subpanels
seeAlsoPanel = new pmHelpSeeAlsoPanel(this);
viewPanel = new pmHelpViewPanel(this);
// lay out top panel
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.weightx = 1.0;
c.weighty = 6.0;
// c.gridheight = GridBagConstraints.REMAINDER;
c.gridheight = 0;
c.weighty = 0.0;
c.weightx = 1.0;
this.add(seeAlsoPanel, c);
historyIndex = 0;
historyLast = 0;
// manage focus when we are tabbed or un-tabbed
public void stateChanged(ChangeEvent e) {
if (!(tp.getSelectedComponent() instanceof
/*
controller.frame.getRootPane().
setDefaultButton(
controller.frame.dismiss);
*/
}
}
});
addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
}
});
}
// ask parent controller to show item
}
public void showHistoryBackItem() {
historyIndex + " last = " +
"\n\thistory = " +
history);
// assuming item already visible, preserve its position
if (historyIndex > 1) {
}
}
public void showHistoryForwardItem() {
" last = " + historyLast +
"\n\thistory = " + history);
// assuming already an item visible, preserve its position
if (historyIndex < historyLast) {
}
}
/*
* load the help item
* internal
*/
}
return item;
}
/*
* load the help item corresponding to the specified tag
* external - called from helpController
* note that this is how see-also items are loadedes
*/
return null;
}
", last = " + historyLast);
// if there's already an item visible, preserve its position
history);
/*
* make the new item the latest in history.
* if the history length is maxed out, the new item
* will replace the item that's currently last.
*/
// init pos to 0,0
} else {
// replace last item
}
", last = " + historyLast);
return item;
}
}
}
class pmHelpSeeAlsoPanel extends JPanel {
private void layoutBox() {
theComboBox = new JComboBox();
theComboBox.setEnabled(false);
/*
theComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComboBox src = (JComboBox) e.getSource();
System.out.println("Combo: action = " +
e.getActionCommand());
System.out.println("Combo: mod = " +
e.getModifiers());
System.out.println("Combo: param = " +
e.paramString());
System.out.println("Combo: item = " +
src.getSelectedItem());
}
});
*/
selectButton = new pmButton(
selectButton.setEnabled(false);
public void actionPerformed(ActionEvent e) {
// parentPanel.loadItemForTag(i.tag);
}
});
}
public pmHelpSeeAlsoPanel(pmHelpDetailPanel p) {
parentPanel = p;
layoutBox();
}
/*
* set the titles of the pmHelpItems whose tags are
* passed into see-also combo box
*/
clearItems();
return;
while (e.hasMoreElements()) {
pmHelpItem i =
if (i != null)
theComboBox.addItem(i);
}
selectButton.setEnabled(true);
theComboBox.setEnabled(true);
// repaint();
}
public void clearItems() {
selectButton.setEnabled(false);
theComboBox.setEnabled(false);
}
}
class pmHelpViewPanel extends JPanel {
// JTextArea helpView;
parentPanel = par;
// helpView = new JTextArea(10, 32);
// helpView.setLineWrap(true);
helpView = new JEditorPane();
helpView.setEditable(false);
helpView.setEnabled(false);
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.gridheight = 1;
c.weightx = 1.0;
// c.weighty = 1.0;
c.weighty = 0.05;
titlePanel = new pmHelpHelpOnPanel();
this.add(titlePanel, c);
c.gridy = 1;
c.gridheight = 1;
c.weightx = 1.0;
c.weighty = 6.0;
// c.insets = new Insets(5, 5, 5, 5); // NEW
this.add(scrollPane, c);
/*
*/
try {
} catch (Exception x) {
}
/*
*/
// navigation buttons
p.setLayout(new GridBagLayout());
// pc.insets = new Insets(2, 2, 2, 2);
// pc.fill = GridBagConstraints.HORIZONTAL;
backButton = new pmButton(
backButton.setEnabled(false);
backButton.setDefaultCapable(false);
public void actionPerformed(ActionEvent e) {
}
});
forwardButton = new pmButton(
forwardButton.setEnabled(false);
forwardButton.setDefaultCapable(false);
public void actionPerformed(ActionEvent e) {
}
});
c.weightx = 1.0;
// c.weighty = 1.0;
// c.insets = new Insets(0, 10, 5, 10);
// NEW
add(p, c);
}
// scrollPane.getViewport().setViewPosition(new Point(0, 0));
}
}
}
forwardButton.setEnabled(true);
else
forwardButton.setEnabled(false);
backButton.setEnabled(true);
else
backButton.setEnabled(false);
}
}
class pmJTextField extends JTextField {
public boolean isFocusable() {
return false;
}
}
class pmHelpHelpOnPanel extends JPanel {
public pmHelpHelpOnPanel() {
helpTopic = new pmJTextField();
helpTopic.setEditable(false);
"West");
// this.add(Box.createHorizontalStrut(5));
// this.add(Box.createHorizontalStrut(5));
// this.setBorder(BorderFactory.createEtchedBorder());
}
}