UIForTextPane.java

  1. package swingtree;

  2. import javax.swing.*;
  3. import java.util.Objects;

  4. /**
  5.  *  A declarative SwingTree builder designed for configuring {@link UIForTextPane} instances.
  6.  *
  7.  * @param <P> The type of {@link JTextPane} that this {@link UIForTextPane} configures.
  8.  */
  9. public final class UIForTextPane<P extends JTextPane> extends UIForAnyEditorPane<UIForTextPane<P>, P>
  10. {
  11.     private final BuilderState<P> _state;

  12.     /**
  13.      * {@link UIForAnySwing} (sub)types always wrap
  14.      * a single component for which they are responsible.
  15.      *
  16.      * @param state The {@link BuilderState} modelling how the component is built.
  17.      */
  18.     UIForTextPane( BuilderState<P> state ) {
  19.         Objects.requireNonNull(state);
  20.         _state = state;
  21.     }

  22.     @Override
  23.     protected BuilderState<P> _state() {
  24.         return _state;
  25.     }
  26.    
  27.     @Override
  28.     protected UIForTextPane<P> _newBuilderWithState(BuilderState<P> newState ) {
  29.         return new UIForTextPane<>(newState);
  30.     }
  31. }