if(options.get(0).equals("create")){
manageOption("create");
return;
}
if(!ids.isEmpty()){
final Location location=locationManager.find(new Long(ids.get(0)));
nameBox.setText(location.getName());
warehousesCombo.setText(location.getWarehouse().getName());
sbox.setText(location.getDescription().getShortDescription());
dbox.setText(location.getDescription().getLongDescription());
cmbox.setText(location.getDescription().getComment());
if(options.get(0).equals("show")){
nameBox.setDisabled(true);
warehousesCombo.setDisabled(true);
sbox.setDisabled(true);
dbox.setDisabled(true);
cmbox.setDisabled(true);
}
if(options.get(0).equals("edit")){
nameBox.setDisabled(true);
List<Warehouse> replacements=manager.findAll();
for (Warehouse replacement : replacements) {
Comboitem item=new Comboitem(replacement.getName());
warehousesCombo.appendChild(item);
}
Button okButton=new Button("OK");
okButton.addEventListener("onClick", new EventListener(){
public void onEvent(Event event) throws Exception {
Warehouse comp=manager.findByName(warehousesCombo.getText()).get(0);
if(nameBox.getText().equals("")){
Messagebox.show("Name is empty!", "Error", Messagebox.YES , null);
nameBox.focus();
return;
}
location.setName(nameBox.getText());
location.setWarehouse(comp);
location.getDescription().setShortDescription(sbox.getText());
location.getDescription().setLongDescription(dbox.getText());
location.getDescription().setComment(cmbox.getText());
locationManager.update(location);
detach();
}
});