+++ /dev/null
-/** @file\r
- \r
- The file is used to create cell renderer for CheckBoxList Item \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;\r
-\r
-import java.awt.*;\r
-import javax.swing.*;\r
-import javax.swing.border.*;\r
-\r
-class ICheckBoxListCellRenderer extends JCheckBox implements ListCellRenderer {\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -1718072217181674870L;\r
-\r
- protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);\r
-\r
- /**\r
- This is the default Constructor\r
- \r
- **/\r
- public ICheckBoxListCellRenderer() {\r
- super();\r
- setOpaque(true);\r
- setBorder(noFocusBorder);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)\r
- * Override to get attribute of the ICheckListCellRenderer\r
- * \r
- */\r
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,\r
- boolean cellHasFocus) {\r
- ICheckBoxListItem item = (ICheckBoxListItem) value;\r
-\r
- setComponentOrientation(list.getComponentOrientation());\r
- \r
- if (item.isChecked()) {\r
- setBackground(list.getSelectionBackground());\r
- setForeground(list.getSelectionForeground());\r
- } else {\r
- if (isSelected) {\r
- setBackground(Color.LIGHT_GRAY); \r
- setForeground(list.getForeground()); \r
- } else {\r
- setBackground(list.getBackground());\r
- setForeground(list.getForeground());\r
- }\r
- }\r
-\r
- if (value instanceof ICheckBoxListItem) {\r
- setText(item.getText());\r
- setSelected(item.isChecked());\r
- } else {\r
- setIcon(null);\r
- setText((value == null) ? "" : value.toString());\r
- }\r
-\r
- setEnabled(list.isEnabled());\r
- setFont(list.getFont());\r
-\r
- return this;\r
- }\r
-}\r