uk.co.ist.mwt
Class DlogTemplateLayout

java.lang.Object
  |
  +--uk.co.ist.mwt.MarginLayoutManager
        |
        +--uk.co.ist.mwt.DlogTemplateLayout
Direct Known Subclasses:
IconDlogTemplateLayout

public class DlogTemplateLayout
extends MarginLayoutManager

The DlogTemplateLayout class is an AWT layout manager class which knows how to lay out its children in a manner mimicking the Motif Dialog Template as produced by setting the dialogType resource on a XmMessageBox to XmDIALOG_TEMPLATE. Menubars, unfortunately, are not handled.

See Also:
Serialized Form

Fields inherited from class uk.co.ist.mwt.MarginLayoutManager
marginHeight, marginWidth
 
Constructor Summary
DlogTemplateLayout()
           
 
Method Summary
protected  void addExtraComponents(java.awt.Container c)
          Adds any extra components to the container that we're managing - eg.
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Add a component to the layout manager's records.
protected  java.awt.Dimension buttonSize(boolean minimumSize)
          Finds how large a button should be in the layout.
protected  void getComponents(java.awt.Container parent)
          Gets the list of components for a given parent container, ignoring components which were added by this layout - eg.
 boolean getMinimizeButtons()
          Get accessor for the /minimizeButtons/ flag
protected  boolean isNotWorkarea(java.awt.Component comp)
          Is the passed-in component a work area/button or something that is just there for the appearance of the dialog?
 boolean isSeparatorVisible()
           
 void layoutContainer(java.awt.Container parent)
          Lays out the container.
protected  java.awt.Dimension layoutSize(boolean minimum, java.awt.Container parent)
          Calculates how much space the layed-out components will take up.
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Calculates the minimum size this layout would need to lay out all of the children of the container
protected  void placeButtons(java.util.Vector buttons, int buttonTop, java.awt.Dimension parentSize, java.awt.Dimension buttonsSize, java.awt.Insets insets)
          Places the buttons in the correct place for this layout
protected  void placeWorkArea(java.awt.Component workArea, int width, int height, int x, int y)
          Places the work area (and its icon) in a specified place
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Calculates the size this layout would like to lay out all of the children of the container
 void removeLayoutComponent(java.awt.Component comp)
          Remove a component from the layout manager's records.
 void setMinimizeButtons(boolean minimize)
          Accessor to set the layout so that it makes all buttons their preferred sizes, rather than setting them all to the size of the largest.
 void setSeparatorVisible(boolean b)
           
protected  java.awt.Dimension workAreaSize(boolean minimum, java.awt.Component workArea)
          Calculates how much space the work area will take up
 
Methods inherited from class uk.co.ist.mwt.MarginLayoutManager
getMarginHeight, getMarginWidth, setMarginHeight, setMarginWidth, sizeOfComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DlogTemplateLayout

public DlogTemplateLayout()
Method Detail

setMinimizeButtons

public void setMinimizeButtons(boolean minimize)
Accessor to set the layout so that it makes all buttons their preferred sizes, rather than setting them all to the size of the largest.
See Also:
getMinimizeButtons()

getMinimizeButtons

public boolean getMinimizeButtons()
Get accessor for the /minimizeButtons/ flag
See Also:
setMinimizeButtons(boolean)

layoutContainer

public void layoutContainer(java.awt.Container parent)
Lays out the container. We ignore the menu bar, as it can handle itself well enough (especially on the Mac).
Overrides:
layoutContainer in class MarginLayoutManager
Parameters:
parent - the container to lay out

placeButtons

protected void placeButtons(java.util.Vector buttons,
                            int buttonTop,
                            java.awt.Dimension parentSize,
                            java.awt.Dimension buttonsSize,
                            java.awt.Insets insets)
Places the buttons in the correct place for this layout
Parameters:
buttons - the list of buttons
buttonTop - the y co-ordinate for the buttons
parentSize - the size of our parent container with the insets - but not the margins - already deducted.
buttonSize - the size each button should be if we're not minimising them.

placeWorkArea

protected void placeWorkArea(java.awt.Component workArea,
                             int width,
                             int height,
                             int x,
                             int y)
Places the work area (and its icon) in a specified place
Parameters:
workArea - the work area component
width - the width you want it to have
height - the height you want it to have
x - the x co-ordinate you want it to have
y - the y co-ordinate you want it to have

buttonSize

protected java.awt.Dimension buttonSize(boolean minimumSize)
Finds how large a button should be in the layout. All of the buttons in a DialogTemplate are the same size; we need to find the tallest and the widest button(s) and use their sizes. NB. this only applies if the /minimizeButtons/ flag is false.
Parameters:
minimumSize - use getMinimumSize when asking child components for their size - not getPreferredSize.
Returns:
the size

workAreaSize

protected java.awt.Dimension workAreaSize(boolean minimum,
                                          java.awt.Component workArea)
Calculates how much space the work area will take up
Parameters:
miniumum - use getMinimumSize when asking child components for their size - not getPreferredSize.
workArea - the component this layout is using as its work area - the non-button child
Returns:
the size the work area wants

layoutSize

protected java.awt.Dimension layoutSize(boolean minimum,
                                        java.awt.Container parent)
Calculates how much space the layed-out components will take up. This is called by both minimumLayoutSize and preferredLayoutSize, the only difference being the /minimum/ parameter.
Parameters:
minimum - decides whether the size you get back is the minimum (true) or preferred size.
parent - the Container this layout should try to lay out in
Returns:
the size needed for the children

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Calculates the minimum size this layout would need to lay out all of the children of the container
Overrides:
minimumLayoutSize in class MarginLayoutManager
Parameters:
parent - the container
Returns:
the size

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Calculates the size this layout would like to lay out all of the children of the container
Overrides:
preferredLayoutSize in class MarginLayoutManager
Parameters:
parent - the container
Returns:
the size

addExtraComponents

protected void addExtraComponents(java.awt.Container c)
Adds any extra components to the container that we're managing - eg. the separator.
Parameters:
c - the container

getComponents

protected void getComponents(java.awt.Container parent)
Gets the list of components for a given parent container, ignoring components which were added by this layout - eg. separators - and also ignoring any non-visible components
Parameters:
parent - the parent

isNotWorkarea

protected boolean isNotWorkarea(java.awt.Component comp)
Is the passed-in component a work area/button or something that is just there for the appearance of the dialog?

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Remove a component from the layout manager's records. Because we do not associate any extra contraints-type information with a component, its name included, we do not keep an internal list of the components we are meant to be laying out; instead, like the Flow- and GridLayout classes, we construct a new list of Components to lay out each time we are asked to do so. So, removeLayoutComponent is not used.
Overrides:
removeLayoutComponent in class MarginLayoutManager
Parameters:
comp - would be the component to remove.
See Also:
addLayoutComponent(java.lang.String, java.awt.Component)

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Add a component to the layout manager's records. Because we do not associate any extra contraints-type information with a component, its name included, we do not keep an internal list of the components we are meant to be laying out; instead, like the Flow- and GridLayout classes, we construct a new list of Components to lay out each time we are asked to do so. So, addLayoutComponent is not used.
Overrides:
addLayoutComponent in class MarginLayoutManager
Parameters:
comp - would be the component to add.
name - would be the name with which to add the component.
See Also:
removeLayoutComponent(java.awt.Component)

setSeparatorVisible

public void setSeparatorVisible(boolean b)

isSeparatorVisible

public boolean isSeparatorVisible()