Java Doc for TwoColumnLayout.java in  » Installer » IzPack » com » izforge » izpack » gui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Installer » IzPack » com.izforge.izpack.gui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.izforge.izpack.gui.TwoColumnLayout

TwoColumnLayout
public class TwoColumnLayout implements LayoutManager2(Code)
This class implements a layout manager that generally lays out components in two columns.

The design goal for this layout manager was to lay out forms for data entry, where there are several rows of entry fields with associated labels. The goal was to have the beginning off all labels line up, as well as the left edge of all the data entry fields. This leads to a situation where all components are essentially laid out in two columns. The columns adjust to accommodate components of various sizes. This means that components that are added are laid out top to bottom, either in the left column, in the right column or straddling both columns. In addition to this general behavior, the following additional layout capabilities are supported:
  • Resizable margins are provided on the left and right side.
  • A special region is provided at the top that is only affected by the side margins but not by any other layout behavior.
  • It is possible to specify the vertical positioning of the cluster of laid out components for the case that they do not occupy the entire available real estate.
  • Individual components can be indented.
The Layout Behavior

The left and right margin are absolute. This means that they can not be penetrated by components. All layout happens between the limits established by these margins. The purpose of these margins is to ensure that components are not laid out all the way to the edge of their container, without the need to set matching borders for each component.

The title margin at the top factors only into the layout behavior if there is a component set to be laid out in that region, otherwise it is ignored.

The vertical space available to each row of components depends on the space requirements of the tallest component in that row. Both components are placed vertically centered in their row.

All horizontal layout is based on the position of three vertical rules, the left rule, the right rule and the center rule.



The actual position of each rule depends on the alignment strategy, margin settings and component sizes. Regardless of these factors, components placed in the left column are always positioned with their left edge aligned with the left rule. Components placed in the right column are always positioned with their left edge aligned with the center rule. If a component straddles both columns, it is always positioned with the left edge aligned with the left rule, but is allowed to extend all the way to the right rule. The only exception is a component that is specified with an indent. In this case the component is moved to the right of the respective rule by the indent amount.

The location of the rules is determined based on the alignment strategy as follows:
  • The right rule is always located at the edge of the right margin.
  • Left Alignment: The left rule is located the edge of the left margin. The center rule is located far enough to the right to clear the widest component in the left column.
  • Center Alignment: The center rule is located at the center of the panel. The left rule is located far enough to the left to make the widest component in the left column fit.
  • Right Alignment The center rule is located far enough to the left of the right rule to make the widest component in the right column fit. The left rule is located far enough to the left to make the widest component in the left column fit.
All components clump together vertically and are positioned right beneath the title margin. This is of course not a very appealing presentation. By setting how the remaining vertical space is distributed above and below the cluster of components the cluster can be positioned more favorably (see the shaded area in the illustration).
See Also:   com.izforge.izpack.gui.TwoColumnConstraints
version:
   0.0.1 / 11/14/02
author:
   Elmar Grom


Field Summary
final public static  intCENTER
    
final public static  intLEFT
    
final public static  intRIGHT
    

Constructor Summary
public  TwoColumnLayout(int margin, int gap, int indent, int topBuffer, int alignment)
     Constructs a TwoColumnLayout layout manager.

Method Summary
public  voidaddLayoutComponent(Component comp, Object constraints)
     Sets the constraints for the specified component in this layout.
public  voidaddLayoutComponent(String name, Component comp)
     Adds the specified component with the specified name to the layout.
public  floatgetLayoutAlignmentX(Container parent)
     Returns the alignment along the x axis.
public  floatgetLayoutAlignmentY(Container parent)
     Returns the alignment along the y axis.
public  voidinvalidateLayout(Container parent)
     Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
public  voidlayoutContainer(Container parent)
     Lays out the container in the specified panel.
public  DimensionmaximumLayoutSize(Container parent)
     Calculates the maximum size dimensions for the specified panel given the components in the specified parent container.
public  DimensionminimumLayoutSize(Container parent)
     Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
public  DimensionpreferredLayoutSize(Container parent)
     Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
public  voidremoveLayoutComponent(Component comp)
    
public  voidshowRules(Graphics2D graphics, Color color)
     This method is provided for conveninence of debugging layout problems.

Field Detail
CENTER
final public static int CENTER(Code)



LEFT
final public static int LEFT(Code)



RIGHT
final public static int RIGHT(Code)




Constructor Detail
TwoColumnLayout
public TwoColumnLayout(int margin, int gap, int indent, int topBuffer, int alignment)(Code)
Constructs a TwoColumnLayout layout manager. To add components use the container's add(comp, constraints) method with a TwoColumnConstraints object.
Parameters:
  margin - the margin width to use on the left and right side in % of the total containerwidth. Values less than 0% and greater than 50% are not accepted.
Parameters:
  gap - the gap between the two columns.
Parameters:
  indent - the indent to use for components that have that constraint set. This is a valuein pixels.
Parameters:
  topBuffer - the percentage of left over vertical space to place on top of the componentcluster. Values between 0% and 100% are accepted.
Parameters:
  alignment - how to align the overall layout. Legal values are LEFT, CENTER, RIGHT.




Method Detail
addLayoutComponent
public void addLayoutComponent(Component comp, Object constraints)(Code)
Sets the constraints for the specified component in this layout. null is a legal value for a component, but not for a constraints object.
Parameters:
  comp - the component to be modified.
Parameters:
  constraints - the constraints to be applied.



addLayoutComponent
public void addLayoutComponent(String name, Component comp)(Code)
Adds the specified component with the specified name to the layout. This version is not supported, use addLayoutComponent with layout contsraints.
Parameters:
  name - the component name
Parameters:
  comp - the component to be added



getLayoutAlignmentX
public float getLayoutAlignmentX(Container parent)(Code)
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
Parameters:
  parent - the component to be laid out



getLayoutAlignmentY
public float getLayoutAlignmentY(Container parent)(Code)
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
Parameters:
  parent - the component to be laid out



invalidateLayout
public void invalidateLayout(Container parent)(Code)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
Parameters:
  parent - the component to be laid out



layoutContainer
public void layoutContainer(Container parent)(Code)
Lays out the container in the specified panel.
Parameters:
  parent - the component which needs to be laid out.



maximumLayoutSize
public Dimension maximumLayoutSize(Container parent)(Code)
Calculates the maximum size dimensions for the specified panel given the components in the specified parent container.
Parameters:
  parent - the component to be laid out



minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)(Code)
Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
Parameters:
  parent - the component to be laid out



preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)(Code)
Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
Parameters:
  parent - the component to be laid out



removeLayoutComponent
public void removeLayoutComponent(Component comp)(Code)
This functionality removes the TwoColumnConstraints from Vectors so that alignment of components on UserInputPanel doesn't get dirty
Parameters:
  comp - the component to be removed



showRules
public void showRules(Graphics2D graphics, Color color)(Code)
This method is provided for conveninence of debugging layout problems. It renders the three rules and the limit of the title marign visible after these positions have been computed. In addition, the indent locations are shown as dashed lines. To use this functionality do the following:

  • in the container using this layout manager override the paint() method.
  • in that method, first call super.paint()
  • then call this method

Note: cast the graphics object received in the paint() method to Graphics2D when making the call.


Parameters:
  graphics - the graphics context used for drawing.
Parameters:
  color - the color to use for rendering the layout grid



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.