gwtbootstrap3 / gwtbootstrap3-extras

Extra (third party) wrappers for GwtBootstrap3
Apache License 2.0
43 stars 89 forks source link

custom extra, no class matching and JSNI #326

Closed fusionbeam closed 7 years ago

fusionbeam commented 7 years ago

Hi guys,

First of all thanks for your work on this project. We found it very useful. I'm working on a FlotChart extra, should things go well would happily contribute it back to the project.

Here is my problem, maybe it rings a bell to someone as I am out of ideas at the moment. i've created a <flotchart: namespace binding to my ui package folder where there is the class FlotChart.

Here is a simplified version of it:


public class FlotChart extends Div{

    private ArrayList<DataSet> dataSets;

    public FlotChart() {
        this.dataSets = new ArrayList<DataSet>();
    }

    @Override
    public void add(Widget child) {
        if (child.getClass() != DataSet.class)
            throw new IllegalArgumentException("FlotChart only accepts DataSet as chlidren");

        this.dataSets.add((DataSet)child);

        addChart();
    }

Everything works great so far. By fine I mean that widget is loaded, rendered and the attributes are passed correctly through the uibinder.

<flotchart:FlotChart id="123">
         <flotchart:DataSet label="Traffic (MB)">
                <flotchart:Bars show="true" align="center" barWidth="20" lineWidth="0"/> 
          </flotchart:DataSet>
</flotchart:FlotChart>

However, as soon as I add the simplest native method, let's say this one:

    public void addChart() {
        String id = getElement().getId();
        addChart(id);
    }

    private native void addChart(String id) /*-{
        var hello = 'hello';
    }
    -*/;

I'm getting the following error from the gwt compiler:

Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator [ERROR] No class matching "FlotChart" in urn:import:neoconsult.m2m.selfservice.ui.extras.flotchart.client.ui: <flotchart:FlotChart>

Any thoughts?

Thanks in advance, Rares

fusionbeam commented 7 years ago

never mind figured it out. this is illegal apparently:

}
    -*/;