uibinder

GWT UiBinder: How to make a custom AbsolutePanel which uses the “at” element?

北慕城南 提交于 2019-12-05 17:55:47
Trying to extend AbsolutePanel, my UiBinder won't allow the <g:at> element which is normally ok for straight AbsolutePanels. How do I make my AbsolutePanel subclass able to use the <g:at> element? And more generally, can I make custom UiBinder keywords for my own custom Widgets like "at", "west", "layer" etc.? You can use @UiChild to declare special functions in your widgets accessible in UiBinders. for example, class MyPanel extends AbsolutePanel { @UiChild public void addAt(Widget w, String parameter1, String parameter2) { .... Then, in your uiBinder, you can say <custom:MyPanel> <custom:at

GWT UiBinder any way to have dynamic List of Widgets?

痞子三分冷 提交于 2019-12-05 01:00:46
Class Foo has a variable List<Button> bar , how can I render each of the buttons using UiBinder? Is it even possible? 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 through the button list and add buttons to the panel in java code, using the field handle. Other approach

UiBinder - HTMLPanel vs. div

自闭症网瘾萝莉.ら 提交于 2019-12-04 23:38:34
Is there some sort of penalty when I'm using a HTMLPanel instead of a plain div ? E.g. <g:HTMLPanel> <div> /* Widgets, more HTML */ </div> </g:HTMLPanel> in contrast to <g:HTMLPanel> <g:HTMLPanel> /* Widgets, more HTML */ </g:HTMLPanel> </g:HTMLPanel> Thomas Broyer Short answer: When in doubt, look at the generated code (pass the -gen argument to the DevMode or Compiler) Long answer: There will be a runtime performance penalty using a widget over a simple DOM element, always. And even more when that DOM element is created by parsing an HTML snippet. When UiBinder sees a widget as a child of

Change span element style for GWT Cell using UiRenderer

你离开我真会死。 提交于 2019-12-04 16:51:38
How do I change the style for a Span HTML element when using UiRenderer with GWT 2.5? I have setup a simple cell to be used in a CellTable. The ui.xml looks like this : <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"> <ui:with field='stkval' type='java.lang.String'/> <ui:with field='stkchg' type='java.lang.String'/> <ui:with field='res' type='com.mycompanyclient.client.Enres'/> <div id="parent"> <span><ui:text from='{stkval}'/></span>. [<span class="{res.newstyle.positive}" ui:field="signSpan"> <ui:text from='{stkchg

GWT UiHandler on HTMLPanel

老子叫甜甜 提交于 2019-12-04 12:17:48
问题 I'm writing a widget with the following markup: <g:HTMLPanel ui:field="shortcutPanel" styleName="{style.shortcut}"> <g:Image ui:field="shortcutImage"></g:Image> <span ui:field="shortcutLabel"></span> </g:HTMLPanel> So essentially a div that wraps and image and a label. Now, instead of adding the event handlers on the image/span, I'd like an onClick to be associated with the HTMLPanel. My problem however is that gwt tells me that shortcutPanel doesn't not have an addClickHandler method

Calling JQuery function from GWT

℡╲_俬逩灬. 提交于 2019-12-04 07:43:21
I'am starting a project Using GWT, the designer team made a prototype using HTML and JQuery. I 'am actualy using UIBinder to 'rebuild' the UI. My problem is the application has a drop down menu that use JQuery... and it's not working What I tried so far is I used a HTMLPanel in UIBinder XML and insert the menu, I keeped the .js file and reference them in the HTML file hoping that the actions will be picked up... but no luck. This is menu.ui.xml, the menu is displayed but no mouse over <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <ui:UiBinder xmlns:ui="urn:ui:com

gwt pushButton in UiBinder

夙愿已清 提交于 2019-12-04 00:48:23
I need to create a pushButton(so it's a button with image) in gwt with UiBinder , but I'm not sure how proceed. Here is my ui.xml code: <g:PushButton ui:field="myPushButton"/> And in *.java file I defined: PushButton myPushButton; How can I add an image to the push button? I've tried the following but won't work: <g:PushButton ui:field="myPushButton" image="myImage.gif" /> Thanks Ilia Akhmadullin You can use following code straight from CustomButton Javadoc: g:PushButton ui:field='pushButton' enabled='true'> <g:upFace> <b>click me</b> </g:upFace> <g:upHoveringFace> <b>Click ME!</b> </g

How to handle single quotes in internationalization constants?

隐身守侯 提交于 2019-12-03 23:52:22
We define all our internationalized constant strings in a single properties file LocalizableResource_xx.properties (one per language) located in google.gwt.i18n.client . This way it is possible to access the constants in Java code via the constants interface Window.alert(myConstants.helloWorld()); as well as to use them inside the UiBinder .ui.xml <ui:attribute key="some.key" name="text" description="useful info" /> This approach doesn't work well if the string contains a single quote ( ' ). This is because the GWT compiler throws a java.text.ParseException: Unterminated single quote: when it

GWT UiBinder doesn't load the stylesheet

你。 提交于 2019-12-03 17:04:44
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; padding: 15px 10px; font-family: "Georgia"; } and UserPanelResources.java like: public interface

add class name to element in uibinder xml file

大兔子大兔子 提交于 2019-12-03 15:19:55
问题 The following replaces any current css class names. It appears to call setStyleName . <g:DecoratorPanel styleName="{style.myCssClass}"> What I really want to do is add a class name, like calling addStyleName . Is it possible to do what I'm attempting? 回答1: Use addStyleNames in such situations, like this: <g:DecoratorPanel addStyleNames="{style.myCssClass}"> It's a little trick I picked up on the GWT's Google Group - too bad it's not (?) mentioned in the official documentation. PS: I'm