001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008 Sun Microsystems, Inc. 015 * Portions Copyright 2014 ForgeRock AS. 016 */ 017 018package org.opends.guitools.controlpanel.ui; 019 020import static org.opends.messages.AdminToolMessages.*; 021 022import java.awt.GridBagConstraints; 023import java.awt.GridBagLayout; 024 025import javax.swing.JLabel; 026import javax.swing.JPanel; 027 028import org.opends.guitools.controlpanel.util.Utilities; 029import org.forgerock.i18n.LocalizableMessage; 030 031/** 032 * A simple panel containing a message. 033 * 034 */ 035public class NoItemSelectedPanel extends JPanel 036{ 037 private JLabel l; 038 private LocalizableMessage msg; 039 private static final long serialVersionUID = -8288525745479095426L; 040 041 /** 042 * Default constructor. 043 * 044 */ 045 public NoItemSelectedPanel() 046 { 047 super(new GridBagLayout()); 048 setOpaque(false); 049 GridBagConstraints gbc = new GridBagConstraints(); 050 msg = INFO_CTRL_PANEL_NO_ITEM_SELECTED_LABEL.get(); 051 l = Utilities.createPrimaryLabel(msg); 052 add(l, gbc); 053 } 054 055 /** 056 * Sets the message to be displayed. 057 * @param text the message to be displayed. 058 */ 059 public void setMessage(LocalizableMessage text) 060 { 061 msg = text; 062 l.setText(text.toString()); 063 } 064 065 /** 066 * Returns the displayed message. 067 * @return the displayed message. 068 */ 069 public LocalizableMessage getMessage() 070 { 071 return msg; 072 } 073}