Java Doc for CellConstraints.java in  » Swing-Library » abeille-forms-designer » com » jgoodies » forms » layout » 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 » Swing Library » abeille forms designer » com.jgoodies.forms.layout 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jgoodies.forms.layout.CellConstraints

CellConstraints
final public class CellConstraints implements Cloneable,Serializable(Code)
Defines constraints for components that are layed out with the FormLayout. Defines the components display area: grid x, grid y, grid width (column span), grid height (row span), horizontal alignment and vertical alignment.

Most methods return this object to enable method chaining.

You can set optional insets in a constructor. This is useful if you need to use a pixel-size insets to align perceived component bounds with pixel data, for example an icon. Anyway, this is rarely used. The insets don't affect the size computation for columns and rows. I consider renaming the insets to offsets to better indicate the motivation for this option.

Examples:
The following cell constraints locate a component in the third column of the fifth row; column and row span are 1; the component will be aligned with the column's right-hand side and the row's bottom.

 CellConstraints cc = new CellConstraints();
 cc.xy(3, 5);
 cc.xy(3, 5, CellConstraints.RIGHT, CellConstraints.BOTTOM);
 cc.xy(3, 5, "right, bottom");
 cc.xyw(3, 5, 1);
 cc.xyw(3, 5, 1, CellConstraints.RIGHT, CellConstraints.BOTTOM);
 cc.xyw(3, 5, 1, "right, bottom");
 cc.xywh(3, 5, 1, 1);
 cc.xywh(3, 5, 1, 1, CellConstraints.RIGHT, CellConstraints.BOTTOM);
 cc.xywh(3, 5, 1, 1, "right, bottom");
 
See also the examples in the FormLayout class comment.

TODO: Consider renaming the inset to offsets.
author:
   Karsten Lentzsch
version:
   $Revision: 1.2 $


Inner Class :final public static class Alignment implements Serializable

Field Summary
final public static  AlignmentBOTTOM
     Put the component in the bottom.
final public static  AlignmentCENTER
     Put the component in the center.
final public static  AlignmentDEFAULT
     Use the column's or row's default alignment.
final public static  AlignmentFILL
     Fill the cell either horizontally or vertically.
final public static  AlignmentLEFT
     Put the component in the left.
final public static  AlignmentRIGHT
     Put the component in the right.
final public static  AlignmentTOP
     Put the component in the top.
public  intgridHeight
     Describes the component's vertical grid extent (number of cells).
public  intgridWidth
     Describes the component's horizontal grid extend (number of cells).
public  intgridX
     Describes the component's horizontal grid origin (starts at 1).
public  intgridY
     Describes the component's vertical grid origin (starts at 1).
public  AlignmenthAlign
     Describes the component's horizontal alignment.
public  Insetsinsets
     Describes the component's Insets in it's display area.
public  AlignmentvAlign
     Describes the component's vertical alignment.

Constructor Summary
public  CellConstraints()
     Constructs a default instance of CellConstraints.
public  CellConstraints(int gridX, int gridY)
     Constructs an instance of CellConstraints for the given cell position.
public  CellConstraints(int gridX, int gridY, Alignment hAlign, Alignment vAlign)
     Constructs an instance of CellConstraints for the given cell position, anchor, and fill.
public  CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight)
     Constructs an instance of CellConstraints for the given cell position and size.
public  CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight, Alignment hAlign, Alignment vAlign)
     Constructs an instance of CellConstraints for the given cell position and size, anchor, and fill.
public  CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight, Alignment hAlign, Alignment vAlign, Insets insets)
     Constructs an instance of CellConstraints for the complete set of available properties.
public  CellConstraints(String encodedConstraints)
     Constructs an instance of CellConstraints from the given encoded string properties.

Method Summary
public  Objectclone()
     Creates a copy of this cell constraints object.
 voidensureValidGridBounds(int colCount, int rowCount)
     Checks and verifies that this constraints object has valid grid index values, i.
 voidsetBounds(Component c, FormLayout layout, Rectangle cellBounds, FormLayout.Measure minWidthMeasure, FormLayout.Measure minHeightMeasure, FormLayout.Measure prefWidthMeasure, FormLayout.Measure prefHeightMeasure)
     Sets the component's bounds using the given component and cell bounds.
public  StringtoShortString()
     Returns a short string representation of this constraints object.
public  StringtoShortString(FormLayout layout)
     Returns a short string representation of this constraints object.
public  StringtoString()
     Constructs and returns a string representation of this constraints object.
public  CellConstraintsxy(int col, int row)
     Sets row and column origins; sets width and height to 1; uses the default alignments.
public  CellConstraintsxy(int col, int row, String encodedAlignments)
     Sets row and column origins; sets width and height to 1; decodes horizontal and vertical alignments from the given string.
public  CellConstraintsxy(int col, int row, Alignment colAlign, Alignment rowAlign)
     Sets the row and column origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.
public  CellConstraintsxyw(int col, int row, int colSpan)
     Sets the row, column, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.
public  CellConstraintsxyw(int col, int row, int colSpan, String encodedAlignments)
     Sets the row, column, width, and height; decodes the horizontal and vertical alignments from the given string.
public  CellConstraintsxyw(int col, int row, int colSpan, Alignment colAlign, Alignment rowAlign)
     Sets the row, column, width, and height; sets the horizontal and vertical aligment using the specified alignment objects.
public  CellConstraintsxywh(int col, int row, int colSpan, int rowSpan)
     Sets the row, column, width, and height; uses default alignments.
public  CellConstraintsxywh(int col, int row, int colSpan, int rowSpan, String encodedAlignments)
     Sets the row, column, width, and height; decodes the horizontal and vertical alignments from the given string.
public  CellConstraintsxywh(int col, int row, int colSpan, int rowSpan, Alignment colAlign, Alignment rowAlign)
     Sets the row, column, width, and height; sets the horizontal and vertical aligment using the specified alignment objects.

Field Detail
BOTTOM
final public static Alignment BOTTOM(Code)
Put the component in the bottom.



CENTER
final public static Alignment CENTER(Code)
Put the component in the center.



DEFAULT
final public static Alignment DEFAULT(Code)
Use the column's or row's default alignment.



FILL
final public static Alignment FILL(Code)
Fill the cell either horizontally or vertically.



LEFT
final public static Alignment LEFT(Code)
Put the component in the left.



RIGHT
final public static Alignment RIGHT(Code)
Put the component in the right.



TOP
final public static Alignment TOP(Code)
Put the component in the top.



gridHeight
public int gridHeight(Code)
Describes the component's vertical grid extent (number of cells).



gridWidth
public int gridWidth(Code)
Describes the component's horizontal grid extend (number of cells).



gridX
public int gridX(Code)
Describes the component's horizontal grid origin (starts at 1).



gridY
public int gridY(Code)
Describes the component's vertical grid origin (starts at 1).



hAlign
public Alignment hAlign(Code)
Describes the component's horizontal alignment.



insets
public Insets insets(Code)
Describes the component's Insets in it's display area.



vAlign
public Alignment vAlign(Code)
Describes the component's vertical alignment.




Constructor Detail
CellConstraints
public CellConstraints()(Code)
Constructs a default instance of CellConstraints.



CellConstraints
public CellConstraints(int gridX, int gridY)(Code)
Constructs an instance of CellConstraints for the given cell position.

Examples:

 new CellConstraints(1, 3);
 new CellConstraints(1, 3);
 

Parameters:
  gridX - the component's horizontal grid origin
Parameters:
  gridY - the component's vertical grid origin



CellConstraints
public CellConstraints(int gridX, int gridY, Alignment hAlign, Alignment vAlign)(Code)
Constructs an instance of CellConstraints for the given cell position, anchor, and fill.

Examples:

 new CellConstraints(1, 3, CellConstraints.LEFT, CellConstraints.BOTTOM);
 new CellConstraints(1, 3, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
  gridX - the component's horizontal grid origin
Parameters:
  gridY - the component's vertical grid origin
Parameters:
  hAlign - the component's horizontal alignment
Parameters:
  vAlign - the component's vertical alignment



CellConstraints
public CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight)(Code)
Constructs an instance of CellConstraints for the given cell position and size.

Examples:

 new CellConstraints(1, 3, 2, 1);
 new CellConstraints(1, 3, 7, 3);
 

Parameters:
  gridX - the component's horizontal grid origin
Parameters:
  gridY - the component's vertical grid origin
Parameters:
  gridWidth - the component's horizontal extent
Parameters:
  gridHeight - the component's vertical extent



CellConstraints
public CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight, Alignment hAlign, Alignment vAlign)(Code)
Constructs an instance of CellConstraints for the given cell position and size, anchor, and fill.

Examples:

 new CellConstraints(1, 3, 2, 1, CellConstraints.LEFT, CellConstraints.BOTTOM);
 new CellConstraints(1, 3, 7, 3, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
  gridX - the component's horizontal grid origin
Parameters:
  gridY - the component's vertical grid origin
Parameters:
  gridWidth - the component's horizontal extent
Parameters:
  gridHeight - the component's vertical extent
Parameters:
  hAlign - the component's horizontal alignment
Parameters:
  vAlign - the component's vertical alignment



CellConstraints
public CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight, Alignment hAlign, Alignment vAlign, Insets insets)(Code)
Constructs an instance of CellConstraints for the complete set of available properties.

Examples:

 new CellConstraints(1, 3, 2, 1, CellConstraints.LEFT, CellConstraints.BOTTOM, new Insets(0, 1, 0, 3));
 new CellConstraints(1, 3, 7, 3, CellConstraints.CENTER, CellConstraints.FILL, new Insets(0, 1, 0, 0));
 

Parameters:
  gridX - the component's horizontal grid origin
Parameters:
  gridY - the component's vertical grid origin
Parameters:
  gridWidth - the component's horizontal extent
Parameters:
  gridHeight - the component's vertical extent
Parameters:
  hAlign - the component's horizontal alignment
Parameters:
  vAlign - the component's vertical alignment
Parameters:
  insets - the component's display area Insets
throws:
  IndexOutOfBoundsException - if the grid origin or extent is negative
throws:
  NullPointerException - if the horizontal or vertical alignment is null
throws:
  IllegalArgumentException - if an alignment orientation is invalid



CellConstraints
public CellConstraints(String encodedConstraints)(Code)
Constructs an instance of CellConstraints from the given encoded string properties.

Examples:

 new CellConstraints("1, 3");
 new CellConstraints("1, 3, left, bottom");
 new CellConstraints("1, 3, 2, 1, left, bottom");
 new CellConstraints("1, 3, 2, 1, l, b");
 

Parameters:
  encodedConstraints - the constraints encoded as string




Method Detail
clone
public Object clone()(Code)
Creates a copy of this cell constraints object. a copy of this cell constraints object



ensureValidGridBounds
void ensureValidGridBounds(int colCount, int rowCount)(Code)
Checks and verifies that this constraints object has valid grid index values, i. e. the display area cells are inside the form's grid.
Parameters:
  colCount - number of columns in the grid
Parameters:
  rowCount - number of rows in the grid
throws:
  IndexOutOfBoundsException - if the display area described by this constraints object isnot inside the grid



setBounds
void setBounds(Component c, FormLayout layout, Rectangle cellBounds, FormLayout.Measure minWidthMeasure, FormLayout.Measure minHeightMeasure, FormLayout.Measure prefWidthMeasure, FormLayout.Measure prefHeightMeasure)(Code)
Sets the component's bounds using the given component and cell bounds.
Parameters:
  c - the component to set bounds
Parameters:
  layout - the FormLayout instance that computes the bounds
Parameters:
  cellBounds - the cell's bounds
Parameters:
  minWidthMeasure - measures the minimum width
Parameters:
  minHeightMeasure - measures the minimum height
Parameters:
  prefWidthMeasure - measures the preferred width
Parameters:
  prefHeightMeasure - measures the preferred height



toShortString
public String toShortString()(Code)
Returns a short string representation of this constraints object. a short string representation of this constraints object



toShortString
public String toShortString(FormLayout layout)(Code)
Returns a short string representation of this constraints object. This method can use the given FormLayout to display extra information how default alignments are mapped to concrete alignments. Therefore it asks the related column and row as specified by this constraints object.
Parameters:
  layout - the layout to be presented as a string a short string representation of this constraints object



toString
public String toString()(Code)
Constructs and returns a string representation of this constraints object. string representation of this constraints object



xy
public CellConstraints xy(int col, int row)(Code)
Sets row and column origins; sets width and height to 1; uses the default alignments.

Examples:

 cc.xy(1, 1);
 cc.xy(1, 3);
 

Parameters:
  col - the new column index
Parameters:
  row - the new row index this



xy
public CellConstraints xy(int col, int row, String encodedAlignments)(Code)
Sets row and column origins; sets width and height to 1; decodes horizontal and vertical alignments from the given string.

Examples:

 cc.xy(1, 3, "left, bottom");
 cc.xy(1, 3, "l, b");
 cc.xy(1, 3, "center, fill");
 cc.xy(1, 3, "c, f");
 

Parameters:
  col - the new column index
Parameters:
  row - the new row index
Parameters:
  encodedAlignments - describes the horizontal and vertical alignments this
throws:
  IllegalArgumentException - if an alignment orientation is invalid



xy
public CellConstraints xy(int col, int row, Alignment colAlign, Alignment rowAlign)(Code)
Sets the row and column origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.

Examples:

 cc.xy(1, 3, CellConstraints.LEFT, CellConstraints.BOTTOM);
 cc.xy(1, 3, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
  col - the new column index
Parameters:
  row - the new row index
Parameters:
  colAlign - horizontal component alignment
Parameters:
  rowAlign - vertical component alignment this



xyw
public CellConstraints xyw(int col, int row, int colSpan)(Code)
Sets the row, column, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.

Examples:

 cc.xyw(1, 3, 7);
 cc.xyw(1, 3, 2);
 

Parameters:
  col - the new column index
Parameters:
  row - the new row index
Parameters:
  colSpan - the column span or grid width this



xyw
public CellConstraints xyw(int col, int row, int colSpan, String encodedAlignments)(Code)
Sets the row, column, width, and height; decodes the horizontal and vertical alignments from the given string. The row span (height) is set to 1.

Examples:

 cc.xyw(1, 3, 7, "left, bottom");
 cc.xyw(1, 3, 7, "l, b");
 cc.xyw(1, 3, 2, "center, fill");
 cc.xyw(1, 3, 2, "c, f");
 

Parameters:
  col - the new column index
Parameters:
  row - the new row index
Parameters:
  colSpan - the column span or grid width
Parameters:
  encodedAlignments - describes the horizontal and vertical alignments this
throws:
  IllegalArgumentException - if an alignment orientation is invalid



xyw
public CellConstraints xyw(int col, int row, int colSpan, Alignment colAlign, Alignment rowAlign)(Code)
Sets the row, column, width, and height; sets the horizontal and vertical aligment using the specified alignment objects. The row span (height) is set to 1.

Examples:

 cc.xyw(1, 3, 2, CellConstraints.LEFT, CellConstraints.BOTTOM);
 cc.xyw(1, 3, 7, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
  col - the new column index
Parameters:
  row - the new row index
Parameters:
  colSpan - the column span or grid width
Parameters:
  colAlign - horizontal component alignment
Parameters:
  rowAlign - vertical component alignment this
throws:
  IllegalArgumentException - if an alignment orientation is invalid



xywh
public CellConstraints xywh(int col, int row, int colSpan, int rowSpan)(Code)
Sets the row, column, width, and height; uses default alignments.

Examples:

 cc.xywh(1, 3, 2, 1);
 cc.xywh(1, 3, 7, 3);
 

Parameters:
  col - the new column index
Parameters:
  row - the new row index
Parameters:
  colSpan - the column span or grid width
Parameters:
  rowSpan - the row span or grid height this



xywh
public CellConstraints xywh(int col, int row, int colSpan, int rowSpan, String encodedAlignments)(Code)
Sets the row, column, width, and height; decodes the horizontal and vertical alignments from the given string.

Examples:

 cc.xywh(1, 3, 2, 1, "left, bottom");
 cc.xywh(1, 3, 2, 1, "l, b");
 cc.xywh(1, 3, 7, 3, "center, fill");
 cc.xywh(1, 3, 7, 3, "c, f");
 

Parameters:
  col - the new column index
Parameters:
  row - the new row index
Parameters:
  colSpan - the column span or grid width
Parameters:
  rowSpan - the row span or grid height
Parameters:
  encodedAlignments - describes the horizontal and vertical alignments this
throws:
  IllegalArgumentException - if an alignment orientation is invalid



xywh
public CellConstraints xywh(int col, int row, int colSpan, int rowSpan, Alignment colAlign, Alignment rowAlign)(Code)
Sets the row, column, width, and height; sets the horizontal and vertical aligment using the specified alignment objects.

Examples:

 cc.xywh(1, 3, 2, 1, CellConstraints.LEFT, CellConstraints.BOTTOM);
 cc.xywh(1, 3, 7, 3, CellConstraints.CENTER, CellConstraints.FILL);
 

Parameters:
  col - the new column index
Parameters:
  row - the new row index
Parameters:
  colSpan - the column span or grid width
Parameters:
  rowSpan - the row span or grid height
Parameters:
  colAlign - horizontal component alignment
Parameters:
  rowAlign - vertical component alignment this
throws:
  IllegalArgumentException - if an alignment orientation is invalid



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.