com.maryanovsky.gwtutils.client.ui
Class GwtUiDefaults

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.ui.GwtUiDefaults

public class GwtUiDefaults
extends Object

Defines various usefil UI related values, such as preferred spacing between elements, difference in element sizes which allows aligning them etc. Currently, the implementation is tailored to Internet Explorer. To better support other browsers, it should detect the browser we're running in and use an appropriate delegate. Also, the implementation is not complete.

Author:
Maryanovsky Alexander

Nested Class Summary
static class GwtUiDefaults.WidgetElementType
          The enumeration of types of widgets for which we offer special treatment.
 
Constructor Summary
GwtUiDefaults()
           
 
Method Summary
static GwtUiDefaults.WidgetElementType getElementType(Widget widget)
          Returns the element type of the specified standard GWT widget, if supported.
static int getFormFieldsButtonsGap()
          Returns the vertical distance between a form's fields and its buttons.
static int getFormTitleFieldsGap()
          Returns the vertical distance between a form's title and its fields.
static int getHorizontalVisualMargin(GwtUiDefaults.WidgetElementType elementType)
          UI elements have a visual edge at which they should be aligned.
static int getHorizontalVisualMargin(Widget widget)
          Similar to getHorizontalVisualMargin(WidgetElementType), but the element type is guessed from the widget using getElementType(Widget).
static int getIconLabelGap()
          Returns the gap between an icon image and its label.
static int getIndentSize()
          Returns the indent size.
static int getRelatedHorizontalDistance()
          Returns the preferred horizontal distance between related elements.
static int getRelatedVerticalDistance()
          Returns the preferred vertical distance between related elements.
static int getUnrelatedHorizontalDistance()
          Returns the preferred horizontal distance between unrelated elements.
static int getUnrelatedVerticalDistance()
          Returns the preferred vertical distance between unrelated elements.
static void makeDialogPanel(Widget widget)
          Makes a "dialog" panel from the specified widget.
static void makePallettePanel(Widget widget)
          Makes a "pallette" panel from the specified widget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GwtUiDefaults

public GwtUiDefaults()
Method Detail

makeDialogPanel

public static void makeDialogPanel(Widget widget)
Makes a "dialog" panel from the specified widget.


makePallettePanel

public static void makePallettePanel(Widget widget)
Makes a "pallette" panel from the specified widget.


getHorizontalVisualMargin

public static int getHorizontalVisualMargin(GwtUiDefaults.WidgetElementType elementType)
UI elements have a visual edge at which they should be aligned. This returns the horizontal margin between their visual edge and their actual boundary.


getHorizontalVisualMargin

public static int getHorizontalVisualMargin(Widget widget)
Similar to getHorizontalVisualMargin(WidgetElementType), but the element type is guessed from the widget using getElementType(Widget). Due to this, the method, only works for the standard GWT widgets, while the version that takes an element type can work for custom widgets as well.


getElementType

public static GwtUiDefaults.WidgetElementType getElementType(Widget widget)
Returns the element type of the specified standard GWT widget, if supported. Throws an exception if the widget is not a standard GWT widget or is an unsupported widget.


getRelatedHorizontalDistance

public static int getRelatedHorizontalDistance()
Returns the preferred horizontal distance between related elements.


getUnrelatedHorizontalDistance

public static int getUnrelatedHorizontalDistance()
Returns the preferred horizontal distance between unrelated elements.


getRelatedVerticalDistance

public static int getRelatedVerticalDistance()
Returns the preferred vertical distance between related elements.


getUnrelatedVerticalDistance

public static int getUnrelatedVerticalDistance()
Returns the preferred vertical distance between unrelated elements.


getIconLabelGap

public static int getIconLabelGap()
Returns the gap between an icon image and its label.


getIndentSize

public static int getIndentSize()
Returns the indent size. This is used when related UI is placed on the next line. This is the number of pixels by which it is indented.


getFormTitleFieldsGap

public static int getFormTitleFieldsGap()
Returns the vertical distance between a form's title and its fields.


getFormFieldsButtonsGap

public static int getFormFieldsButtonsGap()
Returns the vertical distance between a form's fields and its buttons.