Package org.uberfire.client.util
Class Layouts
- java.lang.Object
-
- org.uberfire.client.util.Layouts
-
public class Layouts extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_CHILD_SIZE
-
Constructor Summary
Constructors Constructor Description Layouts()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleandisableNearestScrollPanel(com.google.gwt.user.client.ui.Widget w)Disables the scrolling behaviour of the nearest scrollpanel found in the given widget's containment hierarchy.static StringgetContainedHierarchy(com.google.gwt.user.client.ui.Widget startAt)Returns a multi-line string detailing layout information about the given widget and each of its descendants in the widget tree.static StringgetContainmentHierarchy(com.google.gwt.user.client.ui.Widget w)Returns a multi-line string detailing layout information about the given widget and each of its ancestors in the widget tree.static StringgetContainmentHierarchy(com.google.gwt.user.client.ui.Widget w, boolean setDebugIds)Returns a multi-line string detailing layout information about the given widget and each of its ancestors in the widget tree, optionally setting debug IDs on each widget to assist in locating them in browser DOM explorer tools.static intheightOrDefault(org.uberfire.workbench.model.PanelDefinition def)static voidsetToFillParent(com.google.gwt.user.client.ui.Widget w)Sets the CSS on the given widget so it automatically fills the available space, rather than being sized based on the amount of space required by its contents.static intwidthOrDefault(org.uberfire.workbench.model.PanelDefinition def)static intwidthOrHeight(org.uberfire.workbench.model.CompassPosition position, org.uberfire.workbench.model.PanelDefinition definition)Returns the current width or height of the given panel definition.
-
-
-
Field Detail
-
DEFAULT_CHILD_SIZE
public static final int DEFAULT_CHILD_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setToFillParent
public static void setToFillParent(com.google.gwt.user.client.ui.Widget w)
Sets the CSS on the given widget so it automatically fills the available space, rather than being sized based on the amount of space required by its contents. This tends to be useful when building a UI that always fills the available space on the screen, as most desktop application windows do.To achieve this, the element is given relative positioning with top and left set to 0px and width and height set to 100%. This makes the widget fill its nearest ancestor which has relative or absolute positioning. This technique is compatible with GWT's LayoutPanel system. Note that, like LayoutPanels, this only works if the host page is in standards mode (has a
<!DOCTYPE html>header).- Parameters:
w- the widget that should always fill its available space, rather than being sized to fit its contents.
-
getContainmentHierarchy
public static String getContainmentHierarchy(com.google.gwt.user.client.ui.Widget w)
Returns a multi-line string detailing layout information about the given widget and each of its ancestors in the widget tree.- Parameters:
w- the widget to start at. Null is permitted, and results in this method returning an empty string.- Returns:
- information about w and its ancestors, one widget per line.
-
getContainmentHierarchy
public static String getContainmentHierarchy(com.google.gwt.user.client.ui.Widget w, boolean setDebugIds)
Returns a multi-line string detailing layout information about the given widget and each of its ancestors in the widget tree, optionally setting debug IDs on each widget to assist in locating them in browser DOM explorer tools.- Parameters:
w- the widget to start at. Null is permitted, and results in this method returning an empty string.setDebugIds- if true, the element and each of its ancestors will have its ID set to"containment-parent-depth", where depth is 0 for the given widget, 1 for its parent, 2 for its grandparent, and so on. This ID will replace any ID that was previously set on the element, so it may break some CSS and even javascript functionality. Use with caution.- Returns:
- information about w and its ancestors, one widget per line.
-
getContainedHierarchy
public static String getContainedHierarchy(com.google.gwt.user.client.ui.Widget startAt)
Returns a multi-line string detailing layout information about the given widget and each of its descendants in the widget tree.- Parameters:
startAt- the widget to start at. Null is permitted.- Returns:
- information about w and its descendants, one widget per line. Each line is indented with leading spaces to illustrate the containment hierarchy.
-
widthOrHeight
public static int widthOrHeight(org.uberfire.workbench.model.CompassPosition position, org.uberfire.workbench.model.PanelDefinition definition)Returns the current width or height of the given panel definition.- Parameters:
position- determines which dimension (width or height) to return.definition- the definition to get the size information from.- Returns:
- the with if position is EAST or WEST; the height if position is NORTH or SOUTH. If no size is provided by the PanelDefinition the DEFAULT_CHILD_SIZE is used.
-
heightOrDefault
public static int heightOrDefault(org.uberfire.workbench.model.PanelDefinition def)
-
widthOrDefault
public static int widthOrDefault(org.uberfire.workbench.model.PanelDefinition def)
-
disableNearestScrollPanel
public static boolean disableNearestScrollPanel(com.google.gwt.user.client.ui.Widget w)
Disables the scrolling behaviour of the nearest scrollpanel found in the given widget's containment hierarchy.FIXME this is a really horrible workaround! should instead modify UF API to allow PanelDefinition to opt out of having a scroll panel. The better fix would require changes to:
- WorkbenchPartPresenter.View
- WorkbenchPartView and its mock
- The @WorkbenchPanel annotation
- The annotation processor code generators and their tests
- Returns:
- true if a scroll panel was found and disabled; false if no scroll panel was found.
-
-