Class AbstractDpiConverter
java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.AbstractDpiConverter
- All Implemented Interfaces:
IDpiConverter
- Direct Known Subclasses:
DefaultHorizontalDpiConverter,DefaultVerticalDpiConverter,FixedScalingDpiConverter,NoScalingDpiConverter
Abstract implementation for
IDpiConverter that predefines dpi
conversion factors and methods that convert based on these factors.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintconvertDpiToPixel(int dpi) Converts the given DPI scaled value to a pixel value.intconvertPixelToDpi(int pixel) Converts the given amount of pixels to a DPI scaled value.floatintgetDpi()Returns the dots per inch of the display.protected abstract voidSets the value for the dpi member variable.
-
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:IDpiConverterReturns the dots per inch of the display.- Specified by:
getDpiin interfaceIDpiConverter- Returns:
- the horizontal and vertical DPI
-
getCurrentDpiFactor
public float getCurrentDpiFactor()- Specified by:
getCurrentDpiFactorin interfaceIDpiConverter- Returns:
- The factor that will be used for the current DPI.
-
convertPixelToDpi
public int convertPixelToDpi(int pixel) Description copied from interface:IDpiConverterConverts the given amount of pixels to a DPI scaled value.- Specified by:
convertPixelToDpiin interfaceIDpiConverter- Parameters:
pixel- the amount of pixels to convert.- Returns:
- The converted pixels.
-
convertDpiToPixel
public int convertDpiToPixel(int dpi) Description copied from interface:IDpiConverterConverts the given DPI scaled value to a pixel value.- Specified by:
convertDpiToPixelin interfaceIDpiConverter- Parameters:
dpi- the DPI value to convert.- Returns:
- The pixel value related to the given DPI
-