Monday Apr 09, 2012

How to create a PeopleCode Application Package/Application Class using PeopleTools Tables

This article describes how - in PeopleCode (Release PeopleTools 8.50) - to enable a grid without enabling each static column, using a dynamic Application Class.

The goal is to disable the following grid with three columns “Effort Date”, ”Effort Amount” and “Charge Back” , when the Check Box “Finished with task” is selected , without referencing each static column; this PeopleCode could be used dynamically with any grid.


If the check box “Finished with task” is cleared, the content of the grid columns is editable (and the buttons “+” and “-“ are available):


So, you create an Application Package “CLASS_EXTENSIONS” that contains an Application Class “EWK_ROWSET”.

This Application Class is defined with Class extends “ Rowset” and you add two news properties “Enabled” and “Visible”:


After creating this Application Class, you use it in two PeopleCode Events : Rowinit and FieldChange :


This code is very ‘simple’, you write only one command : ” &ERS2.Enabled = False” → and the entire grid is “Enabled”… and you can use this code with any Grid!

So, the complete PeopleCode to create the Application Package is (with explanation in [….]) :

******Package CLASS_EXTENSIONS :    [Name of the Package: CLASS_EXTENSIONS]

--Beginning of the declaration part------------------------------------------------------------------------------
class EWK_ROWSET extends Rowset;          [Definition Class EWK_ROWSET  as a 
                                          subclass of Class Rowset]
   method EWK_ROWSET(&RS As Rowset);      [Constructor is the Method with the
                                          same name of the Class]
   property boolean Visible get set;
   property boolean Enabled get set;      [Definition of the property 
                                          “Enabled” in read/write]
private                                   [Before the word “private”, 
                                          all the declarations are publics]
   method SetDisplay(&DisplaySW As boolean, &PropName As string, 
          &ChildSW As boolean);
   instance boolean &EnSW;
   instance boolean &VisSW;
   instance Rowset &NextChildRS;
   instance Row &NextRow;
   instance Record &NextRec;
   instance Field &NextFld;
   instance integer &RowCnt, &RecCnt, &FldCnt, &ChildRSCnt;
   instance integer &i, &j, &k;
   instance CLASS_EXTENSIONS:EWK_ROWSET &ERSChild;   [For recursion]
   Constant &VisibleProperty = "VISIBLE";
   Constant &EnabledProperty = "ENABLED";
end-class;
--End of the declaration part------------------------------------------------------------------------------

method EWK_ROWSET [The Constructor]
   /+ &RS as Rowset +/
   %Super = &RS;
end-method;
get Enabled
   /+ Returns Boolean +/;
   Return &EnSW;
end-get;
set Enabled
   /+ &NewValue as Boolean +/;
   &EnSW = &NewValue;
  %This.InsertEnabled=&EnSW;
  %This.DeleteEnabled=&EnSW;
 %This.SetDisplay(&EnSW, &EnabledProperty, False); [This method is called when
                                                    you set this property]
end-set;
get Visible
   /+ Returns Boolean +/;
   Return &VisSW;
end-get;

set Visible
   /+ &NewValue as Boolean +/;
   &VisSW = &NewValue;
   %This.SetDisplay(&VisSW, &VisibleProperty, False);
end-set;

method SetDisplay                 [The most important PeopleCode Method]
   /+ &DisplaySW as Boolean, +/
   /+ &PropName as String, +/
   /+ &ChildSW as Boolean +/             [Not used in our example]
   &RowCnt = %This.ActiveRowCount;
   &NextRow = %This.GetRow(1);      [To know the structure of a line ]
   &RecCnt = &NextRow.RecordCount; 
   For &i = 1 To &RowCnt                     [Loop for each Line]
      &NextRow = %This.GetRow(&i);
      For &j = 1 To &RecCnt                   [Loop for each Record]
         &NextRec = &NextRow.GetRecord(&j);
         &FldCnt = &NextRec.FieldCount;      

         For &k = 1 To &FldCnt                 [Loop for each Field/Record]
            &NextFld = &NextRec.GetField(&k);
            Evaluate Upper(&PropName)
            When = &VisibleProperty
               &NextFld.Visible = &DisplaySW;
               Break;
            When = &EnabledProperty;
               &NextFld.Enabled = &DisplaySW; [Enable each Field/Record]
               Break;
            When-Other
              Error "Invalid display property; Must be either VISIBLE or ENABLED"
            End-Evaluate;
         End-For;
      End-For;
      If &ChildSW = True Then   [If recursion]
         &ChildRSCnt = &NextRow.ChildCount;
         For &j = 1 To &ChildRSCnt [Loop for each Rowset child]
            &NextChildRS = &NextRow.GetRowset(&j);
            &ERSChild = create CLASS_EXTENSIONS:EWK_ROWSET(&NextChildRS);
            &ERSChild.SetDisplay(&DisplaySW, &PropName, &ChildSW);
 [For each Rowset child, call Method SetDisplay with the same parameters used 
 with the Rowset parent]
         End-For;
      End-If;
   End-For;
end-method;
******End of the Package CLASS_EXTENSIONS:[Name of the Package: CLASS_EXTENSIONS]

About the Author:


Pascal Thaler joined Oracle University in 2005 where he is a Senior Instructor. His area of expertise is Oracle Peoplesoft Technology and he delivers the following courses:

  • For Developers: PeopleTools Overview, PeopleTools I &II, Batch Application Engine, Language Oriented Object PeopleCode, Administration Security
  • For Administrators : Server Administration & Installation, Database Upgrade & Data Management Tools
  • For Interface Users: Integration Broker (Web Service)

Wednesday Oct 26, 2011

New Style Sheet in Release PeopleTools 8.50: Free Form Stylesheet by Pascal Thaler

Since Release PeopleTools 8.50, free form sub style sheets are text-based sub style sheets that enable you to take advantage of Cascading Style Sheets– Level 2 (CSS2), AJAX, and DHTML features.

With a free form sub style sheet, you can create the style sheet in a third-party editor text and then copy the style sheet text into the Free Form tab of the free form sub style sheet definition.

When creating free form style sheets, style class names (like PSEDITBOX for example) must be identical to the PeopleTools default style class names.

If the default page style sheet includes only free form text, the free form sub style sheet must define and include all default style classes used by the application.

PSSTYLEDEF_SWAN is the default application style sheet. The PSSTYLEDEF_SWAN style sheet comprises all default style classes and consists of these sub style sheets (list only free form sub style sheet):

  • PSNAV2_SWAN: Defines the 8.50 Menu pagelet navigation style classes
  • PSPOPUP_CSS_SWAN: Defines the pop-up dialog box page style classes.
  • PSTAB_PTCSS_SWAN: Defines the page tab style classes.
  • PSHDR2_SWAN: Defines Oracle Logo.

Note:You can also convert style sheets to free form sub style sheets:

  • Open a standard style sheet or sub style sheet.
  • Select File, Definition Properties.
  • In the Style Sheet Type drop-down list box, select Freeform Sub Style Sheet and click the OK button.
  • Save the style sheet.
Example 1: The free form sub style sheet PSNAV2_SWAN

You want to change the left menu navigation color background in PT 8.50:

In ApplicationDesigner, open PSNAV2 (or PSNAV2_SWAN) (free form stylesheet), and change the ptnav2pglt class attributes for background:

and the result is:

Example 2: The free form sub style sheet PSHDR2_SWAN

You want to change to a new image (not update the image standard PT_ORACLELOGO_SWAN) for the Oracle logo in the PeopleSoft header:

In ApplicationDesigner

File -> New, select Image and browse new file image MY_ORACLELOGO_SWAN.gif and Save it.

In ApplicationDesigner, open PSSTYLEDEF_SWAN and open FreeForm Sub Style Sheets: PSHDR2_SWAN and change the pthdr2logoswant class attributes for background url(%Image())no-repeat:

and the result is:

About the Author:

Pascal Thaler joined Oracle University in 2005 where he is a Senior Instructor. His area of expertise is Oracle Peoplesoft Technology and he delivers the following courses:

  • For Developers: PeopleTools Overview, PeopleTools I &II, Batch Application Engine, Language Oriented Object PeopleCode, Administration Security
  • For Administrators : Server Administration & Installation, Database Upgrade & Data Management Tools
  • For Interface Users: Integration Broker (Web Service)
About

Expert trainers from Oracle University share tips and tricks and answer questions that come up in a classroom.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today