1. #11
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    365
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Default


    I just tried using a ContentPanel wrapped with Draggable instead of a Window as the conversation/cell widget. The problems are:

    - Now the user can grab any location in the panel and perform the DnD, I want them to just be able to grab the title bar for DnD.
    - Also because of the previous behavior the user cannot select/access any of the content IN the conversation/call because clicking anywhere is seen as the start of a drag operation. For instance there is a scroll panel in the cell...that is impossible to use now. Do I need to capture where the user's mouse is and disable dragable somehow?
    - The panel is not resizable. I need them to be able to at least resize via the lower right corner and stretch the panel. Can this be done with a ContentPanel?

  2. #12
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    If you can paste code that isn't working, I (and other community members) can be of more help...

    As mentioned in an earlier post, and in the Draggable javadoc, use the Draggable(Widget,Widget) constructor to specify that the entire ContentPanel can be dragged via the header.

    ContentPanel panel = new ContentPanel();
    Draggable d = new Draggable(panel, panel.getHeader());
    Take a look at com.sencha.gxt.widget.core.client.Window.getDraggable() to see how this is done in the Window class.

  3. #13
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    365
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Default


    Your suggestion of:

    Code:
    Draggable draggable = new Draggable(contentPanel, contentPanel.getHeader());
    draggable.setConstrainClient(true);
    draggable.setSizeProxyToSource(true);
    draggable.addDragHandler(gridPanelDragHandler);
    Does seem to allow the DnD to work but I'm not sure what difference the following makes.

    Code:
    draggable.setConstrainClient(true);
    draggable.setSizeProxyToSource(true);
    however I still don't understand how to make the contentPanel resizable. You said to use Resizable but how can I wrap the contentPanel with both the Draggable and Resizable?

  4. #14
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    I'd highly recomend taking a look at the javadoc for both Draggable and Resizable - if it is unclear, let me know, but it seems clear to me for both of the setters you mention. Otherwise, try turning them off and on, and see what effect each has.

    To make something both resizable and draggable, simply create one of each - something like this (config, handlers ommitted for brevity)

    Code:
    ContentPanel panel = new ContentPanel();
    Draggable d = new Draggable(panel, panel.getHeader());
    Resizable r = new Resizable(panel);//add one or more directions to limit how it can be resized, see the javadocs for details
    
    outerPanel.add(panel, ...);

  5. #15
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    365
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Default


    I did try with and without...

    Code:
    draggable.setConstrainClient(true); 
    draggable.setSizeProxyToSource(true);
    And I didn't see any difference yet in my app (perhaps because these are the defaults).

    Regarding making a content panel drag-able and re-sizable, I now see that I can wrap the same content panel with Draggable and with Resizable but the code seems odd to me, i.e.

    private ContentPanel someMethod()
    ContentPanel contentPanel = new ContentPanel();
    Draggable draggable = new Draggable(contentPanel, contentPanel.getHeader());
    Resizable resizable = new Resizable(contentPanel);
    return contentPanel

    draggable & resizable both fall out of scope...not very Java/OO programing norm...one would think that Draggable & Resizable would do nothing in this case ...when you say wrap an object I naturally think the wrapped object must be the input of the next object/method. But although strange code this seems to be working so I will see if I can refine it for my needs.

  6. #16
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    If you don't yourself maintain a refernce to the object, then yes, it falls out of scope, and _you_ have no way of accessing it, but why should it do nothing? Other code still has references to it - take a look in each of the Resizable and Draggable constructors, and notice how they add handlers to watch for events.


    Do you keep references to all event handlers you write? Or do you add them to the component, and leave it at that? This is the same idea.

    As for the setters, yes, the defaults are true, which is why i suggested turning them both on and off - from their descriptions in javadoc constrainClient should keep the thing you are dragging within the bounds of the window, and sizeProxyToSource should make the draggable proxy (if any) the same size as the original object. Both setters trindicate that the default is true already.

  7. #17
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    365
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Default


    Yes I see the constructors do a lot of work...but they shouldn't IMHO. Just like event listeners you don't expect to pass something into its constructor you expect to create the event listener instance and attach it to something...then it's up to you if you keep a reference to the object. E.g.


    Code:
    ContentPanel panel = new ContentPanel(); 
    Draggable d = new Draggable(panel, panel.getHeader()); 
    Resizable r = new Resizable(panel); 
    outerPanel.add(panel, ...);
    should be something like...

    Code:
    ContentPanel panel = new ContentPanel();
    panel.supportDraggable(new Draggable(...));
    panel.supportResizable(new Resizable(...)); 
    outerPanel.add(panel, ...);
    or just...

    Code:
    ContentPanel panel = new ContentPanel(new Draggable(...), new Resizable(...));
    outerPanel.add(panel, ...);

  8. #18
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    We're straying significantly from the discussion at hand, but there are a few reasons that will make things worse. First, you'll be multiplying the number of args required to create the thing - and you'll need to find some common interface all of these will adhere to, which may have the effect of just changing
    Code:
    ContentPanel panel = new ContentPanel();
    Draggable d = new Draggable(panel, panel.getHeader());
    new Draggable(panel, panel.getHeader());
    new Resizable(panel, Dir.N, Dir.E, Dir.S, Dir.W);
    to
    Code:
    ContentPanel panel = new ContentPanel();
    //need to still specify the header is the actual draggable part
    //hypothetical Behavior interface would specify some way to indicate the compoent that gets the behavior
    panel.addBehavior(new Draggable(panel.getHeader()));
    panel.addBehavior(new Resizable(Dir.N, Dir.E, Dir.S, Dir.W);
    This concept of making it part of the ContentPanel (probably implemented at Component)'s responsibility means that the Behavior interface can handle all possible use cases for any behavior added to it - how the user can move it, how things can be dropped on to it (see DragSource and DropTarget for these kinds of cases), and getting into the realm of touch events will add more complexity, since more than one touch can be happening at a time. Meanwhile Draggable and Resizable are simple to use, documented, and examples are provided (both on the examples page and in code, see Window, DragSource, ColumnHeader, http://www.sencha.com/examples-dev/#...lace:draggable and http://www.sencha.com/examples-dev/#ExamplePlace:logos). Additionally, Draggable is written so it can apply to any/all Widgets, not just those which extend GXT's Component class. Resizable should do the same, I've filed an issue to make sure we support this.

    We're far enough into GXT 3 that I don't think major modifications will be made at this time to how these are working, especially as Draggable and Resizable are mostly unchanged from 2.x (and 1.x I believe) - philosophical discussions of perfect APIs aside, they do the job more than adaquetly. Keep in mind that holding a reference to these can be very beneficial across the life of the object - both classes have a release() method to remove handlers and prevent the effect from continuing. Additionally, if one of these is attached to a detached ContentPanel (or any Widget), and the only reference to it are from the Resizable/Draggable, it will be garbarge collected, thanks to GWT's dom event listener bookkeeping occuring on detach.

    That said, if you have a complete suggestion to how this can be built while still supporting all existing use cases, we'd be interested in discussing it. Feel free to join us on irc.freenode.net at #extgwt for more discussion.

  9. #19
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    365
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Default


    I concur we are straying now from the topic but...

    My point here is basically that the way things are now may work, like you say, but the problem is it's not intuitive from an API perspective. Now the things are completely decoupled and that can have some advantages but it requires deep knowledge of the GXT library to know how to get things to work. Normally one expects to see methods on objects (or constructor params) that provide all the functionality one can do with an object. Furthermore there is a setResize() method on ContentPanel that does absolutely nothing (from what I can tell), so not knowing that a separate decoupled Resizable existed I switched to using a Window instead of ContentPanel because it in the the resizing worked as expected. How is one to know that resizing is completely decoupled? What other completely decoupled things am I missing? Again, for new folks using a library the natural thing to do is start with an object and look to its methods to know what it can and can't do, not browse for all completely decoupled objects and see if I can combine them somehow.

  10. #20
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    SimpleContainer.setResize/isResize should be used by doLayout, but this seems to not be called as normal due to how ContentPanel.onResize overrides things. I'll look into how that should behave. However, if you look at the setResize javadoc, it clearly has nothing to do with the user resizing and dragging:
    True to resize the child widget to match the container size (defaults to true).
    We are still missing a good example with Resizable from http://www.sencha.com/examples-dev/ - we'll add that in a future beta. That said, searching for draggable on that page quickly brings up an example using Draggable with ContentPanel, configuring it in different ways. While I admit that we are missing javadoc and examples (again, this is the first beta for this release), we do have a number of examples already present. Many points I've brought up would have been clear to you from reading the javadoc already present, or the examples already available. Based on this thread, I'll be working to make them more visible or easier to find.

    It is not a design goal of GXT to live as a self-sufficient unit, divorced from other GWT libraries, and the basic GWT runtime - in fact, we strive to do the opposite. Many of the changes in 3 are done to offer better interoperability with existing and future GWT concepts - UiBinder, Editor framework, Cells, and working directly with any/all Widgets instead of requiring Component subclasses. We cannot redefine the Widget class or the Cell interface as much as we'd like to, to provide functionality that we think is obvious or useful, so are limited in how we can add features. This is a basic issue of OOP in Java - we can't add mixin methods - other languages get around this by supporting redefining existing methods on existing classes like JavaScript does - but most GWT projects are using GWT because of the maintainability details it encourages - so developers can't just redefine/add methods in certain places as it suites them.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi