Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java GXT3-ColumnSelectionAppearance ClassCastException_Java_Gxt - Fatal编程技术网

Java GXT3-ColumnSelectionAppearance ClassCastException

Java GXT3-ColumnSelectionAppearance ClassCastException,java,gxt,Java,Gxt,我在实现GridSelectionModel时遇到了问题(使用CheckBoxSelectionModel作为灵感)。 我想创建一个RadioSelectionModel,但是当我调用构造函数时,我有一个ClassCastException。 这是我的类结构(如果需要,我会放一些代码,但我认为这不是必需的)。我使用列表和子列表来显示类和嵌入类: class RadioSelectionModel扩展了GridSelectionModel 界面外观 class RadioColumnDefa

我在实现GridSelectionModel时遇到了问题(使用CheckBoxSelectionModel作为灵感)。
我想创建一个RadioSelectionModel,但是当我调用构造函数时,我有一个ClassCastException。 这是我的类结构(如果需要,我会放一些代码,但我认为这不是必需的)。我使用列表和子列表来显示类和嵌入类:

  • class RadioSelectionModel扩展了GridSelectionModel
    • 界面外观
  • class RadioColumnDefaultAppearance
    • 接口RadioColumnStyle扩展了CssResource、ColumnHeaderStyles、GridDataTableStyles
    • 接口RadioColumnResources扩展ClientBundle
RadioColumnAppearance
通过一个gwt.xml文件链接到
RadioColumnDefaultAppearance
,其中包含:

<replace-with
    class="com.app.appearance.RadioColumnDefaultAppearance">
    <when-type-is
        class="com.app.grid.RadioSelectionModel.RadioColumnAppearance" />
</replace-with>

RadioColumnDefaultAppearance未实现RadioColumnAppearance接口。如果要为接口定义默认实现,则类必须实现该接口,否则无法将实现类的实例分配给接口引用。

能否提供确切的堆栈跟踪?还是一些代码?还是两者都有?我已经编辑了这条消息,希望能有所帮助!接口和类位于两个不同的项目中。它们之间的链接是通过gwt.xml创建的。当调用gwt.create(RadioColumnAppearance.class)时,该链接只需告诉gwt要实例化哪个类但由于链接类未实现RadioColumnAppearance,因此您收到了ClassCastException,您是对的,但现在我在编译时遇到另一个错误:
jar:file:RadioColumnDefaultAppearance.java'中的错误无法通过延迟绑定扫描解析RadioColumnDefaultAppearance.RadioColumnResources'以获取更多信息依赖项:jar:file:ColumnHeader.java对于以下类型,从未提交生成的源代码(您是否忘记调用commit()?)RadioColumnDefaultAppearance\u RadioColumnResources\u de\u InlineClientBundleGenerator
这看起来您的gwt编译路径中缺少一些源代码,可能是ColumnHeader。确保您拥有来自正在使用的外部库的所有源。
public class RadioColumnDefaultAppearance < M > implements CheckBoxColumnAppearance< M >
{

public interface RadioColumnStyle extends CheckBoxColumnStyle
{

}

public interface RadioColumnResources extends ClientBundle
{
    @Source( "/css/RadioColumn.css" )
    RadioColumnStyle style();

    @Source( "column.png" )
    @ImageOptions( repeatStyle = RepeatStyle.Vertical )
    ImageResource specialColumn();

    @Source( "column_checked.png" )
    @ImageOptions( repeatStyle = RepeatStyle.Vertical )
    ImageResource specialColumnSelected();
}

private final RadioColumnResources resources;
private final RadioColumnStyle style;

public RadioColumnDefaultAppearance()
{

    this( GWT.< RadioColumnResources > create( RadioColumnResources.class ) );
}

public RadioColumnDefaultAppearance( RadioColumnResources resources )
{
    this.resources = resources;

    this.style = this.resources.style();

    StyleInjectorHelper.ensureInjected( style, true );
}

public void renderRadio( Context context, M value, SafeHtmlBuilder sb )
{
    sb.appendHtmlConstant( "<div class='x-grid-row-checker'>&#160;</div>" );
}


}