/**
  * Replaces the initial status label.
  *
  * @param label The value to replace.
  */
 void setStatusLabel(StatusLabel label) {
   statusLabel = label;
   statusLabel.addPropertyChangeListener(this);
   buildGUI();
   revalidate();
   repaint();
 }
  /** Initializes the components. */
  private void initComponents() {
    reimportedLabel = new JLabel("Reimported");
    reimportedLabel.setVisible(false);
    showContainerLabel = true;
    adapter =
        new MouseAdapter() {

          /**
           * Views the image.
           *
           * @see MouseListener#mousePressed(MouseEvent)
           */
          public void mousePressed(MouseEvent e) {
            if (e.getClickCount() == 1) {
              ViewImage evt;
              int plugin = ImporterAgent.runAsPlugin();
              if (image instanceof ThumbnailData) {
                ThumbnailData data = (ThumbnailData) image;
                EventBus bus = ImporterAgent.getRegistry().getEventBus();
                if (data.getImage() != null) {
                  evt =
                      new ViewImage(
                          new SecurityContext(group.getId()),
                          new ViewImageObject(data.getImage()),
                          null);
                  evt.setPlugin(plugin);
                  bus.post(evt);
                }
              } else if (image instanceof ImageData) {
                ImageData data = (ImageData) image;
                EventBus bus = ImporterAgent.getRegistry().getEventBus();
                if (data != null) {
                  evt =
                      new ViewImage(
                          new SecurityContext(group.getId()), new ViewImageObject(data), null);
                  evt.setPlugin(plugin);
                  bus.post(evt);
                }
              } else if (image instanceof PlateData) {
                firePropertyChange(BROWSE_PROPERTY, null, image);
              }
            }
          }
        };

    setLayout(new FlowLayout(FlowLayout.LEFT));
    busyLabel = new JXBusyLabel(SIZE);
    busyLabel.setVisible(false);
    busyLabel.setBusy(false);

    cancelButton = new JLabel("Cancel");
    cancelButton.setForeground(UIUtilities.HYPERLINK_COLOR);
    cancelButton.addMouseListener(
        new MouseAdapter() {

          /**
           * Browses the object the image.
           *
           * @see MouseListener#mousePressed(MouseEvent)
           */
          public void mousePressed(MouseEvent e) {
            Object src = e.getSource();
            if (e.getClickCount() == 1 && src instanceof JLabel) {
              cancel(true);
            }
          }
        });
    cancelButton.setVisible(true);

    browseButton = new JLabel(BROWSE_CONTAINER_TEXT);
    if (browsable) {
      browseButton.setToolTipText(BROWSE_CONTAINER_TOOLTIP);
      browseButton.setForeground(UIUtilities.HYPERLINK_COLOR);
      browseButton.addMouseListener(
          new MouseAdapter() {

            /**
             * Browses the object the image.
             *
             * @see MouseListener#mousePressed(MouseEvent)
             */
            public void mousePressed(MouseEvent e) {
              Object src = e.getSource();
              if (e.getClickCount() == 1 && src instanceof JLabel) {
                browse();
              }
            }
          });
    }

    browseButton.setVisible(false);

    containerLabel = new JLabel();
    containerLabel.setVisible(false);
    groupLabel = new JLabel("Group: " + group.getName());
    groupLabel.setVisible(false);

    namePane = new JPanel();
    namePane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    IconManager icons = IconManager.getInstance();
    Icon icon;
    if (file.isFile()) icon = icons.getIcon(IconManager.IMAGE);
    else icon = icons.getIcon(IconManager.DIRECTORY);
    imageLabel = new ThumbnailLabel(icon);
    imageLabel.addPropertyChangeListener(this);
    imageLabels = new ArrayList<ThumbnailLabel>();
    ThumbnailLabel label;
    for (int i = 0; i < NUMBER; i++) {
      label = new ThumbnailLabel();
      label.setVisible(false);
      imageLabels.add(label);
    }
    fileNameLabel = new JLabel(file.getName());
    namePane.add(imageLabel);
    Iterator<ThumbnailLabel> j = imageLabels.iterator();
    while (j.hasNext()) {
      namePane.add(j.next());
    }
    namePane.add(Box.createHorizontalStrut(4));
    namePane.add(fileNameLabel);
    namePane.add(Box.createHorizontalStrut(10));
    resultLabel = new JLabel();
    // control = busyLabel;
    errorBox = new JCheckBox("Mark to Send");
    errorBox.setOpaque(false);
    errorBox.setToolTipText("Mark the file to send to the development " + "team.");
    errorBox.setVisible(false);
    errorBox.setSelected(true);
    errorButton = new JButton("Failed");
    errorButton.setForeground(ERROR_COLOR);
    errorButton.addMouseListener(
        new MouseAdapter() {

          /**
           * Displays the error dialog at the specified location.
           *
           * @see MouseAdapter#mouseReleased(MouseEvent)
           */
          public void mouseReleased(MouseEvent e) {
            showError(e.getPoint());
          }
        });
    errorButton.setVisible(false);

    statusLabel = new StatusLabel();
    statusLabel.addPropertyChangeListener(this);
    deleteButton = new JButton(icons.getIcon(IconManager.DELETE));
    deleteButton.setActionCommand("" + DELETE_ID);
    deleteButton.setToolTipText("Delete the image");
    UIUtilities.unifiedButtonLookAndFeel(deleteButton);
    deleteButton.setVisible(false);
    image = null;
  }