|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tigris.gef.presentation.Fig
org.tigris.gef.presentation.FigText
public class FigText
This class handles painting and editing text Fig's in a LayerDiagram. Needs-More-Work: should eventually allow styled text editing, ... someday...
| Field Summary | |
|---|---|
static int |
JUSTIFY_CENTER
|
static int |
JUSTIFY_LEFT
Constants to specify text justification. |
static int |
JUSTIFY_RIGHT
|
static int |
MIN_TEXT_WIDTH
Minimum size of a FigText object. |
| Fields inherited from class org.tigris.gef.presentation.Fig |
|---|
_allowsSaving, _context, _dashes, _dashPeriod, _dashStyle, _filled, _h, _w, _x, _y, an, annotationOwner, annotationStatus, BORDER, MIN_SIZE |
| Constructor Summary | |
|---|---|
FigText(int x,
int y,
int w,
int h)
Construct a new FigText with the given position and size |
|
FigText(int x,
int y,
int w,
int h,
boolean expandOnly)
Construct a new FigText with the given position, size, and attributes. |
|
FigText(int x,
int y,
int w,
int h,
java.awt.Color textColor,
java.awt.Font font)
|
|
FigText(int x,
int y,
int w,
int h,
java.awt.Color textColor,
java.lang.String familyName,
int fontSize)
|
|
FigText(int x,
int y,
int w,
int h,
java.awt.Color textColor,
java.lang.String familyName,
int fontSize,
boolean expandOnly)
Construct a new FigText with the given position, size, color, string, font, and font size. |
|
| Method Summary | |
|---|---|
void |
append(char c)
Append a character to the current String . |
void |
append(java.lang.String s)
Append the given String to the current String. |
void |
calcBounds()
Compute the overall width and height of the FigText object based on the font, font size, and current text. |
void |
deleteLastChar()
Delete the last char from the current string. |
java.lang.String |
deleteLastCharFromString(java.lang.String s)
Remove the last char from the current string line and return the new string. |
protected void |
drawString(java.awt.Graphics graphics,
java.lang.String curLine,
int xPos,
int yPos)
Draws the given string starting at the given position. |
boolean |
getAllowsTab()
|
boolean |
getBold()
|
int |
getBotMargin()
|
boolean |
getEditable()
|
boolean |
getExpandOnly()
|
java.awt.Font |
getFont()
|
java.lang.String |
getFontFamily()
USED BY PGML.tee |
int |
getFontSize()
USED BY PGML.tee |
boolean |
getItalic()
|
int |
getJustification()
|
java.lang.String |
getJustificationByName()
Reply a string that indicates how the text is justified: Left, Center, or Right. |
int |
getLeftMargin()
|
int |
getLineSpacing()
|
int |
getMinimumHeight()
|
java.awt.Dimension |
getMinimumSize()
Returns the minimum size of the Fig. |
boolean |
getMultiLine()
|
int |
getRightMargin()
|
java.lang.String |
getText()
Get the String held by this FigText. |
int |
getTextBounds(java.awt.Graphics graphics)
|
java.awt.Color |
getTextColor()
|
java.lang.Class |
getTextEditorClass()
|
java.awt.Color |
getTextFillColor()
|
boolean |
getTextFilled()
|
int |
getTopMargin()
|
boolean |
getUnderline()
|
boolean |
hit(java.awt.Rectangle r)
Muse clicks are handled differentlty that the defi]ault Fig behavior so that it is easier to select text that is not filled. |
protected boolean |
isStartEditingKey(java.awt.event.KeyEvent ke)
|
void |
keyPressed(java.awt.event.KeyEvent ke)
This method handles backspace and enter. |
void |
keyReleased(java.awt.event.KeyEvent ke)
Not used, does nothing. |
void |
keyTyped(java.awt.event.KeyEvent ke)
When the user presses a key when a FigText is selected, that key should be added to the current string, or if the key was backspace, the last character is removed. |
void |
mouseClicked(java.awt.event.MouseEvent me)
|
void |
mouseEntered(java.awt.event.MouseEvent me)
|
void |
mouseExited(java.awt.event.MouseEvent me)
|
void |
mousePressed(java.awt.event.MouseEvent me)
|
void |
mouseReleased(java.awt.event.MouseEvent me)
|
boolean |
OK()
Check the class invariant to make sure that this FigText is in a valid state. |
void |
paint(java.awt.Graphics g)
Paint the FigText. |
void |
setAllowsTab(boolean b)
|
void |
setBold(boolean b)
|
void |
setBotMargin(int m)
|
void |
setEditable(boolean e)
|
void |
setExpandOnly(boolean b)
|
void |
setFont(java.awt.Font f)
|
void |
setFontFamily(java.lang.String familyName)
USED BY PGML.tee |
void |
setFontSize(int size)
USED BY PGML.tee |
void |
setItalic(boolean b)
|
void |
setJustification(int align)
|
void |
setJustificationByName(java.lang.String justifyString)
Set the text justification given one of these strings: Left, Center, or Right. |
void |
setLeftMargin(int m)
|
void |
setLineSpacing(int s)
|
void |
setMultiLine(boolean b)
|
void |
setRightMargin(int m)
|
void |
setText(java.lang.String s)
Sets the given string to the current string of this fig. |
void |
setText(java.lang.String str,
java.awt.Graphics graphics)
Set the give string to be the current string of this fig. |
void |
setTextColor(java.awt.Color c)
|
void |
setTextEditorClass(java.lang.Class editorClass)
|
void |
setTextFillColor(java.awt.Color c)
|
void |
setTextFilled(boolean b)
|
void |
setTopMargin(int m)
|
void |
setUnderline(boolean b)
|
FigTextEditor |
startTextEditor(java.awt.event.InputEvent ie)
|
void |
stuffMinimumSize(java.awt.Dimension d)
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int JUSTIFY_LEFT
public static final int JUSTIFY_RIGHT
public static final int JUSTIFY_CENTER
public static final int MIN_TEXT_WIDTH
| Constructor Detail |
|---|
public FigText(int x,
int y,
int w,
int h,
java.awt.Color textColor,
java.lang.String familyName,
int fontSize,
boolean expandOnly)
public FigText(int x,
int y,
int w,
int h,
java.awt.Color textColor,
java.lang.String familyName,
int fontSize)
public FigText(int x,
int y,
int w,
int h,
java.awt.Color textColor,
java.awt.Font font)
public FigText(int x,
int y,
int w,
int h)
public FigText(int x,
int y,
int w,
int h,
boolean expandOnly)
| Method Detail |
|---|
public boolean OK()
OK in class Figpublic java.lang.String getJustificationByName()
public void setJustificationByName(java.lang.String justifyString)
public java.awt.Color getTextColor()
public void setTextColor(java.awt.Color c)
public java.awt.Color getTextFillColor()
public void setTextFillColor(java.awt.Color c)
public boolean getTextFilled()
public void setTextFilled(boolean b)
public boolean getEditable()
public void setEditable(boolean e)
public boolean getUnderline()
public void setUnderline(boolean b)
public int getJustification()
public void setJustification(int align)
public int getLineSpacing()
public void setLineSpacing(int s)
public int getTopMargin()
public void setTopMargin(int m)
public int getBotMargin()
public void setBotMargin(int m)
public int getLeftMargin()
public void setLeftMargin(int m)
public int getRightMargin()
public void setRightMargin(int m)
public boolean getExpandOnly()
public void setExpandOnly(boolean b)
public java.awt.Font getFont()
public void setFont(java.awt.Font f)
public java.lang.String getFontFamily()
public void setFontFamily(java.lang.String familyName)
public int getFontSize()
public void setFontSize(int size)
public boolean getItalic()
public void setItalic(boolean b)
public boolean getBold()
public void setBold(boolean b)
public void setMultiLine(boolean b)
public boolean getMultiLine()
public void setAllowsTab(boolean b)
public boolean getAllowsTab()
public java.lang.String deleteLastCharFromString(java.lang.String s)
public void deleteLastChar()
public void append(char c)
public void append(java.lang.String s)
public void setText(java.lang.String str,
java.awt.Graphics graphics)
str - String to be set at this object.graphics - Graphics context for the operation.public void setText(java.lang.String s)
s - public java.lang.String getText()
public java.lang.Class getTextEditorClass()
public void setTextEditorClass(java.lang.Class editorClass)
public void paint(java.awt.Graphics g)
paint in class Fig
protected void drawString(java.awt.Graphics graphics,
java.lang.String curLine,
int xPos,
int yPos)
graphics - Graphic context for drawing the string.curLine - The current text to be drawn.xPos - X-Coordinate of the starting point.yPos - Y-Coordinate of the starting point.public boolean hit(java.awt.Rectangle r)
hit in class Figr - the rectangular hit area
public int getMinimumHeight()
public int getTextBounds(java.awt.Graphics graphics)
public java.awt.Dimension getMinimumSize()
Fig
getMinimumSize in class Figpublic void stuffMinimumSize(java.awt.Dimension d)
public void keyTyped(java.awt.event.KeyEvent ke)
keyTyped in interface java.awt.event.KeyListenerpublic void keyPressed(java.awt.event.KeyEvent ke)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent ke)
keyReleased in interface java.awt.event.KeyListenerprotected boolean isStartEditingKey(java.awt.event.KeyEvent ke)
public void mouseClicked(java.awt.event.MouseEvent me)
mouseClicked in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent me)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent me)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent me)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent me)
mouseExited in interface java.awt.event.MouseListenerpublic FigTextEditor startTextEditor(java.awt.event.InputEvent ie)
public void calcBounds()
calcBounds in class FigcalcBounds()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||