Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER Copyright 2010 IBM. All rights reserved. Use is subject to license terms. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. You can also obtain a copy of the License at http://odftoolkit.org/docs/license.txt Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 
 package org.odftoolkit.simple.style;
 
 
This class represents the table cell style settings. It provides methods to access borders styles. More functions will be added latter.

This class is a corresponded high level class for element "style:table-cell-properties". It provides methods to access the attributes and children of "style:table-cell-properties".

Since:
0.3
 
 public class TableCellProperties {
 
 	// fo:background-color
 	// fo:border
 	// fo:border-bottom
 	// fo:border-left
 	// fo:border-right
 	// fo:border-top
 	// fo:padding
 	// fo:padding-bottom
 	// fo:padding-left
 	// fo:padding-right
 	// fo:padding-top
 	// fo:wrap-option
 	// style:border-line-width
 	// style:border-line-width-bottom
 	// style:border-line-width-left
 	// style:border-line-width-right
 	// style:border-line-width-top
 	// style:cell-protect
 	// style:decimal-places
 	// style:diagonal-bl-tr
 	// style:diagonal-bl-tr-widths
 	// style:diagonal-tl-br
 	// style:diagonal-tl-br-widths
 	// style:direction
 	// style:glyph-orientation-vertical
 	// style:print-content
 	// style:repeat-content
 	// style:rotation-align
 	// style:rotation-angle
 	// style:shadow
 	// style:shrink-to-fit
 	// style:text-align-source
 	// style:vertical-align
 	// style:writing-mode
 
 	// String backgroundColor;
	// String wrapOption;
	// String border;
	// String borderBottom;
	// String borderLeft;
	// String borderRight;
	// String borderTop;
	// String diagonalBlTr;
	// String diagonalTlBr;
	// String borderLineWidth;
	// String borderLineWidthBottom;
	// String borderLineWidthLeft;
	// String borderLineWidthRight;
	// String borderLineWidthTop;
	// String diagonalBlTrWidths;
	// String diagonalTlBrWidths;
Create an instance of TableCellProperties
	protected TableCellProperties() {
	}

Create an instance of TableCellProperties from an element <style:table-cell-properties>

Parameters:
properties - the element of style:table-cell-properties
		 = properties;
	}

Set the border style.

The first parameter bordersType describes which borders you want to apply the style to, e.g. up border, bottom border, left border, right border, diagonal lines or four borders.

The border style information will be removed if the parameter bordersType is NONE.

Parameters:
bordersType - the type of the borders
border - the border style description
	public void setBorders(StyleTypeDefinitions.CellBordersType bordersTypeBorder border) {
		switch (bordersType) {
		case :
			break;
		case :
			break;
		case :
			break;
		case :
			setTopBorder(border);
			break;
			break;
			break;
		case :
			setBorder(border);
			break;
			// border.switchInnerLineOuterLineWidth();
			break;
			setTopBorder(border);
			// border.switchInnerLineOuterLineWidth();
			break;
			break;
		case :
		}
	}

Return the border setting for all four borders.

Null will be returned if there is no border setting for all four borders.

Returns:
the border setting
	public Border getBorder() {
	}

Return the border setting for the top border.

Null will be returned if there is no border setting for the top border.

Returns:
the border setting
	public Border getTopBorder() {
	}

Return the border setting for the left border.

Null will be returned if there is no border setting for the left border.

Returns:
the border setting
	public Border getLeftBorder() {
	}

Return the border setting for the right border.

Null will be returned if there is no border setting for the right border.

Returns:
the border setting
	public Border getRightBorder() {
	}
	// fo:border-bottom
	// style:border-line-width-bottom
Return the border setting for the bottom border.

Null will be returned if there is no border setting for the bottom border.

Returns:
the border setting
	public Border getBottomBorder() {
	}

Return the border setting for the diagonal from bottom left to top right.

Null will be returned if there is no border setting for the diagonal from bottom left to top right.

Returns:
the border setting
	public Border getDiagonalBlTr() {
		Border border = new Border();
		if (borderWidth == null)
			// some ODF version uses diagonal-bl-tr-width while schema use
			// diagonal-bl-tr-widths
			borderWidth = .getAttribute("style:diagonal-bl-tr-width");
		if (borderAttr == null || borderAttr.length() == 0)
			return null;
		border.setBorderByDescription(borderAttr);
		if ((borderWidth != null) && (borderWidth.length() != 0)) {
		}
		return border;
	}

Return the border setting for the diagonal from top left to bottom right.

Null will be returned if there is no border setting for the diagonal from top left to bottom right.

Returns:
the border setting
	public Border getDiagonalTlBr() {
		Border border = new Border();
		if (borderWidth == null)
			// some ODF version uses diagonal-tl-br-width while schema use
			// diagonal-tl-br-widths
			borderWidth = .getAttribute("style:diagonal-tl-br-width");
		border.setBorderByDescription(borderAttr);
		if ((borderWidth != null) && (borderWidth.length() != 0)) {
		}
		return border;
	}
	// fo:border-bottom
	// style:border-line-width-bottom
Set the border definition for the bottom border.

If the parameter border is null, the border definition for the bottom border will be removed.

If the line type in the border definition is NONE, the border definition for the bottom border will be removed.

Parameters:
border - the border setting
	public void setBottomBorder(Border border) {
	}
	// fo:border-top
	// style:border-line-width-top
Set the border definition for the top border.

If the parameter border is null, the border definition for the top border will be removed.

If the line type in the border definition is NONE, the border definition for the top border will be removed.

Parameters:
border - the border setting
	public void setTopBorder(Border border) {
	}
	// fo:border-left
	// style:border-line-width-left
Set the border definition for the left border.

If the parameter border is null, the border definition for the left border will be removed.

If the line type in the border definition is NONE, the border definition for the left border will be removed.

Parameters:
border - the border setting
	public void setLeftBorder(Border border) {
	}
	// fo:border-right
	// style:border-line-width-right
Set the border definition for the right border.

If the parameter border is null, the border definition for the right border will be removed.

If the line type in the border definition is NONE, the border definition for the right border will be removed.

Parameters:
border - the border setting
	public void setRightBorder(Border border) {
	}
	// style:diagonal-bl-tr
	// style:diagonal-bl-tr-widths
Set the border definition for the diagonal from bottom left to top right.

If the parameter border is null, the border definition for the diagonal from bottom left to top right will be removed.

If the line type in the border definition is NONE, the border definition for the diagonal from bottom left to top right will be removed.

Parameters:
border - the border setting
	public void setDiagonalBlTr(Border border) {
		if (border == null) {
			return;
		}
		switch (border.lineStyle) {
		case :
			break;
		case :
			break;
		case :
		}
	}
	// style:diagonal-tl-br
	// style:diagonal-tl-br-widths
Set the border definition for the diagonal from top left to bottom right.

If the parameter border is null, the border definition for the diagonal from top left to bottom right will be removed.

If the line type in the border definition is NONE, the border definition for the diagonal from top left to bottom right will be removed.

Parameters:
border - the border setting
	public void setDiagonalTlBr(Border border) {
		if (border == null) {
			return;
		}
		switch (border.lineStyle) {
		case :
			break;
		case :
			break;
		case :
		}
	}
	// fo:border
	// style:border-line-width
Set the border definition for all four borders.

If the parameter border is null, the border definition for all four borders will be removed.

If the line type in the border definition is NONE, the border definition for all four borders will be removed.

Parameters:
border - the border setting
	public void setBorder(Border border) {
	}
	// fo:background-color
Set the background color.

If the parameter aColor is null, the background color definition will be removed.

Parameters:
aColor - the background color
	public void setBackgroundColor(Color aColor) {
		if (aColor == null)
	}
	// //style:cell-protect
	// public void setProtected(boolean isProtected)
	// {
	//		
	// }
	//	
	// //style:cell-protect
	// public boolean isProctected()
	// {
	// return false;
	// }
Return the background color.

Null will be returned if there is no the background color definition or the background color definition is not valid.

Returns:
the background color
		Color color = null;
		try {
			color = Color.valueOf(property);
catch (Exception e) {
		}
		return color;
	}
	// fo:wrap-option
Set the text is allowed to be wrapped.

If the parameter isWrapped is true, the text will be allowed to be wrapped. Or else, the text is not allowed to be wrapped.

Parameters:
isWrapped - the wrapped option
	public void setWrapped(boolean isWrapped) {
		if (isWrapped) {
else {
		}
	}
	// style:vertical-align
Set the vertical alignment.

If the parameter alignType is null or DEFAULT, the vertical alignment definition will be removed.

Parameters:
alignType - the vertical alignment
		if (alignType == .. || alignType == null)
		else
	}
	// style:vertical-align
Return the vertical alignment.

If there is no vertical alignment definition, null will be returned.

Returns:
the vertical alignment
		if ((alignType == null) || (alignType.length() == 0))
			return null;
		StyleVerticalAlignAttribute.Value value = StyleVerticalAlignAttribute.Value.enumValueOf(alignType);
		switch (value) {
		case :
		case :
		case :
		case :
		case :
		case :
		}
		return null;
	}
	// fo:wrap-option
Return whether the text is allowed to be wrapped.

Return true if the text is allowed to be wrapped. Or else, return false.

Returns:
a boolean value to indicate whether the text is allowed to be wrapped
	public Boolean isWrapped() {
		if ((attr == null) || (attr.length() == 0))
			return false;
		FoWrapOptionAttribute.Value value = FoWrapOptionAttribute.Value.enumValueOf(attr);
		switch (value) {
		case :
			return false;
		case :
			return true;
		}
		return null;
	}

Return an instance of TableCellProperties to represent the "style:table-cell-properties" in a style element.

If there is no "style:table-cell-properties" defined in the style element, a new "style:table-cell-properties" element will be created.

Parameters:
style - a style element
Returns:
an instance of TableCellProperties
		OdfStylePropertiesBase properties = style
	}

Return an instance of TableCellProperties to represent the "style:table-cell-properties" in a style element.

If there is no "style:table-cell-properties" defined in the style element, null will be returned.

Parameters:
style - a style element
Returns:
an instance of TableCellProperties;Null if there is no "style:table-cell-properties" defined
		if (properties != null)
		else
			return null;
	}
	{
	}
	// fo:border-bottom
	// style:border-line-width-bottom
Set the border definition for the bottom border.

If the parameter border is null, the border definition for the bottom border will be removed.

If the line type in the border definition is NONE, the border definition for the bottom border will be removed.

Parameters:
border - the border setting
	public void setBottomBorder(Border border) {
		if (border == null) {
			return;
		}
		switch (border.lineStyle) {
		case :
			break;
		case :
			break;
		case :
		}
	}
	// fo:border-top
	// style:border-line-width-top
Set the border definition for the top border.

If the parameter border is null, the border definition for the top border will be removed.

If the line type in the border definition is NONE, the border definition for the top border will be removed.

Parameters:
border - the border setting
	public void setTopBorder(Border border) {
		if (border == null) {
			return;
		}
		switch (border.lineStyle) {
		case :
			break;
		case :
			break;
		case :
		}
	}
	// fo:border-left
	// style:border-line-width-left
Set the border definition for the left border.

If the parameter border is null, the border definition for the left border will be removed.

If the line type in the border definition is NONE, the border definition for the left border will be removed.

Parameters:
border - the border setting
	public void setLeftBorder(Border border) {
		if (border == null) {
			return;
		}
		switch (border.lineStyle) {
		case :
			break;
		case :
			break;
		case :
		}
	}
	// fo:border-right
	// style:border-line-width-right
Set the border definition for the right border.

If the parameter border is null, the border definition for the right border will be removed.

If the line type in the border definition is NONE, the border definition for the right border will be removed.

Parameters:
border - the border setting
	public void setRightBorder(Border border) {
		if (border == null) {
			return;
		}
		switch (border.lineStyle) {
		case :
			break;
		case :
			break;
		case :
		}
	}
	// fo:border
	// style:border-line-width
Set the border definition for all four borders.

If the parameter border is null, the border definition for all four borders will be removed.

If the line type in the border definition is NONE, the border definition for all four borders will be removed.

Parameters:
border - the border setting
	public void setBorder(Border border) {
		if (border == null) {
			return;
		}
		switch (border.lineStyle) {
		case :
			break;
		case :
			break;
		case :
		}
	}

Return the border setting for all four borders.

Null will be returned if there is no border setting for all four borders.

Returns:
the border setting
	public Border getBorder() {
		Border border = new Border();
		if (borderAttr == null || borderAttr.length() == 0)
			return null;
		border.setBorderByDescription(borderAttr);
		if ((borderWidth != null) && (borderWidth.length() != 0)) {
		}
		return border;
	}

Return the border setting for the top border.

Null will be returned if there is no border setting for the top border.

Returns:
the border setting
	public Border getTopBorder() {
		Border border = new Border();
		String borderWidth = .getAttributeNS(..getUri(), "border-line-width-top");
		if (borderAttr == null || borderAttr.length() == 0)
			return getBorder();
		border.setBorderByDescription(borderAttr);
		if ((borderWidth != null) && (borderWidth.length() != 0)) {
		}
		return border;
	}

Return the border setting for the left border.

Null will be returned if there is no border setting for the left border.

Returns:
the border setting
	public Border getLeftBorder() {
		Border border = new Border();
		String borderWidth = .getAttributeNS(..getUri(), "border-line-width-left");
		if (borderAttr == null || borderAttr.length() == 0)
			return getBorder();
		border.setBorderByDescription(borderAttr);
		if ((borderWidth != null) && (borderWidth.length() != 0)) {
		}
		return border;
	}

Return the border setting for the right border.

Null will be returned if there is no border setting for the right border.

Returns:
the border setting
	public Border getRightBorder() {
		Border border = new Border();
		String borderWidth = .getAttributeNS(..getUri(), "border-line-width-right");
		if (borderAttr == null || borderAttr.length() == 0)
			return getBorder();
		border.setBorderByDescription(borderAttr);
		if ((borderWidth != null) && (borderWidth.length() != 0)) {
		}
		return border;
	}
	// fo:border-bottom
	// style:border-line-width-bottom
Return the border setting for the bottom border.

Null will be returned if there is no border setting for the bottom border.

Returns:
the border setting
	public Border getBottomBorder() {
		Border border = new Border();
		String borderWidth = .getAttributeNS(..getUri(), "border-line-width-bottom");
		if (borderAttr == null || borderAttr.length() == 0) {
			return getBorder();
		}
		border.setBorderByDescription(borderAttr);
		if ((borderWidth != null) && (borderWidth.length() != 0)) {
		}
		return border;
	}
New to GrepCode? Check out our FAQ X