001package com.hfg.xml.msoffice2003.spreadsheetml; 002 003import com.hfg.xml.XMLTag; 004import com.hfg.graphics.ColorUtil; 005 006import java.awt.*; 007 008 009//------------------------------------------------------------------------------ 010/** 011 Excel border. 012 013 @author J. Alex Taylor, hairyfatguy.com 014 */ 015//------------------------------------------------------------------------------ 016// com.hfg Library 017// 018// This library is free software; you can redistribute it and/or 019// modify it under the terms of the GNU Lesser General Public 020// License as published by the Free Software Foundation; either 021// version 2.1 of the License, or (at your option) any later version. 022// 023// This library is distributed in the hope that it will be useful, 024// but WITHOUT ANY WARRANTY; without even the implied warranty of 025// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 026// Lesser General Public License for more details. 027// 028// You should have received a copy of the GNU Lesser General Public 029// License along with this library; if not, write to the Free Software 030// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 031// 032// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 033// jataylor@hairyfatguy.com 034//------------------------------------------------------------------------------ 035 036 037public class ExcelBorder extends XMLTag 038{ 039 040 //--------------------------------------------------------------------------- 041 public ExcelBorder() 042 { 043 super(SpreadsheetML.BORDER); 044 } 045 046 //--------------------------------------------------------------------------- 047 public ExcelBorder setPosition(ExcelBorderPosition inValue) 048 { 049 setAttribute(SpreadsheetML.POSITION_ATT, inValue.name()); 050 return this; 051 } 052 053 //--------------------------------------------------------------------------- 054 public ExcelBorder setLineStyle(ExcelLineStyle inValue) 055 { 056 setAttribute(SpreadsheetML.LINE_STYLE_ATT, inValue.name()); 057 return this; 058 } 059 060 //--------------------------------------------------------------------------- 061 /** 062 Sets the border weight [0 (hairline) to 4 (thick)]. 063 */ 064 public ExcelBorder setWeight(int inValue) 065 { 066 setAttribute(SpreadsheetML.WEIGHT_ATT, inValue); 067 return this; 068 } 069 070 //--------------------------------------------------------------------------- 071 public ExcelBorder setColor(Color inValue) 072 { 073 setAttribute(SpreadsheetML.COLOR_ATT, "#" + ColorUtil.colorToHex(inValue)); 074 return this; 075 } 076 077}