org.deidentifier.arx.gui.view

## Class SWTUtil

- java.lang.Object
- - org.deidentifier.arx.gui.view.SWTUtil

    public class SWTUtil
    extends java.lang.Object

This class provides some utility methods for working with SWT.

Author:
  Fabian Prasser

### Field Summary

Fields
`static int` `SLIDER_MAX` Constant

### Constructor Summary

Constructors
Constructor and Description
`SWTUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `center(org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.widgets.Monitor monitor)` Centers the shell on the given monitor.
`static void` `center(org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.widgets.Shell parent)` Centers the given shell.
`static void` `changeFont(org.eclipse.swt.widgets.Control control, int style)` Changes a control's font
`static void` `createColumnWithBarCharts(org.eclipse.swt.widgets.Table table, org.eclipse.swt.widgets.TableColumn column)` Adds a bar chart to a column
`static void` `createDisabledImage(org.eclipse.swt.widgets.ToolItem item)` Registers an image for a tool item.
`static org.eclipse.swt.layout.GridData` `createFillGridData()` Creates grid data.
`static org.eclipse.swt.layout.GridData` `createFillGridData(int span)` Creates grid data.
`static org.eclipse.swt.layout.GridData` `createFillHorizontallyGridData()` Creates grid data.
`static org.eclipse.swt.layout.GridData` `createFillHorizontallyGridData(boolean fill)` Creates grid data.
`static org.eclipse.swt.layout.GridData` `createFillHorizontallyGridData(boolean fill, int span)` Creates grid data.
`static org.eclipse.swt.layout.GridData` `createFillVerticallyGridData()` Creates grid data.
`static org.eclipse.swt.layout.GridData` `createFillVerticallyGridData(int span)` Creates grid data with a horizontal span.
`static void` `createGenericTooltip(org.eclipse.swt.widgets.Table table)` Creates a generic tooltip for the table
`static org.eclipse.swt.layout.GridData` `createGridData()` Creates grid data.
`static org.eclipse.swt.layout.GridLayout` `createGridLayout(int columns)` Creates a grid layout.
`static org.eclipse.swt.layout.GridLayout` `createGridLayout(int columns, boolean compact)` Creates a grid layout.
`static org.eclipse.swt.layout.GridLayout` `createGridLayoutWithEqualWidth(int columns)` Creates a grid layout with equal-width columns
`static void` `createHelpButton(Controller controller, org.eclipse.swt.custom.CTabFolder folder, java.lang.String id)` Creates a help button in the given folder.
`static void` `createHelpButton(Controller controller, org.eclipse.swt.custom.CTabFolder folder, java.lang.String id, java.util.Map<org.eclipse.swt.widgets.Composite,java.lang.String> helpids)` Creates a help button in the given folder.
`static org.eclipse.swt.layout.GridData` `createNoFillGridData()` Creates grid data.
`static org.eclipse.nebula.widgets.pagination.table.PageableTable` `createPageableTableViewer(org.eclipse.swt.widgets.Composite container, int style, boolean fill, boolean equalSize)` Returns a table viewer with pagination.
`static org.eclipse.swt.widgets.Table` `createTable(org.eclipse.swt.widgets.Composite parent, int style)` Returns a table.
`static de.linearbits.swt.table.DynamicTable` `createTableDynamic(org.eclipse.swt.widgets.Composite parent, int style)` Returns a dynamic table.
`static org.eclipse.jface.viewers.TableViewer` `createTableViewer(org.eclipse.swt.widgets.Composite container, int style)` Returns a table viewer.
`static org.eclipse.jface.viewers.CheckboxTableViewer` `createTableViewerCheckbox(org.eclipse.swt.widgets.Composite container, int style)` Returns a checkbox table viewer.
`static void` `disable(org.eclipse.swt.widgets.Composite elem)` Disables the composite and its children.
`static void` `disable(org.eclipse.swt.widgets.Control elem)` Disables the control.
`static int` `doubleToSlider(double min, double max, double value)` Converts the double value to a slider selection.
`static void` `enable(org.eclipse.swt.widgets.Composite elem)` Enables the composite and its children.
`static void` `enable(org.eclipse.swt.widgets.Control elem)` Enables the control.
`static void` `fixOSXMenu(Controller controller)` Fixes the application menu on OSX.
`static void` `fixOSXSashBug(org.eclipse.swt.custom.SashForm sash)` Tries to fix a bug when resizing sash forms in OSX
`static java.lang.String` `getPrettyString(boolean value)` Converts a boolean into a pretty string
`static java.lang.String` `getPrettyString(double value)` Returns a pretty string representing the given double
`static java.lang.String` `getPrettyString(int value)` Returns a pretty string representing the given value
`static java.lang.String` `getPrettyString(long value)` Returns a pretty string representing the given value
`static java.lang.String` `getPrettyString(java.lang.Object value)` Fallback for objects of unknown type
`static boolean` `isMac()` Are we running on an OSX system
`static double` `sliderToDouble(double min, double max, int value)` Converts the slider value to a double.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### SLIDER_MAX

    public static final int SLIDER_MAX

Constant

See Also:
  Constant Field Values

### Constructor Detail

#### SWTUtil

    public SWTUtil()

### Method Detail

#### center

    public static void center(org.eclipse.swt.widgets.Shell shell,
                              org.eclipse.swt.widgets.Monitor monitor)

Centers the shell on the given monitor.

Parameters:
  `shell` -
  `monitor` -

#### center

    public static void center(org.eclipse.swt.widgets.Shell shell,
                              org.eclipse.swt.widgets.Shell parent)

Centers the given shell.

Parameters:
  `shell` -
  `parent` -

#### changeFont

    public static void changeFont(org.eclipse.swt.widgets.Control control,
                                  int style)

Changes a control's font

Parameters:
  `control` -
  `style` -

#### createColumnWithBarCharts

    public static void createColumnWithBarCharts(org.eclipse.swt.widgets.Table table,
                                                 org.eclipse.swt.widgets.TableColumn column)

Adds a bar chart to a column

Parameters:
  `table` -
  `column` -

#### createDisabledImage

    public static void createDisabledImage(org.eclipse.swt.widgets.ToolItem item)

Registers an image for a tool item. Generates a version of the image that renders well on windows toolbars, when disabled.

Parameters:
  `item` -
  `image` -

#### createFillGridData

    public static org.eclipse.swt.layout.GridData createFillGridData()

Creates grid data.

Returns:

#### createFillGridData

    public static org.eclipse.swt.layout.GridData createFillGridData(int span)

Creates grid data.

Returns:

#### createFillHorizontallyGridData

    public static org.eclipse.swt.layout.GridData createFillHorizontallyGridData()

Creates grid data.

Returns:

#### createFillHorizontallyGridData

    public static org.eclipse.swt.layout.GridData createFillHorizontallyGridData(boolean fill)

Creates grid data.

Returns:

#### createFillHorizontallyGridData

    public static org.eclipse.swt.layout.GridData createFillHorizontallyGridData(boolean fill,
                                                                                 int span)

Creates grid data.

Returns:

#### createFillVerticallyGridData

    public static org.eclipse.swt.layout.GridData createFillVerticallyGridData()

Creates grid data.

Returns:

#### createFillVerticallyGridData

    public static org.eclipse.swt.layout.GridData createFillVerticallyGridData(int span)

Creates grid data with a horizontal span.

Returns:

#### createGenericTooltip

    public static void createGenericTooltip(org.eclipse.swt.widgets.Table table)

Creates a generic tooltip for the table

Parameters:
  `table` -

#### createGridData

    public static org.eclipse.swt.layout.GridData createGridData()

Creates grid data.

Returns:

#### createGridLayout

    public static org.eclipse.swt.layout.GridLayout createGridLayout(int columns)

Creates a grid layout.

Parameters:
  `columns` -
Returns:

#### createGridLayout

    public static org.eclipse.swt.layout.GridLayout createGridLayout(int columns,
                                                                     boolean compact)

Creates a grid layout.

Parameters:
  `columns` -
  `compact` -
Returns:

#### createGridLayoutWithEqualWidth

    public static org.eclipse.swt.layout.GridLayout createGridLayoutWithEqualWidth(int columns)

Creates a grid layout with equal-width columns

Parameters:
  `columns` -
Returns:

#### createHelpButton

    public static void createHelpButton(Controller controller,
                                        org.eclipse.swt.custom.CTabFolder folder,
                                        java.lang.String id)

Creates a help button in the given folder.

Parameters:
  `controller` -
  `folder` -
  `id` -

#### createHelpButton

    public static void createHelpButton(Controller controller,
                                        org.eclipse.swt.custom.CTabFolder folder,
                                        java.lang.String id,
                                        java.util.Map<org.eclipse.swt.widgets.Composite,java.lang.String> helpids)

Creates a help button in the given folder.

Parameters:
  `controller` -
  `folder` -
  `id` -
  `helpids` -

#### createNoFillGridData

    public static org.eclipse.swt.layout.GridData createNoFillGridData()

Creates grid data.

Returns:

#### createPageableTableViewer

    public static org.eclipse.nebula.widgets.pagination.table.PageableTable createPageableTableViewer(org.eclipse.swt.widgets.Composite container,
                                                                                                      int style,
                                                                                                      boolean fill,
                                                                                                      boolean equalSize)

Returns a table viewer with pagination. Implements hacks for fixing OSX bugs.

Parameters:
  `parent` -
  `style` -
  `fill` -
  `equalSize` -
Returns:

#### createTable

    public static org.eclipse.swt.widgets.Table createTable(org.eclipse.swt.widgets.Composite parent,
                                                            int style)

Returns a table. Implements hacks for fixing OSX bugs.

Parameters:
  `parent` -
  `style` -
Returns:

#### createTableDynamic

    public static de.linearbits.swt.table.DynamicTable createTableDynamic(org.eclipse.swt.widgets.Composite parent,
                                                                          int style)

Returns a dynamic table. Implements hacks for fixing OSX bugs.

Parameters:
  `parent` -
  `style` -
Returns:

#### createTableViewer

    public static org.eclipse.jface.viewers.TableViewer createTableViewer(org.eclipse.swt.widgets.Composite container,
                                                                          int style)

Returns a table viewer. Implements hacks for fixing OSX bugs.

Parameters:
  `parent` -
  `style` -
Returns:

#### createTableViewerCheckbox

    public static org.eclipse.jface.viewers.CheckboxTableViewer createTableViewerCheckbox(org.eclipse.swt.widgets.Composite container,
                                                                                          int style)

Returns a checkbox table viewer. Implements hacks for fixing OSX bugs.

Parameters:
  `parent` -
  `style` -
Returns:

#### disable

    public static void disable(org.eclipse.swt.widgets.Composite elem)

Disables the composite and its children.

Parameters:
  `elem` -

#### disable

    public static void disable(org.eclipse.swt.widgets.Control elem)

Disables the control.

Parameters:
  `elem` -

#### doubleToSlider

    public static int doubleToSlider(double min,
                                     double max,
                                     double value)

Converts the double value to a slider selection.

Parameters:
  `min` -
  `max` -
  `value` -
Returns:

#### enable

    public static void enable(org.eclipse.swt.widgets.Composite elem)

Enables the composite and its children.

Parameters:
  `elem` -

#### enable

    public static void enable(org.eclipse.swt.widgets.Control elem)

Enables the control.

Parameters:
  `elem` -

#### fixOSXMenu

    public static void fixOSXMenu(Controller controller)

Fixes the application menu on OSX.

Parameters:
  `controller` -

#### fixOSXSashBug

    public static void fixOSXSashBug(org.eclipse.swt.custom.SashForm sash)

Tries to fix a bug when resizing sash forms in OSX

Parameters:
  `sash` -

#### getPrettyString

    public static java.lang.String getPrettyString(boolean value)

Converts a boolean into a pretty string

Parameters:
  `value` -
Returns:

#### getPrettyString

    public static java.lang.String getPrettyString(double value)

Returns a pretty string representing the given double

Parameters:
  `value` -
Returns:

#### getPrettyString

    public static java.lang.String getPrettyString(int value)

Returns a pretty string representing the given value

Parameters:
  `value` -
Returns:

#### getPrettyString

    public static java.lang.String getPrettyString(long value)

Returns a pretty string representing the given value

Parameters:
  `value` -
Returns:

#### getPrettyString

    public static java.lang.String getPrettyString(java.lang.Object value)

Fallback for objects of unknown type

Parameters:
  `value` -
Returns:

#### isMac

    public static boolean isMac()

Are we running on an OSX system

Returns:

#### sliderToDouble

    public static double sliderToDouble(double min,
                                        double max,
                                        int value)

Converts the slider value to a double.

Parameters:
  `min` -
  `max` -
  `value` -
Returns: