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