private void executeDelClick(UIDisplayElement element, int id, Zone deletezone) { switch (deletezone.zonetype) { case Gather: { MinionSystem.getGatherZoneList().remove(deletezone); break; } case Work: { MinionSystem.getWorkZoneList().remove(deletezone); break; } case Terraform: { MinionSystem.getTerraformZoneList().remove(deletezone); break; } case Storage: { MinionSystem.getStorageZoneList().remove(deletezone); break; } case OreonFarm: { MinionSystem.getOreonFarmZoneList().remove(deletezone); break; } } fillUI(); }
@Override public void click(UIDisplayElement element, int button) { UIListItem listitem = (UIListItem) element; if (listitem.getValue().getClass().equals(ZoneType.class)) { switch (((ZoneType) listitem.getValue())) { case Gather: { uizonelist.removeAll(); for (Zone zone : MinionSystem.getGatherZoneList()) { UIListItem newlistitem = new UIListItem(zone.Name, zone); newlistitem.setTextColor(Color.black); newlistitem.addClickListener(zonelistener); uizonelist.addItem(newlistitem); } uizonelistgroup.setVisible(false); uizonelist.setVisible(true); btnBack.setVisible(true); break; } case Terraform: { uizonelist.removeAll(); for (Zone zone : MinionSystem.getTerraformZoneList()) { UIListItem newlistitem = new UIListItem(zone.Name, zone); newlistitem.setTextColor(Color.black); newlistitem.addClickListener(zonelistener); uizonelist.addItem(newlistitem); } uizonelistgroup.setVisible(false); uizonelist.setVisible(true); btnBack.setVisible(true); break; } case Work: { uizonelist.removeAll(); for (Zone zone : MinionSystem.getWorkZoneList()) { UIListItem newlistitem = new UIListItem(zone.Name, zone); newlistitem.setTextColor(Color.black); newlistitem.addClickListener(zonelistener); uizonelist.addItem(newlistitem); } uizonelistgroup.setVisible(false); uizonelist.setVisible(true); btnBack.setVisible(true); break; } case Storage: { uizonelist.removeAll(); for (Zone zone : MinionSystem.getStorageZoneList()) { UIListItem newlistitem = new UIListItem(zone.Name, zone); newlistitem.setTextColor(Color.black); newlistitem.addClickListener(zonelistener); uizonelist.addItem(newlistitem); } uizonelistgroup.setVisible(false); uizonelist.setVisible(true); btnBack.setVisible(true); break; } case OreonFarm: { uizonelist.removeAll(); for (Zone zone : MinionSystem.getOreonFarmZoneList()) { UIListItem newlistitem = new UIListItem(zone.Name, zone); newlistitem.setTextColor(Color.black); newlistitem.addClickListener(zonelistener); uizonelist.addItem(newlistitem); } uizonelistgroup.setVisible(false); uizonelist.setVisible(true); btnBack.setVisible(true); break; } default: { break; } } } else { if (cmbType.isVisible()) { cmbType.setVisible(false); } lblError.setText(""); Zone zone = (Zone) listitem.getValue(); txtzonename.setText(zone.Name); txtheight.setText("" + zone.zoneheight); txtwidth.setText("" + zone.zonewidth); txtdepth.setText("" + zone.zonedepth); switch (zone.zonetype) { case Gather: { lblzonetype.setText("Zonetype : Gather"); break; } case Terraform: { lblzonetype.setText("Zonetype : Terraform"); break; } case Work: { lblzonetype.setText("Zonetype : Work"); break; } default: { lblzonetype.setText("label wasn't set"); break; } } btnSave.setVisible(false); btnDelete.setVisible(true); } }