1 /* 2 * Copyright (c) 2003-2008 by Cosylab d. d. 3 * 4 * This file is part of CosyBeans-Common. 5 * 6 * CosyBeans-Common is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * CosyBeans-Common is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with CosyBeans-Common. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 package com.cosylab.gui.components.table.renderers; 21 22 import java.awt.Color; 23 24 import javax.swing.border.LineBorder; 25 26 27 /** 28 * Border displayed whenever timeout is detected for individual cell. 29 * 30 * @author <a href="mailto:ales.pucelj@cosylab.com">Ales Pucelj</a> 31 * @version $id$ 32 */ 33 public class TimeoutBorder extends LineBorder 34 { 35 private static final long serialVersionUID = 1L; 36 private Color disabledColor = Color.white; 37 protected boolean enabled; 38 private Color color; 39 40 /** 41 * TimeoutBorder constructor comment. 42 */ 43 public TimeoutBorder() 44 { 45 super(new java.awt.Color(255, 90, 200), 2); 46 color = lineColor; 47 } 48 49 /** 50 * Returns color of this border when cell is disabled. 51 * 52 * @return Color of this cell when disabled. 53 */ 54 public Color getDisabledColor() 55 { 56 return disabledColor; 57 } 58 59 /** 60 * Returns whether this border is enabled. 61 * 62 * @return true if enabled. 63 */ 64 public boolean isEnabled() 65 { 66 return enabled; 67 } 68 69 /** 70 * Sets the color when this border is disabled. 71 * 72 * @param newDisabledColor new disabled color. 73 */ 74 public void setDisabledColor(Color newDisabledColor) 75 { 76 disabledColor = newDisabledColor; 77 } 78 79 /** 80 * Sets whether this border is enabled. 81 * 82 * @param newEnabled boolean 83 */ 84 public void setEnabled(boolean newEnabled) 85 { 86 enabled = newEnabled; 87 lineColor = enabled ? color : disabledColor; 88 } 89 } 90 91 /* __oOo__ */