Liking cljdoc? Tell your friends :D

seesaw.table


clear!clj

(clear! target)

Clear all rows from a table model or JTable.

Returns target.

Clear all rows from a table model or JTable.

Returns target.
sourceraw docstring

column-countclj

(column-count target)

Return number of columns in a table model or JTable.

Return number of columns in a table model or JTable.
sourceraw docstring

insert-at!clj

(insert-at! target row value)
(insert-at! target row value & more)

Inserts one or more rows into a table. The arguments are one or more row-index/value pairs where value is either a map or a vector with the right number of columns. Each row index indicates the position before which the new row will be inserted. All indices are relative to the starting state of the table, i.e. they shouldn't take any shifting of rows that takes place during the insert. The indices must be in ascending sorted order!!

Returns target.

Examples:

; Insert a row at the front of the table (insert-at! 0 {:name "Agent Cooper" :likes "Cherry pie and coffee"})

; Insert two rows, one at the front, one before row 3 (insert-at! 0 {:name "Agent Cooper" :likes "Cherry pie and coffee"} 3 {:name "Big Ed" :likes "Norma"})

Inserts one or more rows into a table. The arguments are one or more row-index/value
pairs where value is either a map or a vector with the right number of columns. Each
row index indicates the position before which the new row will be inserted. All indices
are relative to the starting state of the table, i.e. they shouldn't take any shifting
of rows that takes place during the insert. The indices *must* be in ascending sorted
order!!

Returns target.

Examples:

  ; Insert a row at the front of the table
  (insert-at! 0 {:name "Agent Cooper" :likes "Cherry pie and coffee"})

  ; Insert two rows, one at the front, one before row 3
  (insert-at! 0 {:name "Agent Cooper" :likes "Cherry pie and coffee"}
              3 {:name "Big Ed"       :likes "Norma"})

sourceraw docstring

remove-at!clj

(remove-at! target row)
(remove-at! target row & more)

Remove one or more rows from a table or table model by index. Args are a list of row indices at the start of the operation. The indices must be in ascending sorted order!

Returns target.

Examples:

; Remove first row (remove-at! t 0)

; Remove first and third row (remove-at! t 0 3)

Remove one or more rows from a table or table model by index. Args are a list of row indices at
the start of the operation. The indices *must* be in ascending sorted order!

Returns target.

Examples:

  ; Remove first row
  (remove-at! t 0)

  ; Remove first and third row
  (remove-at! t 0 3)
sourceraw docstring

row-countclj

(row-count target)

Return number of rows in a table model or JTable.

Return number of rows in a table model or JTable.
sourceraw docstring

table-modelclj

(table-model & {:keys [columns rows] :as opts})

Creates a TableModel from column and row data. Takes two options:

:columns - a list of keys, or maps. If a key, then (name key) is used as the column name. If a map, it can be in the form {:key key :text text :class class} where key is use to index the row data, text (optional) is used as the column name, and class (optional) specifies the object class of the column data returned by getColumnClass. The order establishes the order of the columns in the table.

:rows - a sequence of maps or vectors, possibly mixed. If a map, must contain row data indexed by keys in :columns. Any additional keys will be remembered and retrievable with (value-at). If a vector, data is indexed by position in the vector.

Example:

(table-model :columns [:name {:key :age :text "Age" :class java.lang.Integer}] :rows [ ["Jim" 65] {:age 75 :name "Doris"}])

This creates a two column table model with columns "name" and "Age" and two rows.

See: (seesaw.core/table) http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableModel.html

Creates a TableModel from column and row data. Takes two options:

  :columns - a list of keys, or maps. If a key, then (name key) is used as the 
             column name. If a map, it can be in the form 
             {:key key :text text :class class} where key is use to index the 
             row data, text (optional) is used as the column name, and 
             class (optional) specifies the object class of the column data
             returned by getColumnClass. The order establishes the order of the
             columns in the table.

  :rows - a sequence of maps or vectors, possibly mixed. If a map, must contain
          row data indexed by keys in :columns. Any additional keys will
          be remembered and retrievable with (value-at). If a vector, data
          is indexed by position in the vector.

Example:

  (table-model :columns [:name
                         {:key :age :text "Age" :class java.lang.Integer}]
               :rows [ ["Jim" 65]
                       {:age 75 :name "Doris"}])

  This creates a two column table model with columns "name" and "Age"
  and two rows.

See:
  (seesaw.core/table)
  http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableModel.html
sourceraw docstring

update-at!clj

(update-at! target row value)
(update-at! target row value & more)

Update a row in a table model or JTable. Accepts an arbitrary number of row/value pairs where row is an integer row index and value is a map or vector of values just like the :rows property of (table-model).

Notes:

Any non-column keys, i.e. keys that weren't present in the original column spec when the table-model was constructed will be remembered and retrievable later with (value-at).

Examples:

; Given a table created with column keys :a and :b, update row 3 and 5 (update-at! t 3 ["Col0 Value" "Col1 Value"] 5 { :a "A value" "B value" })

See: (seesaw.core/table) (seesaw.table/table-model) http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableModel.html

Update a row in a table model or JTable. Accepts an arbitrary number of row/value
pairs where row is an integer row index and value is a map or vector of values
just like the :rows property of (table-model).

Notes:

  Any non-column keys, i.e. keys that weren't present in the original column
  spec when the table-model was constructed will be remembered and retrievable
  later with (value-at).

Examples:

  ; Given a table created with column keys :a and :b, update row 3 and 5
  (update-at! t 3 ["Col0 Value" "Col1 Value"]
                5 { :a "A value" "B value" })

See:
  (seesaw.core/table)
  (seesaw.table/table-model)
  http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableModel.html
sourceraw docstring

value-atclj

(value-at target rows)

Retrieve one or more rows from a table or table model. target is a JTable or TableModel. rows is either a single integer row index, or a sequence of row indices. In the first case a single map of row values is returns. Otherwise, returns a sequence of maps.

If a row index is out of bounds, returns nil.

Notes:

If target was not created with (table-model), the returned map(s) are indexed by column name.

Any non-column keys passed to (update-at!) or the initial rows of (table-model) are remembered and returned in the map.

Examples:

; Retrieve row 3 (value-at t 3)

; Retrieve rows 1, 3, and 5 (value-at t [1 3 5])

; Print values of selected rows (listen t :selection (fn [e] (println (value-at t (selection t {:multi? true}))))) See: (seesaw.core/table) (seesaw.table/table-model) http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableModel.html

Retrieve one or more rows from a table or table model. target is a JTable or TableModel.
rows is either a single integer row index, or a sequence of row indices. In the first case
a single map of row values is returns. Otherwise, returns a sequence of maps.

If a row index is out of bounds, returns nil.

Notes:

If target was not created with (table-model), the returned map(s) are indexed
by column name.

Any non-column keys passed to (update-at!) or the initial rows of (table-model)
are *remembered* and returned in the map.

Examples:

  ; Retrieve row 3
  (value-at t 3)

  ; Retrieve rows 1, 3, and 5
  (value-at t [1 3 5])

  ; Print values of selected rows
  (listen t :selection
    (fn [e]
      (println (value-at t (selection t {:multi? true})))))
See:
  (seesaw.core/table)
  (seesaw.table/table-model)
  http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableModel.html
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close