4518N/A/*
4518N/A * CDDL HEADER START
4518N/A *
4518N/A * The contents of this file are subject to the terms of the
4518N/A * Common Development and Distribution License, Version 1.0 only
4518N/A * (the "License"). You may not use this file except in compliance
4518N/A * with the License.
4518N/A *
4518N/A * You can obtain a copy of the license at
4518N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE
4518N/A * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
4518N/A * See the License for the specific language governing permissions
4518N/A * and limitations under the License.
4518N/A *
4518N/A * When distributing Covered Code, include this CDDL HEADER in each
4518N/A * file and include the License file at
4518N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
4518N/A * add the following below this CDDL HEADER, with the fields enclosed
4518N/A * by brackets "[]" replaced with your own identifying information:
4518N/A * Portions Copyright [yyyy] [name of copyright owner]
4518N/A *
4518N/A * CDDL HEADER END
4518N/A *
4518N/A *
4518N/A * Copyright 2009 Sun Microsystems, Inc.
4518N/A */
4518N/A
4518N/Apackage org.opends.guitools.controlpanel.ui.renderer;
4518N/A
4518N/Aimport java.awt.Component;
4518N/A
4518N/Aimport javax.swing.BorderFactory;
4518N/Aimport javax.swing.JTable;
4518N/Aimport javax.swing.border.Border;
4518N/Aimport javax.swing.table.DefaultTableCellRenderer;
4518N/A
4518N/Aimport org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
4518N/A
4518N/A/**
4518N/A * Class used to render the task tables.
4518N/A */
4518N/Apublic class TaskCellRenderer extends DefaultTableCellRenderer
4518N/A{
4518N/A private static final long serialVersionUID = -84332267021523835L;
4518N/A /**
4518N/A * The border of the first column.
4518N/A * TODO: modify CustomCellRenderer to make this public.
4518N/A */
4518N/A protected final static Border column0Border =
4518N/A BorderFactory.createCompoundBorder(
4518N/A BorderFactory.createMatteBorder(0, 1, 0, 0,
4518N/A ColorAndFontConstants.gridColor),
4518N/A BorderFactory.createEmptyBorder(4, 4, 4, 4));
4518N/A /**
4518N/A * The default border.
4518N/A */
4518N/A public final static Border defaultBorder = CustomCellRenderer.defaultBorder;
4518N/A
4518N/A /**
4518N/A * Default constructor.
4518N/A */
4518N/A public TaskCellRenderer()
4518N/A {
4518N/A setFont(ColorAndFontConstants.tableFont);
4518N/A setOpaque(true);
4518N/A setBackground(ColorAndFontConstants.treeBackground);
4518N/A setForeground(ColorAndFontConstants.treeForeground);
4518N/A }
4518N/A
4518N/A /**
4518N/A * {@inheritDoc}
4518N/A */
4518N/A public Component getTableCellRendererComponent(JTable table, Object value,
4518N/A boolean isSelected, boolean hasFocus, int row, int column) {
4518N/A super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
4518N/A row, column);
4518N/A
4518N/A if (hasFocus)
4518N/A {
4518N/A setBorder(
4518N/A CustomCellRenderer.getDefaultFocusBorder(table, value, isSelected,
4518N/A row, column));
4518N/A }
4518N/A else if (column == 0)
4518N/A {
4518N/A setBorder(column0Border);
4518N/A }
4518N/A else
4518N/A {
4518N/A setBorder(defaultBorder);
4518N/A }
4518N/A return this;
4518N/A }
4518N/A}
4518N/A