我有一个包含TextArea的简单UiBinder小部件:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:TextArea visibleLines="3" />
</ui:UiBinder>
Run Code Online (Sandbox Code Playgroud)
我想控制此textarea的背景颜色,以便进行可写和只读状态.GWT使用"-readonly"样式名称装饰器来实现此目的.所以我试试这个:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
.textBoxStyle {
background-color:yellow;
}
.textBoxStyle-readonly {
background-color:lightgray;
}
</ui:style>
<g:TextArea styleName="{style.textBoxStyle}" visibleLines="3" />
</ui:UiBinder>
Run Code Online (Sandbox Code Playgroud)
显然这不起作用,因为样式名称被混淆为CssResources导致类似这样的事情:
.G1x26wpeN {
background-color:yellow
}
.G1x26wpeO {
background-color: lightgray;
}
Run Code Online (Sandbox Code Playgroud)
可写textarea的结果HTML如下所示:
<textarea tabindex="0" class="G1x26wpeN" rows="3"/>
Run Code Online (Sandbox Code Playgroud)
只读textarea看起来像这样:
<textarea tabindex="0" class="G1x26wpeN G1x26wpeN-readonly" readonly="" rows="3"/>
Run Code Online (Sandbox Code Playgroud)
如何声明样式,以便GWT对主要部分进行模糊处理而不对"-readonly"decdorator进行模糊处理?
我知道我可以禁用整个样式名称的混淆.但我想在使用装饰器的同时保持混淆.
我是gwt的新手.我不知道如何启动Super Dev模式.我需要一步一步详细说明.
我已经尝试通过添加来编辑gwt.xml文件
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-property name="compiler.useSourceMaps" value="true" />
Run Code Online (Sandbox Code Playgroud)
但我无法理解这一点.
在我的GWT应用程序中,在客户端Java文件中,我写了一行来打印Locale:
System.out.println(Locale.getDefault());
Run Code Online (Sandbox Code Playgroud)
这里Locale是java.util.Locale的一个实例.
我得到一个例外: 09:31:53.656 [ERROR] [stockwatcher] Line 167 No source code is available for type java.util.Locale; did you forget to inherit a required module?
出人意料的是,在这个类我也用java.util.ArrayList
和java.util.Date
,但我没有得到这些类的任何异常.
我在这做错了什么?
我有一个CssResource,我想让一些css类"映射"到方法:
@ClassName("top-table")
String topTable();
Run Code Online (Sandbox Code Playgroud)
但我想关闭GWT的混淆(至少在开发时,为了在firebug中进行更好的调试等).
有没有一种简单的方法来实现这一目标?我知道我可以在我的css文件中使用@external然后我必须定义所有我的css类,如@external .c1,.c2,.c3等...
像@external.*这样的东西可以解决我的问题,但至少在gwt 2.0.x中似乎没有
我目前的解决方案是使用:
<set-configuration-property name="CssResource.style" value="pretty"/>
Run Code Online (Sandbox Code Playgroud)
但这并没有关闭混淆,只是让它更漂亮:)我知道obf是需要避免碰撞但我不喜欢我的情况,并真的想关闭混淆
我正在尝试与GWT 2.1.0的新GWT Editor框架集成.我还想将验证检查添加到框架中.但是,我正在努力寻找一个体面的例子来做这件事.
目前我有以下代码:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:e="urn:import:com.google.gwt.editor.ui.client">
<ui:with type="be.credoc.iov.webapp.client.MessageConstants"
field="msg" />
<g:HTMLPanel>
<e:ValueBoxEditorDecorator ui:field="personalReference">
<e:valuebox>
<g:TextBox />
</e:valuebox>
</e:ValueBoxEditorDecorator>
</g:HTMLPanel>
</ui:UiBinder>
Run Code Online (Sandbox Code Playgroud)
对于我的编辑:
public class GarageEditor extends Composite implements Editor<Garage> {
@UiField
ValueBoxEditorDecorator<String> personalReference;
interface GarageEditorUiBinder extends UiBinder<Widget, GarageEditor> {
}
private static GarageEditorUiBinder uiBinder = GWT.create(GarageEditorUiBinder.class);
public GarageEditor() {
initWidget(uiBinder.createAndBindUi(this));
}
}
Run Code Online (Sandbox Code Playgroud)
在什么时候我必须调用我的验证器,我该如何与它集成?
更新:
我实际上正在寻找一种方法来检索具有关键属性路径的地图,以及编辑器的值.委托上有一个路径字段,但这不是编辑对象中的路径,而是编辑器类中的路径.
有人知道是否有可能做这样的事情?
我为它创建了一个ButtonCell和一个列:
ButtonCell previewButton = new ButtonCell();
Column<Auction,String> preview = new Column<Auction,String>(previewButton) {
public String getValue(Auction object) {
return "Preview";
}
};
Run Code Online (Sandbox Code Playgroud)
我现在如何为此ButtonCell添加点击处理程序(例如ClickHandler)?
我需要一个与Gxt的NumberField非常相似的文本字段.不幸的是,我没有在我的应用程序中使用Gxt,而GWT 2.0还没有使用数字文本字段实现.
因此,目前通过使用keyboardHandler过滤掉非数字键击,我可以选择模拟NumberField.
这是解决问题的最佳方法吗?这里有没有人有更好的解决方案/方法?
提前致谢 :)
什么可以提供给a的location属性
<c:SimplePager ui:field='pager' location='HERE' />
Run Code Online (Sandbox Code Playgroud)
我尝试了CENTER,但它没有用,我在费用示例应用程序中看到他们没有位置属性,而是将其设置为在UiBinder中创建它.但我不能这样做,因为它是必需的属性.该怎么办?
我有一个自定义小部件,实际上是一个图像,我希望能够将它拖动到AbsolutePanel内并每次都得到它的坐标.我想使用GWT 2.4的新DND API,但我很难实现它.有人可以提出我必须采取的基本步骤吗?
它是如何工作的?
我看到没有定义标签,例如在UiBinder.ui.xml文件中添加CellTable,比如
文档很少见.
因此,如果它不起作用,我应该在uiBinder类或演示者中放置单元格小部件?
gwt ×10
gwt2 ×10
uibinder ×4
java ×3
click ×1
clientbundle ×1
css ×1
cssresource ×1
editor ×1
gwt-mvp ×1
gwt-rpc ×1
obfuscation ×1