Class: Clevic::TextAreaDelegate

Inherits:
Delegate show all
Defined in:
lib/clevic/swing/text_area_delegate.rb

Instance Attribute Summary

Attributes inherited from Delegate

#entity, #field, #parent

Instance Method Summary collapse

Methods inherited from Delegate

#attribute, #editorEvent, #entity_class, #full_edit, #initialize, #inspect, #is_combo?, #native, #show_message, #updateEditorGeometry

Methods included from FieldValuer

#attribute_value, #attribute_value=, #display_value, #edit_value, #edit_value=, #find_related, #raw_value, #text_value=, #tooltip, valuer, #valuer, #writer

Constructor Details

This class inherits a constructor from Clevic::Delegate

Instance Method Details

#editorObject



25
26
27
# File 'lib/clevic/swing/text_area_delegate.rb', line 25

def editor
  @editor ||= EditorScrollPane.new( text_component, javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS )
end

#init_component(cell_editor) ⇒ Object

TODO check that Ctrl-VK_ENTER stops editing



18
19
20
21
22
23
# File 'lib/clevic/swing/text_area_delegate.rb', line 18

def init_component( cell_editor )
  @cell_editor = cell_editor
  text_component.text = edit_value
  text_component.rows = ( edit_value.andand.count( "\n" ) || 0 ) + 2
  text_component.select_all
end

#minimal_editObject



37
38
39
# File 'lib/clevic/swing/text_area_delegate.rb', line 37

def minimal_edit
  text_component.select_all
end

#needs_pre_selection?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/clevic/swing/text_area_delegate.rb', line 41

def needs_pre_selection?
  true
end

#text_componentObject



29
30
31
# File 'lib/clevic/swing/text_area_delegate.rb', line 29

def text_component
  @text_component ||= javax.swing.JTextArea.new
end

#valueObject



33
34
35
# File 'lib/clevic/swing/text_area_delegate.rb', line 33

def value
  text_component.text
end