CSF editor

From Jeniux Framework wiki
Jump to: navigation, search

CSF editor (Custom Style Formatter) is a powerful WYSIWYG word processor that you can embed in a JeniuX Form to write styled text. This text is saved in the database in HTML format. For this reason, if you need to include your styled text in a FOP Report, you have to use the INCLUDE_CSF procedure to correctly read a field written by the CSF Editor.

This component handles special characters correctly, converting them to the Unicode format.

Requirements

A very large CHAR or VARCHAR database field

How it's like

Here you can see how it look like in a JeniuX Form. It's key feature is usability. It looks very much like a word processor currently used by most of the office suites (e.g. Microsoft Word).


Jeniux client.jpg - Example of CSF editor



This is how styled text is written to DB:


Text Html on file CSF00F


How to define it

This component can only be embedded in a JeniuX Form.

For this example, we are considering a form named SFATTURE_S

Attributes

HTMLeditor 10.jpg


JeniuX Developer

To set a CSF Editor component in your form, drag and drop this icon wherever you need. First of all, it is necessary to specify a file and a DB field. Here we use CSF00F/CSFTXT.

Warning: If you're using a VARCHAR field with a RPG Form, a little work is needed in order to get the form fully working.


RPG Form

Jeniux developer.jpg - CSF Field

As the error is displaying, ds need to be qualified in order to proceed as the field is a varchar. Right click on SFATTURE_S + Modify.

Jeniux developer.jpg - Modify Form

Check use qualified ds attribute.

Jeniux developer.jpg - Use qualified ds


Gestiamo ora il campo Testo CSF (CSFTXT) nella scheda Fatture (SFATTURE_S).
Nella subroutine jOnLoad verifichiamo se esiste già un testo CSF abbianato alla scheda.
Non dimentichiamoci che la DS di scheda è qualificata e quindi tutti i campi della scheda possono essere utilizzati solo se gli anteponiamo jdsscheda..

begsr jOnLoad;  

 ...  
                             
 // Clear CSF Text                                
  jdsscheda.csftxt=' ';                         
// Read  CSF Text from CSF00F                    
 exec sql                                         
    SELECT csftxt                                  
    INTO   :jdsscheda.csftxt                       
    FROM   csf00f                                  
    WHERE  csfform='SFATTURE_S' and csfnum=1;        
 ...
                                              
endsr;    


Ricordando che i campi VARCHAR vengono trattati in modo particolare nelle RPG Form, gestiamo il campo anche nelle subroutine di personalizzazione jAfterWrite, jAfterUpdate e jAfterDelete; ma non in Jupdate, Jwrite e Jdelete perchè per questa scheda il file non è quello principale.

begsr jAfterWrite;                                     
   ....                                                   
   // Update CSF Text                             
   exec sql                                       
     UPDATE csf00f                                 
     SET    csftxt=trim(:jdsscheda.csftxt),        
            csfuser=:Juser,                        
            csfts=CURRENT_TIMESTAMP                
     WHERE  csfform='SFATTURE_S' and csfnum=1;     
   ...                                               
endsr;                                             


begsr jAfterUpdate;                                                 
   ...
   // Insert new CSF Text
   exec sql                                        
      INSERT INTO csf00f                                    
      VALUES (trim(:jdsscheda.csftxt),                      
              'SFATTURE_S',                                 
              1,            
              ' ',                                          
              :Juser,                                        
              CURRENT_TIMESTAMP);                                         
endsr;


begsr jAfterDelete;                                              
   // Annulla CSF Text                                          
   exec sql                                                     
    UPDATE csf00f                                               
    SET    csfdes='Anullata',   
           csfnum=(SELECT coalesce(max(csfnum), 9000) +1        
                   FROM   csf00f                             
                   WHERE  csfform='SFATTURE_S' and csfnum>9000),                   
           csfuser=:Juser,                                      
           csfts=CURRENT_TIMESTAMP                              
    WHERE  csfform='SFATTURE_S' and csfnum=1;    
endsr;

JAVA Form

How to use it

The use of this component is rather straightforward. Everyone who have a small experience in word processor should have no problems using it.

Let's see its main features:

Menu


Edit



Jeniux client.jpg - Example of Menu - Edit
Action Shortcut Description
Cut CTRL + X Cut the selected text and put it in the clipboard
Copy CTRL + C Copy the selected text and put it in the clipboard
Paste CTRL + SHIFT + V Paste styled text. Warning: It could be dangerous.
Pasteplain CTRL + V Paste plain text.
Undo CTRL + Z Restore the text prior to the last action.
Redo CTRL + Y Redo the next action if Undo button is pressed
Select All NONE Select all the text


Font



Jeniux client.jpg - Example of Menu - Font
Action Shortcut Description
Bold CTRL + B Make text bold
Italic CTRL + I Make text italic
Underline CTRL + U Make text underlined
Strike NONE Make text striked
Superscript NONE ---
Subscript NONE ---
Select Font ... NONE Select the desired font


Format



Jeniux client.jpg - Example of Menu - Format
Action Shortcut Description
Left Alignement CTRL + B Make text bold
Center Alignement CTRL + I Make text italic
Right Alignement CTRL + U Make text underlined
Justify NONE Make text striked
Unordered List NONE As shown in Figure 1
Ordered List NONE As shown in Figure 2


Jeniux client.jpg - Figure 1
Jeniux client.jpg - Figure 2



Search



Jeniux client.jpg - Example of Menu - Search


Action Shortcut Description
Find NONE Find
Find again NONE Find again
Find and replace NONE Find and replace


Insert



Jeniux client.jpg - Example of Menu - Insert
Action Shortcut Description
Horizontal Rule NONE Insert an horizontal rule



Table



It's possible to tab to the next cell using the handy shortcut SHIFT + TAB. You can also create nested table but be aware that space on the field can dramatically decrease.

Jeniux client.jpg - Example of Menu - Table
Action Shortcut Description
Create Table NONE Create a table
Edit Table NONE Edit the currently selected table
Edit Cell NONE Edit the currently selected cell
Insert Row NONE Insert a row in the currently selected table
Insert Column NONE Insert a column in the currently selected table
Delete Row NONE Delete a row from the currently selected table
Delete Column NONE Delete a column from the currently selected table


Forms



Jeniux client.jpg - Example of Menu - Forms


Text field attributes Description
Name Variable name
Size graphical dimension
Maxlength NONE
Checkbox attributes Description
Name Variable name
Radiobutton attributes Description
Name Variable name*
  • Name deve essere lo stesso per il gruppo di scelte possibili.

Examples