Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.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 GWT-基于浏览器的条件编译_Java_Gwt_Conditional Compilation - Fatal编程技术网

Java GWT-基于浏览器的条件编译

Java GWT-基于浏览器的条件编译,java,gwt,conditional-compilation,Java,Gwt,Conditional Compilation,有没有办法告诉GWT为每个目标浏览器编译不同的Java代码 GWT现在为每个目标浏览器创建不同的脚本,所有脚本都是从同一个源文件生成的。但是,在不同浏览器中使用非标准功能时(例如,将文件拖放到浏览器中),不同浏览器之间的支持差异很大,需要编写不同的代码 有类似的吗 // if IE .. some Java code to compile into the IE script // else if chrome .. some Java code to compile into the chr

有没有办法告诉GWT为每个目标浏览器编译不同的Java代码

GWT现在为每个目标浏览器创建不同的脚本,所有脚本都是从同一个源文件生成的。但是,在不同浏览器中使用非标准功能时(例如,将文件拖放到浏览器中),不同浏览器之间的支持差异很大,需要编写不同的代码

有类似的吗

// if IE 
.. some Java code to compile into the IE script
// else if chrome
.. some Java code to compile into the chrome script

等等。

是的,偏离航线。这就是所谓的延迟绑定。退房

这里有一段摘录

<module>

  <!--  ... other configuration omitted ... -->

  <!-- Fall through to this rule is the browser isn't IE or Mozilla -->
  <replace-with class="com.google.gwt.user.client.ui.impl.PopupImpl">
    <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl"/>
  </replace-with>

  <!-- Mozilla needs a different implementation due to issue #410 -->
  <replace-with class="com.google.gwt.user.client.ui.impl.PopupImplMozilla">
    <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl" />
    <any>
      <when-property-is name="user.agent" value="gecko"/>
      <when-property-is name="user.agent" value="gecko1_8" />
    </any>
  </replace-with>

  <!-- IE has a completely different popup implementation -->
  <replace-with class="com.google.gwt.user.client.ui.impl.PopupImplIE6">
    <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl"/>
    <when-property-is name="user.agent" value="ie6" />
  </replace-with>
</module>

对于其他浏览器,我相信如果没有掉下来的规则,它也能工作。我认为通过失败规则来加速事情的发展。不要认为这是理所当然的,因为我不是100%确定

这是GWT的官方文档