uibinder

passing an object to the constructor of a widget defined in uibinder

旧时模样 提交于 2019-12-10 14:41:12
问题 I'm trying to pass my app's EventBus to a widget declared in a UiBinder via its constructor. I'm using the @UiConstructor annotation to mark a constructor that accepts the EventBus, but I don't know how to actually reference the object from my ui.xml code. That is, I need something like WidgetThatNeedsAnEventBus.java public class WidgetThatNeedsAnEventBus extends Composite { private EventBus eventBus; @UiConstructor public WidgetThatNeedsAnEventBus(EventBus eventBus) { this.eventBus =

CSS class definition doesn't work inside <g:HTML> element

蓝咒 提交于 2019-12-10 13:56:53
问题 Could you guys tell me why css class definition doesn't work in following example ? I'm using GWT 2.4 + Chrome 17. <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'> <ui:style> div.test { color: red; } </ui:style> <g:HTML> <div class="test">I should be red but I'm not</div> </g:HTML> </ui:UiBinder> 回答1: CSS classes listed in the <ui:style> will be obfuscated, going from test to GKYSKJX (or something similar). Update your div to this:

GWT UiBinder CSS styling

守給你的承諾、 提交于 2019-12-10 13:55:18
问题 I declare some colors for the border of a VerticalLayout panel, like in: <ui:style> .onMouseOverBorderColor {border-color: red; border-style: outset} .onMouseOutBorderColor {border-color: black; border-style: outset} </ui:style> Then i want to change the color of the panel's border according to the position of the mouse, and i add to the constructor of my widget the following: clickable.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { GWT

GWT UiBinder any way to have dynamic List of Widgets?

你。 提交于 2019-12-10 01:44:48
问题 Class Foo has a variable List<Button> bar , how can I render each of the buttons using UiBinder? Is it even possible? 回答1: UiBinder is a XML template for declaratively laying out widgets and is not a renderer . Hence you cannot have conditionals, loops and other logical constructs within the UiBinder XML. What you can instead do is have a Panel in the UiBinder as mere placeholder for where you would like all your buttons to go. Have a ui:field reference to this panel in your Java class. Loop

GWT UiBinder doesn't load the stylesheet

旧城冷巷雨未停 提交于 2019-12-09 13:42:05
问题 I wanted to make a GWT widget using UiBinder. So I made: UserPanel.ui.xml like this: <?xml version="1.0" encoding="UTF-8"?> <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'> <ui:with field="res" type="com.example.resources.UserPanelResources" /> <g:VerticalPanel styleNames='{res.userpanel.main}'> ...some other widgets go here... </g:VerticalPanel> </ui:UiBinder> UserPanel.css like this: .main { width: 1000px; background-color: #f9f9fa;

Use ClientBundle image as background-image

萝らか妹 提交于 2019-12-09 09:37:29
问题 I'm trying to use an image from a ClientBundle as a background-image in a UIBInder template. I used this discussion as a guide, but was unable to get it to work. In my Java class I have: public static interface PriceButtonStyles extends ClientBundle { String paidIcon(); @ClientBundle.Source("paid_button_53x31.png") DataResource paid_buttonAsDataResource(); } @UiField PriceButtonStyles priceButtonStyle; And then in the corresponding template file I reference it like: <ui:style field=

What is this error Found widget <g:ListBox class='dropdownbx' name='deleteDigits' ui:field='deletedigs'> in an HTML context

百般思念 提交于 2019-12-08 20:31:27
问题 I get this error when I run my Gwt app Found widget in an HTML context Here is a snippet of the xml that it complains about: <!-- ... --> <g:HTML ui:field="localPanel"> <fieldset> <legend>Local</legend> <label for="btn" >BTN:</label><input type="text" ui:field="btn" class="txtbx numeric" maxlength="10" name='btn'/> <label for="stdprt">SDT PRT:</label><input type="text" ui:field="stdprt" class="txtbx" readonly="readonly" name='stdPrt'/> <label for="rateArea">Rate Area:</label><input type="text

When click on an item in a tree, it makes the vertical scroll bar jump up

两盒软妹~` 提交于 2019-12-08 11:29:37
问题 Look at this simple code Tree testTree=new Tree(); TreeItem testTreeItem=new TreeItem("test"); TreeItem testTreeItem2=new TreeItem("test2"); more TreeItem.... testTree.addItem(testTreeItem1); testTree.addItem(testTreeItem2); ........ Now, resize your browser so that you can see the vertical scroll bar on the right hand-side. Now click on a tree item at the very bottom ex testTreeItem10 , you will see the the vertical scroll bar jump up instead of staying in the current position. This error

Move ViewPort of Element Map in GWT?

血红的双手。 提交于 2019-12-08 08:24:51
问题 I have a GWT application with a viewport that shows a part of an element map. On the element map are div elements. The user can drag and move on the viewport (not on the elements). If the user drag and move on the viewport than he can move the viewport to all directions. This means that another part of the element map will be displayed. The browser position of the viewport remains unchanged, only the element map moves on drap and move of the viewport. How do I have to setup the viewport and

GWT UiConstructor with optional parameters

十年热恋 提交于 2019-12-08 07:52:54
问题 We have a custom widget with 4 parameters. One of these parameters is optional. If we use the widget in UiBinder and omit the optional field an error is thrown. For example MyWidget(String arg1, String arg2, String arg3) { ... } If in the UiBinder file I write ... <b:MyWidget arg1="sdfsd" arg2="fsdgds" arg3="ertlkj"> ... If I write ... <b:MyWidget arg1="sdfsd" arg2="fsdgds"> ... Then the following error occurs: [ERROR] <MyWidget arg1="sdfsd" arg2="fsdgds"> missing required attribute(s): arg3: