Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER Copyright 2011 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.draw;
 
This class provides functions to handle the style of a frame.

Since:
0.5
 
 public class FrameStyleHandler extends DefaultStyleHandler {
 
 	private Frame mFrame;
 
 	public FrameStyleHandler(Frame frame) {
 		super(frame.getDrawFrameElement());
 		 = frame;
 	}

Set the border style of this cell. You can set the border style for a single border or a border collection.

The second 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.

Parameters:
border - the border style description
bordersType - the type of the borders
 
 	public void setBorders(Border borderCellBordersType bordersType) {
 		getGraphicPropertiesForWrite().setBorders(bordersTypeborder);
 	}

Set the style of stroke.

There are three types of stroke: none, solid and dash.

If the stroke is NONE, there is no stroke around the frame.

If the stroke is SOLID, there is solid line around the frame. color and width need to be specified.

If the stroke is DASH, there is dash line around the frame. color, width and the style name of dash line need to be specified.

Parameters:
stroke - the stroke type
color - the color of the stroke
widthDesc - the width description of the stroke, e.g. "0.01in"
dashStyleName - the dash style name
See also:
org.odftoolkit.simple.style.StyleTypeDefinitions.OdfDrawStroke
 
 	public void setStroke(StyleTypeDefinitions.OdfDrawStroke strokeColor colorString widthDescString dashStyleName) {
 		getGraphicPropertiesForWrite().setStroke(strokecolorwidthDescdashStyleName);
 	}

Set the background color of this frame.

If the parameter is null, there will be no background color defined for this frame. The old setting of background color will be removed.

Parameters:
color - the background color to be set
	public void setBackgroundColor(Color color) {
		if (color == null)
		else
	}

Set whether the content of a frame is displayed in the background or foreground. If it's displayed in the background, the content wouldn't be selected or moved.

Parameters:
isBackgroundFrame If true, the frame is displayed in the background.
Since:
0.5.5
	public void setBackgroundFrame(boolean isBackgroundFrame) {
		GraphicProperties graphicPropertiesForWrite = getGraphicPropertiesForWrite();
		graphicPropertiesForWrite.setStyleRunThrough(isBackgroundFrame);
	}

Set how a frame is bound to a text document. Default position relative and alignment will be set.

If the document is not text document, nothing will happen.

Parameters:
achorType - the point at which a frame is bound to a text document
	{
			return;
		GraphicProperties graphicPropertiesForWrite = getGraphicPropertiesForWrite();
		frameElement.setTextAnchorTypeAttribute(achorType.toString());
		//set default relative
		switch(achorType)
		{
			graphicPropertiesForWrite.setVerticalRelative(.);
			graphicPropertiesForWrite.setVerticalPosition(.);
			break;
			graphicPropertiesForWrite.setVerticalPosition(.);
			break;
		case :
			graphicPropertiesForWrite.setVerticalRelative(.);
			graphicPropertiesForWrite.setVerticalPosition(.);
			graphicPropertiesForWrite.setHorizontalRelative(.);
			break;
			graphicPropertiesForWrite.setVerticalPosition(.);
			break;
		case :
			break;
		}
	}

Set the horizontal position

Parameters:
horizontalPos - the horizontal position
	public void setHorizontalPosition(FrameHorizontalPosition horizontalPos) {
		GraphicProperties graphicPropertiesForWrite = getGraphicPropertiesForWrite();
		graphicPropertiesForWrite.setHorizontalPosition(horizontalPos);
	}

Set the horizontal relative

Parameters:
relative - the horizontal relative
	{
		GraphicProperties graphicPropertiesForWrite = getGraphicPropertiesForWrite();
		graphicPropertiesForWrite.setHorizontalRelative(relative);
	}

Set the vertical relative

Parameters:
relative - the vertical relative
	public void setVerticalRelative(VerticalRelative relative)
	{
		GraphicProperties graphicPropertiesForWrite = getGraphicPropertiesForWrite();
		graphicPropertiesForWrite.setVerticalRelative(relative);
	}

Set the vertical position

Parameters:
verticalPos - the vertical position
	public void setVerticalPosition(FrameVerticalPosition verticalPos) {
		GraphicProperties graphicPropertiesForWrite = getGraphicPropertiesForWrite();
		graphicPropertiesForWrite.setVerticalPosition(verticalPos);
	}

Return the horizontal position

Returns:
the horizontal position
		GraphicProperties graphicPropertiesForRead = getGraphicPropertiesForRead();
		return graphicPropertiesForRead.getHorizontalPosition();
	}

Return the vertical position

Returns:
the vertical position
		GraphicProperties graphicPropertiesForRead = getGraphicPropertiesForRead();
		return graphicPropertiesForRead.getVerticalPosition();
	}

Return the vertical relative

Returns:
the vertical relative
	{
		GraphicProperties graphicPropertiesForRead = getGraphicPropertiesForRead();
		return graphicPropertiesForRead.getVerticalRelative();
	}

Return the horizontal relative

Returns:
the horizontal relative
	{
		GraphicProperties graphicPropertiesForRead = getGraphicPropertiesForRead();
		return graphicPropertiesForRead.getHorizontalRelative();
	}
New to GrepCode? Check out our FAQ X