Module: Origami::Field

Included in:
Annotation::Widget, Subform
Defined in:
lib/origami/acroform.rb

Defined Under Namespace

Modules: Flags, TextAlign, Type Classes: AdditionalActions, CertificateSeedValue, SignatureLock, SignatureSeedValue, Subform

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object

:nodoc:


155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/origami/acroform.rb', line 155

def self.included(receiver) #:nodoc:
    receiver.field   :FT,     :Type => Name, :Required => true
    receiver.field   :Parent, :Type => Field
    receiver.field   :Kids,   :Type => Array.of(Field)
    receiver.field   :T,      :Type => String
    receiver.field   :TU,     :Type => String, :Version => "1.3"
    receiver.field   :TM,     :Type => String, :Version => "1.3"
    receiver.field   :Ff,     :Type => Integer, :Default => 0
    receiver.field   :V,      :Type => Object
    receiver.field   :DV,     :Type => Object
    receiver.field   :AA,     :Type => AdditionalActions, :Version => "1.2"

    # Variable text fields
    receiver.field   :DA,     :Type => String, :Default => "/F1 10 Tf 0 g", :Required => true
    receiver.field   :Q,      :Type => Integer, :Default => TextAlign::LEFT
    receiver.field   :DS,     :Type => String, :Version => "1.5"
    receiver.field   :RV,     :Type => [ String, Stream ], :Version => "1.5"
end

Instance Method Details

#nameObject

Returns the (partial) name of the field.


200
201
202
# File 'lib/origami/acroform.rb', line 200

def name
    self.T
end

#name=(field_name) ⇒ Object

Sets the (partial) name of the field.


193
194
195
# File 'lib/origami/acroform.rb', line 193

def name=(field_name)
    self.T = field_name
end

#onCalculate(action) ⇒ Object


231
232
233
234
235
236
237
238
# File 'lib/origami/acroform.rb', line 231

def onCalculate(action)
    unless action.is_a?(Action)
        raise TypeError, "An Action object must be passed."
    end

    self.AA ||= AdditionalActions.new
    self.AA.C = action
end

#onFormat(action) ⇒ Object


213
214
215
216
217
218
219
220
# File 'lib/origami/acroform.rb', line 213

def onFormat(action)
    unless action.is_a?(Action)
        raise TypeError, "An Action object must be passed."
    end

    self.AA ||= AdditionalActions.new
    self.AA.F = action
end

#onKeyStroke(action) ⇒ Object


204
205
206
207
208
209
210
211
# File 'lib/origami/acroform.rb', line 204

def onKeyStroke(action)
    unless action.is_a?(Action)
        raise TypeError, "An Action object must be passed."
    end

    self.AA ||= AdditionalActions.new
    self.AA.K = action
end

#onValidate(action) ⇒ Object


222
223
224
225
226
227
228
229
# File 'lib/origami/acroform.rb', line 222

def onValidate(action)
    unless action.is_a?(Action)
        raise TypeError, "An Action object must be passed."
    end

    self.AA ||= AdditionalActions.new
    self.AA.V = action
end

#pre_buildObject

:nodoc:


174
175
176
177
178
179
180
# File 'lib/origami/acroform.rb', line 174

def pre_build #:nodoc:
    unless self.key?(:T)
        self.set_name "field#{self.object_id}"
    end

    super
end

#set_name(field_name) ⇒ Object

Sets the (partial) name of the field.


185
186
187
188
# File 'lib/origami/acroform.rb', line 185

def set_name(field_name)
    self.T = field_name
    self
end