Skip to content

Instantly share code, notes, and snippets.

View Elrhino's full-sized avatar

Renaud Lainé Elrhino

View GitHub Profile
@Elrhino
Elrhino / ApplicationPresenter.java
Created January 5, 2016 16:28
Code snippets from BeeStore
public static final NestedSlot SLOT_MAIN = new NestedSlot();
public static final SingleSlot SLOT_SIDE_PANEL = new SingleSlot();
@Elrhino
Elrhino / SidePanelPresenter.java
Created January 4, 2016 16:14
Code snippet from BeeStore
@Override
protected void onBind() {
setInSlot(SLOT_MAIN, shoppingCartPresenter);
addRegisteredHandler(CheckoutContinueEvent.TYPE, this);
}
@Override
public void onCheckoutContinue(CheckoutContinueEvent event) {
if (getChildren(SLOT_MAIN).contains(shoppingCartPresenter)) {
@Elrhino
Elrhino / HomePresenter.java
Last active January 5, 2016 16:23
Code snippet from BeeStore
addToSlot(SLOT_MAIN_PRODUCTS, productFactory.create(ProductWidgetType.MAIN_LEFT, shirt));
addToSlot(SLOT_MAIN_PRODUCTS, productFactory.create(ProductWidgetType.MAIN_RIGHT, bag));
@Elrhino
Elrhino / bugfix
Created October 26, 2015 18:25
GSSS "java.lang.NumberFormatException" bug fix
# add this to vm.options (intelliJ)
-Duser.language=en -Duser.country=US
@Elrhino
Elrhino / ToasterPresenterWidger.java
Last active October 27, 2015 00:59
Code snippets from toaster launcher part 2
public class ToasterWidgetPresenter extends PresenterWidget<ToasterWidgetPresenter.MyView>
implements ToasterWidgetUiHandlers {
interface MyView extends View, HasUiHandlers<ToasterWidgetUiHandlers> {
void setToaster(Toaster toaster);
}
private final RestDispatch dispatch;
private final ToasterResource resource;
@Inject
@Elrhino
Elrhino / LauncherPresenter.java
Last active October 27, 2015 00:58
Code snippets from toaster launcher part 2
@Override
public void onLaunch(String coordinates, String power) {
validateFields(coordinates, power);
dispatch.execute(resource.launch(coordinates, power), new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable throwable) {
// Handle failure
}
@Elrhino
Elrhino / LauncherView.ui.xml
Created October 20, 2015 06:05
Code snippets from toaster launcher part 2
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<g:HTMLPanel>
<h1>Toaster Launcher</h1>
<label>Coordinates (x, y, z):</label><br/>
<g:TextBox ui:field="launchCoordinates"/><br/>
<label>Power:</label><br/>
<g:TextBox ui:field="launchPower"/><br/>
<g:Button ui:field="launchButton" text="LAUNCH!"/><br/>
<g:SimplePanel ui:field="container"/>
@Elrhino
Elrhino / LauncherView.java
Created October 20, 2015 06:04
Code snippets from toaster launcher part 2
public class LauncherView extends ViewWithUiHandlers<LauncherPresenter> implements LauncherPresenter.MyView {
interface Binder extends UiBinder<Widget, LauncherView> {
}
@UiField
TextBox launchCoordinates;
@UiField
TextBox launchPower;
@UiField
Button launchButton;
@Elrhino
Elrhino / ToasterWidgetPresenter.java
Created October 20, 2015 05:50
Code snippets from toaster launcher part 2
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.PresenterWidget;
import com.gwtplatform.mvp.client.View;
public class ToasterWidgetPresenter extends PresenterWidget<ToasterWidgetPresenter.MyView>
implements ToasterWidgetUiHandlers {
interface MyView extends View, HasUiHandlers<ToasterWidgetUiHandlers> {
void setToaster(Toaster toaster);
@Elrhino
Elrhino / ClientModule.java
Created October 20, 2015 05:25
Code snippets from toaster launcher part 2
public class ClientModule extends AbstractPresenterModule {
@Override
protected void configure() {
install(new DefaultModule.Builder().build());
install(new ApplicationModule());
bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.LOGIN);
bindConstant().annotatedWith(ErrorPlace.class).to(NameTokens.LOGIN);
bindConstant().annotatedWith(UnauthorizedPlace.class).to(NameTokens.LOGIN);