|
java-gnome version 4.0.19 | ||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.freedesktop.bindings.Pointer
org.freedesktop.bindings.Proxy
org.gnome.glib.Object
org.gnome.gtk.Object
org.gnome.gtk.CellRenderer
org.gnome.gtk.CellRendererText
public class CellRendererText
Render textual data into a TreeViewColumn. This is the most commonly used
CellRenderer, used to present Strings. The fundamental mapping method is
setText()
which you use to indicate the
particular DataColumnString from the underlying TreeModel which will
provide the Strings.
CellRendererTexts are also frequently used to present numerical data when
it is desired to apply formatting to that data (converting it to a String
in the process) before rendering it. If you do that, you'll probably want
to use a second (numerically typed) DataColumn to indicate the appropriate
sorting order to be applied if that TreeViewColumn is clicked and sorting
is turned on for it; see setSortColumn()
.
Nested Class Summary | |
---|---|
static interface |
CellRendererText.Edited
Event generated after user activated a cell, changed its content and pressed Return. |
Nested classes/interfaces inherited from class org.gnome.gtk.Object |
---|
Object.Destroy |
Constructor Summary | |
---|---|
CellRendererText(CellLayout vertical)
Construct a new CellRendererText. |
Method Summary | |
---|---|
void |
connect(CellRendererText.Edited handler)
Hook up a handler to receive "edited" events on this CellRenderer. |
EllipsizeMode |
getEllipsizeMode()
Get the current ellipsization used. |
void |
setEditable(boolean editable)
Indicate if the contents rendered by this CellRenderer should be editable. |
void |
setEditable(DataColumnBoolean column)
Indicate the DataColumn containing the information whether the cell should be editable or not. |
void |
setEllipsize(EllipsizeMode setting)
Set the ellipsization mode to use to make the
text fits the cell width. |
void |
setForeground(DataColumnString column)
Indicate the DataColumn containing the name of the foreground colour to used when rendering text. |
void |
setMarkup(DataColumnString column)
Indicate the DataColumn containing Pango markup to render as text. |
void |
setText(DataColumnString column)
Indicate the DataColumn containing the plain text to render. |
Methods inherited from class org.gnome.gtk.CellRenderer |
---|
setAlignment, setBackground, setBackground, setVisible |
Methods inherited from class org.gnome.gtk.Object |
---|
connect, destroy |
Methods inherited from class org.freedesktop.bindings.Pointer |
---|
toString |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CellRendererText(CellLayout vertical)
Method Detail |
---|
public void connect(CellRendererText.Edited handler)
final DataColumnString column; final TreeView view; final ListStore store; final TreeViewColumn visibleColumn store = new ListStore(new DataColumn[]{ column = new DataColumnString() }); view = new TreeView(store); visibleColumn = view.appendColumn(); CellRendererText renderer = new CellRendererText(visibleColumn); renderer.setText(column); renderer.setEditable(true); renderer.connect(new CellRendererText.Edited(){ public void onEdited(CellRendererText source, TreePath path, String text) { System.out.println("New value for path " + path + " is " + text); TreeIter row = store.getIter(path); store.setValue(row, column, text); }});
public EllipsizeMode getEllipsizeMode()
public void setEditable(boolean editable)
public void setEditable(DataColumnBoolean column)
public void setEllipsize(EllipsizeMode setting)
ellipsization mode
to use to make the
text fits the cell width.
public void setForeground(DataColumnString column)
public void setMarkup(DataColumnString column)
The String in the DataColumn being rendered will be interpreted as containing markup in Pango's text markup language. Using this allows you to make very expressive presentations within TreeView cells.
Using this (instead of setText()
)
has the same effect as using a Label with
setUseMarkup(true)
in normal
layouts.
public void setText(DataColumnString column)
If you want to use Pango markup to format the text being rendered, call
setMarkup()
instead.
|
![]() java-gnome |
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |