3853N/A/*
3853N/A * CDDL HEADER START
3853N/A *
3853N/A * The contents of this file are subject to the terms of the
3853N/A * Common Development and Distribution License, Version 1.0 only
3853N/A * (the "License"). You may not use this file except in compliance
3853N/A * with the License.
3853N/A *
6983N/A * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
6983N/A * or http://forgerock.org/license/CDDLv1.0.html.
3853N/A * See the License for the specific language governing permissions
3853N/A * and limitations under the License.
3853N/A *
3853N/A * When distributing Covered Code, include this CDDL HEADER in each
6983N/A * file and include the License file at legal-notices/CDDLv1_0.txt.
6983N/A * If applicable, add the following below this CDDL HEADER, with the
6983N/A * fields enclosed by brackets "[]" replaced with your own identifying
6983N/A * information:
3853N/A * Portions Copyright [yyyy] [name of copyright owner]
3853N/A *
3853N/A * CDDL HEADER END
3853N/A *
3853N/A *
3853N/A * Copyright 2008 Sun Microsystems, Inc.
3853N/A */
3853N/A
3853N/Apackage org.opends.guitools.controlpanel.ui.components;
3853N/A
3853N/Aimport java.awt.GridBagConstraints;
3853N/Aimport java.awt.GridBagLayout;
3853N/A
3853N/Aimport javax.swing.JLabel;
3853N/Aimport javax.swing.JPanel;
3853N/A
3853N/Aimport org.opends.guitools.controlpanel.util.Utilities;
3853N/Aimport org.opends.messages.Message;
3853N/Aimport org.opends.messages.MessageBuilder;
3853N/A
3853N/A/**
3853N/A * This is a panel containing two labels with different fonts. It is used
3853N/A * for instance in the index panel. The label on the left contains the type
3853N/A * of object and the label on the right, details about the object.
3853N/A *
3853N/A */
3853N/Apublic class TitlePanel extends JPanel
3853N/A{
3853N/A private static final long serialVersionUID = -5164867192115208627L;
3853N/A private JLabel lTitle;
3853N/A private JLabel lDetails;
3853N/A
3853N/A private Message title;
3853N/A private Message details;
3853N/A
3853N/A /**
3853N/A * Constructor of the panel.
3853N/A * @param title the title of the panel.
3853N/A * @param details the details of the panel.
3853N/A */
3853N/A public TitlePanel(Message title, Message details)
3853N/A {
3853N/A super(new GridBagLayout());
3853N/A setOpaque(false);
3853N/A GridBagConstraints gbc = new GridBagConstraints();
3853N/A MessageBuilder mb = new MessageBuilder();
3853N/A mb.append(title);
3853N/A mb.append(" - ");
3853N/A lTitle = Utilities.createTitleLabel(mb.toMessage());
3853N/A lDetails = Utilities.createDefaultLabel(details);
3853N/A gbc.fill = GridBagConstraints.NONE;
3853N/A gbc.anchor = GridBagConstraints.SOUTHWEST;
3853N/A gbc.gridx = 0;
3853N/A gbc.gridy = 0;
3853N/A add(lTitle, gbc);
3853N/A gbc.gridx ++;
3853N/A add(lDetails, gbc);
3853N/A this.title = title;
3853N/A this.details = details;
3853N/A }
3853N/A
3853N/A /**
3853N/A * Sets the title of this panel.
3853N/A * @param title the title of this panel.
3853N/A */
3853N/A public void setTitle(Message title)
3853N/A {
3853N/A lTitle.setText(title+" - ");
3853N/A this.title = title;
3853N/A }
3853N/A
3853N/A /**
3853N/A * Sets the details of this panel.
3853N/A * @param details the details of this panel.
3853N/A */
3853N/A public void setDetails(Message details)
3853N/A {
3853N/A lDetails.setText(details.toString());
3853N/A this.details = details;
3853N/A }
3853N/A
3853N/A /**
3853N/A * Returns the title of this panel.
3853N/A * @return the title of this panel.
3853N/A */
3853N/A public Message getTitle()
3853N/A {
3853N/A return title;
3853N/A }
3853N/A
3853N/A /**
3853N/A * Returns the details of this panel.
3853N/A * @return the details of this panel.
3853N/A */
3853N/A public Message getDetails()
3853N/A {
3853N/A return details;
3853N/A }
3853N/A}