Class ResizePolicy

All Implemented Interfaces:
IAdaptable.Bound<IVisualPart<? extends Node>>, IPolicy

public class ResizePolicy extends AbstractPolicy
The ResizePolicy is an AbstractPolicy that handles the resize of an IVisualPart.
  • Constructor Details

    • ResizePolicy

      public ResizePolicy()
  • Method Details

    • applySize

      protected void applySize(double dw, double dh)
      Apply the new size to the host.
      Parameters:
      dw - The width delta.
      dh - The height delta.
    • commit

      public ITransactionalOperation commit()
      Description copied from class: AbstractPolicy
      Returns an ITransactionalOperation that performs all manipulations applied by the policy since the previous AbstractPolicy.init() call.
      Specified by:
      commit in interface IPolicy
      Overrides:
      commit in class AbstractPolicy
      Returns:
      An ITransactionalOperation that performs all manipulations applied by the policy since the last AbstractPolicy.init() call.
    • computeApplicableDelta

      protected Dimension computeApplicableDelta(double dw, double dh)
      Computes the applicable delta from the given delta width and delta height values, i.e. respecting the part's minimum size.
      Parameters:
      dw - The width delta.
      dh - The height delta.
      Returns:
      A Dimension containing the applicable delta based on the given values.
    • createOperation

      protected ITransactionalOperation createOperation()
      Description copied from class: AbstractPolicy
      Creates an ITransactionalOperation that is used to encapsulate the changes that are applied by this AbstractPolicy through its "work" methods. The created operation should allow for local execution at each time.
      Specified by:
      createOperation in class AbstractPolicy
      Returns:
      A new ITransactionalOperation to encapsulate all applied changes.
    • createResizeContentOperation

      protected ITransactionalOperation createResizeContentOperation(ResizeOperation resizeOperation)
      Create an operation to resize the content according to the given ResizeOperation.
      Parameters:
      resizeOperation - The ResizeOperation for which to create a ResizeContentOperation.
      Returns:
      The operation to resize the content.
    • getCurrentSize

      protected Dimension getCurrentSize()
      Returns the current size of the IResizableContentPart.
      Returns:
      The current size.
    • getDeltaHeight

      public double getDeltaHeight()
      Returns the delta height of the resize operation that is used by this policy.
      Returns:
      The delta height of the resize operation that is used by this policy.
    • getDeltaWidth

      public double getDeltaWidth()
      Returns the delta width of the resize operation that is used by this policy.
      Returns:
      The delta width of the resize operation that is used by this policy.
    • getHost

      public IResizableContentPart<? extends Node> getHost()
      Description copied from interface: IPolicy
      Returns the host of this IPolicy, i.e. the IVisualPart this IPolicy is attached to.
      Returns:
      The host of this IPolicy.
    • getInitialSize

      protected Dimension getInitialSize()
      Returns the initial size of the IResizableContentPart.
      Returns:
      The initial size.
    • getResizeOperation

      protected ResizeOperation getResizeOperation()
      Returns the ResizeOperation that is used by this ResizePolicy.
      Returns:
      The ResizeOperation used by this AbstractPolicy.
    • isContentResizable

      protected boolean isContentResizable()
      Returns whether the content part supports a content resize operation.
      Returns:
      true if content resize is supported, false otherwise.
    • resize

      public void resize(double finalDw, double finalDh)
      Resizes the host by the given delta width and delta height.
      Parameters:
      finalDw - The delta width.
      finalDh - The delta height.
    • updateResizeOperation

      protected void updateResizeOperation(double intendedDeltaWidth, double intendedDeltaHeight)
      Computes the applicable delta width and height from the given intended delta values and updates the operation accordingly.
      Parameters:
      intendedDeltaWidth - The intended width delta.
      intendedDeltaHeight - The intended height delta.