| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.server.util.DynamicConstants; |
| | | |
| | | /** |
| | | * The generic frame of the Control Panel. It contains a StatusGenericPanel. |
| | | */ |
| | | /** The generic frame of the Control Panel. It contains a StatusGenericPanel. */ |
| | | public class GenericFrame extends JFrame |
| | | { |
| | | private static final long serialVersionUID = -2643144936460484112L; |
| | |
| | | KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); |
| | | ActionListener actionListener = new ActionListener() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | setVisible(false); |
| | |
| | | |
| | | FocusListener focusListener = new FocusAdapter() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void focusGained(FocusEvent ev) |
| | | { |
| | | lastComponentWithFocus = ev.getComponent(); |
| | |
| | | addFocusListener(focusListener, panel); |
| | | |
| | | addWindowListener(new WindowAdapter() { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void windowClosing(WindowEvent e) { |
| | | GenericFrame.this.panel.closeClicked(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setVisible(boolean visible) |
| | | { |
| | | if (visible && lastComponentWithFocus == null) |
| | |
| | | closeButton.setEnabled(enable); |
| | | } |
| | | |
| | | /** |
| | | * Updates the title of the frame using the title of the panel. |
| | | * |
| | | */ |
| | | /** Updates the title of the frame using the title of the panel. */ |
| | | public void updateTitle() |
| | | { |
| | | if (panel.getTitle() != null) |
| | |
| | | buttonsPanel.add(okButton, gbc); |
| | | okButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.okClicked(); |
| | |
| | | cancelButton.setOpaque(false); |
| | | cancelButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.cancelClicked(); |
| | |
| | | buttonsPanel.add(okButton, gbc); |
| | | okButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.okClicked(); |
| | |
| | | buttonsPanel.add(closeButton, gbc); |
| | | closeButton.addActionListener(new ActionListener() |
| | | { |
| | | @Override |
| | | public void actionPerformed(ActionEvent ev) |
| | | { |
| | | panel.closeClicked(); |