Class CopyElementToolItemProperties<V>

java.lang.Object
com.amalgamasimulation.desktop.ui.editor.sections.descriptors.toolitems.ToolItemProperties<CopyElementToolItemProperties<V>>
com.amalgamasimulation.desktop.ui.editor.sections.descriptors.toolitems.CopyElementToolItemProperties<V>
Type Parameters:
V - the type of elements that can be copied

public class CopyElementToolItemProperties<V> extends ToolItemProperties<CopyElementToolItemProperties<V>>
A builder class for configuring properties of a copy element tool item in table toolbars. Provides methods to set copy actions, icons, text, and tooltips for copying table elements. This class is designed to be used by end users to configure copy functionality in table toolbars within their applications.
Author:
Ionov Ivan
  • Constructor Details

    • CopyElementToolItemProperties

      public CopyElementToolItemProperties()
      Constructs a new CopyElementToolItemProperties instance with default values. Sets default copy icon, text, and tooltip from platform resources.
  • Method Details

    • isExistCopyElementToolItem

      public boolean isExistCopyElementToolItem()
      Checks if a copy element action is configured for this tool item.
      Returns:
      true if either a default or custom copy action is configured, false otherwise
    • getDefaultCopyElementAction

      public Function<V,V> getDefaultCopyElementAction()
      Returns the default copy element action function.
      Returns:
      a Function that copies an element of type V
    • defaultCopyElementAction

      public CopyElementToolItemProperties<V> defaultCopyElementAction(UnaryOperator<V> defaultCopyElementAction)
      Sets a default copy element action using a UnaryOperator. This method is mutually exclusive with customCopyElementAction().
      Parameters:
      defaultCopyElementAction - a UnaryOperator that copies an element of type V
      Returns:
      this CopyElementToolItemProperties instance for method chaining
      Throws:
      IllegalStateException - if a custom copy action is already configured
    • getCustomCopyElementAction

      public BiFunction<Table<V>,V,V> getCustomCopyElementAction()
      Returns the custom copy element action function.
      Returns:
      a BiFunction that copies an element of type V with table context
    • customCopyElementAction

      public CopyElementToolItemProperties<V> customCopyElementAction(BiFunction<Table<V>,V,V> customCopyElementAction)
      Sets a custom copy element action using a BiFunction that includes table context. This method is mutually exclusive with defaultCopyElementAction().
      Parameters:
      customCopyElementAction - a BiFunction that copies an element with table context
      Returns:
      this CopyElementToolItemProperties instance for method chaining
      Throws:
      IllegalStateException - if a default copy action is already configured