Skip to content

Instantly share code, notes, and snippets.

View Elrhino's full-sized avatar

Renaud Lainé Elrhino

View GitHub Profile
@Elrhino
Elrhino / ToasterResource.java
Last active December 11, 2018 10:36
Code snippets from toaster launcher part 2
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.gwtplatform.dispatch.rest.shared.RestAction;
@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 / 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 / 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 / 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 / LauncherPresenter.java
Last active October 27, 2015 00:55
Code snippets from toaster launcher part 2
public static final Slot SLOT_CONTENT = new Slot();
private final ToasterPresenterWidget toasterPresenterWidget;
@Inject
LauncherPresenter(
EventBus eventBus,
MyView view,
MyProxy proxy,
ToasterPresenterWidget toasterPresenterWidget) {
@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 / Toaster.java
Last active October 20, 2015 06:14
Code snippets from toaster launcher part 2
public class Toaster {
private String name;
private String coordinates;
private String power;
private Toaster() {
// For serialization
}
@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"/>