001/*
002 * Portions created by Ernie Rael are
003 * Copyright (C) 2026 Ernie Rael.  All Rights Reserved.
004 *
005 * This Source Code Form is subject to the terms of the Mozilla Public
006 * License, v. 2.0. If a copy of the MPL was not distributed with this
007 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
008 *
009 * Contributor(s): Ernie Rael <errael@raelity.com>
010 */
011
012package dev.visdb.seesaw.contrib.simplevalidation;
013
014
015import java.awt.Component;
016import java.awt.Container;
017
018import org.netbeans.validation.api.ui.swing.ValidationPanel;
019import org.openide.util.lookup.ServiceProvider;
020
021import dev.visdb.seesaw.decorators.DecoratorFactory;
022import dev.visdb.seesaw.decorators.DecoratorFactoryBase;
023
024/**
025 * Handles SimpleValidation.
026 */
027@ServiceProvider(path = DecoratorFactory.DECORATOR_PATH, service = DecoratorFactory.class)
028public class SVDecoratorFactory extends DecoratorFactoryBase {
029  /** Create a DefaultSVDecorator */
030  public SVDecoratorFactory() {
031    super(() -> new DefaultSVDecorator(), SVUtils.SIMPLE_VALIDATION);
032  }
033  
034  /**
035   * {@inheritDoc }
036   * <p>
037   * Wrap the uiPanel in a {@link ValidationPanel}.
038   */
039  @Override
040  public ValidationPanel createDecoratorPanel(Component uiPanel) {
041    return SVUtils.createDecoratorPanel((Container)uiPanel);
042  }
043}
044// vi: sw=2 ts=8