}
}
}
private void drawBlueprint(final BlueprintDto blueprint) {
EditableBlueprintDetails editableBlueprintDetails = new EditableBlueprintDetails();
blueprintToEditableDetailsMap.put(blueprint, editableBlueprintDetails);
final int index = blueprintTable.getRowCount();
Long blueprintTypeID = blueprint.getItemTypeID();
String blueprintTypeName = blueprint.getItemTypeName();
List<Integer> rows = blueprintNameToRowsMap.get(blueprintTypeName);
if (rows == null) {
rows = new ArrayList<Integer>();
blueprintNameToRowsMap.put(blueprintTypeName, rows);
}
rows.add(index);
blueprintIdToBlueprintMap.put(blueprint.getId(), blueprint);
blueprintIdToRowMap.put(blueprint.getId(), index);
String blueprintImageUrl = imageUrlProvider.getBlueprintImageUrl(blueprintTypeID);
Image blueprintImage = new Image(blueprintImageUrl);
blueprintImage.setTitle(blueprintTypeName);
blueprintImage.addStyleName(resources.css().image32());
EveItemInfoLink imageItemInfoLink = new EveItemInfoLink(ccpJsMessages, blueprintImage, blueprint.getItemTypeID(), blueprint.getItemID());
blueprintTable.setWidget(index, 0, imageItemInfoLink);
blueprintTable.setWidget(index, 1, new EveItemInfoLink(constants, urlMessages, ccpJsMessages, blueprintTypeName, blueprintTypeID));
blueprintTable.setWidget(index, 2, new Label(messages.me() + ":"));
Label meLabel = new Label(String.valueOf(blueprint.getMaterialLevel()));
blueprintTable.setWidget(index, 3, meLabel);
blueprintTable.setWidget(index, 4, new Label(messages.pe() + ":"));
Label peLabel = new Label(String.valueOf(blueprint.getProductivityLevel()));
blueprintTable.setWidget(index, 5, peLabel);
Button detailsButton = new Button(messages.details());
blueprintTable.setWidget(index, 6, detailsButton);
Button editButton = new Button(messages.edit());
blueprintTable.setWidget(index, 7, editButton);
Button deleteButton = new Button(messages.delete());
blueprintTable.setWidget(index, 8, deleteButton);
FlexTable.FlexCellFormatter blueprintTableCellFormatter = blueprintTable.getFlexCellFormatter();
Image spinnerImage = new Image(resources.spinnerIcon());
spinnerImage.setTitle(messages.loading());
spinnerImage.addStyleName(resources.css().blueprintSpinnerImage());
FlexTable detailsTable = new FlexTable();
detailsTable.setWidget(0, 0, spinnerImage);
blueprintTable.setWidget(index + 1, 0, detailsTable);
blueprintTableCellFormatter.setColSpan(index + 1, 0, 9);
blueprintTableRowFormatter.setVisible(index + 1, false);
handlerRegistrations.add(detailsButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (blueprintTableRowFormatter.isVisible(index + 1)) {
blueprintTableRowFormatter.setVisible(index + 1, false);
} else {
blueprintTableRowFormatter.setVisible(index + 1, true);
}
}
}));
TextBox meLevelTextBox = new TextBox();
meLevelTextBox.setValue(meLabel.getText());
meLevelTextBox.addStyleName(resources.css().mePeInput());
TextBox peLevelTextBox = new TextBox();
peLevelTextBox.setValue(peLabel.getText());
peLevelTextBox.addStyleName(resources.css().mePeInput());
final DecoratedPopupPanel editPopup = new DecoratedPopupPanel(true);
FlexTable editPopupFlexTable = new FlexTable();
editPopupFlexTable.setWidget(0, 0, new Label(messages.materialLevel() + ":"));
editPopupFlexTable.setWidget(0, 1, meLevelTextBox);
editPopupFlexTable.setWidget(1, 0, new Label(messages.productivityLevel() + ":"));
editPopupFlexTable.setWidget(1, 1, peLevelTextBox);
editPopupFlexTable.setWidget(2, 0, new Label(messages.attachedCharacter() + ":"));
AttachedCharacterListBox editAttachToCharacterListBox = new AttachedCharacterListBox(messages);
editAttachToCharacterListBox.addItem(messages.none(), "-1");
for (CharacterNameDto characterNameDto : attachedCharacterNames) {
editAttachToCharacterListBox.addItem(characterNameDto);
}
editAttachToCharacterListBox.setAttachedCharacter(blueprint.getAttachedCharacterInfo());
editPopupFlexTable.setWidget(2, 1, editAttachToCharacterListBox);
editPopupFlexTable.setWidget(3, 0, new Label(messages.sharingLevel() + ":"));
SharingLevelListBox editSharingLevelListBox = new SharingLevelListBox(messages);
for (String sharingLevel : sharingLevels) {
editSharingLevelListBox.addItem(sharingLevel);
}
editSharingLevelListBox.setSharingLevel(blueprint.getSharingLevel());
editPopupFlexTable.setWidget(3, 1, editSharingLevelListBox);
editPopupFlexTable.setWidget(4, 0, new Label(messages.itemID() + ":"));
TextBox itemIdTextBox = new TextBox();
itemIdTextBox.addStyleName(resources.css().itemIdInput());
if (blueprint.getItemID() != null) {
itemIdTextBox.setText(String.valueOf(blueprint.getItemID()));
}
editPopupFlexTable.setWidget(4, 1, itemIdTextBox);
Button saveButton = new Button(messages.save());
editPopupFlexTable.setWidget(5, 0, saveButton);
editPopupFlexTable.getFlexCellFormatter().setColSpan(5, 0, 2);
editPopup.setWidget(editPopupFlexTable);
final DecoratedPopupPanel deletePopup = new DecoratedPopupPanel(true);
FlexTable deletePopupTable = new FlexTable();
deletePopupTable.setWidget(0, 0, new Label(messages.areYouSure()));
Button confirmDeleteButton = new Button(messages.yes());
deletePopupTable.setWidget(1, 0, confirmDeleteButton);
deletePopup.setWidget(deletePopupTable);
editableBlueprintDetails.setSpinnerImage(spinnerImage);
editableBlueprintDetails.setMeLevelLabel(meLabel);
editableBlueprintDetails.setPeLevelLabel(peLabel);
editableBlueprintDetails.setMeLevelTextBox(meLevelTextBox);
editableBlueprintDetails.setPeLevelTextBox(peLevelTextBox);
editableBlueprintDetails.setAttachedCharacterListBox(editAttachToCharacterListBox);
editableBlueprintDetails.setSharingLevelListBox(editSharingLevelListBox);
editableBlueprintDetails.setItemIdTextBox(itemIdTextBox);
editableBlueprintDetails.setSaveButton(saveButton);
editableBlueprintDetails.setDetailsButton(detailsButton);
editableBlueprintDetails.setDeleteButton(confirmDeleteButton);
editableBlueprintDetails.setDetailsTable(detailsTable);
handlerRegistrations.add(editButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Widget source = (Widget) event.getSource();