SlideShare uma empresa Scribd logo
1 de 28
Baixar para ler offline
your oracle solutions partner


APEX 4.0: Plug-Ins

           How to use them,
           How to write them ….


           By Jan Huyzentruyt & Stijn Van Raes
iAdvise
 Started in 2004
  (member of Cronos-group)

 > 55 consultants

 Since 2006:
  APEX Core Team

 O2U (the Nederlands)

 Oracle Gold Partner

                             © 2011
Agenda

 Introduction

 How to use them ?

 How to write them ?




                        © 2011
PLUG-INS




           © 2011
Why Plug-Ins ?
 Make javascript declarative
   Structured way of implementing
   Encapsulated for developer community
 Increase reusability
   Develop Once, Use Often
 Increase productivity
 Make javascript transportable
   Exportable as separate/independent
    component



                                           © 2011
Plug-In Types
 There are four types of plug-ins:

   Item type plug-ins
     Example: Star Rating, Color Picker, …
   Region type plug-ins
     Example: Google Maps, Google Visualizations, …
   Dynamic action plug-ins
     Example: Twitter Status update, Yahoo Stock Quote
   Process type plug-ins
     Example: Get Data



                                                          © 2011
Agenda

 Introduction

 How to use them ?

 How to write them ?




                        © 2011
How to use them ?
 Download a plugin
   http://www.oracle.com/technetwork/developer-
    tools/apex/application-express/apex-plug-ins-
    182042.html
   http://www.apex-plugin.com/
 Import the plugin
   Shared Components > Plug-ins > Import
 Create an item
   Select plugins
   Select your plugin
   [Fill in settings]
 Run your page



                                                    © 2011
How to use them ?
 Once loaded, use in similar fashion
  to native components

 Not supported at workspace level

 Included in APEX application export




                                        © 2011
DEMO




       © 2011
Agenda

 Introduction

 How to use them ?

 How to write them ?




                        © 2011
Plug-In Engine

Page                                         Rendered by
                                          Rendered by plugin
                                                 apex
                                               engine

       Region


                    Star    Pre element                        Post element



                   Clear    Pre element                        Post element




         Standard Element   Pre element                        Post element




                                                                              © 2011
Plug-In builder
 What’s in a name
   DOMAIN.COMPANY.APEX.PLUGIN_NAME
   Ex: BE.IADVISE.APEX.CLEARABLETEXTFIELD

 Type
   Category
 Subscription
 Settings
   File prefix
 Source


                                             © 2011
Plug-In builder
 Callbacks
       Render function (region, item, dyn. action)
       Ajax function (region, item, dyn. action)
       Validation function (item)
       Execute function (process)
   Standard Attributes
   Custom Attributes
   Files
   Events


                                                 © 2011
How to write them ?
 Five+ Steps
     Step   0:   Get the idea
     Step   1:   Create a render function
     Step   2:   Add files
     Step   3:   Add standard attributes
     Step   4:   Add custom attributes
     Step   5:   Add events




                                             © 2011
Step 0: Get the idea
 Start with an idea
   It’s all in your head
   Existing jquery plugin:   Example




                                        © 2011
Step 1: Create render function
 Pl/sql function




 Get your plugin cheatsheet after the
  presentation

                                         © 2011
Step 1: Create render function
 APEX_PLUGIN API
   get_input_name_for_page_item


 Print input item
   HTP.P
   Don’t trust the user use:
    apex_plugin_util.escape




                                   © 2011
Step 1: Create render function
 Add debug
   apex_plugin_util.debug_page_item


 Add readonly
   apex_plugin_util.print_hidden_if_readonly


 Add printer friendly
   apex_plugin_util.print_display_only




                                            © 2011
Step 2: Add files
 Javascript, css, images,...
 Include them into your plug-in
   apex_javascript.add_library
   apex_css.add_file
 Use the plugin file prefix
   t_plugin.file_prefix
   #IMAGE_PREFIX#, #PLUGIN_PREFIX#




                                      © 2011
Step 2: Add files
 APEX_JAVASCRIPT API
   Add_library
   Add_onload_code
   Add_inline_code


 APEX_CSS API
   Add_file
   Add




                        © 2011
Step 3: Add standard attributes
 Attributes you can select for your
  item, region, dynamic action plug-ins
 Possibility to use the values that are
  filled in by the apex developer in your
  plug-in
   Apex_plugin.t_page_item
       Lov_definition
       Element_width
       Element_height
       ...
 Use them when you print your plug-in
                                            © 2011
Step 4: Add custom attributes
 Define your own plugin ‘parameters’
 Use the values that are filled in by the
  Apex developer in your plugin
   Apex_plugin.t_page_item
     Attribute_01, Attribute_02,... Attribute_10
 Give them a scope
   Application, component
 Make required, conditions
 Help text!


                                                    © 2011
Step 5: Add events
 Add your event
 Use jquery .trigger in the plug-in
  source
   Ex:   $("#'||p_item.name||'").trigger("clear");})

 Your plug-in events will appear as
  dynamic action events




                                                        © 2011
Tips
 Make plug-in development easier:
   Put your files on your server, and use
    p_plugin.file_prefix to reference them
   Put the plugin pl/sql functions in a
    package on your db scheme
     Reference them in the callbacks
      [package_name.]function_name
 Firebug is your friend
 Use jquery
 Avoid excessive inline js & css code

                                             © 2011
Tips
 Test with multiple instances!
 Read Only and Printer Friendly Mode
 Secure? XSS & Data Validation
 Help Text for Plug-In and Attributes!
 Check the code of plug-ins you use




                                          © 2011
Q&A




      © 2011
Thank You
 Email:
   stijn.vanraes@iadvise.be
   jan.huyzentruyt@iadvise.be


 Blogs:
   http://iadviseblog.wordpress.com/
   http://apexcommunity.wordpress.com/


 More APEX info on:
     http://www.apexcommunity.be

                                          © 2011

Mais conteúdo relacionado

Último

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Último (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Destaque

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

Destaque (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

APEX 4.0 Plug-Ins: How to use them ..., How to build them ...

  • 1. your oracle solutions partner APEX 4.0: Plug-Ins How to use them, How to write them …. By Jan Huyzentruyt & Stijn Van Raes
  • 2. iAdvise  Started in 2004 (member of Cronos-group)  > 55 consultants  Since 2006: APEX Core Team  O2U (the Nederlands)  Oracle Gold Partner © 2011
  • 3. Agenda  Introduction  How to use them ?  How to write them ? © 2011
  • 4. PLUG-INS © 2011
  • 5. Why Plug-Ins ?  Make javascript declarative  Structured way of implementing  Encapsulated for developer community  Increase reusability  Develop Once, Use Often  Increase productivity  Make javascript transportable  Exportable as separate/independent component © 2011
  • 6. Plug-In Types  There are four types of plug-ins:  Item type plug-ins  Example: Star Rating, Color Picker, …  Region type plug-ins  Example: Google Maps, Google Visualizations, …  Dynamic action plug-ins  Example: Twitter Status update, Yahoo Stock Quote  Process type plug-ins  Example: Get Data © 2011
  • 7. Agenda  Introduction  How to use them ?  How to write them ? © 2011
  • 8. How to use them ?  Download a plugin  http://www.oracle.com/technetwork/developer- tools/apex/application-express/apex-plug-ins- 182042.html  http://www.apex-plugin.com/  Import the plugin  Shared Components > Plug-ins > Import  Create an item  Select plugins  Select your plugin  [Fill in settings]  Run your page © 2011
  • 9. How to use them ?  Once loaded, use in similar fashion to native components  Not supported at workspace level  Included in APEX application export © 2011
  • 10. DEMO © 2011
  • 11. Agenda  Introduction  How to use them ?  How to write them ? © 2011
  • 12. Plug-In Engine Page Rendered by Rendered by plugin apex engine Region Star Pre element Post element Clear Pre element Post element Standard Element Pre element Post element © 2011
  • 13. Plug-In builder  What’s in a name  DOMAIN.COMPANY.APEX.PLUGIN_NAME  Ex: BE.IADVISE.APEX.CLEARABLETEXTFIELD  Type  Category  Subscription  Settings  File prefix  Source © 2011
  • 14. Plug-In builder  Callbacks  Render function (region, item, dyn. action)  Ajax function (region, item, dyn. action)  Validation function (item)  Execute function (process)  Standard Attributes  Custom Attributes  Files  Events © 2011
  • 15. How to write them ?  Five+ Steps  Step 0: Get the idea  Step 1: Create a render function  Step 2: Add files  Step 3: Add standard attributes  Step 4: Add custom attributes  Step 5: Add events © 2011
  • 16. Step 0: Get the idea  Start with an idea  It’s all in your head  Existing jquery plugin: Example © 2011
  • 17. Step 1: Create render function  Pl/sql function  Get your plugin cheatsheet after the presentation © 2011
  • 18. Step 1: Create render function  APEX_PLUGIN API  get_input_name_for_page_item  Print input item  HTP.P  Don’t trust the user use: apex_plugin_util.escape © 2011
  • 19. Step 1: Create render function  Add debug  apex_plugin_util.debug_page_item  Add readonly  apex_plugin_util.print_hidden_if_readonly  Add printer friendly  apex_plugin_util.print_display_only © 2011
  • 20. Step 2: Add files  Javascript, css, images,...  Include them into your plug-in  apex_javascript.add_library  apex_css.add_file  Use the plugin file prefix  t_plugin.file_prefix  #IMAGE_PREFIX#, #PLUGIN_PREFIX# © 2011
  • 21. Step 2: Add files  APEX_JAVASCRIPT API  Add_library  Add_onload_code  Add_inline_code  APEX_CSS API  Add_file  Add © 2011
  • 22. Step 3: Add standard attributes  Attributes you can select for your item, region, dynamic action plug-ins  Possibility to use the values that are filled in by the apex developer in your plug-in  Apex_plugin.t_page_item  Lov_definition  Element_width  Element_height  ...  Use them when you print your plug-in © 2011
  • 23. Step 4: Add custom attributes  Define your own plugin ‘parameters’  Use the values that are filled in by the Apex developer in your plugin  Apex_plugin.t_page_item  Attribute_01, Attribute_02,... Attribute_10  Give them a scope  Application, component  Make required, conditions  Help text! © 2011
  • 24. Step 5: Add events  Add your event  Use jquery .trigger in the plug-in source  Ex: $("#'||p_item.name||'").trigger("clear");})  Your plug-in events will appear as dynamic action events © 2011
  • 25. Tips  Make plug-in development easier:  Put your files on your server, and use p_plugin.file_prefix to reference them  Put the plugin pl/sql functions in a package on your db scheme  Reference them in the callbacks [package_name.]function_name  Firebug is your friend  Use jquery  Avoid excessive inline js & css code © 2011
  • 26. Tips  Test with multiple instances!  Read Only and Printer Friendly Mode  Secure? XSS & Data Validation  Help Text for Plug-In and Attributes!  Check the code of plug-ins you use © 2011
  • 27. Q&A © 2011
  • 28. Thank You  Email:  stijn.vanraes@iadvise.be  jan.huyzentruyt@iadvise.be  Blogs:  http://iadviseblog.wordpress.com/  http://apexcommunity.wordpress.com/  More APEX info on:  http://www.apexcommunity.be © 2011