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 forIDpiConverter
that predefines dpi conversion factors and methods that convert based on these factors.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
dpi
protected float
scaleFactor
-
Constructor Summary
Constructors Constructor Description AbstractDpiConverter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
convertDpiToPixel(int dpi)
Converts the given DPI scaled value to a pixel value.int
convertPixelToDpi(int pixel)
Converts the given amount of pixels to a DPI scaled value.float
getCurrentDpiFactor()
int
getDpi()
Returns the dots per inch of the display.protected abstract void
readDpiFromDisplay()
Sets the value for the dpi member variable.
-
-
-
Method Detail
-
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 interfaceIDpiConverter
- Returns:
- the horizontal and vertical DPI
-
getCurrentDpiFactor
public float getCurrentDpiFactor()
- Specified by:
getCurrentDpiFactor
in interfaceIDpiConverter
- 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 interfaceIDpiConverter
- 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 interfaceIDpiConverter
- Parameters:
dpi
- the DPI value to convert.- Returns:
- The pixel value related to the given DPI
-
-