google-code-export / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 0 forks source link

TriggerField does not expose the trigger click method for GWT #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempt to use the TriggerField class to create a custom text field a la
DateField.
2. Note that there is no way of exposing the trigger click method.
3. .. add a new Issue?

Please provide any additional information below.

This fix should do it:

protected void _triggerClick(EventObject event)
{   
  onTriggerClick(event);
}

protected abstract void onTriggerClick(EventObject event);

/*
 * Call me in the ctor
 */
private native void setup(JavaScriptObject jsObj)/*-{
        var _jsobj = jsObj;
        var _gwtobj = this;
        _jsobj.onTriggerClick = function(evt){
            var e =
@com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaSc
riptObject;)(evt);

_gwtobj.@<InsertSuitableClassNameHere>::_triggerClick(Lcom/gwtext/client/core/Ev
entObject;)(e);
        };
    }-*/;

Original issue reported on code.google.com by intern...@gmail.com on 21 Aug 2007 at 3:24

GoogleCodeExporter commented 9 years ago
Users can now extend the abstract class TriggerField and impelment the
onTriggerClick(..) method to build custom TriggerField's. For example :

public class LookupField extends TriggerField {

    private LayoutDialog dialog;

    public LookupField() {
    }

    public LookupField(TriggerFieldConfig config) {
        super(config);
    }

    protected void onTriggerClick(EventObject event) {
        if (dialog == null) {
            dialog = new LayoutDialog(
                    new LayoutDialogConfig() {
                        {
                            setWidth(400);
                            setHeight(200);
                        }
                    }, new LayoutRegionConfig());
        }
        dialog.show();
    }
}

Original comment by sanjiv.j...@gmail.com on 2 Oct 2007 at 11:32

GoogleCodeExporter commented 9 years ago
With the example above, the dialog now shows, however if I use this 
TriggerField as 
the editor of a grid cell, the grid stops editing the cell as soon as I click 
anywhere in the dialog.  Any suggestions?

Original comment by pkonigsb...@unica.com on 28 Jan 2008 at 6:57

GoogleCodeExporter commented 9 years ago
I'm struggling with the same issue.  It seems we're only part way to actually
implementing a real TriggerField as a ComboBox extension.  

ComboBox will close if you blur from the Field part, but I've had no success 
binding
an event to onBlur for my TriggerField. Of course, if I got that part working, 
but it
kept  on turning off editing of a cell/field when I move focus to the dialog, 
then
I'd have other problems.

Was TriggerField only intended to work with model dialogs that cover the page?  
I'm
trying to get it to do an in-place grid+checkbox mashup.

Original comment by brian.du...@gmail.com on 3 Jul 2008 at 11:29