X Y Mouse Click Coordinates in the Request Map?

I have a mapping application that layers several images with a clickable top layer. When I wrap the top image in a command link I don't get the x and y coordinates of the mouse click in the request map. So I've had to use a regular command button with an image property. This works fine but doesn't allow me to use partial page rendering to limit the refresh of particular images in the stack. Can the x,y coordinate of the mouse click be returned with straight ADF?
(I"ve included the code for retreiving the x and y coordinates under the jspx code)
<af:panelGroup type="vertical">
<af:objectImage source="#{backing_collect2.activeSource}"/>
<af:objectImage source="#{backing_collect2.baseSource}"
inlineStyle="position:absolute;left:0px;top:0px"
binding="#{backing_collect2.baseImage}"/>
<af:objectImage source="#{backing_collect2.allPointSource}"
inlineStyle="position:absolute;left:0px;top:0px"
binding="#{backing_collect2.allPointImage}"/>
<af:objectImage source="#{backing_collect2.userPointSource}"
inlineStyle="position:absolute;left:0px;top:0px"
binding="#{backing_collect2.userPointImage}"/>
<af:objectImage source="#{backing_collect2.activePointSource}"
inlineStyle="position:absolute;left:0px;top:0px"
binding="#{backing_collect2.activePointImage}"/>
This following fails to return x and y in the request Map, imageMapType="server"
attr on objectImage does not help
<af:commandLink actionListener="#{backing_collect2.processClick}"
action="#{backing_collect2.collectAction}"
inlineStyle="position:absolute;left:0px;top:0px">
<af:objectImage source="#{backing_collect2.activeSource}"
inlineStyle="position:absolute;left:0px;top:0px"/>
</af:commandLink>
I have to use the following regular command button to get x, y click coordinates in the request map. But using this component makes its impossible to use partial page rendering to limit refreshes of the images above.
<h:commandButton image="#{backing_collect2.activeSource}"
binding="#{backing_collect2.activeLayer}"
actionListener="#{backing_collect2.processClick}"
action="#{backing_collect2.collectAction}"
style="position:absolute;left:0px;top:0px"/>
</af:panelGroup>
// Code to get x and y from the request map
visit.setLastClickPoint(visit.getClickPoint());
FacesContext fc = FacesContext.getCurrentInstance();
String clientId = actionEvent.getComponent().getClientId(fc);
java.util.Map requestParams = fc.getExternalContext().getRequestParameterMap();
String xString =(String) requestParams.get((String)clientId + ".x");
String yString =(String) requestParams.get((String)clientId + ".y");
int xMouse = (new Integer(xString)).intValue();
int yMouse = (new Integer(yString)).intValue();

Should have added that I'm using EA14

Similar Messages

  • Getting mouse click coordinates with image button

    I'm using ADF Rich Client components in JDeveloper 11g Technology preview.
    I have to get the mouse click coordinates with an image button. In the page I put something like this:
    <af:commandButton text="commandButton1" icon="ambiente.jpg"
    actionListener="#{prova.listen}" action="#{prova.esegui}" />
    In the listener method of the managed bean I try to get the coordinates with this code:
    public void listen(ActionEvent e)
    FacesContext context = FacesContext.getCurrentInstance();
    String clientId = e.getComponent().getClientId(context);
    Map requestParams =
    context.getExternalContext().getRequestParameterMap();
    int x =
    new Integer((String) requestParams.get(clientId + ".x")).intValue();
    int y =
    new Integer((String) requestParams.get(clientId + ".y")).intValue();
    but it doesn't work. It seems that there aren't in the request the coordinates of the image point clicked. Is it true? How can I do that with ADF ?

    Hi,
    the mouse position is not part of the request parameters send. You will have to use client side JavaScript for this
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document>
    <f:verbatim>
    <![CDATA[
    <script>
    function handleMouseCoordinates(event) {      
    alert("x: "+event.getPageX()+" y: "+event.getPageY());
    </script>
    ]]>
    </f:verbatim>
    <af:form>
    <af:commandButton text="My Click Button" icon="/images/jdev_cup.gif">
    <af:clientListener method="handleMouseCoordinates" type="click"/>
    </af:commandButton>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    Frank

  • Using Firefox 3.6 after a few mouse click/ keyboard input the firefox window is no more active, mouse click and keyboard input is inactive ; then I click on the taskbar and the keyboard is active again during a few click then it stops again etc.

    Using Firefox 3.6 after a few mouse click/ keyboard input the firefox window is no more active, mouse click and keyboard input is inactive ;
    to solve it I click on the taskbar and the keyboard is active again during a few click then it does not work any more and I click again on the task bar etc.
    after several repetitions, I have to call the task manager alt+del+ctrl, then come back to the firefox window to be able to use keyboard and mouse again

    Attaching the picture for the tab shape I want...

  • Mouse Click Coordinates

    Hi,
    The question I have is this:
    How can I translate the X and Y of a mouse click to the 3D environment? For example, when I click and print out the X and Y, I get coordinates relative to the world (ie. X=213, y= 512). If I wanted to say, click somewhere and have all the rectangles on the screen move to the location of the click, how would I accomplish that?
    Thanks in advance,
    threeFiddy

    Hi,
    there are classes which will translate coordinates from Canvas to World. But before you translate anything, you need a concept, how to handle the third Dimension.
    This task is discussed in the pdf documentation on http://java.sun.com/products/java-media/3D/collateral/ part 4 chapter 4.6 Picking.
    Regards,
    Oliver

  • Inappropriate mouse event coordinates in the WebKit of HTMLLoader/StageWebView

    Hi,
    We have a desktp application which incorporates an HTMLRichTextEditor (implemented in HTML/JS and loaded into AIR).
    We have run into a big problem with text selection though. It seems that the both the HTMLLoader and the StageWebView are passing wrong mouse coordinates to the WebKit when the cursor is outside of the component.
    I've created a sample application which uses mx:HTML (which is a wrapper of the HTMLLoader) and a WebView class (a wrapper aroun StageWebView reference to which is given here).
    The application is located here in Dropbox. The source code of the app is here.
    The app was built with Flex 4.6 and ran in AIR 3.7
    The sample app has a WebView which loads loremipsum and HTML loading some dummy local HTML page. The HTML page uses the JS->AIR bridge to report the mouseevents to a function in AIR. In the snapshot below the selection was started from the first row and then slowly continued to the left. As soon as it reaches the green area the selection changes unexpectably. As it can be seen in the bottom right -> the WebKit has received a mouse event with incorrect coordinates. The reported mouse coordinates seem to be the mouse coordinates within the green component and the selection behaves like that. If the mouse is moved to the blue - the selection changes again (according to the coordinates in the blue area).
    The component which uses the StageWebView behaves in absolutely the same way.
    I'd assume that I have to post a bug but I decided to post here at first.
    I've tried a few workarounds in order to stop and ongoing selection or to change it's behaviour but none of them with any relevant success. Even disabling mouse children for the entire application has no effect on the selection once it's started.
    Any help and/or comments would be much appreciated.
    Thanks !

    Thank you for the heads up.  Do you know if this is a recent change in behavior with AIR (ie. does this occur in previous versions)?  Regardless, could you please open a new bug report on this over at bugbase.adobe.com? 
    Once added, please post back with the URL so that others affected can add their comments and votes and I can follow up internally.
     

  • How do I globally uncheck the property "mouse click sounds" under the captions section

    I am doing software simulation and it produces a large number of slides. I want to remove the mouse click sounds. Is there another way to do that other than
    select each and every slide and uncheck the "Mouse Click Sound" checkbox?
    Adobe you need to provide that option in preferences!

    So I tried it...here are the screen shot. I do have the updated Captivate 7....So you can see they are selected and I used the timeline to bring up the mouse clicks box.
    I then unchecked the the 'Mouse Click Box'
    I clicked on the slide...and this may be where it goes wrong. I did try to exit by hitting Enter, but that didn't work. I had to click somewhere on the project.
    Here you can see that slide 2 has the "Mouse Click Sound" box still checked.
    Sweet dreams to all ....it can wait until Monday, unless anyone else who is not sleeping wants to chime in

  • I can't access Bing Maps on this desktop computer. Bing comes up with the search function. A thumbnail map will come up in search results, but when I click to get the large map, I get a blank screen. The left sidebbar is there, just not the map image.

    This began happening a few weeks ago. At first, I could click the thumbnail map, and it would bring up the large map. Now, all I get is a blank page.

    Your dsplay is getting extended onto the external monitor. Chcnage the setting to duplicate it or only display on the external monitor and you should be fine,
    Let me know if this worked for you.

  • How to prevent middle mouse click to move the cursor but still poaste the clipboard ?

    This is a linux only issue.
    When i'm typing a text editing box, i use the select text/middle click gesture to copy/paste text.
    But the middle click not only paste the selected text but move the cursor at the actual mouse position before.
    I don't want this behavior, because :
    1. I work a lot with vim, where you don't mouve the cursor using the mouse, so i must change my habit when i'm using firefox.
    2. When i middle click, event if i put the mouse in the right place, i might mouve it a bit and the text will be pasted on the wrong place
    I've been looking in the about:config and the only related option is
    middlemouse.paste;
    If i put it to false, the middle click button does not mouve the cursor, nor does it paste.
    Any idea how to achieve that ?

    I do not find the cursor moving on me if I use middle-click to paste text or url that is in that I highlighted into clipboard. Whether I used my Logitech MX510 or the T-CH!!/T-CL13 trackballs that I use now.
    The right-click and copy selection then right-click and paste to paste contents where Caret is method can be more precise though.
    '''FredMcD''', if you have not used Linux then maybe you should not be replying to questions that are Linux specific. Same with Mac OSX.

  • Follow an object (mouse click) without decreasing the speed

    hello,
    i want to make a movie clip follow the mouse while we are pressing the left Button (NOT "be" the mouse ), i end it up with this code but am having a problem,
    -the speed of the movie clip decrase by his own, i know that this is happening because of the last two lines, i will be glad if anyone could help me to solve this problem, thanx
    onClipEvent (enterFrame) {
              onMouseUp = function ()
                        apui = false;
              onMouseDown = function ()
                        apui = true;
                        rotateSpeed = 3;
              if (apui == true)
                        goX = _root._xmouse;
                        goY = _root._ymouse;
              else if (apui == false)
                        goX = this._x;
                        goY = this._y;
              this._x -= (this._x - this.goX)/20 ;
              this._y -= (this._y - this.goY)/20 ;

    thank you, this is solved the speed issue, now i had one last problem, the rotation,
    1st let me know if i had to close this discussion and start another one cause i found what i was looking for .
    but maybe i can ask about it here,
    so here is the rotation issue,
    first here is my rotation code
    function rotateTowards(clip, targetX, targetY)
              var clipPoint = {x:clip._x, y:clip._y};
              clip._parent.localToGlobal(clipPoint);
              var deltaX = targetX - clipPoint.x;
              var deltaY = targetY - clipPoint.y;
              var rotationRadian = Math.atan2(deltaY, deltaX);
              var rotationAngle = radiansToDegrees(rotationRadian);
              clip._rotation -= (clip._rotation-rotationAngle)/8;
    function radiansToDegrees(radians)
              return (radians / Math.PI) * 180;
    and i have this code on my car movieClip
    onClipEvent (load) {
              rotateSpeed = 3;
    onClipEvent (enterFrame) {
              onMouseUp = function ()
                        apui = false;
              onMouseDown = function ()
                        apui = true;
                        rotateSpeed = 3;
              if (apui == true)
                        goX = _root._xmouse;
                        goY = _root._ymouse;
                        rotX = _root._xmouse;
                        rotY = _root._ymouse;
                        _root.rotateTowards(this,rotX,rotY);
              else if (apui == false)
                        goX = this._x;
                        goY = this._y;
              _root.destination_mc._x = goX;
              _root.destination_mc._y = goY;
              this._x -= (this._x - this.goX) / 15;
              this._y -= (this._y - this.goY) / 15;
    my problem is to make the rotation more "realistic" for example if we choose to go to the opposit direction i need the car to rollback then make a 1/2 turn then go tward the point
    thank you

  • Write a program that draws a line from one mouse click spot to the next.

    WHERE AM I GOING WRONG?
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.awt.geom.*;
    public class Week8Lab extends Applet implements MouseListener
         private int[] x;
         private int[] y;
         private int count;
         public void init()
              x = new int[10];
              y = new int[10];
              count = 0;
              this.addMouseListener(this);
         public void paint(Graphics g)
              for(int i = 0; i < 10; i++)
                   g.drawLine(x[0], y[0], x[i]+1, y[i]+1);               
         public void mouseEntered(MouseEvent e) {}
         public void mouseExited(MouseEvent e) {}
         public void mousePressed(MouseEvent e)
              x[count % 10] = e.getX();
              y[count % 10] = e.getY();     
              count++;
              repaint();
    System.out.println ("Mouse X =" + e.getX() + "Mouse Y =" + e.getY());
         public void mouseReleased(MouseEvent e) {}
         public void mouseClicked(MouseEvent e) {}
    WHERE AM I GOING WRONG?

    Try this:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class Week8Lab extends JFrame implements MouseListener {
         private int lastX = -1;
         private int lastY = -1;     
         private int newX = 0;
         private int newY = 0;     
         public Week8Lab(){
              this.addMouseListener(this);
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
         public void paint(Graphics g){
              if(lastX < 1){
                   lastX = newX;
                   lastY = newY;
                   return;
              g.drawLine(lastX, lastY, newX, newY);
              lastX = newX;
              lastY = newY;
         public void mouseEntered(MouseEvent e) {}
         public void mouseExited(MouseEvent e) {}
         public void mousePressed(MouseEvent e){
              newX = e.getX();
              newY = e.getY();
              repaint();
         public void mouseReleased(MouseEvent e) {}
         public void mouseClicked(MouseEvent e) {}
         public static void main(String[] args){
              JFrame fr = new Week8Lab();
              fr.setSize(300, 300);
              fr.setVisible(true);
    }

  • Open topics by double-clicking them in the DITA map - not working any more?

    Hi all,
    I just noticed when I double-click a topicref in a DITA map in FM12 then the referenced topic does not open any more. I checked the problem with several maps. Is this a bug/feature or do I need to activate this function somewhere in the options?
    Robert

    Hi Robert...
    When you say that you need "variations" from the normal topic type .. are those structural variations or just formatting? FM associates structure apps with XML files based on the doctype (root element). If your files all have the same root element, then they will all open with the same structure application (unless you specify a different one when opening the file or by importing a new EDD). It sounds like you really should be creating a specialization for each alternate topic type. If you don't, you'll end up getting the wrong "model" assigned to the wrong file.
    Multiple EDDs (structure apps) can share the same DTD, and one EDD (structure app) can support multiple models. This is how the "ditabase" app works. There are lots of ways to set this up, but I think what you've done is probably not quite right.
    The default structure app setup in FM11 and FM12 is very complicated to work with. I recommend creating a single app that supports many models. This isn't always possible, but it sounds like in your case it should be. I've set up one app that supports 13 different specialized topic models and it works fine.
    Note that even though you've added structure apps for each model, if you end up opening the files using the default template, you are no longer using those modified models.
    Sorry, but this is a bit more than can be dealt with appropriately in a forum post. If you'd like more help with this, feel free to contact me off list.
    Cheers,
    …scott
    Scott Prentice
    Leximation, Inc.
    www.leximation.com

  • At runtime, can it be determined if multiple overlapping objects/layers exist beneath a mouse click?

    Hi folks - total nube here. I am trying to find out whether I can determine if multiple objects exist beneath a usr's mouse click coordinates. The objects will be either shaded areas under a LineSeries in a chart or possibly overlayed images representing such areas (not sure which approach would be better). I know that I can probably determine alebraically whether the coordinates selected b a mouse click belong under one series or another or multiple and if this is the best option, then I will proceed with it. But possibly, there is a way for me to determine whether a shaded area under a series or a grpahical element exists under those coordinates. Any hints? Thanks in advance.

    Yes, export it for your reference first. make it delete and create new one.
    hope it should work fine.
    thx
    Deep

  • Is there any easy way to move the cursor in a plot by just a mouse click?

    Right now I have to click at the cursor and drag it to the right position. I was wondering if there is an easy way to just do the mouse click to change the cursor (not dragging the cursor). I have only one cursor in the graph.

    Assuming that if you click the cursor that you want it to always move to the same position, I think that you could do what you want by calling the cursor's SetPosition method in the graph's CursorMouseDown event.
    - Elton

  • Multiple Buttons in JTable Headers:  Listening for Mouse Clicks

    I am writing a table which has table headers that contain multiple buttons. For the header cells, I am using a custom cell renderer which extends JPanel. A JLabel and JButtons are added to the JPanel.
    Unfortunately, the buttons do not do anything. (Clicking in the area of a button doesn't appear to have any effect; the button doesn't appear to be pressed.)
    Looking through the archives, I read a suggestion that the way to solve this problem is to listen for mouse clicks on the table header and then determine whether the mouse clicks fall in the area of the button. However, I cannot seem to get coordinates for the button that match the coordinates I see for mouse clicks.
    The coordinates for mouse clicks seem to be relative to the top left corner of the table header (which would match the specification for mouse listeners). I haven't figured out how to get corresponding coordinates for the button. The coordinates returned by JButton.getBounds() seem to be relative to the top left corner of the panel. I hoped I could just add those to the coordinates for the panel to get coordinates relative to the table header, but JPanel.getBounds() gives me negative numbers for x and y (?!?). JPanel.getLocation() gives me the same negative numbers. When I tried JPanel.getLocationOnScreen(), I get an IllegalComponentStateException:
    Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
    Can someone tell me how to get coordinates for the button on the JTableHeader? Or is there an easier way to do this (some way to make the buttons actually work so I can just use an ActionListener like I normally would)?
    Here is relevant code:
    public class MyTableHeaderRenderer extends JPanel implements TableCellRenderer {
    public MyTableHeaderRenderer() {
      setOpaque(true);
      // ... set colors...
      setBorder(UIManager.getBorder("TableHeader.cellBorder"));
      setLayout(new FlowLayout(FlowLayout.LEADING));
      setAlignmentY(Component.CENTER_ALIGNMENT);
    public Component getTableCellRendererComponent(JTable table,
                                                     Object value,
                                                     boolean isSelected,
                                                     boolean hasFocus,
                                                     int row,
                                                     int column){
      if (table != null){
        removeAll();
        String valueString = (value == null) ? "" : value.toString();
        add(new JLabel(valueString));
        Insets zeroInsets = new Insets(0, 0, 0, 0);
        final JButton sortAscendingButton = new JButton("1");
        sortAscendingButton.setMargin(zeroInsets);
        table.getTableHeader().addMouseListener(new MouseAdapter(){
          public void mouseClicked(MouseEvent e) {
            Rectangle buttonBounds = sortAscendingButton.getBounds();
            Rectangle panelBounds = MyTableHeaderRenderer.this.getBounds();
            System.out.println(Revising based on (" + panelBounds.x + ", "
                               + panelBounds.y + ")...");
            buttonBounds.translate(panelBounds.x, panelBounds.y);
            if (buttonBounds.contains(e.getX(), e.getY())){  // The click was on this button.
              System.out.println("Calling sortAscending...");
              ((MyTableModel) table.getModel()).sortAscending(column);
            else{
              System.out.println("(" + e.getX() + ", " + e.getY() + ") is not within "
                                 + sortAscendingButton.getBounds() + " [ revised to " + buttonBounds + "].");
        sortAscendingButton.setEnabled(true);
        add(sortAscendingButton);
        JButton button2 = new JButton("2");
        button2.setMargin(zeroInsets);
        add(button2);
        //etc
      return this;
    }

    I found a solution to this: It's the getHeaderRect method in class JTableHeader.
    table.getTableHeader().addMouseListener(new MouseAdapter(){
      public void mouseClicked(MouseEvent e) {
        Rectangle panelBounds = table.getTableHeader().getHeaderRect(column);
        Rectangle buttonBounds = sortAscendingButton.getBounds();
        buttonBounds.translate(panelBounds.x, panelBounds.y);
        if (buttonBounds.contains(e.getX(), e.getY()) && processedEvents.add(e)){  // The click was on this button.
          ((MyTableModel) table.getModel()).sortAscending(column);
    });

  • Mouse click point is not accurate

    Has anyone ever had an issue with the mouse click coordinates not being accurate? For example, when I click on my canvas with the Rectangular Selection Tool, the point being clicked is actually 10 pixels below where the mouse is pointing! It causes much unnecessary headache...
    Thanks for reading!

    How about giving some relevant information (see link)?
    How To Get Help Quickly!
    If you work on CS4 you could rotate through the Screen Modes (hit F three times) to correct the issue, which occurs when opening or creating a file in Full Screen Mode.

Maybe you are looking for