public void propertyChange(PropertyChangeEvent event) { List<?> buildQueue = (List<?>) event.getNewValue(); if (buildQueue == null || buildQueue.isEmpty()) { initialize(null); } else { initialize((BuildableType) buildQueue.get(0)); } }
public void setColony(Colony newColony) { if (newColony != colony) { if (colony != null) { colony.removePropertyChangeListener(EVENT, this); for (MouseListener listener : getMouseListeners()) { removeMouseListener(listener); } } this.colony = newColony; // we are interested in changes to the build queue, as well as // changes to the warehouse and the colony's production bonus colony.addPropertyChangeListener(EVENT, this); if (openBuildQueue) { addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent e) { gui.showBuildQueuePanel(colony); } }); } } initialize(colony.getCurrentlyBuilding()); }
public void update() { initialize(colony.getCurrentlyBuilding()); }