How to get the position of a selected cell in a table without using the mouse event?
Dear All,
I have a question about table:After clicking the cell of a table, the cell is into the edit status. How to know the row number and column number of the cell, when I click a button?
The link below is using the mouse down event:
http://forums.ni.com/ni/board/message?board.id=170&message.id=260102&query.id=55917#M260102
Is there any other way to do it? Having tried to using the "edit position" property, but it seems not working well.
Thanks for any suggestion.
Hugo
Attachments:
table.vi 17 KB
It works well with the "edit position" property.
See attached
Attachments:
table.vi 12 KB
Similar Messages
-
How to get the position of a selected cell in a table ?
Hi,
How can I get the position of a selected cell in a table or in a list multicolumn cmd ?
Thanks.Invoke node >>> point to Row Column
Ben
Message Edited by Ben on 07-19-2007 03:14 PM
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction
Attachments:
Point_To_Row_Column.PNG 22 KB -
How to throw the mouse event to a upper level component?
For example: a panel using absolute layout, and there is a label on it.
Now when mouse clicked on the label, i do not want the label but the panel to get the mouse event , so that i can get the mouse click point's x and y in the panel.
How to implement it?
Thanks a looooooooooooot for ur help
Best Regardstry this
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Testing extends JFrame
public Testing()
setSize(100,75);
setLocation(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
final JPanel p = new JPanel();
JLabel lbl = new JLabel("Click Me");
lbl.setToolTipText("OK");
lbl.setBorder(BorderFactory.createLineBorder(Color.BLACK));
p.add(lbl);
getContentPane().add(p);
lbl.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent me){//match method name
p.dispatchEvent(me);}});
p.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent me){//with this method name
System.out.println("Panel clicked");}});
public static void main(String[] args){new Testing().setVisible(true);}
} -
How to get the mouse clicked positions on a movie
I am doing a project on Objects tracking
I am capturing the video data using webcamera and playing it using processor in JMF
my problem is , if i click on the movie that is being played currently, i have to display the co-ordinates of the mouse clicked position.
can anyone help me?
Thanks in advance
Sudhahello
i have attache my coding here
see to it
import java.io.*;
import java.io.IOException;
import java.net.*;
import java.net.URL;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import javax.swing.*;
import javax.media.*;
import javax.media.util.*;
import javax.media.Buffer.*;
import javax.media.format.*;
import javax.media.Format;
import javax.media.protocol.*;
import javax.media.control.*;
import javax.media.rtp.*;
import javax.media.protocol.DataSource;
import com.sun.media.ui.*;
import javax.media.format.YUVFormat;
import java.util.*;
import java.util.Vector;
import javax.imageio.*;
import javax.imageio.stream.*;
class capturing1 extends JInternalFrame implements ActionListener,MouseListener,MouseMotionListener,ControllerListener
* The entry point of the example
* @param args The command line arguments
int mark_flg=0;
int xpos=0,ypos=0;
mdetect mde=new mdetect();
protected boolean transitionOK;
protected Object synchronizer;
protected Processor processor;
JButton mark;
JButton track;
capturing1(String fname)
{ super(fname, true, true, true, true);
getContentPane().setLayout( new BorderLayout() );
setSize(320, 10);
setLocation(50, 50);
setVisible(true);
processor = null;
synchronizer = new Object();
transitionOK = true;
mark=new JButton("mark");
track=new JButton("track");
mark.setSize(25,25);
track.setSize(25,25);
mark.addActionListener(this);
track.addActionListener(this);
getContentPane().add("East", mark);
//getContentPane().add("West", track);
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception e) {
System.err.println("Could not initialize java.awt Metal lnf");
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, new Boolean(true));
addMouseListener(this);
addMouseMotionListener(this);
loadAndStart(fname);
public void loadAndStart(String fn)
boolean status;
status = loadFile(fn);
if (status) status = configure();
TrackControl tc[] = processor.getTrackControls();
if (tc == null) {
System.err.println("Failed to obtain track controls from the processor.");
System.exit(0);
// Search for the track control for the video track.
TrackControl videoTrack = null;
for (int i = 0; i < tc.length; i++) {
if (tc.getFormat() instanceof VideoFormat) {
videoTrack = tc[i];
break;
if (videoTrack == null) {
System.err.println("The input media does not contain a video track.");
System.exit(0);
try {
Codec codec[] = {mde};
videoTrack.setCodecChain(codec);
} catch (UnsupportedPlugInException e) {
System.err.println("The processor does not support effects.");
if (status) status = realize();
public boolean loadFile(String fn)
boolean status;
URL url;
status = false;
/*Vector v = CaptureDeviceManager.getDeviceList(new VideoFormat(
VideoFormat.YUV));
System.out.println(((CaptureDeviceInfo) v.get(0)).getName());
try{
MediaLocator ml = ((CaptureDeviceInfo) v.get(0)).getLocator();
System.out.println(ml.toString());
processor = Manager.createProcessor(ml);processor.addControllerListener(this);status = true;
}catch(Exception e){
System.err.println("Exception occured\n");
e.printStackTrace();
System.exit(0);
try {
url = new URL("file:"+
System.getProperty("user.dir")+
"/"+fn);
if (url != null) {
processor = Manager.createProcessor(url);
processor.addControllerListener(this);
status = true;
} catch (NoProcessorException npe) {
System.out.println("Unable to create a processor!");
} catch (IOException ioe) {
System.out.println("Unable to connect to source!");
return status;
public boolean configure()
boolean status;
status = false;
// Put the Processor into the configured state
processor.configure();
if (waitFor(processor.Configured)) {
// Set the content descriptor to null so that the
// processor can be used as a player
processor.setContentDescriptor(null);
status = true;
} else {
System.out.println("Unable to configure the processor!");
return status;
public boolean realize()
boolean status;
Component c;
status = false;
// Put the Processor into the realized state
processor.prefetch();
if (waitFor(processor.Prefetched)) {
// The Processor has been realized so the
// components can be layed out
c = processor.getVisualComponent();
getContentPane().add("Center", c);
c = processor.getControlPanelComponent();
if (c != null)
getContentPane().add("South", c);
System.out.println("button added");
// Start the Processor
validate();System.out.println("button added");
processor.start();
status = true;
} else {
System.out.println("Unable to realize the processor!");
return status;
protected boolean waitFor(int state)
// Make this block synchronized
synchronized(synchronizer) {
try {
while ((processor.getState() != state) &&
(transitionOK)) {
synchronizer.wait();
} catch (InterruptedException ie) {
// Ignore it
return transitionOK;
public synchronized void controllerUpdate(ControllerEvent evt)
if ( (evt instanceof ConfigureCompleteEvent) ||
(evt instanceof RealizeCompleteEvent) ||
(evt instanceof PrefetchCompleteEvent) ) {
// Synchronize this block
synchronized(synchronizer) {
transitionOK = true;
synchronizer.notifyAll();
} else if (evt instanceof ResourceUnavailableEvent) {
// Synchronize this block
synchronized(synchronizer) {
transitionOK = false;
synchronizer.notifyAll();
public void mouseMoved(MouseEvent e) {
//saySomething("Mouse moved", e);
public void mouseDragged(MouseEvent e) {
saySomething("Mouse dragged", e);
public void mousePressed(MouseEvent e) {
//saySomething("Mouse pressed; # of clicks: "
// + e.getClickCount(), e);
public void mouseReleased(MouseEvent e) {
//saySomething("Mouse released; # of clicks: "
// + e.getClickCount(), e);
public void mouseEntered(MouseEvent e) {
//saySomething("Mouse entered", e);
public void mouseExited(MouseEvent e) {
//saySomething("Mouse exited", e);
public void mouseClicked(MouseEvent e) {
saySomething("Mouse clicked (# of clicks: "
+ e.getClickCount() + ")", e);
xpos=e.getX(); ypos=e.getY();
void saySomething(String eventDescription, MouseEvent e) {
System.out.println("The Object is at the point "+"x ,"+e.getX()+ "y" + e.getY());
if(mark_flg==1){
mdetect.markObject(xpos,ypos);
//mark_flg=0;
public void actionPerformed(ActionEvent e)
if(e.getSource()==track)
System.out.println("track pressed");
processor.start();
if(e.getSource()==mark)
mark_flg=1;//processor.stop();
System.out.println("mark pressed");
public class track extends Frame
{ JDesktopPane desktop;
public track(String f)
setLayout( new BorderLayout() );
desktop = new JDesktopPane();
desktop.setDoubleBuffered(true);
add("Center", desktop);
setSize(640, 480);
capturing1 cap1=new capturing1(f);
desktop.add(cap1);
setVisible(true);
public static void main(String args[])
new track(args[0]);
/****************************** mdetect class**********************************************/
class mdetect implements Effect
//Processor processor;
static boolean marked=true; static int mark_flg=0; int a=1;
static int xpos=0,ypos=0;
private Format inputFormat;
private Format outputFormat;
private Format[] inputFormats;
private Format[] outputFormats;
private int[] bwPixels;
private byte[] bwData;
private RGBFormat vfIn = null;
private static int imageWidth = 0;
private int imageHeight = 0;
private int imageArea = 0;
static int[] p1;
mdetect()
System.out.println("mdetect called");
inputFormats = new Format[] {
new RGBFormat(null,
Format.NOT_SPECIFIED,
Format.byteArray,
Format.NOT_SPECIFIED,
24,
3, 2, 1,
3, Format.NOT_SPECIFIED,
Format.TRUE,
Format.NOT_SPECIFIED)
outputFormats = new Format[] {
new RGBFormat(null,
Format.NOT_SPECIFIED,
Format.byteArray,
Format.NOT_SPECIFIED,
24,
3, 2, 1,
3, Format.NOT_SPECIFIED,
Format.TRUE,
Format.NOT_SPECIFIED)
public Format[] getSupportedInputFormats() {
return inputFormats;
public Format [] getSupportedOutputFormats(Format input) {
if (input == null) {
return outputFormats;
if (matches(input, inputFormats) != null) {
return new Format[] { outputFormats[0].intersects(input) };
} else {
return new Format[0];
public Format setInputFormat(Format input) {
inputFormat = input;
return input;
public Format setOutputFormat(Format output) {
if (output == null || matches(output, outputFormats) == null)
return null;
RGBFormat incoming = (RGBFormat) output;
Dimension size = incoming.getSize();
int maxDataLength = incoming.getMaxDataLength();
int lineStride = incoming.getLineStride();
float frameRate = incoming.getFrameRate();
int flipped = incoming.getFlipped();
int endian = incoming.getEndian();
if (size == null)
return null;
if (maxDataLength < size.width * size.height * 3)
maxDataLength = size.width * size.height * 3;
if (lineStride < size.width * 3)
lineStride = size.width * 3;
if (flipped != Format.FALSE)
flipped = Format.FALSE;
outputFormat = outputFormats[0].intersects(new RGBFormat(size,
maxDataLength,
null,
frameRate,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
lineStride,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED));
return outputFormat;
public synchronized int process(Buffer inBuffer, Buffer outBuffer) {
int i=0;
a++;
//System.out.println("discard buffer"+inBuffer.isEOM());
//System.out.println("w n h");
//System.out.println("w"+size.width+"h"+size.height);
//System.out.println("format"+inBuffer.getFormat());
//System.out.println("RGB"+outImage.getRGB(3,3));
//Graphics og = outImage.getGraphics();
//og.drawImage(stopImage, 0, 0, size.width, size.height, null);
vfIn = (RGBFormat) inBuffer.getFormat();
Dimension size = vfIn.getSize();
if(inBuffer.isEOM()==false)
BufferToImage stopBuffer = new BufferToImage((VideoFormat) inBuffer.getFormat());
Image stopImage = stopBuffer.createImage( inBuffer);
BufferedImage outImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
if(a==6)
PictureButton.but(stopImage);
System.out.println("stop image called");
//cut
/*if(a<0)
for(int rr=0;rr<MAXROWS;rr++)
for(int cc=0;cc<MAXCOLS;cc++)
System.out.print(PixelArray[rr][cc]+" ");
System.out.println("@");
a=0;
int outputDataLength = ((VideoFormat)outputFormat).getMaxDataLength();
validateByteArraySize(outBuffer, outputDataLength);
outBuffer.setLength(outputDataLength);
outBuffer.setFormat(outputFormat);
outBuffer.setFlags(inBuffer.getFlags());
byte [] inData = (byte[]) inBuffer.getData();
byte [] outData =(byte[]) outBuffer.getData();
Object data = inBuffer.getData();
int pixStrideIn = vfIn.getPixelStride();
int lineStrideIn = vfIn.getLineStride();
imageWidth = (vfIn.getLineStride())/3; //Divide by 3 since each pixel has 3 colours.
imageHeight = ((vfIn.getMaxDataLength())/3)/imageWidth;
imageArea = imageWidth*imageHeight;
int r=0,g=0,b = 0; //Red, green and blue values.
System.arraycopy(inData,0,outData,0,outData.length);
bwPixels = new int[outputDataLength/3] ;
p1=new int[outputDataLength/3];int[] p=new int[outputDataLength/3];
for (int ip = 0; ip < inData.length; ip+=3) {
int bw = 0;
r = (int) inData[ip] ;
g = (int) inData[ip+1] ;
b = (int) inData[ip+2];
bw = (int) ((r + b + g)/ (double) 3);
p1[ip/3]=bw;
return BUFFER_PROCESSED_OK;
public String getName() {
return "Motion Detection Codec";
public void open() {
public void close() {
public void reset() {
public Format matches(Format in, Format outs[]) {
for (int i = 0; i < outs.length; i++) {
if (in.matches(outs[i]))
return outs[i];
return null;
public Object getControl(String controlType) {
System.out.println(controlType);
return null;
public Object[] getControls() {
return null;
byte[] validateByteArraySize(Buffer buffer,int newSize) {
Object objectArray=buffer.getData();
byte[] typedArray;
if (objectArray instanceof byte[]) { // Has correct type and is not null
typedArray=(byte[])objectArray;
if (typedArray.length >= newSize ) { // Has sufficient capacity
return typedArray;
byte[] tempArray=new byte[newSize]; // Reallocate array
System.arraycopy(typedArray,0,tempArray,0,typedArray.length);
typedArray = tempArray;
} else {
typedArray = new byte[newSize];
buffer.setData(typedArray);
return typedArray;
public static void markObject(int x,int y)
marked=true;
xpos=x; ypos=y;
/* int j =0, m=0,n=0;
int total = p1.length; int col = imageWidth; //int row = imageHeight;
int[][] twodim = new int[total/col][col];
System.out.println("p1 arr"+p1.length+","+twodim.length+"col"+col);
for(j=0;j<total;j++)
twodim[n][m] = p1[j];
System.out.print( twodim[n][m]+" ");
m++;
if( m ==col)
m=0; n++;
System.out.println("@"+n);
System.out.println("m"+m+"n"+n);*/
public int markObject()
//System.out.println("boolean mark called");
mark_flg=1;
return mark_flg;
/*****************************************end of mdetect class*****************************************************/
/*********************************** Image Icon class ****************************************************************/
class PictureButton extends JFrame implements MouseMotionListener,MouseListener{
static Image image;Icon icon2;JButton button2=new JButton("hi"); int[] pixels; Container content;
public PictureButton(Image img ) {
super("PictureButton v1.0");
setSize(200, 200);
setLocation(200, 200);
Icon icon = new ImageIcon(img);
JButton button = new JButton(icon);
button.addMouseMotionListener(this);
button.addMouseListener(this);
button.addActionListener(new ActionListener( ) {
public void actionPerformed(ActionEvent ae) {
System.out.println("Urp!");
content = getContentPane( );
content.setLayout(new FlowLayout( ));
content.add(button);
//content.add(button2);
public static void but(Image im) {
image=im;
JFrame f = new PictureButton(im );
f.addWindowListener(new WindowAdapter( ) {
public void windowClosing(WindowEvent we) { System.exit(0); }
f.setVisible(true);
public void mouseMoved(MouseEvent e) {
//saySomething("Mouse moved", e);
public void mouseDragged(MouseEvent e) {
saySomething("Mouse dragged", e);
public void mousePressed(MouseEvent e) {
//saySomething("Mouse pressed; # of clicks: "
// + e.getClickCount(), e);
public void mouseReleased(MouseEvent e) {
//saySomething("Mouse released; # of clicks: "
// + e.getClickCount(), e);
public void mouseEntered(MouseEvent e) {
//saySomething("Mouse entered", e);
public void mouseExited(MouseEvent e) {
//saySomething("Mouse exited", e);
public void mouseClicked(MouseEvent e) {
saySomething("Mouse clicked (# of clicks: "
+ e.getClickCount() + ")", e);
void saySomething(String eventDescription, MouseEvent e) {
int w=0;int ind=0;
System.out.println("The Object is at the point "+"x ,"+e.getX()+ "y" + e.getY());
int[][][] imagePixels = imageIO.loadImage(image);
final int MAXROWS = imagePixels.length;
final int MAXCOLS = imagePixels[0].length;
int[][] PixelArray = new int[MAXROWS][MAXCOLS];
pixels=new int[MAXROWS*MAXCOLS];
int cnt=0;
int pix=0,pix1=0;
for(int row=0; row<imagePixels.length; row++) {
for(int col=0; col<imagePixels[0].length; col++) {
for(int rgbo=0; rgbo<4; rgbo++) {
if((cnt<3)&&(rgbo<3))
w++;
pix=pix+imagePixels[row][col][rgbo];
cnt++;
else
{cnt=0;}
} // for rgbo
pix1 = pix/3;
pix = 0;
/*if(col<97)
{pix1=(byte)192;}*/
PixelArray[row][col] = pix1;
System.out.print(pix1+" ");
} // for col
System.out.println("@");
} // for row
System.out.println("pix arr"+PixelArray.length);
for(int ww=0;ww<MAXROWS;ww++)
for(int hh=0;hh<MAXCOLS;hh++)
pixels[ind++]=PixelArray[ww][hh];
image = createImage (new MemoryImageSource( MAXROWS,MAXCOLS, pixels, 0, MAXROWS));
System.out.println(" img added");
/********************************* end of Image Icon class**********************************************************/
this program will capture the video n play
if u click on the mark button processor will be stopped
u can click on the image and get the mouse co-ordinates
i have also got the pixel values of the current frame at which u had clicked the mark button..do some manipulation on the pixels to get ur stuff work
hope this will help u in some way
regards
sudha -
How To Get The CLOSE Event In a JSP File?
Hello everybody,
Right now I am working in a JSP project which is about access log, when the users start , oprate, or close the system, the access log system works. I am in trouble in that when the users close the system, how can I get the close event?
The JSP file contains the following fields :
Close Window
How to add code to get the CLOSE Event and submit to the service?
And If I hit the "Close Button"(on the right-top of the window), how can I get the CLOSE event, too?
Can anyone tell me?1. Add a hidden field:
<input type="hidden" id="status" value="">2. modify <a href="index.jsp" onclick ="parent.window.close( );">Close Window</a> with <a href="index.jsp" onclick ="closefn();">Close Window</a>3. Add a javascript
<script language="javascript">function closefn(){
document.getElementById('status').value="close";
document.form.action="";
document.form.method="post";
document.form.submit();
parent.window.close( );
}4. Now on the action page get the value of status by request.getParameter("status"); and log it. -
How to catch the mouse event from the JTable cell of the DefaultCellEditor
Hi, my problem is:
I have a JTable with the cells of DefaultCellEditor(JComboBox) and added the mouse listener to JTable. I can catch the mouse event from any editor cell when this cell didn't be focused. However, when I click the editor to select one JComboBox element, all the mouse events were intercepted by the editor.
So, how can I catch the mouse event in this case? In other word, even if I do the operation over the editor, I also need to catch the cursor position.
Any idea will be highly appreciated!
Thanks in advance!Hi, bbritta,
Thanks very much for your help. Really, your code could run well, but my case is to catch the JComboBox event. So, when I change the JTextField as JComboBox, it still fail to catch the event. The following is my code. Could you give me any other suggestion?
Also, any one has a good idea for my problem? I look forward to the right solution to this problem.
Thanks.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test3
extends JFrame {
// JTextField jtf = new JTextField();
Object[] as = {"aa","bb","cc","dd"};
JComboBox box = new JComboBox(as);
public Test3() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = getContentPane();
String[] head = {
"One", "Two", "Three"};
String[][] data = {
"R1-C1", "R1-C2", "R1-C3"}
"R2-C1", "R2-C2", "R2-C3"}
JTable jt = new JTable(data, head);
box.addMouseListener(new MouseAdapter() {
// jtf.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
System.out.println("-------------------JComboBox mouseclick....");
jt.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
System.out.println("-------------------JTable mouseclick....");
// jt.setDefaultEditor(Object.class, new DefaultCellEditor(jtf));
jt.setDefaultEditor(Object.class, new DefaultCellEditor(box));
content.add(new JScrollPane(jt), BorderLayout.CENTER);
setSize(300, 300);
public static void main(String[] args) {
new Test3().setVisible(true);
} -
How to get the mouse drag event ?
I Have a JTextField and I want to move a selected text in the JTextField from a location to another by pressing the mouse on selected text and dragging it to newer
location in the same text field (Same as Microsoft word does).Will u help me out please .But i can't get it working for the same component i.e dragging a text from the JTextField and dropping it in the same text field
will u please help me with the sample code for 1 JTextField.I will really be very thankful to u
Please -
How to get the closing event (not closed) of Dialog control
Hi All,
I have one requirement, that I have to close the Dialog box in an animated way like on clicking of the Dialog close button the popup has to close from top to bottom in a slide effect.
sap.ui.commons.Dialog
When I tried closed method of Dialog, it is calling only after dialog box closed but, I need the closing event rather closed event.
I am putting a UI5 view in Dialog as I need some custom/dynamic content in the dialog.
Please suggest the solution for this.
Thanks & Regards,
Pavan Thirunamala,
[Moderator Message - Please do not provide contact information like Phone Number etc in the discussion message. It has been removed.]
Message was edited by: Chandrashekhar MahajanJS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type="application/jso…
sap.ui.getCore().getEventBus().subscribe("sap.ui","__beforePopupClose",
function(channel, event, params)
debugger;
$(params.domNode).animate({
opacity : 1,
height : 0 -
How to get the mouse's status ?
Hello,
Anybody knows call which API can reach to get mouse's status, not mouse position and click status I want , but its "Normal select" "Busy" "Working in background" etc status. thanks in advance.
and I have made one "GetCurrsor" sample attached, but, it is not well, why the count would change at labVIEW front panel only, if the cursor is out of labVIEW front panel, it is no response. is anything wrong ?
please help to point out.
Attachments:
Get_Cursor.vi 17 KBYup, and I am going to that forums too (LAVA), but I found Gilbert have told us his last concern Clearly.
Try to make everything Automatic -
How to get the cancel event of inlineDocument-style dialog.
Hi experts,
My customer has a question about ADF dialog framework.
When we open new inlineDocument-style dialog from af:commandButtton, how can we get dialog cancel event?
[Sample code]
<af:commandButton id="cb2" action="dialog:test"
windowModalityType="modeless"
text="dialog:test" windowHeight="500"
windowWidth="800"
windowEmbedStyle="inlineDocument"
useWindow="true"/>
When we use af:popup, it has popupCanceledlListener attribute so that we can handle the situation where users click close button or Esc button.
Does dialog have a similar feature?
We can set a returnListener for dialog, but it doesn't work in case users click close button.
Regards,
Atsushiis this what you are looking for [url http://www.oracle.com/technetwork/developer-tools/adf/learnmore/77-ok-cancel-support-in-dialog-351871.pdf]Handling the af:dialog Ok and CANCEL buttons
and [url https://blogs.oracle.com/jdevotnharvest/entry/strategies_for_controlling_the_af]Strategies for controlling the af:popup close event
Edited by: Mohammad Jabr on Apr 27, 2012 11:34 AM -
How to Get the Job, Cost center, Position description using select query
Hi all,
How to get the Job, Cost center, Position description through select query without using the Function module?
thanks,
Prasaduse adhoq query and take the report chose both text and value
-
How to get the values from html:select? tag..?
i tried with this, but its not working...
<html:select styleClass="text" name="querydefs" property="shortcut"
onchange="retrieveOptions()" styleId="firstBox" indexed="true">
<html:options collection="advanced.choices" property="shortcut" labelProperty="label" />
</html:select>
<td align="left" class="rowcolor1">
<script language="javascript" type="text/javascript">
function retrieveOptions(){
var sel = document.querydefs.options;
var selectedOption = sel[sel.selectedIndex].value;
document.write(selectedOption);
</script><td align="left" class="rowcolor1">
<script language="javascript" type="text/javascript">
function retrieveOptions(){
var sel = document.querydefs.options;
var selectedOption = sel[sel.selectedIndex].value;
document.write(selectedOption);
</script>This java script is not working at all..its not printing anything in document.write();
This is code..
<td class="rowcolor1" width="20%">
<html:select styleClass="text" name="querydefs" property="shortcut"
onchange="retrieveSecondOptions()" styleId="firstBox"
indexed="true">
<html:options collection="advanced.choices" property="shortcut"
labelProperty="label" />
</html:select>i tried with this also. but no use..i'm not the getting the seleced option...
function retrieveOptions(){
firstBox = document.getElementById('firstBox');
if(firstBox.selectedIndex==0){
return;
selectedOption = firstBox.options[firstBox.selectedIndex].value;
}actually , how to get the values from <html:select> ...?
my idea is to know which value is selected from the combo box(<html:select> ) if that value is equal some string i have enable a hyperlink to open a popup window -
How to get the selected values from the shuttle
Hi
Please tell me how to get the selected option values from the shuttle leading list.
Thanksyou can also obtain the option values present in the leading and trailing lists using the
following methods:
public String[] getLeadingListOptionValues(OAPageContext pageContext, OAWebBean
webBean)
public String[] getTrailingListOptionValues(OAPageContext pageContext, OAWebBean
webBean)For example, the following code sample returns an array of values in the trailing list, ordered according to the
order in which they appear in the list:
String[] trailingItems =
shuttle.getTrailingListOptionValues(pageContext, shuttle);Thanks
--Anil -
How to get the selected values from a selectmanylistbox?
Hi ADF Experts,
<af:selectManyListbox label="Label 1" id="sml1" partialTriggers="cb2"
value="#{viewScope.TestBean.lovValue}"
autoSubmit="true" valuePassThru="true">
<f:selectItems value="#{viewScope.TestBean.actualList}" id="si1"
binding="#{viewScope.TestBean.selectedItems}"/>
</af:selectManyListbox>
<af:commandButton text="get selected values" id="cb3"
actionListener="#{viewScope.TestBean.getSelectedValues}"
partialSubmit="true"/>
private List<String> lovValue;
private List<SelectItem> actualList;
//getters and setters
public void getSelectedValues(ActionEvent actionEvent) {
// Add event code here...
for (String selectedItem : lovValue) {
System.out.println("Selected item: " +selectedItem.); // this is giving 1 and 3 like this. how to get the checked values as I'm getting only the indexes. In this scenario I am populating the list programmatically.Just I wanted to know how can we get the selected values(not indexes). Please suggest.
Thanks-
AbhijitHi Timo,
As I am sharing the page fragment and the Java class. So its my usecase I have mentioned below
I am sharing the jsff page fragment and java class. So that it wud be of help to others.
jsff page fragment
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:f="http://java.sun.com/jsf/core">
<af:panelGroupLayout id="pgl1">
<af:commandButton text="Search" id="cb1"
actionListener="#{viewScope.TestBean.searchSupplier}"/>
</af:panelGroupLayout>
<af:popup id="p1" binding="#{viewScope.TestBean.searchSupplierPopup}">
<af:dialog id="d2"
type="none">
<af:table value="#{bindings.Contacts.collectionModel}" var="row"
rows="#{bindings.Contacts.rangeSize}"
emptyText="#{bindings.Contacts.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.Contacts.rangeSize}"
rowBandingInterval="0"
binding="#{viewScope.TestBean.tsupportIssues}"
filterModel="#{bindings.ContactsQuery.queryDescriptor}"
queryListener="#{bindings.ContactsQuery.processQuery}"
filterVisible="true" varStatus="vs"
selectionListener="#{bindings.Contacts.collectionModel.makeCurrent}"
rowSelection="multiple" id="t1">
<af:column sortProperty="name" filterable="true" sortable="true"
headerText="#{bindings.Contacts.hints.name.label}" id="c2">
<af:outputText value="#{row.name}" id="ot1"/>
</af:column>
<af:column sortProperty="email" filterable="true" sortable="true"
headerText="#{bindings.Contacts.hints.email.label}"
id="c1">
<af:outputText value="#{row.email}" id="ot2"/>
</af:column>
</af:table>
<af:commandButton text="OK" id="cb5" partialSubmit="true" actionListener="#{viewScope.TestBean.testMethod}"/>
<af:commandButton text="Cancel" id="cb6"
actionListener="#{viewScope.TestBean.cancelPopupSearch}"/>
</af:dialog>
</af:popup>
<af:selectManyListbox label="Label 1" id="sml1" partialTriggers="cb5"
value="#{viewScope.TestBean.lovValue}"
autoSubmit="true" valuePassThru="true"
binding="#{viewScope.TestBean.prp1}">
<f:selectItems value="#{viewScope.TestBean.actualList}" id="si1"
binding="#{viewScope.TestBean.selectedItems}"/>
</af:selectManyListbox>
<af:commandButton text="get selected values" id="cb3"
actionListener="#{viewScope.TestBean.getSelectedValues}"
partialSubmit="true"/>
<af:commandButton text="remove selected" id="cb4"
partialSubmit="true" actionListener="#{viewScope.TestBean.removeSelectedValues}"/>
</jsp:root>
TestBean.java
package com.demo.view;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.faces.component.UISelectItems;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.component.rich.input.RichSelectManyListbox;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.adf.view.rich.event.DialogEvent;
import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;
import org.apache.myfaces.trinidad.model.RowKeySet;
public class TestBean {
private RichTable tsupportIssues;
private List<SelectItem> lovValue;
private List<SelectItem> actualList;
private RichSelectManyListbox prp1;
private List valuesChoosed = new ArrayList();
private UISelectItems selectedItems;
private RichPopup searchSupplierPopup;
public TestBean() {
super();
public void setTsupportIssues(RichTable tsupportIssues) {
this.tsupportIssues = tsupportIssues;
public RichTable getTsupportIssues() {
return tsupportIssues;
public void testMethod(ActionEvent actionEvent) {
// Add event code here...
// For learning purposes - show Select Many Button clicked
System.out.println("Select Many Button has been Clicked");
// // RowKeySet Object can hold the selected rows from a user as follows
RowKeySet rksSelectedRows = this.getTsupportIssues().getSelectedRowKeys();
// Iterator object provides the ability to use hasNext(), next() and remove() against the selected rows
Iterator itrSelectedRows = rksSelectedRows.iterator();
// Get the data control that is bound to the table - e.g.
// OpenSupportItemsIterator
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dcIteratorBindings = bindings.findIteratorBinding("findAllContactsIterator");
// Information from binding that is specific to the rows
RowSetIterator rsiSelectedRows = dcIteratorBindings.getRowSetIterator();
// Loop through selected rows
int i=1;
while (itrSelectedRows.hasNext()) {
// Get key for selected row
Key key = (Key)((List)itrSelectedRows.next()).get(0);
// Use the key to get the data from the above binding that is related to the row
Row myRow = rsiSelectedRows.getRow(key);
// Display attribute of row in console output - would generally be bound to a UI component like a Label and or used to call another proces
System.out.println(myRow.getAttribute("name"));
valuesChoosed.add(myRow.getAttribute("name"));
// actualList = new ArrayList<SelectItem>();
// String j = Integer.toString(i);
// actualList.add(new SelectItem(j, (String)myRow.getAttribute("name")));
// i++;
searchSupplierPopup.hide();
AdfFacesContext.getCurrentInstance().addPartialTarget(prp1);
public void setLovValue(List<SelectItem> lovValue) {
this.lovValue = lovValue;
public List<SelectItem> getLovValue() {
return lovValue;
public void setActualList(List<SelectItem> actualList) {
this.actualList = actualList;
public List<SelectItem> getActualList() {
actualList = new ArrayList<SelectItem>();
if(valuesChoosed.size()!=0){
for(int i=0;i<valuesChoosed.size();i++){
actualList.add(new SelectItem(valuesChoosed.get(i), (String)valuesChoosed.get(i)));
else{
actualList.add(new SelectItem("1","Select One"));
return actualList;
public void setPrp1(RichSelectManyListbox prp1) {
this.prp1 = prp1;
public RichSelectManyListbox getPrp1() {
return prp1;
public void setValuesChoosed(List valuesChoosed) {
this.valuesChoosed = valuesChoosed;
public List getValuesChoosed() {
return valuesChoosed;
public void getValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<valuesChoosed.size();i++){
System.out.println(valuesChoosed.get(i));
public void getSelectedValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<this.getLovValue().size();i++){
System.out.println("Selected Value:"+this.getLovValue().get(i));
public void removeSelectedValues(ActionEvent actionEvent) {
// Add event code here...
public void setSelectedItems(UISelectItems selectedItems) {
this.selectedItems = selectedItems;
public UISelectItems getSelectedItems() {
return selectedItems;
public void setSearchSupplierPopup(RichPopup searchSupplierPopup) {
this.searchSupplierPopup = searchSupplierPopup;
public RichPopup getSearchSupplierPopup() {
return searchSupplierPopup;
public void cancelPopupSearch(ActionEvent actionEvent) {
// Add event code here...
searchSupplierPopup.hide();
public void searchSupplier(ActionEvent actionEvent) {
// Add event code here...
RichPopup.PopupHints hints = new RichPopup.PopupHints();
searchSupplierPopup.show(hints);
package com.demo.view;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.faces.component.UISelectItems;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.component.rich.input.RichSelectManyListbox;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.adf.view.rich.event.DialogEvent;
import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;
import org.apache.myfaces.trinidad.model.RowKeySet;
public class TestBean {
private RichTable tsupportIssues;
private List<SelectItem> lovValue;
private List<SelectItem> actualList;
private RichSelectManyListbox prp1;
private List valuesChoosed = new ArrayList();
private UISelectItems selectedItems;
private RichPopup searchSupplierPopup;
public TestBean() {
super();
public void setTsupportIssues(RichTable tsupportIssues) {
this.tsupportIssues = tsupportIssues;
public RichTable getTsupportIssues() {
return tsupportIssues;
public void testMethod(ActionEvent actionEvent) {
// Add event code here...
// For learning purposes - show Select Many Button clicked
System.out.println("Select Many Button has been Clicked");
// // RowKeySet Object can hold the selected rows from a user as follows
RowKeySet rksSelectedRows = this.getTsupportIssues().getSelectedRowKeys();
// Iterator object provides the ability to use hasNext(), next() and remove() against the selected rows
Iterator itrSelectedRows = rksSelectedRows.iterator();
// Get the data control that is bound to the table - e.g.
// OpenSupportItemsIterator
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dcIteratorBindings = bindings.findIteratorBinding("findAllContactsIterator");
// Information from binding that is specific to the rows
RowSetIterator rsiSelectedRows = dcIteratorBindings.getRowSetIterator();
// Loop through selected rows
int i=1;
while (itrSelectedRows.hasNext()) {
// Get key for selected row
Key key = (Key)((List)itrSelectedRows.next()).get(0);
// Use the key to get the data from the above binding that is related to the row
Row myRow = rsiSelectedRows.getRow(key);
// Display attribute of row in console output - would generally be bound to a UI component like a Label and or used to call another proces
System.out.println(myRow.getAttribute("name"));
valuesChoosed.add(myRow.getAttribute("name"));
// actualList = new ArrayList<SelectItem>();
// String j = Integer.toString(i);
// actualList.add(new SelectItem(j, (String)myRow.getAttribute("name")));
// i++;
searchSupplierPopup.hide();
AdfFacesContext.getCurrentInstance().addPartialTarget(prp1);
public void setLovValue(List<SelectItem> lovValue) {
this.lovValue = lovValue;
public List<SelectItem> getLovValue() {
return lovValue;
public void setActualList(List<SelectItem> actualList) {
this.actualList = actualList;
public List<SelectItem> getActualList() {
actualList = new ArrayList<SelectItem>();
if(valuesChoosed.size()!=0){
for(int i=0;i<valuesChoosed.size();i++){
actualList.add(new SelectItem(valuesChoosed.get(i), (String)valuesChoosed.get(i)));
else{
actualList.add(new SelectItem("1","Select One"));
return actualList;
public void setPrp1(RichSelectManyListbox prp1) {
this.prp1 = prp1;
public RichSelectManyListbox getPrp1() {
return prp1;
public void setValuesChoosed(List valuesChoosed) {
this.valuesChoosed = valuesChoosed;
public List getValuesChoosed() {
return valuesChoosed;
public void getValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<valuesChoosed.size();i++){
System.out.println(valuesChoosed.get(i));
public void getSelectedValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<this.getLovValue().size();i++){
System.out.println("Selected Value:"+this.getLovValue().get(i));
public void removeSelectedValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<this.getLovValue().size();i++){
System.out.println("Selected Value:"+this.getLovValue().get(i));
System.out.println(this.getLovValue().remove(i));
AdfFacesContext.getCurrentInstance().addPartialTarget(prp1);
public void setSelectedItems(UISelectItems selectedItems) {
this.selectedItems = selectedItems;
public UISelectItems getSelectedItems() {
return selectedItems;
public void setSearchSupplierPopup(RichPopup searchSupplierPopup) {
this.searchSupplierPopup = searchSupplierPopup;
public RichPopup getSearchSupplierPopup() {
return searchSupplierPopup;
public void cancelPopupSearch(ActionEvent actionEvent) {
// Add event code here...
searchSupplierPopup.hide();
public void searchSupplier(ActionEvent actionEvent) {
// Add event code here...
RichPopup.PopupHints hints = new RichPopup.PopupHints();
searchSupplierPopup.show(hints);
Thanks,
A. Abhijit -
How to get the values of Select-options from the screen.
The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.
Hi,
Refer this following code..this will solve your problem...
"Following code reads value entered in s_po select options and willprovide search
"help for s_item depending upon s_po value.
REPORT TEST.
TABLES : ekpo.
DATA: BEGIN OF itab OCCURS 0,
ebelp LIKE ekpo-ebelp,
END OF itab.
SELECT-OPTIONS s_po FOR ekpo-ebeln.
SELECT-OPTIONS s_item FOR ekpo-ebelp.
INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
DATA:
dyn_field TYPE dynpread,
temp_fields TYPE TABLE OF dynpread,
zlv_dynpro TYPE syst-repid.
zlv_dynpro = syst-repid.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = zlv_dynpro
dynumb = syst-dynnr
request = 'A'
TABLES
dynpfields = temp_fields
EXCEPTIONS
OTHERS = 0.
LOOP AT temp_fields INTO dyn_field.
IF dyn_field-fieldname EQ 'S_PO-LOW'.
SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
WHERE ebeln EQ dyn_field-fieldvalue.
EXIT.
ENDIF.
ENDLOOP.
Maybe you are looking for
-
Open Hub - Header in flat file
Hi there Experts. I am working with a opeb Hub destination, and so far everything has been straight forward. But i need to include headers in the first line of the file. By default the Open Hub i generating a Control File, so it is possible to look i
-
Outlook 2010 Under Windows XP Requests Authentication After Each Launch
We are working on installing a new Exchange 2013 environment. Exchange 2013 SP1 Standard has been installed and then upgraded to CU7. It is a single box for the CAS and MB roles. It is running Windows Server 2012 R2. The domain and forest are in 200
-
HT1807 non 3 g iPad 2 in St Lucia how to connect wifi
how does the iPad 2 work in Caribbean does non 3 g have to be operated in any particular way?
-
How do I get my contacts on my imac to show up in iCloud?
I just upgraded to Lion. I have a 2008 imac. My contacts on my computer have not synced with icloud.com. Also, when I add contacts via the webstie, they show up as a different group in address book on my computer. Preferrably, I'd like all my con
-
please help