uibinder

GWT - What's the shortest way of simply sharing strings and number constants between Java code and UiBinder files?

社会主义新天地 提交于 2020-01-01 12:05:25
问题 Can someone post an example of the shortest way of sharing a (preferably static final) string or number constant between Java code and UiBinder XML, where I can use the constant either in an attribute: <g:TextArea width="...px"/> or in a value: <g:Label>...</g:Label> I can't seem to find an example of this, only text from a file, which I don't want. 回答1: static fields (and enum constants) can be used with a simple <ui:import> : <ui:import field="com.example.Pojo.CONSTANT" /> or <ui:import

GWT - What's the shortest way of simply sharing strings and number constants between Java code and UiBinder files?

删除回忆录丶 提交于 2020-01-01 12:05:02
问题 Can someone post an example of the shortest way of sharing a (preferably static final) string or number constant between Java code and UiBinder XML, where I can use the constant either in an attribute: <g:TextArea width="...px"/> or in a value: <g:Label>...</g:Label> I can't seem to find an example of this, only text from a file, which I don't want. 回答1: static fields (and enum constants) can be used with a simple <ui:import> : <ui:import field="com.example.Pojo.CONSTANT" /> or <ui:import

Trying to get UIBinder to give me a span not a div

痞子三分冷 提交于 2019-12-30 01:53:04
问题 I am building a widget with UiBinder, and I need to have it enclosed in a <span /> but UiBinder only gives me <div /> . E.g. <g:HTMLPanel /> => <div /> . HorizonPanel, FlowPanel, VerticalPanel also give out only <div /> . Does any one know a solution? 回答1: Try this: <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'> <g:HTMLPanel tag="span"> <!-- your stuff --> </g:HTMLPanel> </ui:UiBinder> 回答2: You can keep using a <div> but just add

widget remove itself

空扰寡人 提交于 2019-12-25 07:47:12
问题 i have widget like below in ui.xml textbox, anchor_delete when anchor_delete is press, @uihandler fired and i want entire widget textbox and anchor_delete remove itself from the view. Is this possible @UiHandler("anchor_delete") void deleteRowAction(ClickEvent event) { getWidget().removeFromParent(); //i tried this but fail } 回答1: Did you try: textbox.removeFromParent(); anchor_delete.removeFromParent(); Assuming both are widgets. 来源: https://stackoverflow.com/questions/4194125/widget-remove

GWT CompositeEditor - Dynamically switched editor not being added to chain properly

做~自己de王妃 提交于 2019-12-25 07:16:30
问题 I've got a value type Commission that's part of a larger editor graph: public class Commission implements Serializable { private CommissionType commissionType; // enum private Money value; // custom type, backed by BigDecimal private Integer multiplier; private Integer contractMonths; // ... } What I want to achieve is to initially only show the dropdown for the commissionType enum, and then select an appropriate sub-editor to edit the rest of the fields based on the value selected: I have

List all the widgets of a page/panel in GWT

早过忘川 提交于 2019-12-25 05:06:19
问题 Is there a programmatic way to read all the widget a GWT page or Panel contains? I have several error labels in my form, all suffixed by "ErrorLabel" and I'd like to find them and clear them. I can do a list of them, but I figured out I can actually automate that if I had some... I am using UiBinder. 回答1: Use recursion method to get all the children of any component. Steps to follow: (How to read the UiField names?) Add below entry in you gwt.xml <inherits name="com.google.gwt.user.Debug"/>

Displaying a Widget in a new Window in GWT

戏子无情 提交于 2019-12-25 04:05:27
问题 I have a requirement wherein I need to display a drag n drop cell table in a new window. I have checked for answers and I have googled about this, but I did not get appropriate answers. I am able to open a new window on click of a button. Following is the code which I am using: @UiHandler(value = { "buttonReleaseView" }) void onReleaseViewClick(ClickEvent clickEvent) { String winUrl = GWT.getModuleBaseURL() + "releaseView/"; String winName = "Release View"; openNewWindow (winName, winUrl); /*

overlapping divs on the right edge of the page

限于喜欢 提交于 2019-12-24 16:02:44
问题 I am having troubles for positioning a span with the watermark text on top of an input. The code using GWT+uibinder looks like that: http://jsfiddle.net/camposcarlos/dMzL4/ and transformed into html looks like that: http://jsfiddle.net/ajMWd/ instead of having the span overlapped on top of the input field by floating it to the left: |----------------------------------| | |------------||--|| | |passwd ||Go|| | |------------||--|| | | |----------------------------------| I get it after the

How to change the url of a g:image in gwt

萝らか妹 提交于 2019-12-24 15:00:00
问题 I'm new to GWT. I created in my ui.xml a panel containing an Image. I want to change the url, the alt & the title of that image depending some conditions. How to do it ? <g:Image url="images/document-statut-1.gif" title="My title" altText="My alt"></g:Image> Thnx 回答1: Modify the uibinder element so it has a field name: <g:Image url="images/document-statut-1.gif" ui:field="imageWidget" title="My title" altText="My alt" /> Then make a matching field in your java code: @UiField Image imageWidget

read key from LocalizedResource.properties programmatically

这一生的挚爱 提交于 2019-12-24 09:39:06
问题 I able to use LocalizedResource.properties with uibinder. let say i have widget that created programmatically in java file. how to read in key from LocalizedResource.properties depending on language "en,fr..etc" selected by users? 回答1: It's difficult to say something definitely. If your LocalizedResource.properties is generated as described by "Internationalization - UiBinder" so I don't understand why you want to read in key from it If .properties made for Message or Constant interface so