JIDE 3.5.15

com.jidesoft.editor
Class ColumnGuide

java.lang.Object
  extended by com.jidesoft.editor.ColumnGuide

public class ColumnGuide
extends Object

ColumnGuide a line to indicate the certain columns that have special meaning. For example, some code guideline says no line should be longer than 80. So it would be useful if there is a vertical line to indicate where column 80 is.

To add a new column guide, you just create one and add it to CodeEditor.addColumnGuide(ColumnGuide). We support any number of column guides. Each column guide can has its own color and stroke. The location can be specified in number of columns or in pixels.

For each column guide, you can control the color and the stroke. If you want to a more customized guide, you can always override paint method to do whatever painting you want. Please note, the paint of column guide is the last steps in code editor painting process. So what you did in the column guide's paint method will override everything else.


Field Summary
static Color DEFAULT_COLOR
           
static int UNIT_IN_COLUMNS
          A constant used by setUnit(int) to indicate the unit is in the number of columns.
static int UNIT_IN_PIXELS
          A constant used by setUnit(int) to indicate the unit is in the number of pixels.
 
Constructor Summary
ColumnGuide(int location)
          Creates a column guide at the specified location (in columns by default)
ColumnGuide(int location, Color color)
          Creates a column guide at the specified location (in columns by default) using the specified color.
ColumnGuide(int location, int unit)
          Creates a column guide at the specified location.
ColumnGuide(int location, int unit, Color color)
          Creates a column guide at the specified location, using the specified color.
 
Method Summary
 Color getColor()
          Gets the color.
 int getLocation()
          Gets the location of the column guide.
 Stroke getStroke()
          Gets the stroke of the column guide line.
 int getUnit()
          Gets the unit.
 void paint(CodeEditor codeEditor, Graphics g, Rectangle rect)
          Paints the column guide.
 void setColor(Color color)
          Sets the color of the column guide line.
 void setLocation(int location)
          Sets the location of the column guide.
 void setStroke(Stroke stroke)
          Sets the stroke of the column guide line.
 void setUnit(int unit)
          Sets the unit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIT_IN_COLUMNS

public static final int UNIT_IN_COLUMNS
A constant used by setUnit(int) to indicate the unit is in the number of columns.

See Also:
Constant Field Values

UNIT_IN_PIXELS

public static final int UNIT_IN_PIXELS
A constant used by setUnit(int) to indicate the unit is in the number of pixels.

See Also:
Constant Field Values

DEFAULT_COLOR

public static final Color DEFAULT_COLOR
Constructor Detail

ColumnGuide

public ColumnGuide(int location)
Creates a column guide at the specified location (in columns by default)

Parameters:
location - the location of the column guide.

ColumnGuide

public ColumnGuide(int location,
                   int unit)
Creates a column guide at the specified location. You can specify either in columns or in pixels.

Parameters:
location - the location of the column guide.
unit - the unit of the location.

ColumnGuide

public ColumnGuide(int location,
                   Color color)
Creates a column guide at the specified location (in columns by default) using the specified color.

Parameters:
location - the location of the column guide.
color - the color of the column guide.

ColumnGuide

public ColumnGuide(int location,
                   int unit,
                   Color color)
Creates a column guide at the specified location, using the specified color. You can specify either in columns or in pixels.

Parameters:
location - the location of the column guide.
unit - the unit of the location.
color - the color of the column guide.
Method Detail

getLocation

public int getLocation()
Gets the location of the column guide.

Returns:
the location of the column guide.

setLocation

public void setLocation(int location)
Sets the location of the column guide. It could be either the number of columns or the pixels, depending on the value of getUnit().

Parameters:
location - the location of the column guide.

getUnit

public int getUnit()
Gets the unit. The valid values are either UNIT_IN_COLUMNS (default) or UNIT_IN_PIXELS.

Returns:
the unit.

setUnit

public void setUnit(int unit)
Sets the unit. The valid values are either UNIT_IN_COLUMNS (default) or UNIT_IN_PIXELS.

Parameters:
unit - the unit.

getColor

public Color getColor()
Gets the color.

Returns:
the color of the column guide line.

setColor

public void setColor(Color color)
Sets the color of the column guide line.

Parameters:
color - the color of the column guide line.

getStroke

public Stroke getStroke()
Gets the stroke of the column guide line.

Returns:
the stroke of the column guide line.

setStroke

public void setStroke(Stroke stroke)
Sets the stroke of the column guide line.

Parameters:
stroke - the stroke of the column guide line.

paint

public void paint(CodeEditor codeEditor,
                  Graphics g,
                  Rectangle rect)
Paints the column guide.

Parameters:
codeEditor - the code editor where the column guide is added.
g - the graphics context
rect - the clip rect.

JIDE 3.5.15