Disable button event handing
Hi All,
I have a employee number Lov on page and when the user select employee number from the LOV I have to check whether this Employee is already exists or not.
I am storing the data in some custom table.
If the data of selected employee is already there in custom table then I want to disable the button.
Step I did..
I have capture the Lov event and check that whether the employee exists in table or not. I am getting stuck that how in Processs from request I can change web bean property.
Regards
Ajay
Edited by: Ajay Sharma on May 6, 2009 4:21 AM
You can use SPEL expression to achieve this. In this case you need to do extension of VO.
or
you can redirect the page to itself in processFormRequest(). so that processRequest() will be called and you can disable the button using standard code.
if (pageContext.isLovEvent())
// Form was submitted because the user selected
// a value from the LOV modal window,
// or because the user tabbed out of the LOV input.
// Find out which LOV input triggered the event.
String lovInputSourceId = pageContext.getLovInputSourceId();
// At this point, all the data is available in the base VO, just as in
// regular PPR events. Invoke an AM method to update the application
// properties VO.
// if ("myLovInput".equals(lovInputSourceId))
// redirect here
setForwardURLToCurrentPage(HashMap params, boolean retainAM, String addBreadCrumb, byte messagingLevel) ;
--Prasanna
Similar Messages
-
Disabled button fires an event ?! :-O
Hi, friends!
I've never thought about the next issue: why desabled button can fire an et_Click event?
I havn't no idea to check that!
I thought before that enabled=false is the method to prevent et_Click event for that item, but...
<b>Is it a bug or feature?</b>
I'm talking now about v6.5, what can you say about that situation on v6.7?It is not a bug, the SDK is simply informing you that the user clicked on something. You can click on other disabled items such as edittexts and they will also generate the click events for you.
The important difference with a disabled button is that the et_ITEM_PRESSED event won't be triggered. The et_ITEM_PRESSED event is the correct one to use to detect the user pressing a button.
John. -
Disabled button generates events
Hello,
I have a radio button that I want to disable while a background process is running.
After the process finishes, I enable the button again.
However, if the user clicks on the disabled button during the background process, an ActionEvent still gets generated.
Then when the button is re-enabled, it responds to the event that was generated while it was disabled. I want to prevent my button from responding to events generated while it was disabled.
I do not want to use the getGlassPane.setVisible(true) technique because I still want my cancel button to be able to generate events during the background process.
I am using JDK 1.3.1 and my button is in a panel contained in a JFrame application.
Suggestions?
Thank you,
Ted HillHello,
I have a radio button that I want to disable while a background process is running.
After the process finishes, I enable the button again.
However, if the user clicks on the disabled button during the background process, an ActionEvent still gets generated.
Then when the button is re-enabled, it responds to the event that was generated while it was disabled. I want to prevent my button from responding to events generated while it was disabled.
I do not want to use the getGlassPane.setVisible(true) technique because I still want my cancel button to be able to generate events during the background process.
I am using JDK 1.3.1 and my button is in a panel contained in a JFrame application.
Suggestions?
Thank you,
Ted Hill -
Mouse Events on Disabled Buttons
Hi,
In my application I should make a disabled button to show a tool tip when mouse is entered onto it.
I'm using java.awt.container not Jcontainer.
I have searched in SDN forums and after reading some of the comments what I understood is �disabled Swing button can react to Mouse events but a disabled awt button can not react to mouse events�.
Is that true or did I not understand correctly?
And how would I be able to implement the required functionality in my
application?
Thanks.import java.awt.*;
import java.awt.event.*;
public class AwtTooltip {
private Panel getContent(Frame f) {
Button left = new Button("left");
left.setEnabled(false);
Button right = new Button("right");
Panel panel = new Panel(new GridBagLayout());
new TipManager(panel, f);
GridBagConstraints gbc = new GridBagConstraints();
gbc.weightx = 1.0;
panel.add(left, gbc);
panel.add(right, gbc);
return panel;
public static void main(String[] args) {
AwtTooltip test = new AwtTooltip();
Frame f = new Frame();
f.addWindowListener(closer);
f.add(test.getContent(f));
f.setSize(300,100);
f.setLocation(200,200);
f.setVisible(true);
private static WindowListener closer = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
class TipManager extends MouseMotionAdapter {
Panel component;
Window tooltip;
Label label;
public TipManager(Panel panel, Frame frame) {
component = panel;
panel.addMouseMotionListener(this);
initTooltip(frame);
* Since enabled Buttons consume MouseEvents we will
* receive events sent only from disabled Buttons.
public void mouseMoved(MouseEvent e) {
Point p = e.getPoint();
boolean hovering = false;
Component[] c = component.getComponents();
for(int j = 0; j < c.length; j++) {
Rectangle r = c[j].getBounds();
if(r.contains(p)) {
hovering = true;
if(!tooltip.isShowing())
showTooltip(c[j], p);
break;
if(!hovering && tooltip.isShowing()) {
tooltip.setVisible(false);
private void showTooltip(Component c, Point p) {
String text = ((Button)c).getLabel();
label.setText(text);
tooltip.pack();
convertPointToScreen(p, component);
tooltip.setLocation(p.x+10, p.y-15);
tooltip.setVisible(true);
/** Copied from SwingUtilities source code. */
public void convertPointToScreen(Point p, Component c) {
Rectangle b;
int x,y;
do {
if(c instanceof Window) {
try {
Point pp = c.getLocationOnScreen();
x = pp.x;
y = pp.y;
} catch (IllegalComponentStateException icse) {
x = c.getX();
y = c.getY();
} else {
x = c.getX();
y = c.getY();
p.x += x;
p.y += y;
if(c instanceof Window)
break;
c = c.getParent();
} while(c != null);
private void initTooltip(Frame owner) {
label = new Label();
label.setBackground(new Color(184,207,229));
tooltip = new Window(owner);
tooltip.add(label);
} -
Disabled buttons still generate events
It seems that disabled buttons still generate events in business one. If a button is disabled (even a standard one) click events can still be seen in the SBO event logger. I would have expected a disabled button to be completely disabled and no events to be generated whereas as it is I have to check in the event handler to see if the button is enabled or not.
Is my understanding of this correct?
Has anyone else had issues like this?
Gordon WoodHi Gordon,
That sounds like an issue with the SBO Event Logger because no event is actually triggered in the addon when the button is disabled.
Kind Regards,
Owen -
How to enable or disable buttons on an interactive ALV report
I have two buttons on Interactive ALV report. Before displaying the ALV report, I want to enable or disable buttons on ALV depending on some conditions.I dont want to make the buttons visible or invisible. This is not an OO ALV report.
Please suggest !!!Then you have to use the event set_pf_status or parameter I_CALLBACK_PF_STATUS_SET for this pass the form name.
You have to Implement the form Routine.
FORM PF_STATUS using status type SLIS_T_EXTAB.
SET PF-STATUS 'STS' excluding status.
ENDFORM.
First create the pf-staus using SE41 or double click on the status name and create . By default you make them Disable mode. -
Disablying keyboard events in a JFrame.
Hello,
How is it possible to disable keyboard events for a specific JFrame and then (after a while) enable events again ?
thank you,
RamiLook at this program, events are send but you can't see the data in the fields.
import java.awt.*;
import java.awt.event.*;
public class Nok extends Frame
public Nok()
super();
setBounds(6,6,400,300);
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent ev)
dispose();
System.exit(0);
setLayout(new GridLayout(4,0));
add(new TextField("this is a text field"));
add(new TextArea("this is a text area"));
add(new Button("this is a button"));
setVisible(true);
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener()
{ public void eventDispatched(AWTEvent e)
System.out.println(""+e);
((KeyEvent)e).consume();
} ,AWTEvent.KEY_EVENT_MASK);
public static void main (String[] args)
new Nok();
Noah
import java.awt.*;
import java.awt.event.*;
public class Nok extends Frame
public Nok()
super();
setBounds(6,6,400,300);
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent ev)
dispose();
System.exit(0);
setLayout(new GridLayout(4,0));
add(new TextField("this is a text field"));
add(new TextArea("this is a text area"));
add(new Button("this is a button"));
setVisible(true);
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener()
{ public void eventDispatched(AWTEvent e)
System.out.println(""+e);
((KeyEvent)e).consume();
} ,AWTEvent.KEY_EVENT_MASK);
public static void main (String[] args)
new Nok(); -
My problem is that a disabled button are getting focus, which is bad when the application are operated without a mouse.
I made this litlte demo to illustrate the problem.
Try pressing button no.1. This will disable button no.1 and button no.2,
but why are button no.2 getting focus afterwards?
* NewJFrame.java
* Created on 29. september 2005, 16:55
import javax.swing.*;
* @author Peter
public class NewJFrame extends javax.swing.JFrame {
/** Creates new form NewJFrame */
public NewJFrame() {
initComponents();
printButtonStatus();
private void printButtonStatus () {
printFocus (jButton1);
printFocus (jButton2);
printFocus (jButton3);
printFocus (jButton4);
* Just debug inf.
private void printFocus (JButton button) {
System.out.println ("Button=<" + button.getText () + ">, Enabled=<" + button.isEnabled() + ">, Focus=<" + button.isFocusable() + ">");
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jButton4 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
jPanel1.add(jButton1);
jButton2.setText("jButton2");
jPanel1.add(jButton2);
jButton3.setText("jButton3");
jPanel1.add(jButton3);
getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
jButton4.setText("jButton1");
jPanel2.add(jButton4);
getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
pack();
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jButton1.setEnabled(false);
jButton2.setEnabled(false);
jButton3.setEnabled(false);
printButtonStatus();
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
// End of variables declaration
}Very courius.
I have made a little change in your code.
1) scenario
Simply changing .setEnabled(false) invokation, the class works fine.
so
jButton2.setEnabled(false);
jButton3.setEnabled(false);
jButton1.setEnabled(false);
2) scenario
the class works fine also using your .setEnabled(false) order invokations and putting after those:
FocusManager.getCurrentManager().focusNextComponent();
I do not know exactly why, I suppose that is there something not properly
syncronized in events dispaching.
In my opinion:
a) setEnabled(false) at last calls for setEnabled(false) of JComponent
that fires a propertyChange event
so:
scenario 1)
buttons 2 and 3 are disabled before of button1 that has the focus in
that moment (given by a the mouse click on itself)
When botton1.setEnabled(false) is performed buttons 2 and 3 are
just disabled, so focus is got by button4 (that is enabled)
scenario 2)
button1 that has the focus (given it by the mouse click) becames
disabled before that button2 becames disabled too.
So, probably, when the event of PropertyChanged is fired and processed, button2.setEnabled(false) invokation has not been
just performed and swings looks for it as a focusable component
So, using FocusManager.getCurrentManager().focusNextComponent(),
we force the transer focus on next focusable component.
This is only a my suppose, looking what happens.
Regards.
import javax.swing.*;
* @author Peter
public class NewJFrame extends javax.swing.JFrame {
/** Creates new form NewJFrame */
public NewJFrame() {
initComponents();
private void printButtonStatus () {
printFocus (jButton1);
printFocus (jButton2);
printFocus (jButton3);
printFocus (jButton4);
System.out.println("--------------------------------");
* Just debug inf.
private void printFocus (JButton button) {
System.out.println ("Button=<" + button.getText () + ">, Enabled=<" + button.isEnabled() + ">, Focus=<" + button.hasFocus() + ">, Focusable=<" + button.isFocusable() + ">");
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jButton4 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
jPanel1.add(jButton1);
jButton2.setText("jButton2");
jPanel1.add(jButton2);
jButton3.setText("jButton3");
jPanel1.add(jButton3);
getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
jButton4.setText("jButton1");
jPanel2.add(jButton4);
getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
pack();
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
// I have simply change the order
jButton2.setEnabled(false);
jButton3.setEnabled(false);
jButton1.setEnabled(false);
// with this sentence the class work with original .setEnabled order
//FocusManager.getCurrentManager().focusNextComponent();
SwingUtilities.invokeLater(new Runnable()
public void run()
printButtonStatus();
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
// End of variables declaration
} -
What can be done in our code in order to disable the Link/Hand/Popup actio?
Hi all,
We are implementing a process that includes an Adobe Form. This form retrieves some information from our ERP and has some images that represent some executives signatures and companys logo. At runtime, this application seems right, but when you place the mouse over the images a Hand appears and a click is possible. If you click over it, a FileSystem PopUp appears and you can choose a new image. What can be done in our code in order to disable the Link/Hand/Popup action??
Regards and Thanks in advance!Hi Carlos,
You can write a script to make it readonly .
Click on the image element .check the object properties.
find the bind
nd u can use the formcalc script to disable action like;
Event :Initialize
Script :formcalc
runat :client
Subform.image1.access="readOnly"
Swathi
Do offer pts:-) -
How do I disable an event handler?
The file below contains a canvas and a button on the canvas. There are two event handlers, one for the button and one for the canvas. How to I disable the event handler for the canvas when the button is clicked?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
public function init():void{
canvas.addEventListener(MouseEvent.CLICK, handleClick)
button.addEventListener(MouseEvent.CLICK, handleButtonClick)
public function handleClick(e:Event):void{
trace("Application clicked")
public function handleButtonClick(e:Event):void{
trace("Button clicked")
]]>
</mx:Script>
<mx:Canvas id="canvas" x="108" y="82" width="200" height="200" backgroundColor="0xff0000">
<mx:Button id="button" x="10" y="168" label="Button" mouseChildren="false"/>
</mx:Canvas>
</mx:Application>u can do this when user clicks on any of the canvas or button, just check it currentTarget and then work with ur functions accordingly
-
Unable to capture button event in pageLayout Controller
Hi Guys,
I have the following layout
pageLayout
pageLayoutCO (controller)
----header (Region)
----------messageComponentLayout (Region)
-----------------MessageLovInpurt
-----------------MessageChoice(Item)
-----------------MessageTextInput
-----------------MessageLayout
----------HideShow (Region)
-----------------MessageLovInpurt(Item)
-----------------MessageChoice(Item)
-----------------MessageTextInput(Item)
-----------MessageComponentLayout (Region)
-----------------MessageLayout
------------------------SubmitButton(ID:SearchBtn)
------------------------SubmitButton(ID:ClearBtn, fires partial action named clear)
-----------header(Region)
I am not able to capture the event fired by the button ClearBtn in the controller of the pagelayout.....
The two methods I used as follows aren't worked:
if ("clear".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
if (pageContext.getParameter("ClearBtn") != null) {
what should i do in order to capture the button event in the pageLayout Controller
Thanks in advance
Mandy
Edited by: user8898100 on 2011-8-2 上午7:49Mandy,
Its really strange that its not able to caputure the event in CO.
Below is the way in which we handle to Submit action at CO level.
/Check whether ClearBtn is same in case too.
if(pageContext.getParameter("ClearBtn")!=null){
System.out.println("Inside the Clear Btn Action");
Regards,
Gyan -
How to Capture Button event on TrainBean navigation
Hi All
i m being required to capture a button event in train bean Navigation, i m doing customization in Iexpense Module,here in Create IExpenseReport i need to capture the events of Remove,Return etc.how is it possible any clue would be very helpful.
Thanx
Prataptry this..
if (GOTO_PARAM.equals(pageContext.getParameter(EVENT_PARAM))
"NavBar".equals(pageContext.getParameter(SOURCE_PARAM))
// This condition checks whether the event is raised from Navigation bar
// and Next or Back button in navigation bar is invoked.
int target = Integer.parseInt(pageContext.getParameter(VALUE_PARAM));
// We use the parameter "value" to tell use the number of
// the page the user wants to visit.
String targetPage;
switch(target)
case 1: targetPage = "/oracle/apps/dem/employee/webui/EmpDescPG"; break;
case 2: targetPage = "/oracle/apps/dem/employee/webui/EmpAssignPG"; break;
case 3: targetPage = "/oracle/apps/dem/employee/webui/EmpReviewPG"; break;
default: throw new OAException("ICX", "FWK_TBX_T_EMP_FLOW_ERROR");
HashMap pageParams = new HashMap(2);
pageParams.put("empStep", new Integer(target));
pageContext.setForwardURL("OA.jsp?page=" + targetPage,
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
pageParams,
true, // Retain AM
OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrumbs
OAWebBeanConstants.IGNORE_MESSAGES);
--Prasanna -
Not able to capture button event in extended controller
Hi Gurus,
I am not able to capture the button event (of seeded controller) in extended controller.
I have written code in extended controller like below:
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean){
String str = pageContext.getParameter("event"); // copied from seeded controller for the button event //
if ("editLines".equals(str)) {
//cutom validation
super.processFormRequest(pageContext, webBean);
Please help me in resolving the issue.
Thanks,
Srinivas
///my cutom validateionHi Bm,
Thanks for your response.
I have tried the same but no luck.
Please help in getting this resolved.
Thanks,
Srinivas -
Not able to capture button event in pageLayout Controller
Hi Guys,
I have the following layout
pageLayout ------------------------ pageLayoutCO (controller)
----messageComponentLayout (Region)
----------messageComponentText (item)
----------messageComponentText (item)
----------messageComponentText (item)
----------messageLayout (Region)
----------------header(Region)
----------------------button (item) (say BTN1) (fires partial action)
I am not able to capture the event fired by the button BTN1 in the controller of the pagelayout..... but if i set a controller at the messageComponentLayout iam able to capture the event.
what should i do in order to capture the button event in the pageLayout Controller
Thanks in advance
Tom.Tom,
Two things:
1)The button ur using is of type submitbutton or button?.In this scenario it should be button.
2)The correct coding practice is using:
if("QUERY".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
instead of
String _event = pageContext.getParameter("event");
if("QUERY".equals(_event))
because you never know if Oracle in any upgrade or patch change the value of the constant EVENT_PARAM in class OAWebBeanConstants.
3)If first point is followed by you, just match the exact event name in code and in property inspector for the button.
--Mukul
--Mukul -
Can DISABLE preProcess Event Handler add to the Orchestration parameters?
I have a DISABLE pre-process event handler defined on the User object. I need to set the current date on a USR UDF attribute whenever the user is disabled or enabled or created. The CREATE handler works and the date value shows up on the user profile. However, when I try to set this attribute on the pre-process DISABLE or ENABLE event handlers, the new date does not show up. Here is the code I am using in my DISABLE/ENABLE event handler:
Date currentTime = new Date(System.currentTimeMillis());
orchestration.addParameter(USER_STATUS_DATETIME_ATTR_NAME, currentTime);
Where the orchestration object is from the execute() parameter list.
Any ideas as to why this is not working? Is adding to the orchestration not allowed for DISABLE or ENABLE event handlers? I know my handler is getting calls as I am logging the orchestration.getOperation() value.
Thanks for any suggestions.
-Dave
Edited by: user552098 on Nov 12, 2012 1:56 PMWhen you update the field, make sure you are using the field label name, and not the UDF value.
-Kevin
Maybe you are looking for
-
How to create a custom focus manager in jdk1.4
Dear All, I'm now trying to create a form for user to submit data. The key tab are easily to tab between textfields in html, you can set whatever order you want. But when I tried to create a form using java, I found very hard to do so. Any reference
-
my airport extreme is flashing amber it says i need a ip address .... it was working just fine yesterday until i had to reboot cable modem how do i get my extreme to work again so i can have wireless..... please help!!!
-
Getting list of all users and their group memberships from Active Directory
Hi, I want to retrieve a list of all the users and their group memberships through JNDI from Active Directory. I am using the following code to achieve this: ================== import javax.naming.*; import java.util.Hashtable; import javax.naming.di
-
Cannot sync old phone info to 4s
I have gone through a 3s and two 4's without any trouble syncing the previous phones data. Though with the new iphone 4s i cant seem to sync the information (contacts and notes are my prioity) from my previous phones. unfortunatly both my iphone 4's
-
Back flush indicator in Production Order
I have a production order with 3 components that are supposed to be set to back flush, but the check box does not default to this. The MRP2 tab of the material master for these components has the indicator set to "always back flush". Is there a back