2011年4月4日月曜日

GWT UiBinder で CustomButton を使う





<!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>

</ui:style>

<ui:image field="pushButton" src="android-robot-35.gif"/>

<g:HTMLPanel>
<g:VerticalPanel>
<g:HTML><h2>Push Buttons:</h2></g:HTML>
<g:HorizontalPanel spacing="10">
<g:PushButton>
<g:upFace image="{pushButton}"/>
<g:downFace image="{pushButton}"/>
<g:upHoveringFace>click me</g:upHoveringFace>
<g:downHoveringFace>CLICK ME</g:downHoveringFace>
<g:upDisabledFace>disable up</g:upDisabledFace>
<g:downDisabledFace>disable down</g:downDisabledFace>
</g:PushButton>

<g:PushButton enabled="false">
<g:upFace image="{pushButton}"/>
<g:downFace image="{pushButton}"/>
<g:upHoveringFace>click me</g:upHoveringFace>
<g:downHoveringFace>CLICK ME</g:downHoveringFace>
<g:upDisabledFace>disable up</g:upDisabledFace>
<g:downDisabledFace>disable down</g:downDisabledFace>
</g:PushButton>

<g:PushButton enabled="true">
<g:upFace image="{pushButton}"/>
<g:downFace image="{pushButton}"/>
</g:PushButton>
</g:HorizontalPanel>

<g:HTML><h2>Toggle Buttons:</h2></g:HTML>
<g:HorizontalPanel spacing="10">
<g:ToggleButton>
<g:upFace image="{pushButton}"/>
<g:downFace image="{pushButton}"/>
</g:ToggleButton>
<g:ToggleButton enabled="false">
<g:upFace image="{pushButton}"/>
<g:downFace image="{pushButton}"/>
</g:ToggleButton>
<g:ToggleButton down="true">
<g:upFace image="{pushButton}"/>
<g:downFace image="{pushButton}"/>
</g:ToggleButton>
</g:HorizontalPanel>
</g:VerticalPanel>
</g:HTMLPanel>
</ui:UiBinder>



package yanzm.example.hellowtgt.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class CustomButton extends Composite {

private static CustomButtonUiBinder uiBinder = GWT
.create(CustomButtonUiBinder.class);

interface CustomButtonUiBinder extends UiBinder<Widget, CustomButton> {
}

public CustomButton() {
initWidget(uiBinder.createAndBindUi(this));
}
}





■ その他
Java code による実装例 (Showcase)
com.google.gwt.user.client.ui.PushButton
com.gooble.gwt.user.client.ui.ToggleButton
com.google.gwt.user.client.ui.Image
com.google.gwt.user.client.ui.CustomButton



 


 

0 件のコメント:

コメントを投稿