1. /*
  2. * @(#)LayoutManager2.java 1.14 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt;
  8. /**
  9. * Defines an interface for classes that know how to layout Containers
  10. * based on a layout constraints object.
  11. *
  12. * This interface extends the LayoutManager interface to deal with layouts
  13. * explicitly in terms of constraint objects that specify how and where
  14. * components should be added to the layout.
  15. * <p>
  16. * This minimal extension to LayoutManager is intended for tool
  17. * providers who wish to the creation of constraint-based layouts.
  18. * It does not yet provide full, general support for custom
  19. * constraint-based layout managers.
  20. *
  21. * @see LayoutManager
  22. * @see Container
  23. *
  24. * @version 1.14, 12/19/03
  25. * @author Jonni Kanerva
  26. */
  27. public interface LayoutManager2 extends LayoutManager {
  28. /**
  29. * Adds the specified component to the layout, using the specified
  30. * constraint object.
  31. * @param comp the component to be added
  32. * @param constraints where/how the component is added to the layout.
  33. */
  34. void addLayoutComponent(Component comp, Object constraints);
  35. /**
  36. * Calculates the maximum size dimensions for the specified container,
  37. * given the components it contains.
  38. * @see java.awt.Component#getMaximumSize
  39. * @see LayoutManager
  40. */
  41. public Dimension maximumLayoutSize(Container target);
  42. /**
  43. * Returns the alignment along the x axis. This specifies how
  44. * the component would like to be aligned relative to other
  45. * components. The value should be a number between 0 and 1
  46. * where 0 represents alignment along the origin, 1 is aligned
  47. * the furthest away from the origin, 0.5 is centered, etc.
  48. */
  49. public float getLayoutAlignmentX(Container target);
  50. /**
  51. * Returns the alignment along the y axis. This specifies how
  52. * the component would like to be aligned relative to other
  53. * components. The value should be a number between 0 and 1
  54. * where 0 represents alignment along the origin, 1 is aligned
  55. * the furthest away from the origin, 0.5 is centered, etc.
  56. */
  57. public float getLayoutAlignmentY(Container target);
  58. /**
  59. * Invalidates the layout, indicating that if the layout manager
  60. * has cached information it should be discarded.
  61. */
  62. public void invalidateLayout(Container target);
  63. }