org.eclipse.nebula.widgets.nattable.layer
Class AbstractDpiConverter

java.lang.Object
  extended by org.eclipse.nebula.widgets.nattable.layer.AbstractDpiConverter
All Implemented Interfaces:
IDpiConverter

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 Summary
protected  Integer dpi
           
 
Constructor Summary
AbstractDpiConverter()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dpi

protected Integer dpi
Constructor Detail

AbstractDpiConverter

public AbstractDpiConverter()
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 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


Copyright © 2015. All rights reserved.