Package edu.cnu.mdi.item
Interface ITextEditable
- All Known Implementing Classes:
MapTextItem,TextItem
public interface ITextEditable
Marks an item as having editable text content, font, and style — the minimal
contract required by
TextEditDialog.
Purpose
TextEditDialog was originally written to accept a concrete
TextItem. Introducing this interface breaks that dependency so the
dialog can operate on any text-bearing item — in particular both
TextItem (world-space anchor) and
MapTextItem (geographic anchor) — without
knowing about either class.
Implementing classes
Any item that can be edited by TextEditDialog should implement this
interface. Typically that means declaring implements ITextEditable on
the class; the six methods are usually already present.
Method contract
getText()/setText(String)— the full text content as a single string with embedded newlines for multi-line text.getFont()/setFont(Font)— the display font. PassingnulltosetFontshould restore a sensible default.getStyle()/setStyle(IStyled)— the fill, line, and text colors (and any other style attributes) for this item.
-
Method Details
-
getText
String getText()Returns the current text content.Multi-line text is represented with embedded
'\n'characters. Implementations must never returnnull; an empty string is the correct representation of no content.- Returns:
- the text; never
null
-
setText
Replaces the text content.- Parameters:
text- the new text; implementations should treatnullas an empty string
-
getFont
Font getFont()Returns the current display font.- Returns:
- the font; must not be
nullin a correctly initialised item
-
setFont
Sets the display font.- Parameters:
font- the new font; passingnullshould restore the implementation's default font
-
getStyle
IStyled getStyle()Returns the current style (colors, line style, etc.).- Returns:
- the style; may be
nullon a partially constructed or disposed item, but must not benullduring normal use
-
setStyle
Replaces the current style.- Parameters:
style- the new style;nullis accepted but may cause rendering errors unlessgetStyleSafe()is used subsequently
-