CellView

Implements: tracker.Observable

A themeable cell view for list or collection display with interactive features.

CellView provides a rich set of features for displaying items in collections:

  • Title and subtitle text display with automatic truncation
  • Selection state with visual feedback
  • Optional icons for kind/type indication
  • Action buttons for lock, duplicate, and delete operations
  • Drag and drop support with visual feedback and auto-scrolling
  • Hover states and smooth transitions
  • Theme-aware styling with light/dark mode support
  • Input style mode for form-like appearance

The view is commonly used within CellCollectionView for displaying lists of items with consistent styling and behavior.

Example usage:

var cell = new CellView();
cell.title = "Item Name";
cell.subTitle = "Description";
cell.kindIcon = Entypo.DOC_TEXT;
cell.handleTrash = () -> deleteItem();
cell.bindDragDrop(click, handleReorder);

Instance Members

elements
observedDirty: Bool

Default is false, automatically set to true when any of this instance's observable variables has changed.


elements
theme: Theme

The theme to use for styling. If null, uses the global context theme.


elements
selected: Bool

Whether this cell is currently selected. Selected cells display with accent colors and borders.


elements
title: String

The main title text to display in the cell. Text is automatically truncated if it exceeds the available width.


elements
subTitle: String

The subtitle text displayed below the title. Rendered in italic style with smaller font size. Text is automatically truncated if it exceeds the available width.


elements
itemIndex: Int

The index of this cell within its parent collection. Used for drag and drop reordering operations. Setting a new index resets the hover state.


elements
collectionView: CellCollectionView

Reference to the parent collection view containing this cell. Used to check scrolling state for hover behavior.


elements
inputStyle: Bool

When true, applies input-style theming with lighter appearance. Used for cells that represent form inputs or editable fields.


elements
displaysEmptyValue: Bool

When true in input style, displays the title with italic skew to indicate an empty or placeholder value.


elements
locked: Bool

Whether this cell represents a locked/protected item. Locked cells display with a darker background and lock icon.


elements
kindIcon: Null<Entypo>

Optional icon to display on the left side indicating the item type. Uses the Entypo icon set.


elements
dragging: Bool

Whether this cell is currently being dragged. Read-only property updated during drag operations.


elements
invalidateTheme(): Void

elements
invalidateSelected(): Void

elements
invalidateTitle(): Void

elements
invalidateSubTitle(): Void

elements
invalidateItemIndex(): Void

elements
invalidateCollectionView(): Void

elements
invalidateInputStyle(): Void

elements
invalidateDisplaysEmptyValue(): Void

elements
invalidateLocked(): Void

elements
invalidateKindIcon(): Void

elements
invalidateHandleTrash(): Void

elements
handleTrash(): Void

Callback invoked when the trash/delete button is clicked. If null, the trash button is not displayed.


elements
invalidateHandleLock(): Void

elements
handleLock(): Void

Callback invoked when the lock/unlock button is clicked. If null, the lock button is not displayed.


elements
invalidateHandleDuplicate(): Void

elements
handleDuplicate(): Void

Callback invoked when the duplicate button is clicked. If null, the duplicate button is not displayed.


elements
invalidateDragging(): Void

elements
invalidateClonedForDragging(): Void

elements
invalidateHover(): Void

elements
invalidateAppliedHoverItemIndex(): Void

elements
bindDragDrop(?click: ceramic.Click, handleDrop: Function): Void

Enables drag and drop functionality for this cell.

Name Type Default Description
click ceramic.Click (optional) Optional click component to use for drag detection
handleDrop Function Callback invoked when the cell is dropped at a new position Receives the target itemIndex where the cell should be moved

elements
unbindDragDrop(): Void

Disables drag and drop functionality for this cell. Cleans up drag handlers and resets dragging state.


elements
new(): Void

Creates a new CellView instance.

Initializes the cell with:

  • Column layout for title and subtitle
  • Text views with appropriate styling
  • Border configuration
  • Event handlers for hover states
  • Auto-updating style based on theme and state

Private Members

elements
unobservedTheme: Theme

elements
unobservedSelected: Bool

elements
unobservedTitle: String

elements
unobservedSubTitle: String

elements
unobservedItemIndex: Int

elements
unobservedCollectionView: CellCollectionView

elements
unobservedInputStyle: Bool

elements
unobservedDisplaysEmptyValue: Bool

elements
unobservedLocked: Bool

elements
unobservedKindIcon: Null<Entypo>

elements
unobservedDragging: Bool

elements
titleTextView: ceramic.TextView

elements
subTitleTextView: ceramic.TextView

elements
columnLayout: ceramic.ColumnLayout

elements
iconsView: ceramic.RowLayout

elements
dragTargetTy: Float

elements
dragDrop: DragDrop

elements
dragAutoScroll: Float

elements
dragStartScrollY: Float

elements
draggingCellDragY: Float

elements
draggingCell: CellView

elements
dragOnItemIndex: Int

elements
clonedForDragging: Bool

elements
unobservedClonedForDragging: Bool

elements
hover: Bool

elements
unobservedHover: Bool

elements
appliedHoverItemIndex: Int

elements
unobservedAppliedHoverItemIndex: Int

elements
emitObservedDirty(instance: CellView, fromSerializedField: Bool): Void

Event when any observable value as changed on this instance.

Name Type
instance CellView
fromSerializedField Bool

elements
emitThemeChange(current: Theme, previous: Theme): Void

Event when theme field changes.

Name Type
current Theme
previous Theme

elements
emitSelectedChange(current: Bool, previous: Bool): Void

Event when selected field changes.

Name Type
current Bool
previous Bool

elements
emitTitleChange(current: String, previous: String): Void

Event when title field changes.

Name Type
current String
previous String

elements
emitSubTitleChange(current: String, previous: String): Void

Event when subTitle field changes.

Name Type
current String
previous String

elements
emitItemIndexChange(current: Int, previous: Int): Void

Event when itemIndex field changes.

Name Type
current Int
previous Int

elements
emitCollectionViewChange(current: CellCollectionView, previous: CellCollectionView): Void

Event when collectionView field changes.

Name Type
current CellCollectionView
previous CellCollectionView

elements
emitInputStyleChange(current: Bool, previous: Bool): Void

Event when inputStyle field changes.

Name Type
current Bool
previous Bool

elements
emitDisplaysEmptyValueChange(current: Bool, previous: Bool): Void

Event when displaysEmptyValue field changes.

Name Type
current Bool
previous Bool

elements
emitLockedChange(current: Bool, previous: Bool): Void

Event when locked field changes.

Name Type
current Bool
previous Bool

elements
emitKindIconChange(current: Null<Entypo>, previous: Null<Entypo>): Void

Event when kindIcon field changes.

Name Type
current Null<Entypo>
previous Null<Entypo>

elements
unobservedHandleTrash(): Void

elements
emitHandleTrashChange(current: Function, previous: Function): Void

Event when handleTrash field changes.

Name Type
current Function
previous Function

elements
unobservedHandleLock(): Void

elements
emitHandleLockChange(current: Function, previous: Function): Void

Event when handleLock field changes.

Name Type
current Function
previous Function

elements
unobservedHandleDuplicate(): Void

elements
emitHandleDuplicateChange(current: Function, previous: Function): Void

Event when handleDuplicate field changes.

Name Type
current Function
previous Function

elements
emitDraggingChange(current: Bool, previous: Bool): Void

Event when dragging field changes.

Name Type
current Bool
previous Bool

elements
clearScrollDelay(): Void

elements
emitClonedForDraggingChange(current: Bool, previous: Bool): Void

Event when clonedForDragging field changes.

Name Type
current Bool
previous Bool

elements
emitHoverChange(current: Bool, previous: Bool): Void

Event when hover field changes.

Name Type
current Bool
previous Bool

elements
emitAppliedHoverItemIndexChange(current: Int, previous: Int): Void

Event when appliedHoverItemIndex field changes.

Name Type
current Int
previous Int

elements
updateTitle(): Void

Updates the title text view based on the current title property. Hides the text view when title is null.


elements
updateSubTitle(): Void

Updates the subtitle text view based on the current subTitle property. Hides the text view when subTitle is null.


elements
layoutTitle(): Void

Clips the title text to fit within the available width. Called during layout to prevent text overflow.


elements
layoutSubTitle(): Void

Clips the subtitle text to fit within the available width. Called during layout to prevent text overflow.


elements
updateIcons(): Void

Updates the icon layout based on current icon properties. Creates icon buttons for trash, lock, duplicate, and kind icon as needed. Adjusts text padding when a kind icon is present.


elements
updateStyle(): Void

Updates all visual styling based on current state and theme.

Handles different visual states:

  • Selected: Accent colors and borders
  • Locked: Darker background with muted text
  • Hover: Light background (when not scrolling)
  • Input style: Different padding and border configuration
  • Empty value: Italic skewed text

elements
cloneForDragDrop(): CellView

Creates a visual clone of this cell for drag visualization. The clone has all the same properties but is marked as a dragging clone.

Returns Description
CellView A new CellView with identical appearance

elements
createDraggingVisual(): ceramic.Visual
Returns
ceramic.Visual

elements
releaseDraggingVisual(visual: ceramic.Visual): Void
Name Type
visual ceramic.Visual

elements
firstEnabledParentScroller(): ceramic.Scroller

Finds the first parent scroller that has scrolling enabled. Used for auto-scrolling during drag operations.

Returns Description
ceramic.Scroller The nearest enabled parent Scroller, or null if none found

elements
handleDragChange(dragging: Bool, wasDragging: Bool): Void
Name Type
dragging Bool
wasDragging Bool

elements
updateFromDrag(): Void

Updates the drag visualization and other cells based on drag position. Handles:

  • Moving the dragged cell visual
  • Calculating which cells should shift position
  • Determining auto-scroll needs when near container edges

elements
updateOtherCellsFromDrag(): Void

Updates the positions of other cells in response to dragging. Cells shift up or down with smooth transitions based on the dragged cell's position relative to their centers.


elements
scrollFromDragIfNeeded(delta: Float): Void

Performs auto-scrolling when dragging near container edges. Called every frame during drag operations.

Name Type Description
delta Float Time elapsed since last frame

Metadata

Name Parameters
:build tracker.macros.ObservableMacro.build()
:autoBuild tracker.macros.ObservableMacro.build()
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()