CJ Blocks Editor

Block editor is used to create and edit code using CJ Blocks - a built-in block-based language. CJ Blocks is built on top of Google Blockly and translates to Java or JavaScript. The language and is tightly coupled with App Builder way of storing metadata.

The image below shows Block editor user interface.



The code is written by dragging blocks and data (variables, type references, seed instances, etc) from their respective panels onto the working area. First block that is shown after block creation is function signature, which can contain multiple parameters and return type. It's possible to use primitive and composite types created in App Builder or void for return type. Function signature block can not be deleted and serves as a container for all the blocks constituting function body which should be placed inside of function signature block. Blocks that are not connected to function signature are stored when function workspace is saved but are not compiled and are not participating in reference integrity checks.

Note: App Builder maintains reference integrity automatically. This means, that when you try to delete a function B which is called by a function A, you'll get a warning and a first few references to the function B will be shown. Blocks that are stored with  are not connected to function signature.


Open menu marked with three dots near view name to see block usage, history, generated code or delete block.




Use Java Code or JavaScript Code button to view generated code. Use Code Blocks button to return from code view to block view.




To connect blocks into unit of business logic use drag and drop using items from left panel split into sections:


Section
Description
General
Expressions, collection editing, entity persist and other.
String
String resource related.
Logic
If/else blocks and logical expressions.
Queries
Creating queries for stored entities.
Loops
While and for each blocks.
Time
Time functions.
Log
Notifications and comment block.
Custom
Blocks to create custom code and use custom types.


Blocks can be disabled using right button menu on block. This prevents generating code from it, like just keeping the block not connected on editing area.

Some blocks contain "wheel" button, which opens options for it. Like adding else section to if, adding placeholder variables in custom code, etc.

Hotkeys

Ctrl + key


Hotkey
Action
cCopy
vPaste
xCut
dDuplicate
zUndo
shift+zRedo

To open source of function call block right click on it and then select "Go to definition"  or simply select it and press ''F3'.

For handy work with variables you have several options:

  • Show variable - locates variable in a tree
  • Get variable - create get an expression for the variable
  • Set variable - create set an expression for the variable