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

net.anwiba.commons.swing.object.DefaultObjectFieldConfiguration Maven / Gradle / Ivy

/*
 * #%L
 * anwiba commons swing
 * %%
 * Copyright (C) 2007 - 2016 Andreas Bartels
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 2.1 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * .
 * #L%
 */
package net.anwiba.commons.swing.object;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

import net.anwiba.commons.lang.functional.IConverter;
import net.anwiba.commons.model.IObjectModel;
import net.anwiba.commons.utilities.validation.IValidationResult;
import net.anwiba.commons.utilities.validation.IValidator;

public class DefaultObjectFieldConfiguration extends AbstractObjectTextFieldConfiguration {

  private final IValidator validator;
  private final IConverter toObjectConverter;
  private final IConverter toStringConverter;

  public DefaultObjectFieldConfiguration(
      final IObjectModel model,
      final IObjectModel validStateModel,
      final IValidator validator,
      final IConverter toObjectConverter,
      final IConverter toStringConverter) {
    this(
        model,
        validStateModel,
        validator,
        toObjectConverter,
        toStringConverter,
        null,
        true,
        10,
        new ArrayList<>(),
        null,
        null);
  }

  public DefaultObjectFieldConfiguration(
      final IObjectModel model,
      final IObjectModel validStateModel,
      final IValidator validator,
      final IConverter toObjectConverter,
      final IConverter toStringConverter,
      final boolean isEditable) {
    this(
        model,
        validStateModel,
        validator,
        toObjectConverter,
        toStringConverter,
        null,
        isEditable,
        10,
        new ArrayList<>(),
        null,
        null);
  }

  public DefaultObjectFieldConfiguration(
      final IObjectModel model,
      final IObjectModel validStateModel,
      final IValidator validator,
      final IConverter toObjectConverter,
      final IConverter toStringConverter,
      final IToolTipFactory toolTipFactory,
      final boolean isEditable,
      final int columns,
      final List> actionFactorys,
      final IKeyListenerFactory keyListenerFactory,
      final Color backgroundColor) {
    super(
        model,
        validStateModel,
        toolTipFactory,
        isEditable,
        columns,
        actionFactorys,
        keyListenerFactory,
        backgroundColor);
    this.validator = validator;
    this.toObjectConverter = toObjectConverter;
    this.toStringConverter = toStringConverter;
  }

  @Override
  public IConverter getToObjectConverter() {
    return this.toObjectConverter;
  }

  @Override
  public IConverter getToStringConverter() {
    return this.toStringConverter;
  }

  @Override
  public IValidator getValidator() {
    return this.validator;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy