1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    8
    Vote Rating
    0
    Shark107 is on a distinguished road

      0  

    Default Unanswered: How to change the position of Info.display ?

    Unanswered: How to change the position of Info.display ?


    Hello

    I need to change the position of the Info.display popup: I need it on the bottom right, instead of on top. Can you please show me how to? Thanks in advance!

  2. #2
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    Yea, it looks like you'll need to extend Info and override the position() method. I don't think you'll need to touch the onShowInfo() method.

    Basically, you're going to need to change the behavior so it "stacks" upwards from the bottom right instead of downwards from the upper right.

    The good thing is, you can do this in a sandbox in debug mode and test your changes pretty quickly.

  3. #3
    Sencha User
    Join Date
    Mar 2013
    Posts
    8
    Vote Rating
    0
    Shark107 is on a distinguished road

      0  

    Default


    Thanks for the answer! That's exactly what I tried to do, but ( and I assume this is my fault, that's pure Java ) I cannot access the private attribute slots of the method
    How can I achieve that? Thanks for your time and sorry for my partial ignorance about Java

    EDIT:

    that's the method

    Code:
      protected Point position() {    Size s = XDOM.getViewportSize();
        int left = s.getWidth() - config.getWidth() - 10 + XDOM.getBodyScrollLeft();
    
    
        int top = 10;
    
    
        if (slots.size() > 0) {
          Info bottom = slots.peek();
          top = bottom.getAbsoluteTop() + bottom.getOffsetHeight() + 20;
        }
    
    
        return new Point(left, top);
      }
    problem is, that's the declaration of the attribute
    Code:
      private static Stack<Info> slots = new Stack<Info>();
    So obviously if I override the method in my new class I cannot see slots
    How to fix this problem?
    Last edited by Shark107; 24 Jul 2013 at 9:23 AM. Reason: more details

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,644
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    It turns out that you can write JSNI to access fields and methods that are otherwise private or inaccessible - this can be a handy way to work around issues like this where you don't quite have access to. Keep the code in these to a minimum, since the compiler can't optimize JSNI methods.

    As luck would have it, we've added the functionality described in this post to what will become GXT 3.0.6, and it is currently in our nightly builds and available at http://qa.sencha.com:8080/examples-d...mplePlace:info until it is released to support subscribers.

  5. #5
    Sencha User
    Join Date
    Mar 2013
    Posts
    8
    Vote Rating
    0
    Shark107 is on a distinguished road

      0  

    Default


    That's a good news, for the future for now, is there a way you could help me doing what you suggested..?

  6. #6
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    I believe this is the resource you are looking for: http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html

    I think it may look something like this:
    Code:
    private static native Stack<Info> getSlots() /*-{
      return @com.sencha.gxt.widget.core.client.info.Info::slots;
    }-*/;
    And then you can call getSlots() in your overridden method. I've never actually done JSNI, but I think this is really close.
    Last edited by icfantv; 25 Jul 2013 at 7:11 AM. Reason: added missing static modifier

  7. #7
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,644
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    Take a look at http://www.gwtproject.org/doc/latest...asicsJSNI.html for a discussion of how jsni works, how to use it. In this case you'll be accessing the stack, so the method might look like
    Code:
    private static native Stack<Info> getSlots() /*-{
        return @com.sencha.gxt.widget.core.client.info.Info::slots;
    }-*/;
    Completely untested, but looks like it ought to work. Your IDE will probably give you code completion on this sort of thing.

    Remember that private methods and fields are *not* part of the published API and may be changed without notice, within a minor release, and will not be mentioned in release notes. This will happen in GXT 3.0.6, as multiple stacks will be required to handle each region.

  8. #8
    Sencha User
    Join Date
    Mar 2013
    Posts
    8
    Vote Rating
    0
    Shark107 is on a distinguished road

      0  

    Default


    Thank you very much, both of you have been very kind and crystal clear. While this solved my problem about the private attribute, I'm afraid I still cannot achieve what I had in mind.

    That's what I do, correct me if I'm wrong.

    I create a new class, which extends Info: let's call it MyInfo.
    In this class, I override the method I need to change, which is position() .I also write the method we talked about before, to access the attribute.
    Then, I create a new instance of this class, and I call the display method. Since MyInfo does not have it, it calls Info.display.

    Problem is, my override is not seen. I tried to put some breakpoint in debug mode, and it never goes there. I'm afraid when the Info.display is called, it goes under the usual sequence and compiles its method, instead of mine.


    Am I doing something wrong?

  9. #9
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    Can you please post your code?

  10. #10
    Sencha User
    Join Date
    Mar 2013
    Posts
    8
    Vote Rating
    0
    Shark107 is on a distinguished road

      0  

    Default


    This is MyInfo

    Code:
    public class MyInfo extends Info {    
        
        private native Stack<Info> getSlots() /*-{
          return @com.sencha.gxt.widget.core.client.info.Info::slots;
        }-*/;
        
        @Override
         public Point position() {
            Size s = XDOM.getViewportSize();
            int left = s.getWidth() - config.getWidth() - 10 + XDOM.getBodyScrollLeft();
        
            int top = 10;
        
            if (getSlots().size() > 0) {
              Info bottom = getSlots().peek();
    //          top = bottom.getAbsoluteTop() + bottom.getOffsetHeight() + 20;
              top = s.getHeight() - config.getHeight() - 10 - ((config.getHeight() + 10)) + XDOM.getBodyScrollTop();
    
    
            }
        
            return new Point(left, top);
          }
    
    
    }
    and this is my Desktop where I wanna see the popup
    Code:
    MyInfo display = new MyInfo();
    
    display.display("Titolo","testo");

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar