Class AbstractDpiConverter

java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.AbstractDpiConverter
All Implemented Interfaces:
IDpiConverter
Direct Known Subclasses:
DefaultHorizontalDpiConverter, DefaultVerticalDpiConverter, FixedScalingDpiConverter, NoScalingDpiConverter

public abstract class AbstractDpiConverter extends Object implements IDpiConverter
Abstract implementation for IDpiConverter that predefines dpi conversion factors and methods that convert based on these factors.
  • Field Details

    • dpi

      protected int dpi
    • scaleFactor

      protected float scaleFactor
      Since:
      2.0
  • Constructor Details

    • AbstractDpiConverter

      public AbstractDpiConverter()
  • Method Details

    • readDpiFromDisplay

      protected abstract void readDpiFromDisplay()
      Sets the value for the dpi member variable.

      IMPORTANT:
      Ensure the load operation is done in the UI thread!

    • getDpi

      public int getDpi()
      Description copied from interface: IDpiConverter
      Returns the dots per inch of the display.
      Specified by:
      getDpi in interface IDpiConverter
      Returns:
      the horizontal and vertical DPI
    • getCurrentDpiFactor

      public float getCurrentDpiFactor()
      Specified by:
      getCurrentDpiFactor in interface IDpiConverter
      Returns:
      The factor that will be used for the current DPI.
    • convertPixelToDpi

      public int convertPixelToDpi(int pixel)
      Description copied from interface: IDpiConverter
      Converts the given amount of pixels to a DPI scaled value.
      Specified by:
      convertPixelToDpi in interface IDpiConverter
      Parameters:
      pixel - the amount of pixels to convert.
      Returns:
      The converted pixels.
    • convertDpiToPixel

      public int convertDpiToPixel(int dpi)
      Description copied from interface: IDpiConverter
      Converts the given DPI scaled value to a pixel value.
      Specified by:
      convertDpiToPixel in interface IDpiConverter
      Parameters:
      dpi - the DPI value to convert.
      Returns:
      The pixel value related to the given DPI