Class: ModraUp::Procedure
- Inherits:
-
Object
- Object
- ModraUp::Procedure
Class Method Summary # collapse
-
.new(id:, description:, version:) ⇒ Object
Abstract base class. Subclasses call super in initialize, providing a unique ID (e.g., Company.Extend.Procedure), a visible name, and an integer version.
Instance Method Summary # collapse
- #id ⇒ String
- #description ⇒ String
- #version ⇒ Integer
-
#declare_params_and_ui(args) ⇒ String
Must be implemented. Returns a JSON object string: keys are parameter IDs (matching the keys in attach_procedure), values are control descriptions. This procedure reads these fields: type (number/length/angle/integer/boolean/checkbox/string/text/dropdown/choice/button), label, default, min, max, step, options (string, or value, label), group. Buttons are not parameters. Args: :model.
-
#validate(args) ⇒ Boolean, Array<Hash>
Must be implemented. Args: :model, :control_entities, :parameters (Symbol keys). Do not modify the model. Return true, false, or an error Hash array (:title, :description, :involved_entities).
-
#run(args) ⇒ Boolean, Array<Hash>
Must be implemented. Args: model, definition, parameters. Call within the operation started by this procedure; do not call start_operation. Clear definition.entities (i.e., clear the output), then generate geometry. Return value is the same as for #validate; revert the entire step on failure.
-
#draw(args) ⇒ nil
Optional. Called every time the view is refreshed when the component is opened for editing, to draw the preview. Args: +model+, +view+, +control_entities+, +parameters+.
-
#get_extents(args) ⇒ Geom::BoundingBox
Optional. #draw Returns the extent when drawing outside the component; defaults to an empty bounding box. Drawing or modifying the model is not allowed.
-
#get_widget_states(args) ⇒ Hash
Optional. Control id → enabled:, visible:; omitted controls remain unchanged. Args: model, parameters.
-
#on_button_clicked(args) ⇒ Symbol, nil
Optional. The button control was clicked. Args: :model, :definition, :button_id, :parameters. Perform an operation on the model when modifying it. Return :reload_ui to rebuild the control.
-
#on_open_close(args) ⇒ nil
Optional. Component opens or closes for editing. Args: action (:open / :close), +from_undo_redo+, +model+, +definition+. Only observe, do not modify the model.
Class Method Details
ModraUp::Procedure.new(id:, description:, version:)
Abstract base class. Subclasses call super in initialize, providing a unique ID (e.g., Company.Extend.Procedure), a visible name, and an integer version.
Instance Method Details
procedure.id ⇒ String
procedure.description ⇒ String
procedure.version ⇒ Integer
procedure.declare_params_and_ui(args) ⇒ String
Must be implemented. Returns a JSON object string: keys are parameter IDs (matching the keys in attach_procedure), values are control descriptions. This procedure reads these fields: type (number/length/angle/integer/boolean/checkbox/string/text/dropdown/choice/button), label, default, min, max, step, options (string, or value, label), group. Buttons are not parameters. Args: :model.
procedure.validate(args) ⇒ Boolean, Array<Hash>
Must be implemented. Args: :model, :control_entities, :parameters (Symbol keys). Do not modify the model. Return true, false, or an error Hash array (:title, :description, :involved_entities).
procedure.run(args) ⇒ Boolean, Array<Hash>
Must be implemented. Args: model, definition, parameters. Call within the operation started by this procedure; do not call start_operation. Clear definition.entities (i.e., clear the output), then generate geometry. Return value is the same as for #validate; revert the entire step on failure.
procedure.draw(args) ⇒ nil
Optional. Called every time the view is refreshed when the component is opened for editing, to draw the preview. Args: +model+, +view+, +control_entities+, +parameters+.
procedure.get_extents(args) ⇒ Geom::BoundingBox
Optional. #draw Returns the extent when drawing outside the component; defaults to an empty bounding box. Drawing or modifying the model is not allowed.
procedure.get_widget_states(args) ⇒ Hash
Optional. Control id → enabled:, visible:; omitted controls remain unchanged. Args: model, parameters.
procedure.on_button_clicked(args) ⇒ Symbol, nil
Optional. The button control was clicked. Args: :model, :definition, :button_id, :parameters. Perform an operation on the model when modifying it. Return :reload_ui to rebuild the control.
procedure.on_open_close(args) ⇒ nil
Optional. Component opens or closes for editing. Args: action (:open / :close), +from_undo_redo+, +model+, +definition+. Only observe, do not modify the model.