}
});
}
private void bindStatic() {
final PriceSetListBox priceSetListBox = display.getPriceSetListBox();
staticHandlerRegistrations.add(priceSetListBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
Long currentPriceSetID = priceSetListBox.getCurrentPriceSetID();
if (currentPriceSetID == -1) {
display.clearPriceSetItemsTable();
disableButtons();
display.getPriceSetNamesListBox().setEnabled(true);
return;
}
priceSetListBox.setEnabled(false);
PriceSetLoadAction action = new PriceSetLoadAction();
action.setPriceSetID(currentPriceSetID);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceSetLoadActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceSetLoadActionResponse response) {
priceSetListBox.setEnabled(true);
eventBus.fireEvent(new PriceSetLoadedEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
priceSetListBox.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
final Button createPriceSetButton = display.getCreatePriceSetButton();
staticHandlerRegistrations.add(createPriceSetButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
createPriceSetButton.setEnabled(false);
String priceSetName = display.getNewPriceSetName().getText();
PriceSetCreateAction action = new PriceSetCreateAction();
action.setPriceSetName(priceSetName);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceSetCreateActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceSetCreateActionResponse response) {
createPriceSetButton.setEnabled(true);
eventBus.fireEvent(new PriceSetCreatedEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
createPriceSetButton.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
final Button copyPriceSetButton = display.getCopyPriceSetButton();
staticHandlerRegistrations.add(copyPriceSetButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
copyPriceSetButton.setEnabled(false);
String priceSetName = display.getNewPriceSetName().getText();
PriceSetCopyAction action = new PriceSetCopyAction();
action.setPriceSetID(priceSetListBox.getCurrentPriceSetID());
action.setPriceSetName(priceSetName);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceSetCopyActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceSetCopyActionResponse response) {
copyPriceSetButton.setEnabled(true);
eventBus.fireEvent(new PriceSetCopiedEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
copyPriceSetButton.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
final Button renamePriceSetButton = display.getRenamePriceSetButton();
staticHandlerRegistrations.add(renamePriceSetButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
renamePriceSetButton.setEnabled(false);
String priceSetName = display.getNewPriceSetName().getText();
PriceSetRenameAction action = new PriceSetRenameAction();
Long priceSetID = priceSetListBox.getCurrentPriceSetID();
action.setPriceSetID(priceSetID);
action.setPriceSetName(priceSetName);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceSetRenameActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceSetRenameActionResponse response) {
renamePriceSetButton.setEnabled(true);
eventBus.fireEvent(new PriceSetRenamedEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
renamePriceSetButton.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
final Button deletePriceSetButton = display.getDeletePriceSetButton();
staticHandlerRegistrations.add(deletePriceSetButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
deletePriceSetButton.setEnabled(false);
PriceSetDeleteAction action = new PriceSetDeleteAction();
Long priceSetID = priceSetListBox.getCurrentPriceSetID();
action.setPriceSetID(priceSetID);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceSetDeleteActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceSetDeleteActionResponse response) {
deletePriceSetButton.setEnabled(true);
eventBus.fireEvent(new PriceSetDeletedEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
deletePriceSetButton.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
final Button savePriceSetButton = display.getSavePriceSetButton();
staticHandlerRegistrations.add(savePriceSetButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
savePriceSetButton.setEnabled(false);
PriceSetSaveAction action = new PriceSetSaveAction();
PriceSetDto priceSet = display.getCurrentPriceSet();
List<PriceSetItemDto> priceSetItems = priceSet.getItems();
for (PriceSetItemDto deletedPriceSetItem : display.getCurrentPriceSetDeletedItems()) {
priceSetItems.remove(deletedPriceSetItem);
}
for (PriceSetItemDto currentPriceSetItem : priceSetItems) {
currentPriceSetItem.setPrice(display.getCurrentPriceSetItemValues().get(currentPriceSetItem).getPrice());
}
action.setPriceSet(priceSet);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceSetSaveActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceSetSaveActionResponse response) {
savePriceSetButton.setEnabled(true);
eventBus.fireEvent(new PriceSetSavedEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
savePriceSetButton.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
final Button fetchEveCentralPricesButton = display.getFetchEveCentralPricesButton();
staticHandlerRegistrations.add(fetchEveCentralPricesButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
fetchEveCentralPricesButton.setEnabled(false);
PriceFetchFromEveCentralAction action = new PriceFetchFromEveCentralAction();
PriceSetDto priceSet = display.getCurrentPriceSet();
List<PriceSetItemDto> priceSetItems = priceSet.getItems();
action.setPriceSetItems(priceSetItems);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceFetchFromEveCentralActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceFetchFromEveCentralActionResponse response) {
fetchEveCentralPricesButton.setEnabled(true);
eventBus.fireEvent(new PriceSetFetchedPricesFromEveCentralEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
fetchEveCentralPricesButton.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
final Button fetchEveMetricsPricesButton = display.getFetchEveMetricsPricesButton();
staticHandlerRegistrations.add(fetchEveMetricsPricesButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
fetchEveMetricsPricesButton.setEnabled(false);
PriceFetchFromEveMetricsAction action = new PriceFetchFromEveMetricsAction();
PriceSetDto priceSet = display.getCurrentPriceSet();
List<PriceSetItemDto> priceSetItems = priceSet.getItems();
action.setPriceSetItems(priceSetItems);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceFetchFromEveMetricsActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceFetchFromEveMetricsActionResponse response) {
fetchEveMetricsPricesButton.setEnabled(true);
eventBus.fireEvent(new PriceSetFetchedPricesFromEveMetricsEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
fetchEveMetricsPricesButton.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
staticHandlerRegistrations.add(display.getAddBasicMineralsButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
List<PriceSetItemDto> priceSetItems = new ArrayList<PriceSetItemDto>();
priceSetItems.add(createPriceSetItem(34L, 4L, "06_14", "Tritanium", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(35L, 4L, "06_15", "Pyerite", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(36L, 4L, "06_12", "Mexallon", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(37L, 4L, "06_16", "Isogen", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(38L, 4L, "11_09", "Nocxium", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(39L, 4L, "11_11", "Zydrine", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(40L, 4L, "11_10", "Megacyte", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(11399L, 4L, "35_02", "Morphite", BigDecimal.ZERO));
eventBus.fireEvent(new PriceSetManyItemsAddedEvent(trackingManager, constants, priceSetItems, 0L));
}
}));
staticHandlerRegistrations.add(display.getAddAdvancedMoonMaterialButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
List<PriceSetItemDto> priceSetItems = new ArrayList<PriceSetItemDto>();
priceSetItems.add(createPriceSetItem(16670L, 4L, "49_09", "Crystalline Carbonide", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(16671L, 4L, "49_11", "Titanium Carbide", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(16672L, 4L, "49_12", "Tungsten Carbide", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(16673L, 4L, "49_10", "Fernite Carbide", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(16678L, 4L, "50_02", "Sylramic Fibers", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(16679L, 4L, "49_14", "Fullerides", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(16680L, 4L, "50_01", "Phenolic Composites", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(16681L, 4L, "49_16", "Nanotransistors", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(16682L, 4L, "49_15", "Hypersynaptic Fibers", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(16683L, 4L, "49_08", "Ferrogel", BigDecimal.ZERO));
priceSetItems.add(createPriceSetItem(17317L, 4L, "49_13", "Fermionic Condensates", BigDecimal.ZERO));
eventBus.fireEvent(new PriceSetManyItemsAddedEvent(trackingManager, constants, priceSetItems, 0L));
}
}));
final Button addNewItemButton = display.getAddNewItemButton();
staticHandlerRegistrations.add(addNewItemButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
addNewItemButton.setEnabled(false);
String itemName = display.getAddNewItemName().getText();
PriceSetAddItemAction action = new PriceSetAddItemAction();
action.setItemTypeName(itemName);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceSetAddItemActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceSetAddItemActionResponse response) {
addNewItemButton.setEnabled(true);
eventBus.fireEvent(new PriceSetItemAddedEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
addNewItemButton.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
final PriceSetListBox corporationPriceSetListBox = display.getCorporationPriceSetNamesListBox();
staticHandlerRegistrations.add(corporationPriceSetListBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
Long currentPriceSetID = corporationPriceSetListBox.getCurrentPriceSetID();
if (currentPriceSetID == -1) {
display.clearCorporationPriceSetItemsTable();
return;
}
corporationPriceSetListBox.setEnabled(false);
PriceSetLoadForCorporationAction action = new PriceSetLoadForCorporationAction();
action.setPriceSetID(currentPriceSetID);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceSetLoadForCorporationActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceSetLoadForCorporationActionResponse response) {
corporationPriceSetListBox.setEnabled(true);
eventBus.fireEvent(new PriceSetLoadedForCorporationEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
corporationPriceSetListBox.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));
final PriceSetListBox alliancePriceSetListBox = display.getAlliancePriceSetNamesListBox();
staticHandlerRegistrations.add(alliancePriceSetListBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
Long currentPriceSetID = alliancePriceSetListBox.getCurrentPriceSetID();
if (currentPriceSetID == -1) {
display.clearAlliancePriceSetItemsTable();
return;
}
alliancePriceSetListBox.setEnabled(false);
PriceSetLoadForAllianceAction action = new PriceSetLoadForAllianceAction();
action.setPriceSetID(currentPriceSetID);
showSpinner();
rpcService.execute(action, new PriceSetTabActionCallback<PriceSetLoadForAllianceActionResponse>(eventBus, trackingManager, constants) {
@Override
public void onSuccess(PriceSetLoadForAllianceActionResponse response) {
alliancePriceSetListBox.setEnabled(true);
eventBus.fireEvent(new PriceSetLoadedForAllianceEvent(trackingManager, constants, response, getExecutionDuration()));
}
@Override
public void onFailure(Throwable throwable) {
alliancePriceSetListBox.setEnabled(true);
super.onFailure(throwable);
}
});
}
}));