All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.io7m.laurel.gui.internal.LValidationCellController Maven / Gradle / Ivy

The newest version!
/*
 * Copyright © 2024 Mark Raynsford  https://www.io7m.com
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */


package com.io7m.laurel.gui.internal;

import com.io7m.laurel.filemodel.LValidationProblemType;
import com.io7m.laurel.filemodel.LValidationProblemType.ImageMissingRequiredCaption;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;

import java.net.URL;
import java.util.ResourceBundle;

/**
 * An validation cell controller.
 */

public final class LValidationCellController implements LViewType
{
  @FXML private TextArea errorText;

  /**
   * An validation cell controller.
   */

  public LValidationCellController()
  {

  }

  /**
   * Unset an item.
   */

  public void unsetItem()
  {
    this.errorText.setText("");
  }

  /**
   * Set an item.
   *
   * @param item The event
   */

  public void setItem(
    final LValidationProblemType item)
  {
    switch (item) {
      case final ImageMissingRequiredCaption missing -> {
        this.onMissingRequiredCaption(missing);
      }
    }
  }

  private void onMissingRequiredCaption(
    final ImageMissingRequiredCaption missing)
  {
    this.errorText.setText(missing.message());
  }

  @Override
  public void initialize(
    final URL url,
    final ResourceBundle resourceBundle)
  {

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy