This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.inject.Inject; | |
import com.google.gwt.uibinder.client.UiBinder; | |
import com.google.gwt.user.client.ui.Widget; | |
import com.gwtplatform.mvp.client.ViewImpl; | |
public class LauncherView extends ViewImpl implements LauncherPresenter.MyView { | |
interface Binder extends UiBinder<Widget, LauncherView> { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' | |
xmlns:g='urn:import:com.google.gwt.user.client.ui'> | |
</ui:UiBinder> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' | |
xmlns:g='urn:import:com.google.gwt.user.client.ui'> | |
<g:HTMLPanel> | |
<g:TextBox ui:field="launchCoordinates"/><br/> | |
<g:TextBox ui:field="launchPower"/><br/> | |
<g:Button ui:field="launchButton"/> | |
</g:HTMLPanel> | |
</ui:UiBinder> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LauncherView extends ViewImpl implements LauncherPresenter.MyView { | |
interface Binder extends UiBinder<Widget, LauncherView> { | |
} | |
@UiField | |
TextBox launchCoordinates; | |
@UiField | |
TextBox launchPower; | |
@UiField | |
Button launchButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.gwtplatform.mvp.client.UiHandlers; | |
public interface launcherUiHandlers extends UiHandlers { | |
void onLaunch(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@UiHandler("launchButton") | |
public void onLaunch(ClickEvent event) { | |
// TODO: Send launch parameters to the LauncherPresenter. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@UiHandler("launchButton") | |
public void onLaunch(ClickEvent event) { | |
getUiHandlers().onLaunch(launchCoordinates.getText(), launchPower.getText()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LauncherPresenter extends Presenter<LauncherPresenter.MyView, LauncherPresenter.MyProxy> { | |
interface MyView extends View { | |
} | |
@ProxyStandard | |
@NameToken(NameTokens.HOME) | |
interface MyProxy extends ProxyPlace<LauncherPresenter> { | |
} | |
@Inject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onLaunch(String launchCoordinates, String launchPower) { | |
// TODO: Validate values. | |
// TODO: Do something with the values. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean validateFields(String coordinates, String power) { | |
return coordinates.matches("[0-9]{3};[0-9]{3};[0-9]{3}") && power.matches("[0-9]"); | |
} | |
@Override | |
public void onLaunch(String coordinates, String power) { | |
if (validateFields(coordinates, power)) { | |
// TODO: Do something with the values. Process with service. | |
} | |
} |
OlderNewer