java-gnome version 4.0.19

org.gnome.gtk
Class TreeViewColumn

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.freedesktop.bindings.Proxy
          extended by org.gnome.glib.Object
              extended by org.gnome.gtk.Object
                  extended by org.gnome.gtk.TreeViewColumn
All Implemented Interfaces:
CellLayout

public class TreeViewColumn
extends Object
implements CellLayout

A vertical visible column as presented in a TreeView Widget. A TreeViewColumn's primary role is to connect one or more CellRenderers to a vertical position in the tabular layout of a TreeView and then to assign which attributes of that CellRenderer are powered by what rows from the data TreeModel that will underlie the TreeView.

You get a TreeViewColumn by calling TreeView's appendColumn().

Since:
4.0.5
Author:
Andrew Cowie, Stefan Prelle

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gnome.gtk.Object
Object.Destroy
 
Method Summary
 void emitClicked()
          Activate this column's sorting by sending a click the TreeViewColumn header.
 String getTitle()
          Gets the title of this TreeViewColumn.
 boolean getVisible()
          Returns whether the TreeViewColumn is visible or not.
 Widget getWidget()
          Returns the Widget in the button on the column header.
 void setAlignment(float xalign)
          Set the horizontal alignment of the title (or custom Widget) within the header of this TreeViewColumn.
 void setClickable(boolean setting)
          Set whether the column header allows itself to be clicked.
 void setExpand(boolean setting)
          Set whether this TreeViewColumn will share in additional space available to the parent TreeView.
 void setFixedWidth(int width)
          If (and only if) operating with the FIXED TreeViewSizing mode, this defines the fixed column width in pixels.
 void setMaxWidth(int width)
          Sets the maximum width this column can grow.
 void setMinWidth(int width)
          Sets the minimal width this column can shrink to.
 void setReorderable(boolean setting)
          Permit the user to change the order of the columns in a TreeView by clicking on one of the column headers and dragging it to a new position.
 void setResizable(boolean setting)
          Permit the user to change the width of the columns in a TreeView by clicking on the boundary of a column header and dragging it.
 void setSizing(TreeViewColumnSizing type)
          Set the mode constant that will be used to determine the width behaviour of TreeViewColumns when data is changed in the model causing a CellRenderer to need to redraw a cell.
 void setSortColumn(DataColumn column)
          Set the DataColumn that will be used to sort this TreeViewColumn should sorting be enabled.
 void setTitle(String title)
          Set the title to be used for this TreeViewColumn in the TreeView's header row.
 void setVisible(boolean visible)
          Sets the visibility of the TreeViewColumn.
 void setWidget(Widget widget)
          Sets the widget in the header to be widget.
 
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
 

Method Detail

emitClicked

public void emitClicked()
Activate this column's sorting by sending a click the TreeViewColumn header. Causes TreeViewColumn.Clicked to fire, but more importantly this causes this vertical to become the active column dictating the ordering of the TreeView as a whole (assuming the vertical is setClickable(true) and assuming a DataColumn has been set with setSortColumn() to indicate the ordering).

Since:
4.0.8

getTitle

public String getTitle()
Gets the title of this TreeViewColumn. Please see setTitle() for further information about TreeViewColumn titles.

Since:
4.0.8

getVisible

public boolean getVisible()
Returns whether the TreeViewColumn is visible or not. If it is visible, then the TreeView will show the column.

Since:
4.0.17

getWidget

public Widget getWidget()
Returns the Widget in the button on the column header. If a custom widget has not been set then null is returned.

Since:
4.0.17

setAlignment

public void setAlignment(float xalign)
Set the horizontal alignment of the title (or custom Widget) within the header of this TreeViewColumn.

Parameters:
xalign - As with elsewhere in GTK, a value between 0.0f for left and 1.0f for right alignment. The constants in Alignment may serve.
Since:
4.0.6

setClickable

public void setClickable(boolean setting)
Set whether the column header allows itself to be clicked. The default is false, not to be clickable, also meaning that header won't take the keyboard focus either. Since calling setSortColumn() will set clickable to true, so you only need this for the case where you assign a sort order to a column, but don't want users to be able to change the sorting column or its order.


setExpand

public void setExpand(boolean setting)
Set whether this TreeViewColumn will share in additional space available to the parent TreeView. Like Widgets packed into Containers, ordinarily a TreeViewColumn will be allocated the space it needs but no more, and the TreeView will be the size of the sum of these requests. If the TreeView is allocated space over and above this, however, then this additional space will be given to those TreeViewColumns with this property set to true.

The default for new TreeViewColumns is false. The last (right-most) column is treated specially, however. Extra space given to the TreeView as a whole will automatically go to the last vertical column (ie, ignoring this being set false) unless one or more other columns have had expand set to true.


setFixedWidth

public void setFixedWidth(int width)
If (and only if) operating with the FIXED TreeViewSizing mode, this defines the fixed column width in pixels. If setMinWidth(int) setMinWidth} or setMaxWidth(int) have been called and the fixed width is outside these bounds Min- or MaxWidth take precedence.

The fixed width can be overridden by the user if setResizable() has been set to true.

Parameters:
width - Column width in pixels
Since:
4.0.8

setMaxWidth

public void setMaxWidth(int width)
Sets the maximum width this column can grow. Works in all TreeViewColumnSizing variants. If not set, the column growth is not limited.

Parameters:
width - Column width in pixels
Since:
4.0.8

setMinWidth

public void setMinWidth(int width)
Sets the minimal width this column can shrink to. Works in all TreeViewColumnSizing variants.

Parameters:
width - Column width in pixel
Since:
4.0.8

setReorderable

public void setReorderable(boolean setting)
Permit the user to change the order of the columns in a TreeView by clicking on one of the column headers and dragging it to a new position. This can be useful for wide tables where a great deal of information is being presented and the user might want to have a different subset visible.

Most of the time, however, the order of presentation of the columns is an integral part of your UI and you don't want the user messing with it, which is why the default is false. More than that, people don't much care for horizontal scrolling; if you are presenting so much data that reordering the columns would be necessary, perhaps you should rethink the way you are presenting things.

Since:
4.0.6

setResizable

public void setResizable(boolean setting)
Permit the user to change the width of the columns in a TreeView by clicking on the boundary of a column header and dragging it. Setting this true will implicitly set GROW_ONLY. On the other hand setting AUTOSIZE will implicitly disable resizing.

Since:
4.0.6

setSizing

public void setSizing(TreeViewColumnSizing type)
Set the mode constant that will be used to determine the width behaviour of TreeViewColumns when data is changed in the model causing a CellRenderer to need to redraw a cell. Note that this works in conjunction with other sizing methods (setResizable(), setMinWidth(), setFixedWidth(), etc and there are quite a number of permutations available as a result.

GROW_ONLY is the default.

Since:
4.0.6

setSortColumn

public void setSortColumn(DataColumn column)
Set the DataColumn that will be used to sort this TreeViewColumn should sorting be enabled.

Calling this also makes the TreeViewColumn clickable, but it does not automatically engage the sorting (maybe you only want sorting to be optional and only active if the user clicks a header, certainly if you've set sort information for many columns you will have to indicate explicitly which one is to be active first, etc). Use emitClicked() to activate this column as the one doing the sorting.

Warning:
This only works if the TreeModel being presented by this TreeView is sortable, that is, if that model implements TreeSortable. Since almost everything in GTK does so, you ordinarily don't need to worry about this. The one that doesn't is TreeModelFilter, so if you're using a filtered model make sure you wrap it in a TreeModelSort before adding it to the TreeView.


setTitle

public void setTitle(String title)
Set the title to be used for this TreeViewColumn in the TreeView's header row. In addition to being descriptive, this title is what you click to cause this column to be the one that is sorting the TreeView [assuming you've enabled the columns to be sortable by calling the enclosing TreeView's setHeadersClickable(true) and this TreeViewColumn's setSortColumn(), and that the titles are visible in the first place, ie the header row hasn't been turned off via TreeView's setHeadersVisible(false)].


setVisible

public void setVisible(boolean visible)
Sets the visibility of the TreeViewColumn.


setWidget

public void setWidget(Widget widget)
Sets the widget in the header to be widget. If widget is null, then the header button is set with a Label set to the title of tree_column.

Since:
4.0.17


java-gnome