void updateOffer(ItemComposition offerItem, BufferedImage itemImage, @Nullable GrandExchangeOffer newOffer)
	{
		if (newOffer == null || newOffer.getState() == EMPTY)
		{
			return;
		}
		else
		{
			cardLayout.show(container, FACE_CARD);

			itemName.setText(offerItem.getMembersName());
			itemIcon.setIcon(new ImageIcon(itemImage));

			boolean buying = newOffer.getState() == BOUGHT
				|| newOffer.getState() == BUYING
				|| newOffer.getState() == CANCELLED_BUY;

			String offerState = (buying ? "Bought " : "Sold ")
				+ QuantityFormatter.quantityToRSDecimalStack(newOffer.getQuantitySold()) + " / "
				+ QuantityFormatter.quantityToRSDecimalStack(newOffer.getTotalQuantity());

			offerInfo.setText(offerState);

			itemPrice.setText(htmlLabel("Price each: ", QuantityFormatter.formatNumber(newOffer.getPrice())));

			String action = buying ? "Spent: " : "Received: ";

			offerSpent.setText(htmlLabel(action, QuantityFormatter.formatNumber(newOffer.getSpent()) + " / "
				+ QuantityFormatter.formatNumber(newOffer.getPrice() * newOffer.getTotalQuantity())));

			progressBar.setForeground(getProgressColor(newOffer));
			progressBar.setMaximumValue(newOffer.getTotalQuantity());
			progressBar.setValue(newOffer.getQuantitySold());

			final JPopupMenu popupMenu = new JPopupMenu();
			popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5));

			final JMenuItem openGeLink = new JMenuItem("Open Grand Exchange website");
			openGeLink.addActionListener(e -> grandExchangePlugin.openGeLink(offerItem.getMembersName(), offerItem.getId()));
			popupMenu.add(openGeLink);

			/* Couldn't set the tooltip for the container panel as the children override it, so I'm setting
			 * the tooltips on the children instead. */
			for (Component c : container.getComponents())
			{
				if (c instanceof JPanel)
				{
					JPanel panel = (JPanel) c;
					panel.setToolTipText(htmlTooltip(((int) progressBar.getPercentage()) + "%"));
					panel.setComponentPopupMenu(popupMenu);
				}
			}
		}

		revalidate();
	}
@Test
	public void testUpdateOffer()
	{
		when(offer.getState()).thenReturn(GrandExchangeOfferState.CANCELLED_BUY);

		GrandExchangeOfferSlot offerSlot = new GrandExchangeOfferSlot(mock(GrandExchangePlugin.class));
		offerSlot.updateOffer(mock(ItemComposition.class), mock(AsyncBufferedImage.class), offer);
	}