Klasse SWTUtil

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

public class SWTUtil extends Object
This class provides some utility methods for working with SWT.
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    static double
    Scale factor for handling higher DPI
    static final int
    Constant
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    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
    Creates grid data.
    static org.eclipse.swt.layout.GridData
    Creates grid data.
    static org.eclipse.swt.layout.GridData
    Creates grid data.
    static org.eclipse.swt.layout.GridData
    Creates grid data.
    static org.eclipse.swt.layout.GridData
    createFillHorizontallyGridData(boolean fill, int span)
    Creates grid data.
    static org.eclipse.swt.layout.GridData
    Creates grid data.
    static org.eclipse.swt.layout.GridData
    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
    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
    Creates a grid layout with equal-width columns
    static void
    createHelpButton(Controller controller, org.eclipse.swt.custom.CTabFolder folder, String id)
    Creates a help button in the given folder.
    static void
    createHelpButton(Controller controller, org.eclipse.swt.custom.CTabFolder folder, String id, Map<org.eclipse.swt.widgets.Composite,String> helpids)
    Creates a help button in the given folder.
    static org.eclipse.swt.layout.GridData
    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
    Enforces a light theme on Linux/GTK
    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 String
    getPrettyString(boolean value)
    Converts a boolean into a pretty string
    static String
    getPrettyString(double value)
    Returns a pretty string representing the given double
    static String
    getPrettyString(int value)
    Returns a pretty string representing the given value
    static String
    getPrettyString(long value)
    Returns a pretty string representing the given value
    static String
    Fallback for objects of unknown type
    static boolean
    Are we running on an OSX system
    static void
    redraw(org.eclipse.swt.widgets.Control control)
    Force redraw on control hierarchy
    static int
    scaleToDPI(int size)
    Scales sizes to DPI settings
    static double
    sliderToDouble(double min, double max, int value)
    Converts the slider value to a double.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Felddetails

    • DPI_SCALE_FACTOR

      public static double DPI_SCALE_FACTOR
      Scale factor for handling higher DPI
    • SLIDER_MAX

      public static final int SLIDER_MAX
      Constant
      Siehe auch:
  • Konstruktordetails

    • SWTUtil

      public SWTUtil()
  • Methodendetails

    • center

      public static void center(org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.widgets.Monitor monitor)
      Centers the shell on the given monitor.
      Parameter:
      shell -
      monitor -
    • center

      public static void center(org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.widgets.Shell parent)
      Centers the given shell.
      Parameter:
      shell -
      parent -
    • changeFont

      public static void changeFont(org.eclipse.swt.widgets.Control control, int style)
      Changes a control's font
      Parameter:
      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
      Parameter:
      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.
      Parameter:
      item -
      image -
    • createFillGridData

      public static org.eclipse.swt.layout.GridData createFillGridData()
      Creates grid data.
      Gibt zurück:
    • createFillGridData

      public static org.eclipse.swt.layout.GridData createFillGridData(int span)
      Creates grid data.
      Gibt zurück:
    • createFillHorizontallyGridData

      public static org.eclipse.swt.layout.GridData createFillHorizontallyGridData()
      Creates grid data.
      Gibt zurück:
    • createFillHorizontallyGridData

      public static org.eclipse.swt.layout.GridData createFillHorizontallyGridData(boolean fill)
      Creates grid data.
      Gibt zurück:
    • createFillHorizontallyGridData

      public static org.eclipse.swt.layout.GridData createFillHorizontallyGridData(boolean fill, int span)
      Creates grid data.
      Gibt zurück:
    • createFillVerticallyGridData

      public static org.eclipse.swt.layout.GridData createFillVerticallyGridData()
      Creates grid data.
      Gibt zurück:
    • createFillVerticallyGridData

      public static org.eclipse.swt.layout.GridData createFillVerticallyGridData(int span)
      Creates grid data with a horizontal span.
      Gibt zurück:
    • createGenericTooltip

      public static void createGenericTooltip(org.eclipse.swt.widgets.Table table)
      Creates a generic tooltip for the table
      Parameter:
      table -
    • createGridData

      public static org.eclipse.swt.layout.GridData createGridData()
      Creates grid data.
      Gibt zurück:
    • createGridLayout

      public static org.eclipse.swt.layout.GridLayout createGridLayout(int columns)
      Creates a grid layout.
      Parameter:
      columns -
      Gibt zurück:
    • createGridLayout

      public static org.eclipse.swt.layout.GridLayout createGridLayout(int columns, boolean compact)
      Creates a grid layout.
      Parameter:
      columns -
      compact -
      Gibt zurück:
    • createGridLayoutWithEqualWidth

      public static org.eclipse.swt.layout.GridLayout createGridLayoutWithEqualWidth(int columns)
      Creates a grid layout with equal-width columns
      Parameter:
      columns -
      Gibt zurück:
    • createHelpButton

      public static void createHelpButton(Controller controller, org.eclipse.swt.custom.CTabFolder folder, String id)
      Creates a help button in the given folder.
      Parameter:
      controller -
      folder -
      id -
    • createHelpButton

      public static void createHelpButton(Controller controller, org.eclipse.swt.custom.CTabFolder folder, String id, Map<org.eclipse.swt.widgets.Composite,String> helpids)
      Creates a help button in the given folder.
      Parameter:
      controller -
      folder -
      id -
      helpids -
    • createNoFillGridData

      public static org.eclipse.swt.layout.GridData createNoFillGridData()
      Creates grid data.
      Gibt zurück:
    • 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.
      Parameter:
      style -
      fill -
      equalSize -
      parent -
      Gibt zurück:
    • 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.
      Parameter:
      parent -
      style -
      Gibt zurück:
    • 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.
      Parameter:
      parent -
      style -
      Gibt zurück:
    • 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.
      Parameter:
      style -
      parent -
      Gibt zurück:
    • 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.
      Parameter:
      style -
      parent -
      Gibt zurück:
    • disable

      public static void disable(org.eclipse.swt.widgets.Composite elem)
      Disables the composite and its children.
      Parameter:
      elem -
    • disable

      public static void disable(org.eclipse.swt.widgets.Control elem)
      Disables the control.
      Parameter:
      elem -
    • doubleToSlider

      public static int doubleToSlider(double min, double max, double value)
      Converts the double value to a slider selection.
      Parameter:
      min -
      max -
      value -
      Gibt zurück:
    • enable

      public static void enable(org.eclipse.swt.widgets.Composite elem)
      Enables the composite and its children.
      Parameter:
      elem -
    • enable

      public static void enable(org.eclipse.swt.widgets.Control elem)
      Enables the control.
      Parameter:
      elem -
    • fixGTKDarkTheme

      public static void fixGTKDarkTheme()
      Enforces a light theme on Linux/GTK
    • fixOSXMenu

      public static void fixOSXMenu(Controller controller)
      Fixes the application menu on OSX.
      Parameter:
      controller -
    • fixOSXSashBug

      public static void fixOSXSashBug(org.eclipse.swt.custom.SashForm sash)
      Tries to fix a bug when resizing sash forms in OSX
      Parameter:
      sash -
    • getPrettyString

      public static String getPrettyString(boolean value)
      Converts a boolean into a pretty string
      Parameter:
      value -
      Gibt zurück:
    • getPrettyString

      public static String getPrettyString(double value)
      Returns a pretty string representing the given double
      Parameter:
      value -
      Gibt zurück:
    • getPrettyString

      public static String getPrettyString(int value)
      Returns a pretty string representing the given value
      Parameter:
      value -
      Gibt zurück:
    • getPrettyString

      public static String getPrettyString(long value)
      Returns a pretty string representing the given value
      Parameter:
      value -
      Gibt zurück:
    • getPrettyString

      public static String getPrettyString(Object value)
      Fallback for objects of unknown type
      Parameter:
      value -
      Gibt zurück:
    • isMac

      public static boolean isMac()
      Are we running on an OSX system
      Gibt zurück:
    • redraw

      public static void redraw(org.eclipse.swt.widgets.Control control)
      Force redraw on control hierarchy
      Parameter:
      control -
    • scaleToDPI

      public static int scaleToDPI(int size)
      Scales sizes to DPI settings
      Parameter:
      size -
      Gibt zurück:
    • sliderToDouble

      public static double sliderToDouble(double min, double max, int value)
      Converts the slider value to a double.
      Parameter:
      min -
      max -
      value -
      Gibt zurück: